diff options
Diffstat (limited to 'crates/ra_ssr/src')
-rw-r--r-- | crates/ra_ssr/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/ra_ssr/src/matching.rs | 8 | ||||
-rw-r--r-- | crates/ra_ssr/src/nester.rs | 2 | ||||
-rw-r--r-- | crates/ra_ssr/src/parsing.rs | 4 | ||||
-rw-r--r-- | crates/ra_ssr/src/replacing.rs | 8 | ||||
-rw-r--r-- | crates/ra_ssr/src/resolving.rs | 8 | ||||
-rw-r--r-- | crates/ra_ssr/src/search.rs | 2 |
7 files changed, 17 insertions, 17 deletions
diff --git a/crates/ra_ssr/src/lib.rs b/crates/ra_ssr/src/lib.rs index c780b460a..fb53212a3 100644 --- a/crates/ra_ssr/src/lib.rs +++ b/crates/ra_ssr/src/lib.rs | |||
@@ -21,9 +21,9 @@ use crate::matching::MatchFailureReason; | |||
21 | use hir::Semantics; | 21 | use hir::Semantics; |
22 | use ra_db::{FileId, FilePosition, FileRange}; | 22 | use ra_db::{FileId, FilePosition, FileRange}; |
23 | use ra_ide_db::source_change::SourceFileEdit; | 23 | use ra_ide_db::source_change::SourceFileEdit; |
24 | use ra_syntax::{ast, AstNode, SyntaxNode, TextRange}; | ||
25 | use resolving::ResolvedRule; | 24 | use resolving::ResolvedRule; |
26 | use rustc_hash::FxHashMap; | 25 | use rustc_hash::FxHashMap; |
26 | use syntax::{ast, AstNode, SyntaxNode, TextRange}; | ||
27 | 27 | ||
28 | // A structured search replace rule. Create by calling `parse` on a str. | 28 | // A structured search replace rule. Create by calling `parse` on a str. |
29 | #[derive(Debug)] | 29 | #[derive(Debug)] |
diff --git a/crates/ra_ssr/src/matching.rs b/crates/ra_ssr/src/matching.rs index 0f72fea69..125bf3895 100644 --- a/crates/ra_ssr/src/matching.rs +++ b/crates/ra_ssr/src/matching.rs | |||
@@ -8,10 +8,10 @@ use crate::{ | |||
8 | }; | 8 | }; |
9 | use hir::Semantics; | 9 | use hir::Semantics; |
10 | use ra_db::FileRange; | 10 | use ra_db::FileRange; |
11 | use ra_syntax::ast::{AstNode, AstToken}; | ||
12 | use ra_syntax::{ast, SyntaxElement, SyntaxElementChildren, SyntaxKind, SyntaxNode, SyntaxToken}; | ||
13 | use rustc_hash::FxHashMap; | 11 | use rustc_hash::FxHashMap; |
14 | use std::{cell::Cell, iter::Peekable}; | 12 | use std::{cell::Cell, iter::Peekable}; |
13 | use syntax::ast::{AstNode, AstToken}; | ||
14 | use syntax::{ast, SyntaxElement, SyntaxElementChildren, SyntaxKind, SyntaxNode, SyntaxToken}; | ||
15 | use test_utils::mark; | 15 | use test_utils::mark; |
16 | 16 | ||
17 | // Creates a match error. If we're currently attempting to match some code that we thought we were | 17 | // Creates a match error. If we're currently attempting to match some code that we thought we were |
@@ -264,7 +264,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> { | |||
264 | &self, | 264 | &self, |
265 | phase: &mut Phase, | 265 | phase: &mut Phase, |
266 | pattern: &mut Peekable<PatternIterator>, | 266 | pattern: &mut Peekable<PatternIterator>, |
267 | code: &ra_syntax::SyntaxToken, | 267 | code: &syntax::SyntaxToken, |
268 | ) -> Result<(), MatchFailed> { | 268 | ) -> Result<(), MatchFailed> { |
269 | phase.record_ignored_comments(code); | 269 | phase.record_ignored_comments(code); |
270 | // Ignore whitespace and comments. | 270 | // Ignore whitespace and comments. |
@@ -444,7 +444,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> { | |||
444 | &self, | 444 | &self, |
445 | phase: &mut Phase, | 445 | phase: &mut Phase, |
446 | pattern: &SyntaxNode, | 446 | pattern: &SyntaxNode, |
447 | code: &ra_syntax::SyntaxNode, | 447 | code: &syntax::SyntaxNode, |
448 | ) -> Result<(), MatchFailed> { | 448 | ) -> Result<(), MatchFailed> { |
449 | let mut pattern = PatternIterator::new(pattern).peekable(); | 449 | let mut pattern = PatternIterator::new(pattern).peekable(); |
450 | let mut children = code.children_with_tokens(); | 450 | let mut children = code.children_with_tokens(); |
diff --git a/crates/ra_ssr/src/nester.rs b/crates/ra_ssr/src/nester.rs index b3e20579b..8be570d3c 100644 --- a/crates/ra_ssr/src/nester.rs +++ b/crates/ra_ssr/src/nester.rs | |||
@@ -8,8 +8,8 @@ | |||
8 | //! middle match would take the second `foo` from the outer match. | 8 | //! middle match would take the second `foo` from the outer match. |
9 | 9 | ||
10 | use crate::{Match, SsrMatches}; | 10 | use crate::{Match, SsrMatches}; |
11 | use ra_syntax::SyntaxNode; | ||
12 | use rustc_hash::FxHashMap; | 11 | use rustc_hash::FxHashMap; |
12 | use syntax::SyntaxNode; | ||
13 | 13 | ||
14 | pub(crate) fn nest_and_remove_collisions( | 14 | pub(crate) fn nest_and_remove_collisions( |
15 | mut matches: Vec<Match>, | 15 | mut matches: Vec<Match>, |
diff --git a/crates/ra_ssr/src/parsing.rs b/crates/ra_ssr/src/parsing.rs index f455eb5b7..9570e96e3 100644 --- a/crates/ra_ssr/src/parsing.rs +++ b/crates/ra_ssr/src/parsing.rs | |||
@@ -7,9 +7,9 @@ | |||
7 | 7 | ||
8 | use crate::errors::bail; | 8 | use crate::errors::bail; |
9 | use crate::{SsrError, SsrPattern, SsrRule}; | 9 | use crate::{SsrError, SsrPattern, SsrRule}; |
10 | use ra_syntax::{ast, AstNode, SmolStr, SyntaxKind, SyntaxNode, T}; | ||
11 | use rustc_hash::{FxHashMap, FxHashSet}; | 10 | use rustc_hash::{FxHashMap, FxHashSet}; |
12 | use std::str::FromStr; | 11 | use std::str::FromStr; |
12 | use syntax::{ast, AstNode, SmolStr, SyntaxKind, SyntaxNode, T}; | ||
13 | use test_utils::mark; | 13 | use test_utils::mark; |
14 | 14 | ||
15 | #[derive(Debug)] | 15 | #[derive(Debug)] |
@@ -243,7 +243,7 @@ fn validate_rule(rule: &SsrRule) -> Result<(), SsrError> { | |||
243 | 243 | ||
244 | fn tokenize(source: &str) -> Result<Vec<Token>, SsrError> { | 244 | fn tokenize(source: &str) -> Result<Vec<Token>, SsrError> { |
245 | let mut start = 0; | 245 | let mut start = 0; |
246 | let (raw_tokens, errors) = ra_syntax::tokenize(source); | 246 | let (raw_tokens, errors) = syntax::tokenize(source); |
247 | if let Some(first_error) = errors.first() { | 247 | if let Some(first_error) = errors.first() { |
248 | bail!("Failed to parse pattern: {}", first_error); | 248 | bail!("Failed to parse pattern: {}", first_error); |
249 | } | 249 | } |
diff --git a/crates/ra_ssr/src/replacing.rs b/crates/ra_ssr/src/replacing.rs index 74f9e7db6..8f8fe6149 100644 --- a/crates/ra_ssr/src/replacing.rs +++ b/crates/ra_ssr/src/replacing.rs | |||
@@ -2,9 +2,9 @@ | |||
2 | 2 | ||
3 | use crate::matching::Var; | 3 | use crate::matching::Var; |
4 | use crate::{resolving::ResolvedRule, Match, SsrMatches}; | 4 | use crate::{resolving::ResolvedRule, Match, SsrMatches}; |
5 | use ra_syntax::ast::{self, AstToken}; | ||
6 | use ra_syntax::{SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize}; | ||
7 | use rustc_hash::{FxHashMap, FxHashSet}; | 5 | use rustc_hash::{FxHashMap, FxHashSet}; |
6 | use syntax::ast::{self, AstToken}; | ||
7 | use syntax::{SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize}; | ||
8 | use text_edit::TextEdit; | 8 | use text_edit::TextEdit; |
9 | 9 | ||
10 | /// Returns a text edit that will replace each match in `matches` with its corresponding replacement | 10 | /// Returns a text edit that will replace each match in `matches` with its corresponding replacement |
@@ -92,7 +92,7 @@ impl ReplacementRenderer<'_> { | |||
92 | } | 92 | } |
93 | 93 | ||
94 | fn render_node(&mut self, node: &SyntaxNode) { | 94 | fn render_node(&mut self, node: &SyntaxNode) { |
95 | use ra_syntax::ast::AstNode; | 95 | use syntax::ast::AstNode; |
96 | if let Some(mod_path) = self.match_info.rendered_template_paths.get(&node) { | 96 | if let Some(mod_path) = self.match_info.rendered_template_paths.get(&node) { |
97 | self.out.push_str(&mod_path.to_string()); | 97 | self.out.push_str(&mod_path.to_string()); |
98 | // Emit everything except for the segment's name-ref, since we already effectively | 98 | // Emit everything except for the segment's name-ref, since we already effectively |
@@ -180,7 +180,7 @@ impl ReplacementRenderer<'_> { | |||
180 | } | 180 | } |
181 | 181 | ||
182 | fn parse_as_kind(code: &str, kind: SyntaxKind) -> Option<SyntaxNode> { | 182 | fn parse_as_kind(code: &str, kind: SyntaxKind) -> Option<SyntaxNode> { |
183 | use ra_syntax::ast::AstNode; | 183 | use syntax::ast::AstNode; |
184 | if ast::Expr::can_cast(kind) { | 184 | if ast::Expr::can_cast(kind) { |
185 | if let Ok(expr) = ast::Expr::parse(code) { | 185 | if let Ok(expr) = ast::Expr::parse(code) { |
186 | return Some(expr.syntax().clone()); | 186 | return Some(expr.syntax().clone()); |
diff --git a/crates/ra_ssr/src/resolving.rs b/crates/ra_ssr/src/resolving.rs index d53bd46c7..7e7585c8b 100644 --- a/crates/ra_ssr/src/resolving.rs +++ b/crates/ra_ssr/src/resolving.rs | |||
@@ -4,8 +4,8 @@ use crate::errors::error; | |||
4 | use crate::{parsing, SsrError}; | 4 | use crate::{parsing, SsrError}; |
5 | use parsing::Placeholder; | 5 | use parsing::Placeholder; |
6 | use ra_db::FilePosition; | 6 | use ra_db::FilePosition; |
7 | use ra_syntax::{ast, SmolStr, SyntaxKind, SyntaxNode, SyntaxToken}; | ||
8 | use rustc_hash::FxHashMap; | 7 | use rustc_hash::FxHashMap; |
8 | use syntax::{ast, SmolStr, SyntaxKind, SyntaxNode, SyntaxToken}; | ||
9 | use test_utils::mark; | 9 | use test_utils::mark; |
10 | 10 | ||
11 | pub(crate) struct ResolutionScope<'db> { | 11 | pub(crate) struct ResolutionScope<'db> { |
@@ -70,7 +70,7 @@ struct Resolver<'a, 'db> { | |||
70 | 70 | ||
71 | impl Resolver<'_, '_> { | 71 | impl Resolver<'_, '_> { |
72 | fn resolve_pattern_tree(&self, pattern: SyntaxNode) -> Result<ResolvedPattern, SsrError> { | 72 | fn resolve_pattern_tree(&self, pattern: SyntaxNode) -> Result<ResolvedPattern, SsrError> { |
73 | use ra_syntax::{SyntaxElement, T}; | 73 | use syntax::{SyntaxElement, T}; |
74 | let mut resolved_paths = FxHashMap::default(); | 74 | let mut resolved_paths = FxHashMap::default(); |
75 | self.resolve(pattern.clone(), 0, &mut resolved_paths)?; | 75 | self.resolve(pattern.clone(), 0, &mut resolved_paths)?; |
76 | let ufcs_function_calls = resolved_paths | 76 | let ufcs_function_calls = resolved_paths |
@@ -108,7 +108,7 @@ impl Resolver<'_, '_> { | |||
108 | depth: u32, | 108 | depth: u32, |
109 | resolved_paths: &mut FxHashMap<SyntaxNode, ResolvedPath>, | 109 | resolved_paths: &mut FxHashMap<SyntaxNode, ResolvedPath>, |
110 | ) -> Result<(), SsrError> { | 110 | ) -> Result<(), SsrError> { |
111 | use ra_syntax::ast::AstNode; | 111 | use syntax::ast::AstNode; |
112 | if let Some(path) = ast::Path::cast(node.clone()) { | 112 | if let Some(path) = ast::Path::cast(node.clone()) { |
113 | if is_self(&path) { | 113 | if is_self(&path) { |
114 | // Self cannot be resolved like other paths. | 114 | // Self cannot be resolved like other paths. |
@@ -179,7 +179,7 @@ impl<'db> ResolutionScope<'db> { | |||
179 | sema: &hir::Semantics<'db, ra_ide_db::RootDatabase>, | 179 | sema: &hir::Semantics<'db, ra_ide_db::RootDatabase>, |
180 | resolve_context: FilePosition, | 180 | resolve_context: FilePosition, |
181 | ) -> ResolutionScope<'db> { | 181 | ) -> ResolutionScope<'db> { |
182 | use ra_syntax::ast::AstNode; | 182 | use syntax::ast::AstNode; |
183 | let file = sema.parse(resolve_context.file_id); | 183 | let file = sema.parse(resolve_context.file_id); |
184 | // Find a node at the requested position, falling back to the whole file. | 184 | // Find a node at the requested position, falling back to the whole file. |
185 | let node = file | 185 | let node = file |
diff --git a/crates/ra_ssr/src/search.rs b/crates/ra_ssr/src/search.rs index 85ffa2ac2..e44e14959 100644 --- a/crates/ra_ssr/src/search.rs +++ b/crates/ra_ssr/src/search.rs | |||
@@ -10,8 +10,8 @@ use ra_ide_db::{ | |||
10 | defs::Definition, | 10 | defs::Definition, |
11 | search::{Reference, SearchScope}, | 11 | search::{Reference, SearchScope}, |
12 | }; | 12 | }; |
13 | use ra_syntax::{ast, AstNode, SyntaxKind, SyntaxNode}; | ||
14 | use rustc_hash::FxHashSet; | 13 | use rustc_hash::FxHashSet; |
14 | use syntax::{ast, AstNode, SyntaxKind, SyntaxNode}; | ||
15 | use test_utils::mark; | 15 | use test_utils::mark; |
16 | 16 | ||
17 | /// A cache for the results of find_usages. This is for when we have multiple patterns that have the | 17 | /// A cache for the results of find_usages. This is for when we have multiple patterns that have the |