diff options
| author | bors <bors@rust-lang.org> | 2021-12-19 09:31:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-12-19 09:31:37 +0000 |
| commit | a41a6925badac7508d7a72cc1fc20f43dc6ad75e (patch) | |
| tree | 224de9d17e4b466061b457662dd9d2dfc9b9ce14 /src/librustdoc/html/render/context.rs | |
| parent | 8f540619007c1aa62dfc915409d881f52f21dc84 (diff) | |
| parent | b1c934ebb8b881977a93c05c15caa88921792d3b (diff) | |
| download | rust-a41a6925badac7508d7a72cc1fc20f43dc6ad75e.tar.gz rust-a41a6925badac7508d7a72cc1fc20f43dc6ad75e.zip | |
Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk
Remove `SymbolStr` This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences. Best reviewed one commit at a time. r? `@oli-obk`
Diffstat (limited to 'src/librustdoc/html/render/context.rs')
| -rw-r--r-- | src/librustdoc/html/render/context.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs index 365d959ad9f..c4d326e7711 100644 --- a/src/librustdoc/html/render/context.rs +++ b/src/librustdoc/html/render/context.rs @@ -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 { @@ -315,7 +315,7 @@ impl<'tcx> Context<'tcx> { }; let file = &file; - let symbol; + let krate_sym; let (krate, path) = if cnum == LOCAL_CRATE { if let Some(path) = self.shared.local_sources.get(file) { (self.shared.layout.krate.as_str(), path) @@ -343,8 +343,8 @@ impl<'tcx> Context<'tcx> { let mut fname = file.file_name().expect("source has no filename").to_os_string(); fname.push(".html"); path.push_str(&fname.to_string_lossy()); - symbol = krate.as_str(); - (&*symbol, &path) + krate_sym = krate; + (krate_sym.as_str(), &path) }; let anchor = if with_lines { @@ -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)?; |
