From b1332670c7c471a59f3da113b366e74ac194c38b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 14:12:04 +0200 Subject: Rename UseItem -> Use --- crates/ra_assists/src/handlers/auto_import.rs | 2 +- crates/ra_assists/src/handlers/merge_imports.rs | 2 +- crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs | 4 ++-- crates/ra_assists/src/utils/insert_use.rs | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'crates/ra_assists') diff --git a/crates/ra_assists/src/handlers/auto_import.rs b/crates/ra_assists/src/handlers/auto_import.rs index 947be3b9b..01e7b7a44 100644 --- a/crates/ra_assists/src/handlers/auto_import.rs +++ b/crates/ra_assists/src/handlers/auto_import.rs @@ -92,7 +92,7 @@ impl AutoImportAssets { fn for_regular_path(path_under_caret: ast::Path, ctx: &AssistContext) -> Option { let syntax_under_caret = path_under_caret.syntax().to_owned(); - if syntax_under_caret.ancestors().find_map(ast::UseItem::cast).is_some() { + if syntax_under_caret.ancestors().find_map(ast::Use::cast).is_some() { return None; } diff --git a/crates/ra_assists/src/handlers/merge_imports.rs b/crates/ra_assists/src/handlers/merge_imports.rs index 1beccb61c..c775fe25c 100644 --- a/crates/ra_assists/src/handlers/merge_imports.rs +++ b/crates/ra_assists/src/handlers/merge_imports.rs @@ -28,7 +28,7 @@ pub(crate) fn merge_imports(acc: &mut Assists, ctx: &AssistContext) -> Option<() let mut rewriter = SyntaxRewriter::default(); let mut offset = ctx.offset(); - if let Some(use_item) = tree.syntax().parent().and_then(ast::UseItem::cast) { + if let Some(use_item) = tree.syntax().parent().and_then(ast::Use::cast) { let (merged, to_delete) = next_prev() .filter_map(|dir| neighbor(&use_item, dir)) .filter_map(|it| Some((it.clone(), it.use_tree()?))) diff --git a/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs b/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs index 3d51faa54..53496ede1 100644 --- a/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs +++ b/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs @@ -25,7 +25,7 @@ pub(crate) fn replace_qualified_name_with_use( ) -> Option<()> { let path: ast::Path = ctx.find_node_at_offset()?; // We don't want to mess with use statements - if path.syntax().ancestors().find_map(ast::UseItem::cast).is_some() { + if path.syntax().ancestors().find_map(ast::Use::cast).is_some() { return None; } @@ -85,7 +85,7 @@ fn shorten_paths(rewriter: &mut SyntaxRewriter<'static>, node: SyntaxNode, path: match child { // Don't modify `use` items, as this can break the `use` item when injecting a new // import into the use tree. - ast::UseItem(_it) => continue, + ast::Use(_it) => continue, // Don't descend into submodules, they don't have the same `use` items in scope. ast::Module(_it) => continue, diff --git a/crates/ra_assists/src/utils/insert_use.rs b/crates/ra_assists/src/utils/insert_use.rs index c05027eff..617afe2e9 100644 --- a/crates/ra_assists/src/utils/insert_use.rs +++ b/crates/ra_assists/src/utils/insert_use.rs @@ -225,7 +225,7 @@ fn walk_use_tree_for_best_action( current_use_tree .syntax() .ancestors() - .find_map(ast::UseItem::cast) + .find_map(ast::Use::cast) .map(|it| it.syntax().clone()), true, ); @@ -254,7 +254,7 @@ fn walk_use_tree_for_best_action( current_use_tree .syntax() .ancestors() - .find_map(ast::UseItem::cast) + .find_map(ast::Use::cast) .map(|it| it.syntax().clone()), true, ), @@ -304,7 +304,7 @@ fn walk_use_tree_for_best_action( current_use_tree .syntax() .ancestors() - .find_map(ast::UseItem::cast) + .find_map(ast::Use::cast) .map(|it| it.syntax().clone()), true, ); @@ -377,7 +377,7 @@ fn best_action_for_target( let mut storage = Vec::with_capacity(16); // this should be the only allocation let best_action = container .children() - .filter_map(ast::UseItem::cast) + .filter_map(ast::Use::cast) .filter_map(|it| it.use_tree()) .map(|u| walk_use_tree_for_best_action(&mut storage, None, u, target)) .fold(None, |best, a| match best { -- cgit v1.2.3