diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-12-17 14:02:09 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-12-17 18:19:38 +0100 |
| commit | 44e226ceb753075b44bcaadf349b1d1b6a23ad8d (patch) | |
| tree | 22a90d5822936a35cfc9a808d36931aa09fb59a1 /src/librustdoc/html/format.rs | |
| parent | bdd0a78582efd17f588b35e3e227a65617d5afec (diff) | |
| download | rust-44e226ceb753075b44bcaadf349b1d1b6a23ad8d.tar.gz rust-44e226ceb753075b44bcaadf349b1d1b6a23ad8d.zip | |
Continue String to Symbol conversion in rustdoc
Diffstat (limited to 'src/librustdoc/html/format.rs')
| -rw-r--r-- | src/librustdoc/html/format.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index c49c4892237..f80346aa50b 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -308,7 +308,7 @@ impl<'a> fmt::Display for WhereClause<'a> { } impl clean::Lifetime { - crate fn print(&self) -> &str { + crate fn print(&self) -> impl fmt::Display + '_ { self.get_ref() } } @@ -445,11 +445,10 @@ impl clean::GenericArgs { impl clean::PathSegment { crate fn print(&self) -> impl fmt::Display + '_ { display_fn(move |f| { - f.write_str(&self.name)?; if f.alternate() { - write!(f, "{:#}", self.args.print()) + write!(f, "{}{:#}", self.name, self.args.print()) } else { - write!(f, "{}", self.args.print()) + write!(f, "{}{}", self.name, self.args.print()) } }) } @@ -544,7 +543,7 @@ fn resolved_path( last.name.to_string() } } else { - anchor(did, &last.name).to_string() + anchor(did, &*last.name.as_str()).to_string() }; write!(w, "{}{}", path, last.args.print())?; } @@ -1159,11 +1158,11 @@ impl PrintWithSpace for hir::Mutability { impl clean::Import { crate fn print(&self) -> impl fmt::Display + '_ { display_fn(move |f| match self.kind { - clean::ImportKind::Simple(ref name) => { - if *name == self.source.path.last_name() { + clean::ImportKind::Simple(name) => { + if name == self.source.path.last() { write!(f, "use {};", self.source.print()) } else { - write!(f, "use {} as {};", self.source.print(), *name) + write!(f, "use {} as {};", self.source.print(), name) } } clean::ImportKind::Glob => { @@ -1187,7 +1186,7 @@ impl clean::ImportSource { } let name = self.path.last_name(); if let hir::def::Res::PrimTy(p) = self.path.res { - primitive_link(f, PrimitiveType::from(p), name)?; + primitive_link(f, PrimitiveType::from(p), &*name)?; } else { write!(f, "{}", name)?; } |
