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
|
@ -572,7 +572,7 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
|
|||
template_snippet.as_ref().map(|s| Symbol::intern(s)),
|
||||
template_sp,
|
||||
));
|
||||
let template_str = &template_str.as_str();
|
||||
let template_str = template_str.as_str();
|
||||
|
||||
if let Some(InlineAsmArch::X86 | InlineAsmArch::X86_64) = ecx.sess.asm_arch {
|
||||
let find_span = |needle: &str| -> Span {
|
||||
|
|
|
@ -21,7 +21,7 @@ pub fn expand_concat(
|
|||
match e.kind {
|
||||
ast::ExprKind::Lit(ref lit) => match lit.kind {
|
||||
ast::LitKind::Str(ref s, _) | ast::LitKind::Float(ref s, _) => {
|
||||
accumulator.push_str(&s.as_str());
|
||||
accumulator.push_str(s.as_str());
|
||||
}
|
||||
ast::LitKind::Char(c) => {
|
||||
accumulator.push(c);
|
||||
|
|
|
@ -29,7 +29,7 @@ pub fn expand_concat_idents<'cx>(
|
|||
} else {
|
||||
if let TokenTree::Token(token) = e {
|
||||
if let Some((ident, _)) = token.ident() {
|
||||
res_str.push_str(&ident.name.as_str());
|
||||
res_str.push_str(ident.name.as_str());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ fn report_bad_target(sess: &Session, item: &Annotatable, span: Span) -> bool {
|
|||
|
||||
fn report_unexpected_literal(sess: &Session, lit: &ast::Lit) {
|
||||
let help_msg = match lit.token.kind {
|
||||
token::Str if rustc_lexer::is_ident(&lit.token.symbol.as_str()) => {
|
||||
token::Str if rustc_lexer::is_ident(lit.token.symbol.as_str()) => {
|
||||
format!("try using `#[derive({})]`", lit.token.symbol)
|
||||
}
|
||||
_ => "for example, write `#[derive(Debug)]` for `Debug`".to_string(),
|
||||
|
|
|
@ -80,11 +80,11 @@ pub fn expand_env<'cx>(
|
|||
}
|
||||
|
||||
let sp = cx.with_def_site_ctxt(sp);
|
||||
let value = env::var(&*var.as_str()).ok().as_deref().map(Symbol::intern);
|
||||
let value = env::var(var.as_str()).ok().as_deref().map(Symbol::intern);
|
||||
cx.sess.parse_sess.env_depinfo.borrow_mut().insert((var, value));
|
||||
let e = match value {
|
||||
None => {
|
||||
cx.span_err(sp, &msg.as_str());
|
||||
cx.span_err(sp, msg.as_str());
|
||||
return DummyResult::any(sp);
|
||||
}
|
||||
Some(value) => cx.expr_str(sp, value),
|
||||
|
|
|
@ -955,7 +955,7 @@ pub fn expand_preparsed_format_args(
|
|||
ast::StrStyle::Raw(raw) => Some(raw as usize),
|
||||
};
|
||||
|
||||
let fmt_str = &fmt_str.as_str(); // for the suggestions below
|
||||
let fmt_str = fmt_str.as_str(); // for the suggestions below
|
||||
let fmt_snippet = ecx.source_map().span_to_snippet(fmt_sp).ok();
|
||||
let mut parser = parse::Parser::new(
|
||||
fmt_str,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue