Skip to content

Commit 04b27ef

Browse files
Move to print functions on types instead of impl fmt::Display
This will eventually allow us to easily pass in more parameters to the functions without TLS or other such hacks
1 parent eb48d6b commit 04b27ef

File tree

8 files changed

+553
-523
lines changed

8 files changed

+553
-523
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,7 +1849,7 @@ fn get_real_types(
18491849
cx: &DocContext<'_>,
18501850
recurse: i32,
18511851
) -> FxHashSet<Type> {
1852-
let arg_s = arg.to_string();
1852+
let arg_s = arg.print().to_string();
18531853
let mut res = FxHashSet::default();
18541854
if recurse >= 10 { // FIXME: remove this whole recurse thing when the recursion bug is fixed
18551855
return res;
@@ -3573,16 +3573,6 @@ pub enum GenericArg {
35733573
Const(Constant),
35743574
}
35753575

3576-
impl fmt::Display for GenericArg {
3577-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3578-
match self {
3579-
GenericArg::Lifetime(lt) => lt.fmt(f),
3580-
GenericArg::Type(ty) => ty.fmt(f),
3581-
GenericArg::Const(ct) => ct.fmt(f),
3582-
}
3583-
}
3584-
}
3585-
35863576
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
35873577
pub enum GenericArgs {
35883578
AngleBracketed {
@@ -4274,7 +4264,7 @@ fn resolve_type(cx: &DocContext<'_>,
42744264
return Generic(kw::SelfUpper.to_string());
42754265
}
42764266
Res::Def(DefKind::TyParam, _) if path.segments.len() == 1 => {
4277-
return Generic(format!("{:#}", path));
4267+
return Generic(format!("{:#}", path.print()));
42784268
}
42794269
Res::SelfTy(..)
42804270
| Res::Def(DefKind::TyParam, _)

0 commit comments

Comments
 (0)