File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -97,16 +97,13 @@ impl<'tcx> LateLintPass<'tcx> for UnusedUnit {
97
97
}
98
98
99
99
fn check_poly_trait_ref ( & mut self , cx : & LateContext < ' tcx > , poly : & ' tcx PolyTraitRef < ' tcx > ) {
100
- let segments = & poly. trait_ref . path . segments ;
101
-
102
- if segments. len ( ) == 1
103
- && matches ! ( segments[ 0 ] . ident. name, sym:: Fn | sym:: FnMut | sym:: FnOnce )
104
- && let Some ( args) = segments[ 0 ] . args
100
+ if let [ segment] = & poly. trait_ref . path . segments
101
+ && matches ! ( segment. ident. name, sym:: Fn | sym:: FnMut | sym:: FnOnce )
102
+ && let Some ( args) = segment. args
105
103
&& args. parenthesized == GenericArgsParentheses :: ParenSugar
106
- && let constraints = & args. constraints
107
- && constraints. len ( ) == 1
108
- && constraints[ 0 ] . ident . name == sym:: Output
109
- && let AssocItemConstraintKind :: Equality { term : Term :: Ty ( hir_ty) } = constraints[ 0 ] . kind
104
+ && let [ constraint] = & args. constraints
105
+ && constraint. ident . name == sym:: Output
106
+ && let AssocItemConstraintKind :: Equality { term : Term :: Ty ( hir_ty) } = constraint. kind
110
107
&& args. span_ext . hi ( ) != poly. span . hi ( )
111
108
&& !hir_ty. span . from_expansion ( )
112
109
&& args. span_ext . hi ( ) != hir_ty. span . hi ( )
You can’t perform that action at this time.
0 commit comments