Skip to content

Commit ffb2e84

Browse files
committed
Playground.crate_name String -> Symbol
1 parent 81b637b commit ffb2e84

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/librustdoc/html/markdown.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use rustc_hir::def_id::DefId;
3030
use rustc_hir::HirId;
3131
use rustc_middle::ty::TyCtxt;
3232
use rustc_span::edition::Edition;
33-
use rustc_span::Span;
33+
use rustc_span::{Span, Symbol};
3434

3535
use once_cell::sync::Lazy;
3636
use std::borrow::Cow;
@@ -198,7 +198,7 @@ fn slugify(c: char) -> Option<char> {
198198

199199
#[derive(Clone, Debug)]
200200
pub struct Playground {
201-
pub crate_name: Option<String>,
201+
pub crate_name: Option<Symbol>,
202202
pub url: String,
203203
}
204204

@@ -290,7 +290,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
290290
.map(|l| map_line(l).for_code())
291291
.intersperse("\n".into())
292292
.collect::<String>();
293-
let krate = krate.as_ref().map(|s| &**s);
293+
let krate = krate.as_ref().map(|s| s.as_str());
294294
let (test, _, _) =
295295
doctest::make_test(&test, krate, false, &Default::default(), edition, None);
296296
let channel = if test.contains("#![feature(") { "&amp;version=nightly" } else { "" };

src/librustdoc/html/render/context.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
464464
// If user passed in `--playground-url` arg, we fill in crate name here
465465
let mut playground = None;
466466
if let Some(url) = playground_url {
467-
playground =
468-
Some(markdown::Playground { crate_name: Some(krate.name(tcx).to_string()), url });
467+
playground = Some(markdown::Playground { crate_name: Some(krate.name(tcx)), url });
469468
}
470469
let mut layout = layout::Layout {
471470
logo: String::new(),
@@ -491,7 +490,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
491490
}
492491
(sym::html_playground_url, Some(s)) => {
493492
playground = Some(markdown::Playground {
494-
crate_name: Some(krate.name(tcx).to_string()),
493+
crate_name: Some(krate.name(tcx)),
495494
url: s.to_string(),
496495
});
497496
}

0 commit comments

Comments
 (0)