This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed
src/tools/clippy/clippy_lints/src Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -56,19 +56,18 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
56
56
let Ok ( impls) = cx. tcx . crate_inherent_impls ( ( ) ) else {
57
57
return ;
58
58
} ;
59
- let inherent_impls = cx
60
- . tcx
61
- . with_stable_hashing_context ( |hcx| impls. inherent_impls . to_sorted ( & hcx, true ) ) ;
62
59
63
- for ( _ , impl_ids) in inherent_impls . into_iter ( ) . filter ( | ( & id , impls) | {
64
- impls . len ( ) > 1
60
+ for ( & id , impl_ids) in & impls. inherent_impls {
61
+ if impl_ids . len ( ) < 2
65
62
// Check for `#[allow]` on the type definition
66
- && ! is_lint_allowed (
63
+ || is_lint_allowed (
67
64
cx,
68
65
MULTIPLE_INHERENT_IMPL ,
69
66
cx. tcx . local_def_id_to_hir_id ( id) ,
70
- )
71
- } ) {
67
+ ) {
68
+ continue ;
69
+ }
70
+
72
71
for impl_id in impl_ids. iter ( ) . map ( |id| id. expect_local ( ) ) {
73
72
let impl_ty = cx. tcx . type_of ( impl_id) . instantiate_identity ( ) ;
74
73
match type_map. entry ( impl_ty) {
Original file line number Diff line number Diff line change @@ -24,14 +24,14 @@ impl Foo<u32> {
24
24
}
25
25
26
26
impl < T > Bar for Foo < T > {
27
- //@ has - '//*[@id="associatedtype.Item-1 "]//h4[@class="code-header"]' 'type Item = T'
27
+ // @ has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' 'type Item = T'
28
28
type Item =T ;
29
29
30
30
//@ has - '//*[@id="method.quux"]//h4[@class="code-header"]' 'fn quux(self)'
31
31
fn quux ( self ) { }
32
32
}
33
33
impl < ' a , T > Bar for & ' a Foo < T > {
34
- //@ has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' "type Item = &'a T"
34
+ // @ has - '//*[@id="associatedtype.Item-1 "]//h4[@class="code-header"]' "type Item = &'a T"
35
35
type Item =& ' a T ;
36
36
37
37
//@ has - '//*[@id="method.quux-1"]//h4[@class="code-header"]' 'fn quux(self)'
You can’t perform that action at this time.
0 commit comments