Enable 2021 compatibility lints for all in-tree code

This just applies the suggested fixes from the compatibility warnings,
leaving any that are in practice spurious in. This is primarily intended to
provide a starting point to identify possible fixes to the migrations (e.g., by
avoiding spurious warnings).

A secondary commit cleans these up where they are false positives (as is true in
many of the cases).
This commit is contained in:
Mark Rousskov 2021-09-18 17:37:24 -04:00
parent 5e1a614b53
commit 45b989a033
12 changed files with 52 additions and 34 deletions

View file

@ -40,7 +40,10 @@ where
info!("fully_perform({:?})", self);
}
scrape_region_constraints(infcx, || (self.closure)(infcx))
scrape_region_constraints(infcx, || {
let _ = &self;
(self.closure)(infcx)
})
}
}

View file

@ -394,6 +394,7 @@ fn report_conflicting_impls(
// now because the struct_lint methods don't return back the DiagnosticBuilder
// that's passed in.
let decorate = |err: LintDiagnosticBuilder<'_>| {
let _ = &overlap;
let msg = format!(
"conflicting implementations of trait `{}`{}{}",
overlap.trait_desc,

View file

@ -104,19 +104,22 @@ impl ChildrenExt for Children {
let self_ty = trait_ref.self_ty();
// FIXME: should postpone string formatting until we decide to actually emit.
with_no_trimmed_paths(|| OverlapError {
with_impl: possible_sibling,
trait_desc: trait_ref.print_only_trait_path().to_string(),
// Only report the `Self` type if it has at least
// some outer concrete shell; otherwise, it's
// not adding much information.
self_desc: if self_ty.has_concrete_skeleton() {
Some(self_ty.to_string())
} else {
None
},
intercrate_ambiguity_causes: overlap.intercrate_ambiguity_causes,
involves_placeholder: overlap.involves_placeholder,
with_no_trimmed_paths(|| {
let _ = &overlap;
OverlapError {
with_impl: possible_sibling,
trait_desc: trait_ref.print_only_trait_path().to_string(),
// Only report the `Self` type if it has at least
// some outer concrete shell; otherwise, it's
// not adding much information.
self_desc: if self_ty.has_concrete_skeleton() {
Some(self_ty.to_string())
} else {
None
},
intercrate_ambiguity_causes: overlap.intercrate_ambiguity_causes,
involves_placeholder: overlap.involves_placeholder,
}
})
};