aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_ssr/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_ssr/src')
-rw-r--r--crates/ide_ssr/src/lib.rs7
-rw-r--r--crates/ide_ssr/src/matching.rs2
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))?;