diff options
author | Alan Du <[email protected]> | 2019-06-03 15:27:51 +0100 |
---|---|---|
committer | Alan Du <[email protected]> | 2019-06-04 23:05:07 +0100 |
commit | b28ca32db22d5e2ed34db556c6fd50a5fc2d679c (patch) | |
tree | 7e86e3f6ffdbc972b2ac968503f2b3671fd9b3a5 /crates/ra_ide_api/src | |
parent | 40424d4222d4630bc53294d10f1718f2d3d300de (diff) |
Fix clippy::or_fun_call
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_pattern.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/extend_selection.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_pattern.rs b/crates/ra_ide_api/src/completion/complete_pattern.rs index 74833a756..6655a05a7 100644 --- a/crates/ra_ide_api/src/completion/complete_pattern.rs +++ b/crates/ra_ide_api/src/completion/complete_pattern.rs | |||
@@ -10,7 +10,7 @@ pub(super) fn complete_pattern(acc: &mut Completions, ctx: &CompletionContext) { | |||
10 | let names = ctx.analyzer.all_names(ctx.db); | 10 | let names = ctx.analyzer.all_names(ctx.db); |
11 | for (name, res) in names.into_iter() { | 11 | for (name, res) in names.into_iter() { |
12 | let r = res.as_ref(); | 12 | let r = res.as_ref(); |
13 | let def = match r.take_types().or(r.take_values()) { | 13 | let def = match r.take_types().or_else(|| r.take_values()) { |
14 | Some(hir::Resolution::Def(def)) => def, | 14 | Some(hir::Resolution::Def(def)) => def, |
15 | _ => continue, | 15 | _ => continue, |
16 | }; | 16 | }; |
diff --git a/crates/ra_ide_api/src/extend_selection.rs b/crates/ra_ide_api/src/extend_selection.rs index 00c445310..a713b762c 100644 --- a/crates/ra_ide_api/src/extend_selection.rs +++ b/crates/ra_ide_api/src/extend_selection.rs | |||
@@ -95,7 +95,7 @@ fn extend_single_word_in_comment_or_string( | |||
95 | } | 95 | } |
96 | 96 | ||
97 | let start_idx = before.rfind(non_word_char)? as u32; | 97 | let start_idx = before.rfind(non_word_char)? as u32; |
98 | let end_idx = after.find(non_word_char).unwrap_or(after.len()) as u32; | 98 | let end_idx = after.find(non_word_char).unwrap_or_else(|| after.len()) as u32; |
99 | 99 | ||
100 | let from: TextUnit = (start_idx + 1).into(); | 100 | let from: TextUnit = (start_idx + 1).into(); |
101 | let to: TextUnit = (cursor_position + end_idx).into(); | 101 | let to: TextUnit = (cursor_position + end_idx).into(); |