From e3b1be3b624d6b225901e617bfe28f55b4ebac6d Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 29 Sep 2020 20:23:02 +0200 Subject: [PATCH] Remove unneeded ImportItem on glob ones --- src/librustdoc/clean/mod.rs | 12 +----------- src/test/rustdoc-ui/pub-export-lint.rs | 3 --- src/test/rustdoc-ui/pub-export-lint.stderr | 12 ++---------- src/test/rustdoc/reexport-check.rs | 2 -- 4 files changed, 3 insertions(+), 26 deletions(-) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 721e3902cf51a..54751896bb3b4 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2260,17 +2260,7 @@ impl Clean> for doctree::Import<'_> { let inner = if self.glob { if !denied { let mut visited = FxHashSet::default(); - if let Some(mut items) = inline::try_inline_glob(cx, path.res, &mut visited) { - items.push(Item { - name: None, - attrs: self.attrs.clean(cx), - source: self.span.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(), - visibility: self.vis.clean(cx), - stability: None, - deprecation: None, - inner: ImportItem(Import::new_glob(resolve_use_source(cx, path), false)), - }); + if let Some(items) = inline::try_inline_glob(cx, path.res, &mut visited) { return items; } } diff --git a/src/test/rustdoc-ui/pub-export-lint.rs b/src/test/rustdoc-ui/pub-export-lint.rs index 31953206fd927..3fd3f77400978 100644 --- a/src/test/rustdoc-ui/pub-export-lint.rs +++ b/src/test/rustdoc-ui/pub-export-lint.rs @@ -1,8 +1,5 @@ #![deny(broken_intra_doc_links)] -/// [somewhere] -//~^ ERROR unresolved link to `somewhere` -pub use std::str::*; /// [aloha] //~^ ERROR unresolved link to `aloha` pub use std::task::RawWakerVTable; diff --git a/src/test/rustdoc-ui/pub-export-lint.stderr b/src/test/rustdoc-ui/pub-export-lint.stderr index 7fc24d9bea385..c345def794c08 100644 --- a/src/test/rustdoc-ui/pub-export-lint.stderr +++ b/src/test/rustdoc-ui/pub-export-lint.stderr @@ -1,4 +1,4 @@ -error: unresolved link to `somewhere` +error: unresolved link to `aloha` --> $DIR/pub-export-lint.rs:3:6 | LL | /// [aloha] @@ -11,13 +11,5 @@ LL | #![deny(broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^ = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` -error: unresolved link to `aloha` - --> $DIR/pub-export-lint.rs:6:6 - | -LL | /// [aloha] - | ^^^^^ the module `pub_export_lint` contains no item named `aloha` - | - = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/src/test/rustdoc/reexport-check.rs b/src/test/rustdoc/reexport-check.rs index 9ecf1abbea928..dea72b81a57c3 100644 --- a/src/test/rustdoc/reexport-check.rs +++ b/src/test/rustdoc/reexport-check.rs @@ -7,5 +7,3 @@ pub use std::i32; // @!has 'foo/index.html' '//code' 'pub use self::string::String;' // @has 'foo/index.html' '//tr[@class="module-item"]' 'String' pub use std::string::String; -// @!has 'foo/index.html' '//code' 'pub use self::string::*;' -pub use std::string::*;