Remove unnecessary sigils around Symbol::as_str() calls.
This commit is contained in:
parent
8cddcd39ba
commit
056d48a2c9
104 changed files with 189 additions and 192 deletions
|
|
@ -173,7 +173,7 @@ impl clean::GenericParamDef {
|
|||
Ok(())
|
||||
}
|
||||
clean::GenericParamDefKind::Type { bounds, default, .. } => {
|
||||
f.write_str(&*self.name.as_str())?;
|
||||
f.write_str(self.name.as_str())?;
|
||||
|
||||
if !bounds.is_empty() {
|
||||
if f.alternate() {
|
||||
|
|
@ -637,7 +637,7 @@ fn resolved_path<'cx>(
|
|||
last.name.to_string()
|
||||
}
|
||||
} else {
|
||||
anchor(did, &*last.name.as_str(), cx).to_string()
|
||||
anchor(did, last.name.as_str(), cx).to_string()
|
||||
};
|
||||
write!(w, "{}{}", path, last.args.print(cx))?;
|
||||
}
|
||||
|
|
@ -772,7 +772,7 @@ fn fmt_type<'cx>(
|
|||
clean::Primitive(clean::PrimitiveType::Never) => {
|
||||
primitive_link(f, PrimitiveType::Never, "!", cx)
|
||||
}
|
||||
clean::Primitive(prim) => primitive_link(f, prim, &*prim.as_sym().as_str(), cx),
|
||||
clean::Primitive(prim) => primitive_link(f, prim, prim.as_sym().as_str(), cx),
|
||||
clean::BareFunction(ref decl) => {
|
||||
if f.alternate() {
|
||||
write!(
|
||||
|
|
@ -1268,7 +1268,7 @@ impl clean::Visibility {
|
|||
debug!("path={:?}", path);
|
||||
// modified from `resolved_path()` to work with `DefPathData`
|
||||
let last_name = path.data.last().unwrap().data.get_opt_name().unwrap();
|
||||
let anchor = anchor(vis_did, &last_name.as_str(), cx).to_string();
|
||||
let anchor = anchor(vis_did, last_name.as_str(), cx).to_string();
|
||||
|
||||
let mut s = "pub(in ".to_owned();
|
||||
for seg in &path.data[..path.data.len() - 1] {
|
||||
|
|
@ -1417,7 +1417,7 @@ impl clean::TypeBinding {
|
|||
cx: &'a Context<'tcx>,
|
||||
) -> impl fmt::Display + 'a + Captures<'tcx> {
|
||||
display_fn(move |f| {
|
||||
f.write_str(&*self.name.as_str())?;
|
||||
f.write_str(self.name.as_str())?;
|
||||
match self.kind {
|
||||
clean::TypeBindingKind::Equality { ref ty } => {
|
||||
if f.alternate() {
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ impl<'tcx> Context<'tcx> {
|
|||
fn render_item(&self, it: &clean::Item, is_module: bool) -> String {
|
||||
let mut title = String::new();
|
||||
if !is_module {
|
||||
title.push_str(&it.name.unwrap().as_str());
|
||||
title.push_str(it.name.unwrap().as_str());
|
||||
}
|
||||
if !it.is_primitive() && !it.is_keyword() {
|
||||
if !is_module {
|
||||
|
|
@ -549,7 +549,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
|
|||
|
||||
fn after_krate(&mut self) -> Result<(), Error> {
|
||||
let crate_name = self.tcx().crate_name(LOCAL_CRATE);
|
||||
let final_file = self.dst.join(&*crate_name.as_str()).join("all.html");
|
||||
let final_file = self.dst.join(crate_name.as_str()).join("all.html");
|
||||
let settings_file = self.dst.join("settings.html");
|
||||
|
||||
let mut root_path = self.dst.to_str().expect("invalid path").to_owned();
|
||||
|
|
@ -619,9 +619,9 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
|
|||
if let Some(ref redirections) = self.shared.redirections {
|
||||
if !redirections.borrow().is_empty() {
|
||||
let redirect_map_path =
|
||||
self.dst.join(&*crate_name.as_str()).join("redirect-map.json");
|
||||
self.dst.join(crate_name.as_str()).join("redirect-map.json");
|
||||
let paths = serde_json::to_string(&*redirections.borrow()).unwrap();
|
||||
self.shared.ensure_dir(&self.dst.join(&*crate_name.as_str()))?;
|
||||
self.shared.ensure_dir(&self.dst.join(crate_name.as_str()))?;
|
||||
self.shared.fs.write(redirect_map_path, paths)?;
|
||||
}
|
||||
}
|
||||
|
|
@ -703,7 +703,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
|
|||
if !buf.is_empty() {
|
||||
let name = item.name.as_ref().unwrap();
|
||||
let item_type = item.type_();
|
||||
let file_name = &item_path(item_type, &name.as_str());
|
||||
let file_name = &item_path(item_type, name.as_str());
|
||||
self.shared.ensure_dir(&self.dst)?;
|
||||
let joint_dst = self.dst.join(file_name);
|
||||
self.shared.fs.write(joint_dst, buf)?;
|
||||
|
|
|
|||
|
|
@ -640,9 +640,9 @@ fn short_item_info(
|
|||
// We display deprecation messages for #[deprecated] and #[rustc_deprecated]
|
||||
// but only display the future-deprecation messages for #[rustc_deprecated].
|
||||
let mut message = if let Some(since) = since {
|
||||
let since = &since.as_str();
|
||||
let since = since.as_str();
|
||||
if !stability::deprecation_in_effect(&depr) {
|
||||
if *since == "TBD" {
|
||||
if since == "TBD" {
|
||||
String::from("Deprecating in a future Rust version")
|
||||
} else {
|
||||
format!("Deprecating in {}", Escape(since))
|
||||
|
|
@ -658,7 +658,7 @@ fn short_item_info(
|
|||
let note = note.as_str();
|
||||
let mut ids = cx.id_map.borrow_mut();
|
||||
let html = MarkdownHtml(
|
||||
¬e,
|
||||
note,
|
||||
&mut ids,
|
||||
error_codes,
|
||||
cx.shared.edition(),
|
||||
|
|
@ -683,7 +683,7 @@ fn short_item_info(
|
|||
let mut message =
|
||||
"<span class=\"emoji\">🔬</span> This is a nightly-only experimental API.".to_owned();
|
||||
|
||||
let mut feature = format!("<code>{}</code>", Escape(&feature.as_str()));
|
||||
let mut feature = format!("<code>{}</code>", Escape(feature.as_str()));
|
||||
if let (Some(url), Some(issue)) = (&cx.shared.issue_tracker_base_url, issue) {
|
||||
feature.push_str(&format!(
|
||||
" <a href=\"{url}{issue}\">#{issue}</a>",
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ pub(super) fn print_item(
|
|||
page: page,
|
||||
static_root_path: page.get_static_root_path(),
|
||||
typ: typ,
|
||||
name: &item.name.as_ref().unwrap().as_str(),
|
||||
name: item.name.as_ref().unwrap().as_str(),
|
||||
item_type: &item.type_().to_string(),
|
||||
path_components: path_components,
|
||||
stability_since_raw: &stability_since_raw,
|
||||
|
|
@ -315,7 +315,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
|
|||
w,
|
||||
"<div class=\"item-left\"><code>{}extern crate {} as {};",
|
||||
myitem.visibility.print_with_space(myitem.def_id, cx),
|
||||
anchor(myitem.def_id.expect_def_id(), &*src.as_str(), cx),
|
||||
anchor(myitem.def_id.expect_def_id(), src.as_str(), cx),
|
||||
myitem.name.as_ref().unwrap(),
|
||||
),
|
||||
None => write!(
|
||||
|
|
@ -324,7 +324,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
|
|||
myitem.visibility.print_with_space(myitem.def_id, cx),
|
||||
anchor(
|
||||
myitem.def_id.expect_def_id(),
|
||||
&*myitem.name.as_ref().unwrap().as_str(),
|
||||
myitem.name.as_ref().unwrap().as_str(),
|
||||
cx
|
||||
),
|
||||
),
|
||||
|
|
@ -405,7 +405,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
|
|||
add = add,
|
||||
stab = stab.unwrap_or_default(),
|
||||
unsafety_flag = unsafety_flag,
|
||||
href = item_path(myitem.type_(), &myitem.name.unwrap().as_str()),
|
||||
href = item_path(myitem.type_(), myitem.name.unwrap().as_str()),
|
||||
title = [full_path(cx, myitem), myitem.type_().to_string()]
|
||||
.iter()
|
||||
.filter_map(|s| if !s.is_empty() { Some(s.as_str()) } else { None })
|
||||
|
|
@ -1308,7 +1308,7 @@ fn item_struct(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, s: &clean::St
|
|||
document_non_exhaustive(w, it);
|
||||
for (index, (field, ty)) in fields.enumerate() {
|
||||
let field_name =
|
||||
field.name.map_or_else(|| index.to_string(), |sym| (*sym.as_str()).to_string());
|
||||
field.name.map_or_else(|| index.to_string(), |sym| sym.as_str().to_string());
|
||||
let id = cx.derive_id(format!("{}.{}", ItemType::StructField, field_name));
|
||||
write!(
|
||||
w,
|
||||
|
|
@ -1410,7 +1410,7 @@ crate fn compare_names(mut lhs: &str, mut rhs: &str) -> Ordering {
|
|||
pub(super) fn full_path(cx: &Context<'_>, item: &clean::Item) -> String {
|
||||
let mut s = cx.current.join("::");
|
||||
s.push_str("::");
|
||||
s.push_str(&item.name.unwrap().as_str());
|
||||
s.push_str(item.name.unwrap().as_str());
|
||||
s
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ pub(super) fn write_shared(
|
|||
let dst = cx.dst.join(&format!("source-files{}.js", cx.shared.resource_suffix));
|
||||
let make_sources = || {
|
||||
let (mut all_sources, _krates) =
|
||||
try_err!(collect(&dst, &krate.name(cx.tcx()).as_str(), "sourcesIndex"), &dst);
|
||||
try_err!(collect(&dst, krate.name(cx.tcx()).as_str(), "sourcesIndex"), &dst);
|
||||
all_sources.push(format!(
|
||||
"sourcesIndex[\"{}\"] = {};",
|
||||
&krate.name(cx.tcx()),
|
||||
|
|
@ -437,7 +437,7 @@ pub(super) fn write_shared(
|
|||
// Update the search index and crate list.
|
||||
let dst = cx.dst.join(&format!("search-index{}.js", cx.shared.resource_suffix));
|
||||
let (mut all_indexes, mut krates) =
|
||||
try_err!(collect_json(&dst, &krate.name(cx.tcx()).as_str()), &dst);
|
||||
try_err!(collect_json(&dst, krate.name(cx.tcx()).as_str()), &dst);
|
||||
all_indexes.push(search_index);
|
||||
krates.push(krate.name(cx.tcx()).to_string());
|
||||
krates.sort();
|
||||
|
|
@ -575,7 +575,7 @@ pub(super) fn write_shared(
|
|||
mydst.push(&format!("{}.{}.js", remote_item_type, remote_path[remote_path.len() - 1]));
|
||||
|
||||
let (mut all_implementors, _) =
|
||||
try_err!(collect(&mydst, &krate.name(cx.tcx()).as_str(), "implementors"), &mydst);
|
||||
try_err!(collect(&mydst, krate.name(cx.tcx()).as_str(), "implementors"), &mydst);
|
||||
all_implementors.push(implementors);
|
||||
// Sort the implementors by crate so the file will be generated
|
||||
// identically even with rustdoc running in parallel.
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use std::path::{Component, Path, PathBuf};
|
|||
crate fn render(cx: &mut Context<'_>, krate: &clean::Crate) -> Result<(), Error> {
|
||||
info!("emitting source files");
|
||||
|
||||
let dst = cx.dst.join("src").join(&*krate.name(cx.tcx()).as_str());
|
||||
let dst = cx.dst.join("src").join(krate.name(cx.tcx()).as_str());
|
||||
cx.shared.ensure_dir(&dst)?;
|
||||
|
||||
let mut collector = SourceCollector { dst, cx, emitted_local_sources: FxHashSet::default() };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue