File tree 2 files changed +20
-19
lines changed
2 files changed +20
-19
lines changed Original file line number Diff line number Diff line change @@ -139,25 +139,25 @@ impl<'tcx> LateLintPass<'tcx> for LargeEnumVariant {
139
139
. fields_size
140
140
. iter ( )
141
141
. rev ( )
142
- . take_while ( |val| {
143
- let judge = difference > self . maximum_size_difference_allowed ;
144
- difference = difference. saturating_sub ( val. size ) ;
145
- judge
146
- } )
147
- . map ( |val| {
148
- (
149
- fields [ val . ind ] . ty . span ,
150
- format ! (
151
- "Box<{}>" ,
152
- snippet_with_applicability (
153
- cx ,
154
- fields [ val . ind ] . ty . span ,
155
- ".." ,
156
- & mut applicability
157
- )
158
- . into_owned ( )
159
- ) ,
160
- )
142
+ . map_while ( |val| {
143
+ if difference > self . maximum_size_difference_allowed {
144
+ difference = difference. saturating_sub ( val. size ) ;
145
+ Some ( (
146
+ fields [ val . ind ] . ty . span ,
147
+ format ! (
148
+ "Box<{}>" ,
149
+ snippet_with_applicability (
150
+ cx ,
151
+ fields [ val . ind ] . ty . span ,
152
+ ".." ,
153
+ & mut applicability
154
+ )
155
+ . into_owned ( )
156
+ ) ,
157
+ ) )
158
+ } else {
159
+ None
160
+ }
161
161
} )
162
162
. collect ( ) ;
163
163
Original file line number Diff line number Diff line change 3
3
#![ feature( box_patterns) ]
4
4
#![ feature( drain_filter) ]
5
5
#![ feature( in_band_lifetimes) ]
6
+ #![ feature( iter_map_while) ]
6
7
#![ feature( iter_zip) ]
7
8
#![ feature( once_cell) ]
8
9
#![ feature( rustc_private) ]
You can’t perform that action at this time.
0 commit comments