diff options
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/ssr.rs | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/crates/ra_ide/src/ssr.rs b/crates/ra_ide/src/ssr.rs index b3e9e5dfe..ca7e0ad86 100644 --- a/crates/ra_ide/src/ssr.rs +++ b/crates/ra_ide/src/ssr.rs | |||
@@ -1,5 +1,4 @@ | |||
1 | use ra_db::SourceDatabaseExt; | 1 | use ra_ide_db::RootDatabase; |
2 | use ra_ide_db::{symbol_index::SymbolsDatabase, RootDatabase}; | ||
3 | 2 | ||
4 | use crate::SourceFileEdit; | 3 | use crate::SourceFileEdit; |
5 | use ra_ssr::{MatchFinder, SsrError, SsrRule}; | 4 | use ra_ssr::{MatchFinder, SsrError, SsrRule}; |
@@ -44,20 +43,11 @@ pub fn parse_search_replace( | |||
44 | parse_only: bool, | 43 | parse_only: bool, |
45 | db: &RootDatabase, | 44 | db: &RootDatabase, |
46 | ) -> Result<Vec<SourceFileEdit>, SsrError> { | 45 | ) -> Result<Vec<SourceFileEdit>, SsrError> { |
47 | let mut edits = vec![]; | ||
48 | let rule: SsrRule = rule.parse()?; | 46 | let rule: SsrRule = rule.parse()?; |
49 | if parse_only { | 47 | if parse_only { |
50 | return Ok(edits); | 48 | return Ok(Vec::new()); |
51 | } | 49 | } |
52 | let mut match_finder = MatchFinder::new(db); | 50 | let mut match_finder = MatchFinder::new(db); |
53 | match_finder.add_rule(rule); | 51 | match_finder.add_rule(rule); |
54 | for &root in db.local_roots().iter() { | 52 | Ok(match_finder.edits()) |
55 | let sr = db.source_root(root); | ||
56 | for file_id in sr.iter() { | ||
57 | if let Some(edit) = match_finder.edits_for_file(file_id) { | ||
58 | edits.push(SourceFileEdit { file_id, edit }); | ||
59 | } | ||
60 | } | ||
61 | } | ||
62 | Ok(edits) | ||
63 | } | 53 | } |