diff options
| author | Noah Lev <camelidcamel@gmail.com> | 2021-08-30 20:53:57 -0700 |
|---|---|---|
| committer | Noah Lev <camelidcamel@gmail.com> | 2021-09-12 13:27:11 -0700 |
| commit | 1085dc2148594bc259f9629b7ca4aa9489c8c10d (patch) | |
| tree | 0d262a86985be530ee60732bf6e04b7007bd832f | |
| parent | 07d6454a0fe1f34096a5c20d3f59d8c20e8a0823 (diff) | |
| download | rust-1085dc2148594bc259f9629b7ca4aa9489c8c10d.tar.gz rust-1085dc2148594bc259f9629b7ca4aa9489c8c10d.zip | |
Rename `is_generic()` to `is_assoc_ty()`
The new name is more accurate than the previous one.
| -rw-r--r-- | src/librustdoc/clean/types.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/html/format.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/render/print_item.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/passes/stripper.rs | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 3033af333df..0139c4e879a 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -1498,9 +1498,9 @@ impl Type { } } - crate fn is_generic(&self) -> bool { + crate fn is_assoc_ty(&self) -> bool { match self { - ResolvedPath { path, .. } => path.is_generic(), + ResolvedPath { path, .. } => path.is_assoc_ty(), _ => false, } } @@ -1990,7 +1990,7 @@ impl Path { + &self.segments.iter().map(|s| s.name.to_string()).collect::<Vec<_>>().join("::") } - crate fn is_generic(&self) -> bool { + crate fn is_assoc_ty(&self) -> bool { match self.res { Res::SelfTy(..) if self.segments.len() != 1 => true, Res::Def(DefKind::TyParam, _) if self.segments.len() != 1 => true, diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 722d91ca69b..d11781581a8 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -754,7 +754,7 @@ fn fmt_type<'cx>( clean::Generic(name) => write!(f, "{}", name), clean::ResolvedPath { did, ref path } => { // Paths like `T::Output` and `Self::Output` should be rendered with all segments. - resolved_path(f, did, path, path.is_generic(), use_absolute, cx) + resolved_path(f, did, path, path.is_assoc_ty(), use_absolute, cx) } clean::DynTrait(ref bounds, ref lt) => { f.write_str("dyn ")?; @@ -826,7 +826,7 @@ fn fmt_type<'cx>( hir::Mutability::Not => "const", }; - if matches!(**t, clean::Generic(_)) || t.is_generic() { + if matches!(**t, clean::Generic(_)) || t.is_assoc_ty() { let text = if f.alternate() { format!("*{} {:#}", m, t.print(cx)) } else { diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 90fed020119..1906a7bc3f3 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -715,7 +715,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra clean::ResolvedPath { ref path, did, .. } | clean::BorrowedRef { type_: box clean::ResolvedPath { ref path, did, .. }, .. - } if !path.is_generic() => { + } if !path.is_assoc_ty() => { let &mut (prev_did, ref mut has_duplicates) = implementor_dups.entry(path.last()).or_insert((did, false)); if prev_did != did { @@ -1411,7 +1411,7 @@ fn render_implementor( let use_absolute = match implementor.inner_impl().for_ { clean::ResolvedPath { ref path, .. } | clean::BorrowedRef { type_: box clean::ResolvedPath { ref path, .. }, .. } - if !path.is_generic() => + if !path.is_assoc_ty() => { implementor_dups[&path.last()].1 } diff --git a/src/librustdoc/passes/stripper.rs b/src/librustdoc/passes/stripper.rs index a93880453ba..90300dbd16b 100644 --- a/src/librustdoc/passes/stripper.rs +++ b/src/librustdoc/passes/stripper.rs @@ -128,7 +128,7 @@ impl<'a> DocFolder for ImplStripper<'a> { return None; } if let Some(did) = imp.for_.def_id() { - if did.is_local() && !imp.for_.is_generic() && !self.retained.contains(&did.into()) + if did.is_local() && !imp.for_.is_assoc_ty() && !self.retained.contains(&did.into()) { debug!("ImplStripper: impl item for stripped type; removing"); return None; |
