about summary refs log tree commit diff
path: root/src/librustdoc/html
diff options
context:
space:
mode:
authorCamelid <camelidcamel@gmail.com>2020-12-25 16:16:40 -0800
committerCamelid <camelidcamel@gmail.com>2020-12-25 16:20:08 -0800
commitb959c75b3135189a90a1d3f630d702266270763f (patch)
treec04b5cdc5bb25e18572c0e6fc63b1aa8704f299f /src/librustdoc/html
parent00652e429aaa2250f2561a457e46387bb5b16737 (diff)
downloadrust-b959c75b3135189a90a1d3f630d702266270763f.tar.gz
rust-b959c75b3135189a90a1d3f630d702266270763f.zip
Prefer `pub(crate)` over no modifier
Diffstat (limited to 'src/librustdoc/html')
-rw-r--r--src/librustdoc/html/format.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index a8eae52fc56..90f4aaefc9b 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -1099,12 +1099,12 @@ impl clean::Visibility {
             clean::Visibility::Restricted(vis_did) => {
                 let parent_module = find_closest_parent_module(tcx, item_did);
 
-                if parent_module == Some(vis_did) {
+                if vis_did.index == CRATE_DEF_INDEX {
+                    write!(f, "pub(crate) ")
+                } else if parent_module == Some(vis_did) {
                     // `pub(in foo)` where `foo` is the parent module
                     // is the same as no visibility modifier
                     Ok(())
-                } else if vis_did.index == CRATE_DEF_INDEX {
-                    write!(f, "pub(crate) ")
                 } else if parent_module
                     .map(|parent| find_closest_parent_module(tcx, parent))
                     .flatten()