diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-17 08:12:34 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-17 08:12:34 +0000 |
commit | f7fbea509f1e5f840e715c912ee38aa997d1bfbc (patch) | |
tree | 2b4932678fc83624c278ca93cdf0f1d3a28346c2 /crates/ide_assists/src/handlers/expand_glob_import.rs | |
parent | 6fcb5d772f16af0d1f62dad55fbde75072fb9e89 (diff) | |
parent | ff5f90d8ae2da8e4856d5c78f55e5cd02b178325 (diff) |
Merge #8063
8063: couple clippy::complexity fixes r=matklad a=matthiaskrgr
avoid redundant `.into()` calls to convert T into identical T (`let x: String = String::from("hello").into();`)
use `if let Some(x)` instead of `.is_some()` + `.unwrap()`
don't clone Copy types
remove redundant wrapped ?s: `Some(Some(3)?)` can just be `Some(3)`
use `.map(|x| y)` instead of `and_then(|x| Some(y)` on `Option`s
Co-authored-by: Matthias Krüger <[email protected]>
Diffstat (limited to 'crates/ide_assists/src/handlers/expand_glob_import.rs')
-rw-r--r-- | crates/ide_assists/src/handlers/expand_glob_import.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ide_assists/src/handlers/expand_glob_import.rs b/crates/ide_assists/src/handlers/expand_glob_import.rs index 5b540df5c..83aa11d52 100644 --- a/crates/ide_assists/src/handlers/expand_glob_import.rs +++ b/crates/ide_assists/src/handlers/expand_glob_import.rs | |||
@@ -73,8 +73,8 @@ fn find_parent_and_path( | |||
73 | ) -> Option<(Either<ast::UseTree, ast::UseTreeList>, ast::Path)> { | 73 | ) -> Option<(Either<ast::UseTree, ast::UseTreeList>, ast::Path)> { |
74 | return star.ancestors().find_map(|n| { | 74 | return star.ancestors().find_map(|n| { |
75 | find_use_tree_list(n.clone()) | 75 | find_use_tree_list(n.clone()) |
76 | .and_then(|(u, p)| Some((Either::Right(u), p))) | 76 | .map(|(u, p)| (Either::Right(u), p)) |
77 | .or_else(|| find_use_tree(n).and_then(|(u, p)| Some((Either::Left(u), p)))) | 77 | .or_else(|| find_use_tree(n).map(|(u, p)| (Either::Left(u), p))) |
78 | }); | 78 | }); |
79 | 79 | ||
80 | fn find_use_tree_list(n: SyntaxNode) -> Option<(ast::UseTreeList, ast::Path)> { | 80 | fn find_use_tree_list(n: SyntaxNode) -> Option<(ast::UseTreeList, ast::Path)> { |