diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-12-16 17:21:08 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-12-16 22:04:27 +0100 |
| commit | 50d221c9244c87f22a791af86cff8f3139523dbf (patch) | |
| tree | 9eb4086b17a99d9a3c58fd30e92ce8be54d21018 /src/librustdoc/html | |
| parent | 268cbfeb88b4c13425d47910d3424c85b4c96462 (diff) | |
| download | rust-50d221c9244c87f22a791af86cff8f3139523dbf.tar.gz rust-50d221c9244c87f22a791af86cff8f3139523dbf.zip | |
Replace String with Symbol where possible
Diffstat (limited to 'src/librustdoc/html')
| -rw-r--r-- | src/librustdoc/html/format.rs | 13 | ||||
| -rw-r--r-- | src/librustdoc/html/render/cache.rs | 2 |
2 files changed, 6 insertions, 9 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 536c2e08fde..c49c4892237 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -172,7 +172,7 @@ impl clean::GenericParamDef { display_fn(move |f| match self.kind { clean::GenericParamDefKind::Lifetime => write!(f, "{}", self.name), clean::GenericParamDefKind::Type { ref bounds, ref default, .. } => { - f.write_str(&self.name)?; + f.write_str(&*self.name.as_str())?; if !bounds.is_empty() { if f.alternate() { @@ -193,13 +193,10 @@ impl clean::GenericParamDef { Ok(()) } clean::GenericParamDefKind::Const { ref ty, .. } => { - f.write_str("const ")?; - f.write_str(&self.name)?; - if f.alternate() { - write!(f, ": {:#}", ty.print()) + write!(f, "const {}: {:#}", self.name, ty.print()) } else { - write!(f, ": {}", ty.print()) + write!(f, "const {}: {}", self.name, ty.print()) } } }) @@ -638,7 +635,7 @@ crate fn anchor(did: DefId, text: &str) -> impl fmt::Display + '_ { fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter<'_>, use_absolute: bool) -> fmt::Result { match *t { - clean::Generic(ref name) => f.write_str(name), + clean::Generic(name) => write!(f, "{}", name), clean::ResolvedPath { did, ref param_names, ref path, is_generic } => { if param_names.is_some() { f.write_str("dyn ")?; @@ -1203,7 +1200,7 @@ impl clean::ImportSource { impl clean::TypeBinding { crate fn print(&self) -> impl fmt::Display + '_ { display_fn(move |f| { - f.write_str(&self.name)?; + f.write_str(&*self.name.as_str())?; match self.kind { clean::TypeBindingKind::Equality { ref ty } => { if f.alternate() { diff --git a/src/librustdoc/html/render/cache.rs b/src/librustdoc/html/render/cache.rs index 91037bc160a..80f54d8e161 100644 --- a/src/librustdoc/html/render/cache.rs +++ b/src/librustdoc/html/render/cache.rs @@ -208,7 +208,7 @@ fn get_index_type_name(clean_type: &clean::Type, accept_generic: bool) -> Option }); Some(path_segment.name.clone()) } - clean::Generic(ref s) if accept_generic => Some(s.clone()), + clean::Generic(s) if accept_generic => Some(s.to_string()), clean::Primitive(ref p) => Some(format!("{:?}", p)), clean::BorrowedRef { ref type_, .. } => get_index_type_name(type_, accept_generic), // FIXME: add all from clean::Type. |
