Playground.crate_name String -> Symbol
This commit is contained in:
parent
81b637b6f2
commit
ffb2e84319
2 changed files with 5 additions and 6 deletions
|
|
@ -30,7 +30,7 @@ use rustc_hir::def_id::DefId;
|
|||
use rustc_hir::HirId;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
use std::borrow::Cow;
|
||||
|
|
@ -198,7 +198,7 @@ fn slugify(c: char) -> Option<char> {
|
|||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Playground {
|
||||
pub crate_name: Option<String>,
|
||||
pub crate_name: Option<Symbol>,
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
|
|
@ -290,7 +290,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
|
|||
.map(|l| map_line(l).for_code())
|
||||
.intersperse("\n".into())
|
||||
.collect::<String>();
|
||||
let krate = krate.as_ref().map(|s| &**s);
|
||||
let krate = krate.as_ref().map(|s| s.as_str());
|
||||
let (test, _, _) =
|
||||
doctest::make_test(&test, krate, false, &Default::default(), edition, None);
|
||||
let channel = if test.contains("#![feature(") { "&version=nightly" } else { "" };
|
||||
|
|
|
|||
|
|
@ -464,8 +464,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
|
|||
// If user passed in `--playground-url` arg, we fill in crate name here
|
||||
let mut playground = None;
|
||||
if let Some(url) = playground_url {
|
||||
playground =
|
||||
Some(markdown::Playground { crate_name: Some(krate.name(tcx).to_string()), url });
|
||||
playground = Some(markdown::Playground { crate_name: Some(krate.name(tcx)), url });
|
||||
}
|
||||
let mut layout = layout::Layout {
|
||||
logo: String::new(),
|
||||
|
|
@ -491,7 +490,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
|
|||
}
|
||||
(sym::html_playground_url, Some(s)) => {
|
||||
playground = Some(markdown::Playground {
|
||||
crate_name: Some(krate.name(tcx).to_string()),
|
||||
crate_name: Some(krate.name(tcx)),
|
||||
url: s.to_string(),
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue