Fix removal span calculation of unused_qualifications suggestion
This commit is contained in:
parent
da6b55cc5e
commit
33bd453f35
10 changed files with 138 additions and 22 deletions
|
@ -3911,8 +3911,9 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
|||
&& path[0].ident.name != kw::PathRoot
|
||||
&& path[0].ident.name != kw::DollarCrate
|
||||
{
|
||||
let last_segment = *path.last().unwrap();
|
||||
let unqualified_result = {
|
||||
match self.resolve_path(&[*path.last().unwrap()], Some(ns), None) {
|
||||
match self.resolve_path(&[last_segment], Some(ns), None) {
|
||||
PathResult::NonModule(path_res) => path_res.expect_full_res(),
|
||||
PathResult::Module(ModuleOrUniformRoot::Module(module)) => {
|
||||
module.res().unwrap()
|
||||
|
@ -3928,8 +3929,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
|||
finalize.path_span,
|
||||
"unnecessary qualification",
|
||||
lint::BuiltinLintDiagnostics::UnusedQualifications {
|
||||
path_span: finalize.path_span,
|
||||
unqualified_path: path.last().unwrap().ident
|
||||
removal_span: finalize.path_span.until(last_segment.ident.span),
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue