1
Fork 0

Rollup merge of #99342 - TaKO8Ki:avoid-symbol-to-string-conversions, r=compiler-errors

Avoid some `Symbol` to `String` conversions

This patch removes some Symbol to String conversions.
This commit is contained in:
Matthias Krüger 2022-07-16 22:30:56 +02:00 committed by GitHub
commit 6277ac2fb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 50 additions and 59 deletions

View file

@ -19,8 +19,7 @@ use rustc_middle::ty::subst::InternalSubsts;
use rustc_middle::ty::Region;
use rustc_middle::ty::TypeVisitor;
use rustc_middle::ty::{self, RegionVid, Ty};
use rustc_span::symbol::sym;
use rustc_span::symbol::Ident;
use rustc_span::symbol::{kw, sym, Ident};
use rustc_span::Span;
use crate::borrowck_errors;
@ -758,7 +757,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
return;
};
let lifetime = if f.has_name() { fr_name.to_string() } else { "'_".to_string() };
let lifetime = if f.has_name() { fr_name.name } else { kw::UnderscoreLifetime };
let arg = match param.param.pat.simple_ident() {
Some(simple_ident) => format!("argument `{}`", simple_ident),
@ -770,7 +769,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
self.infcx.tcx,
diag,
fn_returns,
lifetime,
lifetime.to_string(),
Some(arg),
captures,
Some((param.param_ty_span, param.param_ty.to_string())),