diff options
author | Matthias Krüger <[email protected]> | 2021-03-17 00:56:31 +0000 |
---|---|---|
committer | Matthias Krüger <[email protected]> | 2021-03-17 00:56:31 +0000 |
commit | 048dad8c2e86006e53b3a134279729efb28b9e32 (patch) | |
tree | b9e584f4d1c276b60cb0bd7cee3a4ad158a0ac66 /crates/ide_ssr | |
parent | c5d654d5132b702d028ed00b5ec5c654a0b4a2fa (diff) |
don't clone types that are copy (clippy::clone_on_copy)
Diffstat (limited to 'crates/ide_ssr')
-rw-r--r-- | crates/ide_ssr/src/lib.rs | 7 | ||||
-rw-r--r-- | crates/ide_ssr/src/matching.rs | 2 |
2 files changed, 3 insertions, 6 deletions
diff --git a/crates/ide_ssr/src/lib.rs b/crates/ide_ssr/src/lib.rs index 00585f448..47434f4af 100644 --- a/crates/ide_ssr/src/lib.rs +++ b/crates/ide_ssr/src/lib.rs | |||
@@ -139,11 +139,8 @@ impl<'db> MatchFinder<'db> { | |||
139 | pub fn at_first_file(db: &'db ide_db::RootDatabase) -> Result<MatchFinder<'db>, SsrError> { | 139 | pub fn at_first_file(db: &'db ide_db::RootDatabase) -> Result<MatchFinder<'db>, SsrError> { |
140 | use ide_db::base_db::SourceDatabaseExt; | 140 | use ide_db::base_db::SourceDatabaseExt; |
141 | use ide_db::symbol_index::SymbolsDatabase; | 141 | use ide_db::symbol_index::SymbolsDatabase; |
142 | if let Some(first_file_id) = db | 142 | if let Some(first_file_id) = |
143 | .local_roots() | 143 | db.local_roots().iter().next().and_then(|root| db.source_root(*root).iter().next()) |
144 | .iter() | ||
145 | .next() | ||
146 | .and_then(|root| db.source_root(root.clone()).iter().next()) | ||
147 | { | 144 | { |
148 | Ok(MatchFinder::in_context( | 145 | Ok(MatchFinder::in_context( |
149 | db, | 146 | db, |
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))?; |