clippy: Use if lets and remove redundant returns

This commit is contained in:
Alan Du 2018-10-16 11:51:58 -04:00
parent 5db663d61f
commit d493a4476c
11 changed files with 22 additions and 29 deletions

View file

@ -30,7 +30,8 @@ pub fn find_leaf_at_offset(node: SyntaxNodeRef, offset: TextUnit) -> LeafAtOffse
let left = children.next().unwrap();
let right = children.next();
assert!(children.next().is_none());
return if let Some(right) = right {
if let Some(right) = right {
match (
find_leaf_at_offset(left, offset),
find_leaf_at_offset(right, offset),
@ -42,7 +43,7 @@ pub fn find_leaf_at_offset(node: SyntaxNodeRef, offset: TextUnit) -> LeafAtOffse
}
} else {
find_leaf_at_offset(left, offset)
};
}
}
#[derive(Clone, Copy, Debug)]