Auto merge of #90577 - matthiaskrgr:clippy_perf_nov, r=petrochenkov

clippy::perf fixes
This commit is contained in:
bors 2021-11-05 09:17:39 +00:00
commit 489ec310d2
9 changed files with 13 additions and 13 deletions

View File

@ -832,7 +832,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
// FIXME(rcvalle): Add support for generalized identifiers.
// FIXME(rcvalle): Create distinct unnamed MDNodes for internal identifiers.
let typeid = typeid_for_fnabi(bx.tcx(), fn_abi);
let typeid_metadata = bx.typeid_metadata(typeid.clone());
let typeid_metadata = bx.typeid_metadata(typeid);
// Test whether the function pointer is associated with the type identifier.
let cond = bx.type_test(fn_ptr, typeid_metadata);

View File

@ -250,7 +250,7 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
// is associated with a type identifier).
if cx.tcx().sess.is_sanitizer_cfi_enabled() {
let typeid = typeid_for_fnabi(cx.tcx(), fn_abi);
bx.type_metadata(llfn, typeid.clone());
bx.type_metadata(llfn, typeid);
}
}

View File

@ -632,11 +632,11 @@ fn tooltip<'tcx>(
for statement in statements {
let source_range = source_range_no_file(tcx, &statement.source_info.span);
text.push(format!(
"\n{}{}: {}: {}",
"\n{}{}: {}: {:?}",
TOOLTIP_INDENT,
source_range,
statement_kind_name(&statement),
format!("{:?}", statement)
statement
));
}
if let Some(term) = terminator {

View File

@ -67,7 +67,7 @@ crate fn dump_closure_profile(tcx: TyCtxt<'tcx>, closure_instance: Instance<'tcx
src_file.prefer_local(),
line_nos
) {
eprintln!("Error writting to file {}", e.to_string())
eprintln!("Error writing to file {}", e)
}
}
}

View File

@ -236,7 +236,7 @@ impl<'tcx> DumpVisitor<'tcx> {
id,
span,
name: ident.to_string(),
qualname: format!("{}::{}", qualname, ident.to_string()),
qualname: format!("{}::{}", qualname, ident),
value: typ,
parent: None,
children: vec![],
@ -889,7 +889,7 @@ impl<'tcx> DumpVisitor<'tcx> {
// Rust uses the id of the pattern for var lookups, so we'll use it too.
if !self.span.filter_generated(ident.span) {
let qualname = format!("{}${}", ident.to_string(), hir_id);
let qualname = format!("{}${}", ident, hir_id);
let id = id_from_hir_id(hir_id, &self.save_ctxt);
let span = self.span_from_span(ident.span);

View File

@ -1838,7 +1838,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
post.iter().map(|p| format!("- {}", p)).take(4).collect::<Vec<_>>().join("\n"),
post.len() - 4,
)
} else if post.len() > 1 || (post.len() == 1 && post[0].contains("\n")) {
} else if post.len() > 1 || (post.len() == 1 && post[0].contains('\n')) {
format!(":\n{}", post.iter().map(|p| format!("- {}", p)).collect::<Vec<_>>().join("\n"),)
} else if post.len() == 1 {
format!(": `{}`", post[0])

View File

@ -344,7 +344,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
"reorder the arguments: {}: `<{}>`",
param_types_present
.into_iter()
.map(|ord| format!("{}s", ord.to_string()))
.map(|ord| format!("{}s", ord))
.collect::<Vec<String>>()
.join(", then "),
ordered_params

View File

@ -772,7 +772,7 @@ fn infer_placeholder_type<'a>(
} else {
err.span_note(
tcx.hir().body(body_id).value.span,
&format!("however, the inferred type `{}` cannot be named", ty.to_string()),
&format!("however, the inferred type `{}` cannot be named", ty),
);
}
}
@ -796,7 +796,7 @@ fn infer_placeholder_type<'a>(
} else {
diag.span_note(
tcx.hir().body(body_id).value.span,
&format!("however, the inferred type `{}` cannot be named", ty.to_string()),
&format!("however, the inferred type `{}` cannot be named", ty),
);
}
}

View File

@ -55,8 +55,8 @@ impl<T: Write> OutputFormatter for JunitFormatter<T> {
_stdout: &[u8],
_state: &ConsoleTestState,
) -> io::Result<()> {
// Because the testsuit node holds some of the information as attributes, we can't write it
// until all of the tests has ran. Instead of writting every result as they come in, we add
// Because the testsuite node holds some of the information as attributes, we can't write it
// until all of the tests have finished. Instead of writing every result as they come in, we add
// them to a Vec and write them all at once when run is complete.
let duration = exec_time.map(|t| t.0).unwrap_or_default();
self.results.push((desc.clone(), result.clone(), duration));