From c4739bc920a192b852ceb48fb500831594d5ff96 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 19 Dec 2020 14:21:00 +0100 Subject: [PATCH] Rework DocFragment --- src/librustdoc/clean/types.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index d0d37046e59..5c5ad5d7ccf 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -481,7 +481,7 @@ crate enum DocFragmentKind { RawDoc, /// A doc fragment created from a `#[doc(include="filename")]` attribute. Contains both the /// given filename and the file contents. - Include { filename: String }, + Include { filename: Symbol }, } impl<'a> FromIterator<&'a DocFragment> for String { @@ -565,7 +565,7 @@ impl Attributes { /// Reads a `MetaItem` from within an attribute, looks for whether it is a /// `#[doc(include="file")]`, and returns the filename and contents of the file as loaded from /// its expansion. - crate fn extract_include(mi: &ast::MetaItem) -> Option<(String, String)> { + crate fn extract_include(mi: &ast::MetaItem) -> Option<(Symbol, String)> { mi.meta_item_list().and_then(|list| { for meta in list { if meta.has_name(sym::include) { @@ -573,13 +573,13 @@ impl Attributes { // `#[doc(include(file="filename", contents="file contents")]` so we need to // look for that instead return meta.meta_item_list().and_then(|list| { - let mut filename: Option = None; + let mut filename: Option = None; let mut contents: Option = None; for it in list { if it.has_name(sym::file) { if let Some(name) = it.value_str() { - filename = Some(name.to_string()); + filename = Some(name); } } else if it.has_name(sym::contents) { if let Some(docs) = it.value_str() {