diff options
author | Jeremy Kolb <[email protected]> | 2019-07-04 18:26:44 +0100 |
---|---|---|
committer | Jeremy Kolb <[email protected]> | 2019-07-04 22:43:00 +0100 |
commit | 4ad9e986ad05e404df73701c098b71f73a847ca6 (patch) | |
tree | 2a2b2cc9dbee07d0aa92df883c807edbab264a85 /crates/ra_assists/src | |
parent | c6a6e43372de9530ec7df0f38352466ed107e1a2 (diff) |
Some clippy fixes for 1.36
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/auto_import.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_assists/src/auto_import.rs b/crates/ra_assists/src/auto_import.rs index 75ab8fa0f..f8f37e852 100644 --- a/crates/ra_assists/src/auto_import.rs +++ b/crates/ra_assists/src/auto_import.rs | |||
@@ -39,13 +39,13 @@ fn collect_path_segments_raw<'a>( | |||
39 | // We need to reverse only the new added segments | 39 | // We need to reverse only the new added segments |
40 | let only_new_segments = segments.split_at_mut(oldlen).1; | 40 | let only_new_segments = segments.split_at_mut(oldlen).1; |
41 | only_new_segments.reverse(); | 41 | only_new_segments.reverse(); |
42 | return Some(segments.len() - oldlen); | 42 | Some(segments.len() - oldlen) |
43 | } | 43 | } |
44 | 44 | ||
45 | fn fmt_segments(segments: &[SmolStr]) -> String { | 45 | fn fmt_segments(segments: &[SmolStr]) -> String { |
46 | let mut buf = String::new(); | 46 | let mut buf = String::new(); |
47 | fmt_segments_raw(segments, &mut buf); | 47 | fmt_segments_raw(segments, &mut buf); |
48 | return buf; | 48 | buf |
49 | } | 49 | } |
50 | 50 | ||
51 | fn fmt_segments_raw(segments: &[SmolStr], buf: &mut String) { | 51 | fn fmt_segments_raw(segments: &[SmolStr], buf: &mut String) { |
@@ -61,7 +61,7 @@ fn fmt_segments_raw(segments: &[SmolStr], buf: &mut String) { | |||
61 | 61 | ||
62 | // Returns the numeber of common segments. | 62 | // Returns the numeber of common segments. |
63 | fn compare_path_segments(left: &[SmolStr], right: &[&ast::PathSegment]) -> usize { | 63 | fn compare_path_segments(left: &[SmolStr], right: &[&ast::PathSegment]) -> usize { |
64 | return left.iter().zip(right).filter(|(l, r)| compare_path_segment(l, r)).count(); | 64 | left.iter().zip(right).filter(|(l, r)| compare_path_segment(l, r)).count() |
65 | } | 65 | } |
66 | 66 | ||
67 | fn compare_path_segment(a: &SmolStr, b: &ast::PathSegment) -> bool { | 67 | fn compare_path_segment(a: &SmolStr, b: &ast::PathSegment) -> bool { |
@@ -320,7 +320,7 @@ fn walk_use_tree_for_best_action<'a>( | |||
320 | 320 | ||
321 | // We remove the segments added | 321 | // We remove the segments added |
322 | current_path_segments.truncate(prev_len); | 322 | current_path_segments.truncate(prev_len); |
323 | return action; | 323 | action |
324 | } | 324 | } |
325 | 325 | ||
326 | fn best_action_for_target<'b, 'a: 'b>( | 326 | fn best_action_for_target<'b, 'a: 'b>( |
@@ -339,7 +339,7 @@ fn best_action_for_target<'b, 'a: 'b>( | |||
339 | }); | 339 | }); |
340 | 340 | ||
341 | match best_action { | 341 | match best_action { |
342 | Some(action) => return action, | 342 | Some(action) => action, |
343 | None => { | 343 | None => { |
344 | // We have no action and no UseItem was found in container so we find | 344 | // We have no action and no UseItem was found in container so we find |
345 | // another item and we use it as anchor. | 345 | // another item and we use it as anchor. |
@@ -350,7 +350,7 @@ fn best_action_for_target<'b, 'a: 'b>( | |||
350 | .find(|n| n.range().start() < anchor.range().start()) | 350 | .find(|n| n.range().start() < anchor.range().start()) |
351 | .or_else(|| Some(anchor)); | 351 | .or_else(|| Some(anchor)); |
352 | 352 | ||
353 | return ImportAction::add_new_use(anchor, false); | 353 | ImportAction::add_new_use(anchor, false) |
354 | } | 354 | } |
355 | } | 355 | } |
356 | } | 356 | } |