File tree 6 files changed +8
-17
lines changed
6 files changed +8
-17
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ impl RegionHighlightMode {
136
136
pub fn highlighting_region ( & mut self , region : ty:: Region < ' _ > , number : usize ) {
137
137
let num_slots = self . highlight_regions . len ( ) ;
138
138
let first_avail_slot =
139
- self . highlight_regions . iter_mut ( ) . filter ( |s| s. is_none ( ) ) . next ( ) . unwrap_or_else ( || {
139
+ self . highlight_regions . iter_mut ( ) . find ( |s| s. is_none ( ) ) . unwrap_or_else ( || {
140
140
bug ! ( "can only highlight {} placeholders at a time" , num_slots, )
141
141
} ) ;
142
142
* first_avail_slot = Some ( ( * region, number) ) ;
Original file line number Diff line number Diff line change @@ -399,8 +399,7 @@ fn orphan_check_trait_ref<'tcx>(
399
399
let local_type = trait_ref
400
400
. input_types ( )
401
401
. flat_map ( |ty| uncover_fundamental_ty ( tcx, ty, in_crate) )
402
- . filter ( |ty| ty_is_non_local_constructor ( ty, in_crate) . is_none ( ) )
403
- . next ( ) ;
402
+ . find ( |ty| ty_is_non_local_constructor ( ty, in_crate) . is_none ( ) ) ;
404
403
405
404
debug ! ( "orphan_check_trait_ref: uncovered ty local_type: `{:?}`" , local_type) ;
406
405
Original file line number Diff line number Diff line change @@ -1442,7 +1442,7 @@ pub fn suggest_constraining_type_param(
1442
1442
const MSG_RESTRICT_TYPE : & str = "consider restricting this type parameter with" ;
1443
1443
const MSG_RESTRICT_TYPE_FURTHER : & str = "consider further restricting this type parameter with" ;
1444
1444
1445
- let param = generics. params . iter ( ) . filter ( |p| p. name . ident ( ) . as_str ( ) == param_name) . next ( ) ;
1445
+ let param = generics. params . iter ( ) . find ( |p| p. name . ident ( ) . as_str ( ) == param_name) ;
1446
1446
1447
1447
let param = if let Some ( param) = param {
1448
1448
param
Original file line number Diff line number Diff line change @@ -93,18 +93,15 @@ impl<'a> TokenTreesReader<'a> {
93
93
}
94
94
95
95
if let Some ( ( delim, _) ) = self . open_braces . last ( ) {
96
- if let Some ( ( _, open_sp, close_sp) ) = self
97
- . matching_delim_spans
98
- . iter ( )
99
- . filter ( |( d, open_sp, close_sp) | {
96
+ if let Some ( ( _, open_sp, close_sp) ) =
97
+ self . matching_delim_spans . iter ( ) . find ( |( d, open_sp, close_sp) | {
100
98
if let Some ( close_padding) = sm. span_to_margin ( * close_sp) {
101
99
if let Some ( open_padding) = sm. span_to_margin ( * open_sp) {
102
100
return delim == d && close_padding != open_padding;
103
101
}
104
102
}
105
103
false
106
104
} )
107
- . next ( )
108
105
// these are in reverse order as they get inserted on close, but
109
106
{
110
107
// we want the last open/first close
Original file line number Diff line number Diff line change @@ -225,12 +225,8 @@ impl<'a> Parser<'a> {
225
225
226
226
// Make sure that the span of the parent node is larger than the span of lhs and rhs,
227
227
// including the attributes.
228
- let lhs_span = lhs
229
- . attrs
230
- . iter ( )
231
- . filter ( |a| a. style == AttrStyle :: Outer )
232
- . next ( )
233
- . map_or ( lhs_span, |a| a. span ) ;
228
+ let lhs_span =
229
+ lhs. attrs . iter ( ) . find ( |a| a. style == AttrStyle :: Outer ) . map_or ( lhs_span, |a| a. span ) ;
234
230
let span = lhs_span. to ( rhs. span ) ;
235
231
lhs = match op {
236
232
AssocOp :: Add
Original file line number Diff line number Diff line change @@ -565,8 +565,7 @@ impl Attributes {
565
565
566
566
let inner_docs = attrs
567
567
. iter ( )
568
- . filter ( |a| a. doc_str ( ) . is_some ( ) )
569
- . next ( )
568
+ . find ( |a| a. doc_str ( ) . is_some ( ) )
570
569
. map_or ( true , |a| a. style == AttrStyle :: Inner ) ;
571
570
572
571
Attributes {
You can’t perform that action at this time.
0 commit comments