From 2e97dbcbb82dbcc0561d7f0bb9a225eb4d2845fc Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 4 May 2021 20:36:48 +0300 Subject: minor: use standard import style --- crates/hir_expand/src/db.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'crates') diff --git a/crates/hir_expand/src/db.rs b/crates/hir_expand/src/db.rs index 43f787b34..7e02ed036 100644 --- a/crates/hir_expand/src/db.rs +++ b/crates/hir_expand/src/db.rs @@ -3,14 +3,14 @@ use std::sync::Arc; use base_db::{salsa, SourceDatabase}; -use mbe::{ExpandError, ExpandResult, MacroDef, MacroRules}; +use mbe::{ExpandError, ExpandResult}; use parser::FragmentKind; use syntax::{ algo::diff, - ast::{MacroStmts, NameOwner}, + ast::{self, NameOwner}, AstNode, GreenNode, Parse, SyntaxKind::*, - SyntaxNode, + SyntaxNode, SyntaxToken, }; use crate::{ @@ -115,9 +115,9 @@ pub trait AstDatabase: SourceDatabase { pub fn expand_hypothetical( db: &dyn AstDatabase, actual_macro_call: MacroCallId, - hypothetical_args: &syntax::ast::TokenTree, - token_to_map: syntax::SyntaxToken, -) -> Option<(SyntaxNode, syntax::SyntaxToken)> { + hypothetical_args: &ast::TokenTree, + token_to_map: SyntaxToken, +) -> Option<(SyntaxNode, SyntaxToken)> { let macro_file = MacroFile { macro_call_id: actual_macro_call }; let (tt, tmap_1) = mbe::syntax_node_to_token_tree(hypothetical_args.syntax()); let range = @@ -141,10 +141,10 @@ fn ast_id_map(db: &dyn AstDatabase, file_id: HirFileId) -> Arc { fn macro_def(db: &dyn AstDatabase, id: MacroDefId) -> Option> { match id.kind { MacroDefKind::Declarative(ast_id) => match ast_id.to_node(db) { - syntax::ast::Macro::MacroRules(macro_rules) => { + ast::Macro::MacroRules(macro_rules) => { let arg = macro_rules.token_tree()?; let (tt, tmap) = mbe::ast_to_token_tree(&arg); - let rules = match MacroRules::parse(&tt) { + let rules = match mbe::MacroRules::parse(&tt) { Ok(it) => it, Err(err) => { let name = macro_rules.name().map(|n| n.to_string()).unwrap_or_default(); @@ -154,10 +154,10 @@ fn macro_def(db: &dyn AstDatabase, id: MacroDefId) -> Option { + ast::Macro::MacroDef(macro_def) => { let arg = macro_def.body()?; let (tt, tmap) = mbe::ast_to_token_tree(&arg); - let rules = match MacroDef::parse(&tt) { + let rules = match mbe::MacroDef::parse(&tt) { Ok(it) => it, Err(err) => { let name = macro_def.name().map(|n| n.to_string()).unwrap_or_default(); @@ -403,7 +403,7 @@ fn is_self_replicating(from: &SyntaxNode, to: &SyntaxNode) -> bool { if diff(from, to).is_empty() { return true; } - if let Some(stmts) = MacroStmts::cast(from.clone()) { + if let Some(stmts) = ast::MacroStmts::cast(from.clone()) { if stmts.statements().any(|stmt| diff(stmt.syntax(), to).is_empty()) { return true; } -- cgit v1.2.3