diff options
| author | bors <bors@rust-lang.org> | 2020-12-18 05:55:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-12-18 05:55:24 +0000 |
| commit | fee693d08e98d25f566075cbed73e12236c05abd (patch) | |
| tree | bcaa85bb4059293663789644fb33e9f15b209d4a /src/librustdoc/json | |
| parent | 8d006c06b571d4db9fb2ef5b5eb1af28f4ef3574 (diff) | |
| parent | 44e226ceb753075b44bcaadf349b1d1b6a23ad8d (diff) | |
| download | rust-fee693d08e98d25f566075cbed73e12236c05abd.tar.gz rust-fee693d08e98d25f566075cbed73e12236c05abd.zip | |
Auto merge of #80119 - GuillaumeGomez:str-to-symbol, r=jyn514
Continue String to Symbol conversion in rustdoc Follow-up of https://github.com/rust-lang/rust/pull/80091. This PR is already big enough so I'll stop here before the next one. r? `@jyn514`
Diffstat (limited to 'src/librustdoc/json')
| -rw-r--r-- | src/librustdoc/json/conversions.rs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index 809cfb9d743..9dc27e3411d 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -120,7 +120,7 @@ impl From<clean::GenericArg> for GenericArg { fn from(arg: clean::GenericArg) -> Self { use clean::GenericArg::*; match arg { - Lifetime(l) => GenericArg::Lifetime(l.0), + Lifetime(l) => GenericArg::Lifetime(l.0.to_string()), Type(t) => GenericArg::Type(t.into()), Const(c) => GenericArg::Const(c.into()), } @@ -163,7 +163,9 @@ impl From<clean::ItemKind> for ItemEnum { use clean::ItemKind::*; match item { ModuleItem(m) => ItemEnum::ModuleItem(m.into()), - ExternCrateItem(c, a) => ItemEnum::ExternCrateItem { name: c, rename: a }, + ExternCrateItem(c, a) => { + ItemEnum::ExternCrateItem { name: c.to_string(), rename: a.map(|x| x.to_string()) } + } ImportItem(i) => ItemEnum::ImportItem(i.into()), StructItem(s) => ItemEnum::StructItem(s.into()), UnionItem(u) => ItemEnum::StructItem(u.into()), @@ -302,7 +304,7 @@ impl From<clean::WherePredicate> for WherePredicate { bounds: bounds.into_iter().map(Into::into).collect(), }, RegionPredicate { lifetime, bounds } => WherePredicate::RegionPredicate { - lifetime: lifetime.0, + lifetime: lifetime.0.to_string(), bounds: bounds.into_iter().map(Into::into).collect(), }, EqPredicate { lhs, rhs } => { @@ -323,7 +325,7 @@ impl From<clean::GenericBound> for GenericBound { modifier: modifier.into(), } } - Outlives(lifetime) => GenericBound::Outlives(lifetime.0), + Outlives(lifetime) => GenericBound::Outlives(lifetime.0.to_string()), } } } @@ -365,7 +367,7 @@ impl From<clean::Type> for Type { type_: Box::new((*type_).into()), }, BorrowedRef { lifetime, mutability, type_ } => Type::BorrowedRef { - lifetime: lifetime.map(|l| l.0), + lifetime: lifetime.map(|l| l.0.to_string()), mutable: mutability == ast::Mutability::Mut, type_: Box::new((*type_).into()), }, @@ -503,7 +505,7 @@ impl From<clean::Import> for Import { match import.kind { Simple(s) => Import { span: import.source.path.whole_name(), - name: s, + name: s.to_string(), id: import.source.did.map(Into::into), glob: false, }, @@ -519,7 +521,10 @@ impl From<clean::Import> for Import { impl From<clean::ProcMacro> for ProcMacro { fn from(mac: clean::ProcMacro) -> Self { - ProcMacro { kind: mac.kind.into(), helpers: mac.helpers } + ProcMacro { + kind: mac.kind.into(), + helpers: mac.helpers.iter().map(|x| x.to_string()).collect(), + } } } |
