From 048dad8c2e86006e53b3a134279729efb28b9e32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Wed, 17 Mar 2021 01:56:31 +0100 Subject: don't clone types that are copy (clippy::clone_on_copy) --- crates/ide_ssr/src/lib.rs | 7 ++----- crates/ide_ssr/src/matching.rs | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'crates/ide_ssr/src') 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> { pub fn at_first_file(db: &'db ide_db::RootDatabase) -> Result, SsrError> { use ide_db::base_db::SourceDatabaseExt; use ide_db::symbol_index::SymbolsDatabase; - if let Some(first_file_id) = db - .local_roots() - .iter() - .next() - .and_then(|root| db.source_root(root.clone()).iter().next()) + if let Some(first_file_id) = + db.local_roots().iter().next().and_then(|root| db.source_root(*root).iter().next()) { Ok(MatchFinder::in_context( 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> { restrict_range: &Option, sema: &'sema Semantics<'db, ide_db::RootDatabase>, ) -> Result { - let match_state = Matcher { sema, restrict_range: restrict_range.clone(), rule }; + let match_state = Matcher { sema, restrict_range: *restrict_range, rule }; // First pass at matching, where we check that node types and idents match. match_state.attempt_match_node(&mut Phase::First, &rule.pattern.node, code)?; match_state.validate_range(&sema.original_range(code))?; -- cgit v1.2.3