about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-01-27 11:10:37 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2022-01-27 17:42:35 +1100
commit696d5034b22eea20daaa549f3346672d26708df2 (patch)
treead92afbf04ec2c6b32602489c7f2d2dd66aa6895
parent84322efad553c7a79c80189f2d1b9197c1aa005f (diff)
downloadrust-696d5034b22eea20daaa549f3346672d26708df2.tar.gz
rust-696d5034b22eea20daaa549f3346672d26708df2.zip
Clarify the `usage-of-qualified-ty` error message.
I found this message confusing when I encountered it. This commit makes
it clearer that you have to import the unqualified type yourself.
-rw-r--r--compiler/rustc_lint/src/internal.rs2
-rw-r--r--src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr4
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs
index 7353cd6b876..d8e1162890c 100644
--- a/compiler/rustc_lint/src/internal.rs
+++ b/compiler/rustc_lint/src/internal.rs
@@ -108,7 +108,7 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind {
                                     lint.build(&format!("usage of qualified `ty::{}`", t))
                                         .span_suggestion(
                                             path.span,
-                                            "try using it unqualified",
+                                            "try importing it and using it unqualified",
                                             t,
                                             // The import probably needs to be changed
                                             Applicability::MaybeIncorrect,
diff --git a/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr b/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr
index 59732cd84e5..a1056cf85d3 100644
--- a/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr
+++ b/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr
@@ -2,7 +2,7 @@ error: usage of qualified `ty::Ty<'_>`
   --> $DIR/qualified_ty_ty_ctxt.rs:25:11
    |
 LL |     ty_q: ty::Ty<'_>,
-   |           ^^^^^^^^^^ help: try using it unqualified: `Ty<'_>`
+   |           ^^^^^^^^^^ help: try importing it and using it unqualified: `Ty<'_>`
    |
 note: the lint level is defined here
   --> $DIR/qualified_ty_ty_ctxt.rs:4:9
@@ -14,7 +14,7 @@ error: usage of qualified `ty::TyCtxt<'_>`
   --> $DIR/qualified_ty_ty_ctxt.rs:27:16
    |
 LL |     ty_ctxt_q: ty::TyCtxt<'_>,
-   |                ^^^^^^^^^^^^^^ help: try using it unqualified: `TyCtxt<'_>`
+   |                ^^^^^^^^^^^^^^ help: try importing it and using it unqualified: `TyCtxt<'_>`
 
 error: aborting due to 2 previous errors