diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2021-12-15 14:39:23 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2021-12-15 17:32:14 +1100 |
| commit | 056d48a2c97860b2cce936f310331e606076fa01 (patch) | |
| tree | c456e6021abf01fe5350f022926a9974795c071f /compiler/rustc_builtin_macros/src | |
| parent | 8cddcd39ba2189da859a5164804556190906ee2a (diff) | |
| download | rust-056d48a2c97860b2cce936f310331e606076fa01.tar.gz rust-056d48a2c97860b2cce936f310331e606076fa01.zip | |
Remove unnecessary sigils around `Symbol::as_str()` calls.
Diffstat (limited to 'compiler/rustc_builtin_macros/src')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/asm.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_builtin_macros/src/concat.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_builtin_macros/src/concat_idents.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_builtin_macros/src/derive.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_builtin_macros/src/env.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_builtin_macros/src/format.rs | 2 |
6 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_builtin_macros/src/asm.rs b/compiler/rustc_builtin_macros/src/asm.rs index 9ae1584fcbf..42dd8095dda 100644 --- a/compiler/rustc_builtin_macros/src/asm.rs +++ b/compiler/rustc_builtin_macros/src/asm.rs @@ -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 { diff --git a/compiler/rustc_builtin_macros/src/concat.rs b/compiler/rustc_builtin_macros/src/concat.rs index e5077d93674..59361510a67 100644 --- a/compiler/rustc_builtin_macros/src/concat.rs +++ b/compiler/rustc_builtin_macros/src/concat.rs @@ -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); diff --git a/compiler/rustc_builtin_macros/src/concat_idents.rs b/compiler/rustc_builtin_macros/src/concat_idents.rs index 53a456b69ac..239bafb266a 100644 --- a/compiler/rustc_builtin_macros/src/concat_idents.rs +++ b/compiler/rustc_builtin_macros/src/concat_idents.rs @@ -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; } } diff --git a/compiler/rustc_builtin_macros/src/derive.rs b/compiler/rustc_builtin_macros/src/derive.rs index 31a35b9b7b4..47d7b6c259e 100644 --- a/compiler/rustc_builtin_macros/src/derive.rs +++ b/compiler/rustc_builtin_macros/src/derive.rs @@ -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(), diff --git a/compiler/rustc_builtin_macros/src/env.rs b/compiler/rustc_builtin_macros/src/env.rs index 6de12acfb94..285027fc632 100644 --- a/compiler/rustc_builtin_macros/src/env.rs +++ b/compiler/rustc_builtin_macros/src/env.rs @@ -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), diff --git a/compiler/rustc_builtin_macros/src/format.rs b/compiler/rustc_builtin_macros/src/format.rs index cd16172fa31..407aaacb889 100644 --- a/compiler/rustc_builtin_macros/src/format.rs +++ b/compiler/rustc_builtin_macros/src/format.rs @@ -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, |
