diff options
| author | Camelid <camelidcamel@gmail.com> | 2020-12-25 16:16:40 -0800 |
|---|---|---|
| committer | Camelid <camelidcamel@gmail.com> | 2020-12-25 16:20:08 -0800 |
| commit | b959c75b3135189a90a1d3f630d702266270763f (patch) | |
| tree | c04b5cdc5bb25e18572c0e6fc63b1aa8704f299f /src/librustdoc/html | |
| parent | 00652e429aaa2250f2561a457e46387bb5b16737 (diff) | |
| download | rust-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.rs | 6 |
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() |
