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_ssr/src/matching.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_ssr/src/matching.rs')
-rw-r--r-- | crates/ide_ssr/src/matching.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/ide_ssr/src/matching.rs b/crates/ide_ssr/src/matching.rs index e1adb381e..b3072fb9f 100644 --- a/crates/ide_ssr/src/matching.rs +++ b/crates/ide_ssr/src/matching.rs | |||
@@ -127,7 +127,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> { | |||
127 | restrict_range: &Option<FileRange>, | 127 | restrict_range: &Option<FileRange>, |
128 | sema: &'sema Semantics<'db, ide_db::RootDatabase>, | 128 | sema: &'sema Semantics<'db, ide_db::RootDatabase>, |
129 | ) -> Result<Match, MatchFailed> { | 129 | ) -> Result<Match, MatchFailed> { |
130 | let match_state = Matcher { sema, restrict_range: restrict_range.clone(), rule }; | 130 | let match_state = Matcher { sema, restrict_range: *restrict_range, rule }; |
131 | // First pass at matching, where we check that node types and idents match. | 131 | // First pass at matching, where we check that node types and idents match. |
132 | match_state.attempt_match_node(&mut Phase::First, &rule.pattern.node, code)?; | 132 | match_state.attempt_match_node(&mut Phase::First, &rule.pattern.node, code)?; |
133 | match_state.validate_range(&sema.original_range(code))?; | 133 | match_state.validate_range(&sema.original_range(code))?; |