From f4083c6455ad47e0369013dba7eb716eb00223eb Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Wed, 11 Mar 2020 21:17:23 +0300 Subject: [PATCH] Add the "consider importing it directly" label to public imports as well --- src/librustc_resolve/diagnostics.rs | 2 +- src/test/ui/imports/issue-55884-2.stderr | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 063c62ad9aac7..b00c7473bace3 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -987,7 +987,7 @@ impl<'a> Resolver<'a> { ); let def_span = self.session.source_map().def_span(binding.span); let mut note_span = MultiSpan::from_span(def_span); - if !first && next_binding.is_none() && binding.vis == ty::Visibility::Public { + if !first && binding.vis == ty::Visibility::Public { note_span.push_span_label(def_span, "consider importing it directly".into()); } err.span_note(note_span, &msg); diff --git a/src/test/ui/imports/issue-55884-2.stderr b/src/test/ui/imports/issue-55884-2.stderr index 3eee7118e5a22..490c08446b5a8 100644 --- a/src/test/ui/imports/issue-55884-2.stderr +++ b/src/test/ui/imports/issue-55884-2.stderr @@ -13,12 +13,12 @@ note: ...and refers to the struct import `ParseOptions` which is defined here... --> $DIR/issue-55884-2.rs:12:9 | LL | pub use parser::ParseOptions; - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^ consider importing it directly note: ...and refers to the struct import `ParseOptions` which is defined here... --> $DIR/issue-55884-2.rs:6:13 | LL | pub use options::*; - | ^^^^^^^^^^ + | ^^^^^^^^^^ consider importing it directly note: ...and refers to the struct `ParseOptions` which is defined here --> $DIR/issue-55884-2.rs:2:5 |