Some simple clippy::perf
fixes
This commit is contained in:
parent
1c39afb375
commit
f058d05fc2
@ -778,7 +778,7 @@ pub fn print_time_passes_entry(
|
||||
"rss_start": start_rss,
|
||||
"rss_end": end_rss,
|
||||
});
|
||||
eprintln!("time: {}", json.to_string());
|
||||
eprintln!("time: {}", json);
|
||||
return;
|
||||
}
|
||||
TimePassesFormat::Text => (),
|
||||
|
@ -242,8 +242,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let Some(arg) = segment
|
||||
.args()
|
||||
.args
|
||||
.iter()
|
||||
.nth(index) else { return false; };
|
||||
.get(index) else { return false; };
|
||||
error.obligation.cause.span = arg
|
||||
.span()
|
||||
.find_ancestor_in_same_ctxt(error.obligation.cause.span)
|
||||
|
@ -100,7 +100,7 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok
|
||||
Diagnostic::spanned(
|
||||
resource_span,
|
||||
Level::Error,
|
||||
format!("could not open Fluent resource: {}", e.to_string()),
|
||||
format!("could not open Fluent resource: {}", e),
|
||||
)
|
||||
.emit();
|
||||
return failed(&crate_name);
|
||||
|
@ -1224,7 +1224,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||
lifetime_ribs: Vec::new(),
|
||||
lifetime_elision_candidates: None,
|
||||
current_trait_ref: None,
|
||||
diagnostic_metadata: Box::new(DiagnosticMetadata::default()),
|
||||
diagnostic_metadata: Box::<DiagnosticMetadata<'_>>::default(),
|
||||
// errors at module scope should always be reported
|
||||
in_func_body: false,
|
||||
lifetime_uses: Default::default(),
|
||||
|
@ -149,7 +149,7 @@ mod rustc {
|
||||
.iter()
|
||||
.enumerate()
|
||||
.find(|(_, field_def)| name == field_def.name)
|
||||
.expect(&format!("There were no fields named `{name}`."));
|
||||
.unwrap_or_else(|| panic!("There were no fields named `{name}`."));
|
||||
fields[field_idx].unwrap_leaf() == ScalarInt::TRUE
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user