File tree 5 files changed +12
-16
lines changed
libsyntax_ext/deriving/generic
5 files changed +12
-16
lines changed Original file line number Diff line number Diff line change @@ -106,8 +106,7 @@ impl<'a> dot::GraphWalk<'a> for &'a cfg::CFG {
106
106
type Node = Node < ' a > ;
107
107
type Edge = Edge < ' a > ;
108
108
fn nodes ( & ' a self ) -> dot:: Nodes < ' a , Node < ' a > > {
109
- let mut v = Vec :: new ( ) ;
110
- self . graph . each_node ( |i, nd| { v. push ( ( i, nd) ) ; true } ) ;
109
+ let v: Vec < _ > = self . graph . enumerated_nodes ( ) . collect ( ) ;
111
110
v. into ( )
112
111
}
113
112
fn edges ( & ' a self ) -> dot:: Edges < ' a , Edge < ' a > > {
Original file line number Diff line number Diff line change @@ -1062,8 +1062,7 @@ impl<'a> LoweringContext<'a> {
1062
1062
attrs
1063
1063
. iter ( )
1064
1064
. map ( |a| self . lower_attr ( a) )
1065
- . collect :: < Vec < _ > > ( )
1066
- . into ( )
1065
+ . collect ( )
1067
1066
}
1068
1067
1069
1068
fn lower_attr ( & mut self , attr : & Attribute ) -> Attribute {
Original file line number Diff line number Diff line change @@ -281,7 +281,7 @@ impl<'sess> OnDiskCache<'sess> {
281
281
// otherwise, abort
282
282
break ;
283
283
}
284
- interpret_alloc_index. reserve ( new_n) ;
284
+ interpret_alloc_index. reserve ( new_n - n ) ;
285
285
for idx in n..new_n {
286
286
let id = encoder. interpret_allocs_inverse [ idx] ;
287
287
let pos = encoder. position ( ) as u32 ;
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ impl FromHex for str {
146
146
}
147
147
148
148
match modulus {
149
- 0 => Ok ( b. into_iter ( ) . collect ( ) ) ,
149
+ 0 => Ok ( b) ,
150
150
_ => Err ( InvalidHexLength ) ,
151
151
}
152
152
}
Original file line number Diff line number Diff line change @@ -1200,16 +1200,14 @@ impl<'a> MethodDef<'a> {
1200
1200
let sp = trait_. span ;
1201
1201
let variants = & enum_def. variants ;
1202
1202
1203
- let self_arg_names = self_args. iter ( )
1204
- . enumerate ( )
1205
- . map ( |( arg_count, _self_arg) | {
1206
- if arg_count == 0 {
1207
- "__self" . to_string ( )
1208
- } else {
1203
+ let self_arg_names = iter:: once ( "__self" . to_string ( ) ) . chain (
1204
+ self_args. iter ( )
1205
+ . enumerate ( )
1206
+ . skip ( 1 )
1207
+ . map ( |( arg_count, _self_arg) |
1209
1208
format ! ( "__arg_{}" , arg_count)
1210
- }
1211
- } )
1212
- . collect :: < Vec < String > > ( ) ;
1209
+ )
1210
+ ) . collect :: < Vec < String > > ( ) ;
1213
1211
1214
1212
let self_arg_idents = self_arg_names. iter ( )
1215
1213
. map ( |name| cx. ident_of ( & name[ ..] ) )
@@ -1218,7 +1216,7 @@ impl<'a> MethodDef<'a> {
1218
1216
// The `vi_idents` will be bound, solely in the catch-all, to
1219
1217
// a series of let statements mapping each self_arg to an int
1220
1218
// value corresponding to its discriminant.
1221
- let vi_idents: Vec < ast :: Ident > = self_arg_names. iter ( )
1219
+ let vi_idents = self_arg_names. iter ( )
1222
1220
. map ( |name| {
1223
1221
let vi_suffix = format ! ( "{}_vi" , & name[ ..] ) ;
1224
1222
cx. ident_of ( & vi_suffix[ ..] ) . gensym ( )
You can’t perform that action at this time.
0 commit comments