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 +28
-3
lines changed Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -350,16 +350,18 @@ impl<'tcx> LateLintPass<'tcx> for Types {
350350
351351 fn check_impl_item ( & mut self , cx : & LateContext < ' tcx > , item : & ' tcx ImplItem < ' _ > ) {
352352 match item. kind {
353- ImplItemKind :: Const ( ty, _) | ImplItemKind :: TyAlias ( ty ) => self . check_ty (
353+ ImplItemKind :: Const ( ty, _) => self . check_ty (
354354 cx,
355355 ty,
356356 CheckTyContext {
357357 is_in_trait_impl : true ,
358358 ..CheckTyContext :: default ( )
359359 } ,
360360 ) ,
361- // methods are covered by check_fn
362- ImplItemKind :: Fn ( ..) => ( ) ,
361+ // Methods are covered by check_fn.
362+ // Type aliases are ignored because oftentimes it's impossible to
363+ // make type alias declaration in trait simpler, see #1013
364+ ImplItemKind :: Fn ( ..) | ImplItemKind :: TyAlias ( ..) => ( ) ,
363365 }
364366 }
365367
Original file line number Diff line number Diff line change 1+ #![ warn( clippy:: type_complexity) ]
2+ use std:: iter:: { Filter , Map } ;
3+ use std:: vec:: IntoIter ;
4+
5+ struct S ;
6+
7+ impl IntoIterator for S {
8+ type Item = i32 ;
9+ // Should not warn since there is no way to simplify this
10+ type IntoIter = Filter < Map < IntoIter < i32 > , fn ( i32 ) -> i32 > , fn ( & i32 ) -> bool > ;
11+
12+ fn into_iter ( self ) -> Self :: IntoIter {
13+ fn m ( a : i32 ) -> i32 {
14+ a
15+ }
16+ fn p ( _: & i32 ) -> bool {
17+ true
18+ }
19+ vec ! [ 1i32 , 2 , 3 ] . into_iter ( ) . map ( m as fn ( _) -> _ ) . filter ( p)
20+ }
21+ }
22+
23+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments