From a1c187eef3ba08076aedb5154929f7eda8d1b424 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 12 Aug 2020 18:26:51 +0200 Subject: Rename ra_syntax -> syntax --- crates/ra_ssr/src/lib.rs | 2 +- crates/ra_ssr/src/matching.rs | 8 ++++---- crates/ra_ssr/src/nester.rs | 2 +- crates/ra_ssr/src/parsing.rs | 4 ++-- crates/ra_ssr/src/replacing.rs | 8 ++++---- crates/ra_ssr/src/resolving.rs | 8 ++++---- crates/ra_ssr/src/search.rs | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) (limited to 'crates/ra_ssr/src') 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; use hir::Semantics; use ra_db::{FileId, FilePosition, FileRange}; use ra_ide_db::source_change::SourceFileEdit; -use ra_syntax::{ast, AstNode, SyntaxNode, TextRange}; use resolving::ResolvedRule; use rustc_hash::FxHashMap; +use syntax::{ast, AstNode, SyntaxNode, TextRange}; // A structured search replace rule. Create by calling `parse` on a str. #[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::{ }; use hir::Semantics; use ra_db::FileRange; -use ra_syntax::ast::{AstNode, AstToken}; -use ra_syntax::{ast, SyntaxElement, SyntaxElementChildren, SyntaxKind, SyntaxNode, SyntaxToken}; use rustc_hash::FxHashMap; use std::{cell::Cell, iter::Peekable}; +use syntax::ast::{AstNode, AstToken}; +use syntax::{ast, SyntaxElement, SyntaxElementChildren, SyntaxKind, SyntaxNode, SyntaxToken}; use test_utils::mark; // 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> { &self, phase: &mut Phase, pattern: &mut Peekable, - code: &ra_syntax::SyntaxToken, + code: &syntax::SyntaxToken, ) -> Result<(), MatchFailed> { phase.record_ignored_comments(code); // Ignore whitespace and comments. @@ -444,7 +444,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> { &self, phase: &mut Phase, pattern: &SyntaxNode, - code: &ra_syntax::SyntaxNode, + code: &syntax::SyntaxNode, ) -> Result<(), MatchFailed> { let mut pattern = PatternIterator::new(pattern).peekable(); 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 @@ //! middle match would take the second `foo` from the outer match. use crate::{Match, SsrMatches}; -use ra_syntax::SyntaxNode; use rustc_hash::FxHashMap; +use syntax::SyntaxNode; pub(crate) fn nest_and_remove_collisions( mut matches: Vec, 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 @@ use crate::errors::bail; use crate::{SsrError, SsrPattern, SsrRule}; -use ra_syntax::{ast, AstNode, SmolStr, SyntaxKind, SyntaxNode, T}; use rustc_hash::{FxHashMap, FxHashSet}; use std::str::FromStr; +use syntax::{ast, AstNode, SmolStr, SyntaxKind, SyntaxNode, T}; use test_utils::mark; #[derive(Debug)] @@ -243,7 +243,7 @@ fn validate_rule(rule: &SsrRule) -> Result<(), SsrError> { fn tokenize(source: &str) -> Result, SsrError> { let mut start = 0; - let (raw_tokens, errors) = ra_syntax::tokenize(source); + let (raw_tokens, errors) = syntax::tokenize(source); if let Some(first_error) = errors.first() { bail!("Failed to parse pattern: {}", first_error); } 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 @@ use crate::matching::Var; use crate::{resolving::ResolvedRule, Match, SsrMatches}; -use ra_syntax::ast::{self, AstToken}; -use ra_syntax::{SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize}; use rustc_hash::{FxHashMap, FxHashSet}; +use syntax::ast::{self, AstToken}; +use syntax::{SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize}; use text_edit::TextEdit; /// Returns a text edit that will replace each match in `matches` with its corresponding replacement @@ -92,7 +92,7 @@ impl ReplacementRenderer<'_> { } fn render_node(&mut self, node: &SyntaxNode) { - use ra_syntax::ast::AstNode; + use syntax::ast::AstNode; if let Some(mod_path) = self.match_info.rendered_template_paths.get(&node) { self.out.push_str(&mod_path.to_string()); // Emit everything except for the segment's name-ref, since we already effectively @@ -180,7 +180,7 @@ impl ReplacementRenderer<'_> { } fn parse_as_kind(code: &str, kind: SyntaxKind) -> Option { - use ra_syntax::ast::AstNode; + use syntax::ast::AstNode; if ast::Expr::can_cast(kind) { if let Ok(expr) = ast::Expr::parse(code) { 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; use crate::{parsing, SsrError}; use parsing::Placeholder; use ra_db::FilePosition; -use ra_syntax::{ast, SmolStr, SyntaxKind, SyntaxNode, SyntaxToken}; use rustc_hash::FxHashMap; +use syntax::{ast, SmolStr, SyntaxKind, SyntaxNode, SyntaxToken}; use test_utils::mark; pub(crate) struct ResolutionScope<'db> { @@ -70,7 +70,7 @@ struct Resolver<'a, 'db> { impl Resolver<'_, '_> { fn resolve_pattern_tree(&self, pattern: SyntaxNode) -> Result { - use ra_syntax::{SyntaxElement, T}; + use syntax::{SyntaxElement, T}; let mut resolved_paths = FxHashMap::default(); self.resolve(pattern.clone(), 0, &mut resolved_paths)?; let ufcs_function_calls = resolved_paths @@ -108,7 +108,7 @@ impl Resolver<'_, '_> { depth: u32, resolved_paths: &mut FxHashMap, ) -> Result<(), SsrError> { - use ra_syntax::ast::AstNode; + use syntax::ast::AstNode; if let Some(path) = ast::Path::cast(node.clone()) { if is_self(&path) { // Self cannot be resolved like other paths. @@ -179,7 +179,7 @@ impl<'db> ResolutionScope<'db> { sema: &hir::Semantics<'db, ra_ide_db::RootDatabase>, resolve_context: FilePosition, ) -> ResolutionScope<'db> { - use ra_syntax::ast::AstNode; + use syntax::ast::AstNode; let file = sema.parse(resolve_context.file_id); // Find a node at the requested position, falling back to the whole file. 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::{ defs::Definition, search::{Reference, SearchScope}, }; -use ra_syntax::{ast, AstNode, SyntaxKind, SyntaxNode}; use rustc_hash::FxHashSet; +use syntax::{ast, AstNode, SyntaxKind, SyntaxNode}; use test_utils::mark; /// A cache for the results of find_usages. This is for when we have multiple patterns that have the -- cgit v1.2.3