aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists
diff options
context:
space:
mode:
authorJeremy Kolb <[email protected]>2019-07-05 03:59:28 +0100
committerJeremy Kolb <[email protected]>2019-07-05 04:00:00 +0100
commit6b4ec73b7ed2522b837368a11863afb4b432b9a4 (patch)
tree3df753fe58ec1c3fccb48cc2c889fff36e360f33 /crates/ra_assists
parent21f70a7293e7b24dedeec9a504763a1a3ef57675 (diff)
Clippy changes
Diffstat (limited to 'crates/ra_assists')
-rw-r--r--crates/ra_assists/src/fill_match_arms.rs31
-rw-r--r--crates/ra_assists/src/split_import.rs5
2 files changed, 15 insertions, 21 deletions
diff --git a/crates/ra_assists/src/fill_match_arms.rs b/crates/ra_assists/src/fill_match_arms.rs
index d51010b84..deef166b5 100644
--- a/crates/ra_assists/src/fill_match_arms.rs
+++ b/crates/ra_assists/src/fill_match_arms.rs
@@ -23,27 +23,24 @@ pub(crate) fn fill_match_arms(mut ctx: AssistCtx<impl HirDatabase>) -> Option<As
23 // We already have some match arms, so we don't provide any assists. 23 // We already have some match arms, so we don't provide any assists.
24 // Unless if there is only one trivial match arm possibly created 24 // Unless if there is only one trivial match arm possibly created
25 // by match postfix complete. Trivial match arm is the catch all arm. 25 // by match postfix complete. Trivial match arm is the catch all arm.
26 match match_expr.match_arm_list() { 26 if let Some(arm_list) = match_expr.match_arm_list() {
27 Some(arm_list) => { 27 let mut arm_iter = arm_list.arms();
28 let mut arm_iter = arm_list.arms(); 28 let first = arm_iter.next();
29 let first = arm_iter.next(); 29
30 30 match first {
31 match first { 31 // If there arm list is empty or there is only one trivial arm, then proceed.
32 // If there arm list is empty or there is only one trivial arm, then proceed. 32 Some(arm) if is_trivial_arm(arm) => {
33 Some(arm) if is_trivial_arm(arm) => { 33 if arm_iter.next() != None {
34 if arm_iter.next() != None {
35 return None;
36 }
37 }
38 None => {}
39
40 _ => {
41 return None; 34 return None;
42 } 35 }
43 } 36 }
37 None => {}
38
39 _ => {
40 return None;
41 }
44 } 42 }
45 _ => {} 43 };
46 }
47 44
48 let expr = match_expr.expr()?; 45 let expr = match_expr.expr()?;
49 let analyzer = hir::SourceAnalyzer::new(ctx.db, ctx.frange.file_id, expr.syntax(), None); 46 let analyzer = hir::SourceAnalyzer::new(ctx.db, ctx.frange.file_id, expr.syntax(), None);
diff --git a/crates/ra_assists/src/split_import.rs b/crates/ra_assists/src/split_import.rs
index a8feb67c8..99088d9a5 100644
--- a/crates/ra_assists/src/split_import.rs
+++ b/crates/ra_assists/src/split_import.rs
@@ -10,10 +10,7 @@ pub(crate) fn split_import(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assis
10 let path = ast::Path::cast(colon_colon.parent())?; 10 let path = ast::Path::cast(colon_colon.parent())?;
11 let top_path = successors(Some(path), |it| it.parent_path()).last()?; 11 let top_path = successors(Some(path), |it| it.parent_path()).last()?;
12 12
13 let use_tree = top_path.syntax().ancestors().find_map(ast::UseTree::cast); 13 let _use_tree = top_path.syntax().ancestors().find_map(ast::UseTree::cast)?;
14 if use_tree.is_none() {
15 return None;
16 }
17 14
18 let l_curly = colon_colon.range().end(); 15 let l_curly = colon_colon.range().end();
19 let r_curly = match top_path.syntax().parent().and_then(ast::UseTree::cast) { 16 let r_curly = match top_path.syntax().parent().and_then(ast::UseTree::cast) {