mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 07:04:18 +00:00
Auto merge of #120812 - compiler-errors:impl-sorting, r=lcnr
Remove unnecessary impl sorting in queries and metadata Removes unnecessary impl sorting because queries already return their keys in HIR definition order: https://github.com/rust-lang/rust/issues/120371#issuecomment-1926422838 r? `@cjgillot` or `@lcnr` -- unless I totally misunderstood what was being asked for here? 😆 fixes #120371
This commit is contained in:
commit
5f3d385421
1 changed files with 7 additions and 8 deletions
|
@ -56,19 +56,18 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
|
|||
let Ok(impls) = cx.tcx.crate_inherent_impls(()) else {
|
||||
return;
|
||||
};
|
||||
let inherent_impls = cx
|
||||
.tcx
|
||||
.with_stable_hashing_context(|hcx| impls.inherent_impls.to_sorted(&hcx, true));
|
||||
|
||||
for (_, impl_ids) in inherent_impls.into_iter().filter(|(&id, impls)| {
|
||||
impls.len() > 1
|
||||
for (&id, impl_ids) in &impls.inherent_impls {
|
||||
if impl_ids.len() < 2
|
||||
// Check for `#[allow]` on the type definition
|
||||
&& !is_lint_allowed(
|
||||
|| is_lint_allowed(
|
||||
cx,
|
||||
MULTIPLE_INHERENT_IMPL,
|
||||
cx.tcx.local_def_id_to_hir_id(id),
|
||||
)
|
||||
}) {
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for impl_id in impl_ids.iter().map(|id| id.expect_local()) {
|
||||
let impl_ty = cx.tcx.type_of(impl_id).instantiate_identity();
|
||||
match type_map.entry(impl_ty) {
|
||||
|
|
Loading…
Reference in a new issue