Skip to content

Commit 1085dc2

Browse files
committed
Rename is_generic() to is_assoc_ty()
The new name is more accurate than the previous one.
1 parent 07d6454 commit 1085dc2

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/librustdoc/clean/types.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1498,9 +1498,9 @@ impl Type {
14981498
}
14991499
}
15001500

1501-
crate fn is_generic(&self) -> bool {
1501+
crate fn is_assoc_ty(&self) -> bool {
15021502
match self {
1503-
ResolvedPath { path, .. } => path.is_generic(),
1503+
ResolvedPath { path, .. } => path.is_assoc_ty(),
15041504
_ => false,
15051505
}
15061506
}
@@ -1990,7 +1990,7 @@ impl Path {
19901990
+ &self.segments.iter().map(|s| s.name.to_string()).collect::<Vec<_>>().join("::")
19911991
}
19921992

1993-
crate fn is_generic(&self) -> bool {
1993+
crate fn is_assoc_ty(&self) -> bool {
19941994
match self.res {
19951995
Res::SelfTy(..) if self.segments.len() != 1 => true,
19961996
Res::Def(DefKind::TyParam, _) if self.segments.len() != 1 => true,

src/librustdoc/html/format.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ fn fmt_type<'cx>(
754754
clean::Generic(name) => write!(f, "{}", name),
755755
clean::ResolvedPath { did, ref path } => {
756756
// Paths like `T::Output` and `Self::Output` should be rendered with all segments.
757-
resolved_path(f, did, path, path.is_generic(), use_absolute, cx)
757+
resolved_path(f, did, path, path.is_assoc_ty(), use_absolute, cx)
758758
}
759759
clean::DynTrait(ref bounds, ref lt) => {
760760
f.write_str("dyn ")?;
@@ -826,7 +826,7 @@ fn fmt_type<'cx>(
826826
hir::Mutability::Not => "const",
827827
};
828828

829-
if matches!(**t, clean::Generic(_)) || t.is_generic() {
829+
if matches!(**t, clean::Generic(_)) || t.is_assoc_ty() {
830830
let text = if f.alternate() {
831831
format!("*{} {:#}", m, t.print(cx))
832832
} else {

src/librustdoc/html/render/print_item.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
715715
clean::ResolvedPath { ref path, did, .. }
716716
| clean::BorrowedRef {
717717
type_: box clean::ResolvedPath { ref path, did, .. }, ..
718-
} if !path.is_generic() => {
718+
} if !path.is_assoc_ty() => {
719719
let &mut (prev_did, ref mut has_duplicates) =
720720
implementor_dups.entry(path.last()).or_insert((did, false));
721721
if prev_did != did {
@@ -1411,7 +1411,7 @@ fn render_implementor(
14111411
let use_absolute = match implementor.inner_impl().for_ {
14121412
clean::ResolvedPath { ref path, .. }
14131413
| clean::BorrowedRef { type_: box clean::ResolvedPath { ref path, .. }, .. }
1414-
if !path.is_generic() =>
1414+
if !path.is_assoc_ty() =>
14151415
{
14161416
implementor_dups[&path.last()].1
14171417
}

src/librustdoc/passes/stripper.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl<'a> DocFolder for ImplStripper<'a> {
128128
return None;
129129
}
130130
if let Some(did) = imp.for_.def_id() {
131-
if did.is_local() && !imp.for_.is_generic() && !self.retained.contains(&did.into())
131+
if did.is_local() && !imp.for_.is_assoc_ty() && !self.retained.contains(&did.into())
132132
{
133133
debug!("ImplStripper: impl item for stripped type; removing");
134134
return None;

0 commit comments

Comments
 (0)