mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-18 16:20:18 +00:00
clippy: Use if lets and remove redundant returns
This commit is contained in:
parent
5db663d61f
commit
d493a4476c
11 changed files with 22 additions and 29 deletions
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue