Auto merge of #88516 - matthiaskrgr:clippy_perf_end_august, r=jyn514,GuillaumeGomez
some low hanging clippy::perf fixes
This commit is contained in:
commit
64929313f5
6 changed files with 11 additions and 10 deletions
|
@ -2090,7 +2090,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
|
||||||
self.is_unnamed(),
|
self.is_unnamed(),
|
||||||
self.is_underscore(),
|
self.is_underscore(),
|
||||||
self.is_named(),
|
self.is_named(),
|
||||||
sugg.starts_with("&"),
|
sugg.starts_with('&'),
|
||||||
) {
|
) {
|
||||||
(true, _, _, false) => (self.span_unnamed_borrow(), sugg),
|
(true, _, _, false) => (self.span_unnamed_borrow(), sugg),
|
||||||
(true, _, _, true) => {
|
(true, _, _, true) => {
|
||||||
|
|
|
@ -2605,8 +2605,10 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||||
binding.ident,
|
binding.ident,
|
||||||
);
|
);
|
||||||
self.with(scope, |_, this| {
|
self.with(scope, |_, this| {
|
||||||
let scope =
|
let scope = Scope::Supertrait {
|
||||||
Scope::Supertrait { lifetimes: lifetimes.unwrap_or(vec![]), s: this.scope };
|
lifetimes: lifetimes.unwrap_or_default(),
|
||||||
|
s: this.scope,
|
||||||
|
};
|
||||||
this.with(scope, |_, this| this.visit_assoc_type_binding(binding));
|
this.with(scope, |_, this| this.visit_assoc_type_binding(binding));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -664,7 +664,7 @@ impl ToJson for SanitizerSet {
|
||||||
self.into_iter()
|
self.into_iter()
|
||||||
.map(|v| Some(v.as_str()?.to_json()))
|
.map(|v| Some(v.as_str()?.to_json()))
|
||||||
.collect::<Option<Vec<_>>>()
|
.collect::<Option<Vec<_>>>()
|
||||||
.unwrap_or(Vec::new())
|
.unwrap_or_default()
|
||||||
.to_json()
|
.to_json()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
if self.tcx().sess.verbose() {
|
if self.tcx().sess.verbose() {
|
||||||
// make this code only run with -Zverbose because it is probably slow
|
// make this code only run with -Zverbose because it is probably slow
|
||||||
if let Ok(lint_str) = self.tcx.sess.source_map().span_to_snippet(expr.span) {
|
if let Ok(lint_str) = self.tcx.sess.source_map().span_to_snippet(expr.span) {
|
||||||
if !lint_str.contains("\n") {
|
if !lint_str.contains('\n') {
|
||||||
debug!("expr text: {}", lint_str);
|
debug!("expr text: {}", lint_str);
|
||||||
} else {
|
} else {
|
||||||
let mut lines = lint_str.lines();
|
let mut lines = lint_str.lines();
|
||||||
|
|
|
@ -1008,7 +1008,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
let mut err = struct_span_err!(
|
let mut err = struct_span_err!(
|
||||||
self.tcx.sess,
|
self.tcx.sess,
|
||||||
MultiSpan::from_spans(subpat_spans.clone()),
|
MultiSpan::from_spans(subpat_spans),
|
||||||
E0023,
|
E0023,
|
||||||
"this pattern has {} field{}, but the corresponding {} has {} field{}",
|
"this pattern has {} field{}, but the corresponding {} has {} field{}",
|
||||||
subpats.len(),
|
subpats.len(),
|
||||||
|
|
|
@ -72,10 +72,9 @@ impl LocalSourcesCollector<'_, '_> {
|
||||||
href.push('/');
|
href.push('/');
|
||||||
});
|
});
|
||||||
|
|
||||||
let src_fname = p.file_name().expect("source has no filename").to_os_string();
|
let mut src_fname = p.file_name().expect("source has no filename").to_os_string();
|
||||||
let mut fname = src_fname.clone();
|
src_fname.push(".html");
|
||||||
fname.push(".html");
|
href.push_str(&src_fname.to_string_lossy());
|
||||||
href.push_str(&fname.to_string_lossy());
|
|
||||||
self.local_sources.insert(p, href);
|
self.local_sources.insert(p, href);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue