diff options
author | Alan Du <[email protected]> | 2018-10-16 16:51:58 +0100 |
---|---|---|
committer | Alan Du <[email protected]> | 2018-10-18 00:42:23 +0100 |
commit | d493a4476c2059924d032fbf01dda091601f9667 (patch) | |
tree | 74c1249cba67c8c9824e618fcdea53b97b571a7b /crates/ra_syntax/src/algo | |
parent | 5db663d61fb8b006e3b84ef3bcc9cddbe94e5f49 (diff) |
clippy: Use if lets and remove redundant returns
Diffstat (limited to 'crates/ra_syntax/src/algo')
-rw-r--r-- | crates/ra_syntax/src/algo/mod.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/algo/mod.rs b/crates/ra_syntax/src/algo/mod.rs index 9d2014bc7..87f1250bc 100644 --- a/crates/ra_syntax/src/algo/mod.rs +++ b/crates/ra_syntax/src/algo/mod.rs | |||
@@ -30,7 +30,8 @@ pub fn find_leaf_at_offset(node: SyntaxNodeRef, offset: TextUnit) -> LeafAtOffse | |||
30 | let left = children.next().unwrap(); | 30 | let left = children.next().unwrap(); |
31 | let right = children.next(); | 31 | let right = children.next(); |
32 | assert!(children.next().is_none()); | 32 | assert!(children.next().is_none()); |
33 | return if let Some(right) = right { | 33 | |
34 | if let Some(right) = right { | ||
34 | match ( | 35 | match ( |
35 | find_leaf_at_offset(left, offset), | 36 | find_leaf_at_offset(left, offset), |
36 | find_leaf_at_offset(right, offset), | 37 | find_leaf_at_offset(right, offset), |
@@ -42,7 +43,7 @@ pub fn find_leaf_at_offset(node: SyntaxNodeRef, offset: TextUnit) -> LeafAtOffse | |||
42 | } | 43 | } |
43 | } else { | 44 | } else { |
44 | find_leaf_at_offset(left, offset) | 45 | find_leaf_at_offset(left, offset) |
45 | }; | 46 | } |
46 | } | 47 | } |
47 | 48 | ||
48 | #[derive(Clone, Copy, Debug)] | 49 | #[derive(Clone, Copy, Debug)] |