mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Handle self/super/crate in PathSegment as NameRef
This commit is contained in:
parent
0c58aa9dc0
commit
cb863390f2
42 changed files with 258 additions and 254 deletions
|
@ -18,7 +18,7 @@ use itertools::Itertools;
|
|||
use rustc_hash::FxHashSet;
|
||||
use syntax::{
|
||||
ast::{self, AstNode},
|
||||
SyntaxNode, TextRange, T,
|
||||
SyntaxNode, TextRange,
|
||||
};
|
||||
use text_edit::TextEdit;
|
||||
|
||||
|
@ -232,7 +232,7 @@ fn text_edit_for_remove_unnecessary_braces_with_self_in_use_statement(
|
|||
single_use_tree: &ast::UseTree,
|
||||
) -> Option<TextEdit> {
|
||||
let use_tree_list_node = single_use_tree.syntax().parent()?;
|
||||
if single_use_tree.path()?.segment()?.syntax().first_child_or_token()?.kind() == T![self] {
|
||||
if single_use_tree.path()?.segment()?.self_token().is_some() {
|
||||
let start = use_tree_list_node.prev_sibling_or_token()?.text_range().start();
|
||||
let end = use_tree_list_node.text_range().end();
|
||||
return Some(TextEdit::delete(TextRange::new(start, end)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue