Skip to content

Commit 41ad279

Browse files
committed
cargo dev dogfood
cargo uibless
1 parent bfa6bdb commit 41ad279

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clippy_lints/src/use_crate_prefix_for_self_imports.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use clippy_utils::source::snippet_opt;
33
use def_id::LOCAL_CRATE;
44
use rustc_errors::Applicability;
55
use rustc_hir::def::Res;
6-
use rustc_hir::*;
6+
use rustc_hir::{Item, ItemKind, def_id};
77
use rustc_lint::{LateContext, LateLintPass, LintContext};
88
use rustc_session::declare_lint_pass;
99
use rustc_span::{FileName, RealFileName};
@@ -75,10 +75,10 @@ impl LateLintPass<'_> for UseCratePrefixForSelfImports {
7575
span_lint_and_sugg(
7676
cx,
7777
USE_CRATE_PREFIX_FOR_SELF_IMPORTS,
78-
use_path.span,
78+
segment.ident.span,
7979
"this import is not clear",
8080
"prefix with `crate::`",
81-
format!("crate::{}", snippet_opt(cx, use_path.span).unwrap()),
81+
format!("crate::{}", snippet_opt(cx, segment.ident.span).unwrap()),
8282
Applicability::MachineApplicable,
8383
);
8484
}

tests/ui-cargo/use_crate_prefix_for_self_imports/fail/Cargo.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: this import is not clear
22
--> src/main.rs:1:5
33
|
44
1 | use foo::Foo;
5-
| ^^^^^^^^ help: prefix with `crate::`: `crate::foo::Foo`
5+
| ^^^ help: prefix with `crate::`: `crate::foo`
66
|
77
= note: `-D clippy::use-crate-prefix-for-self-imports` implied by `-D warnings`
88
= help: to override `-D warnings` add `#[allow(clippy::use_crate_prefix_for_self_imports)]`

0 commit comments

Comments
 (0)