diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-05 15:19:12 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-05 15:19:12 +0100 |
commit | ec6f71576ace170fd306a68f77e5c5e9646d15be (patch) | |
tree | d39853a3366ea849b60b342240a5908f16899dcf /crates/ra_assists | |
parent | 3be2d1db6c04a99efdd32b1af724caeb10d9676b (diff) | |
parent | 98d769a799e430f152e573c28f101d9d6aee5376 (diff) |
Merge #1491
1491: More clippy r=matklad a=kjeremy
A few more clippy changes.
I'm a little unsure of the second commit. It's the trivially_copy_pass_by_ref lint and there are a number of places in the code we could use it if it makes sense.
Co-authored-by: Jeremy Kolb <[email protected]>
Diffstat (limited to 'crates/ra_assists')
-rw-r--r-- | crates/ra_assists/src/fill_match_arms.rs | 31 |
1 files changed, 14 insertions, 17 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); |