File tree Expand file tree Collapse file tree 5 files changed +12
-16
lines changed
libsyntax_ext/deriving/generic Expand file tree Collapse file tree 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 {
106106 type Node = Node < ' a > ;
107107 type Edge = Edge < ' a > ;
108108 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 ( ) ;
111110 v. into ( )
112111 }
113112 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> {
10621062 attrs
10631063 . iter ( )
10641064 . map ( |a| self . lower_attr ( a) )
1065- . collect :: < Vec < _ > > ( )
1066- . into ( )
1065+ . collect ( )
10671066 }
10681067
10691068 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> {
281281 // otherwise, abort
282282 break ;
283283 }
284- interpret_alloc_index. reserve ( new_n) ;
284+ interpret_alloc_index. reserve ( new_n - n ) ;
285285 for idx in n..new_n {
286286 let id = encoder. interpret_allocs_inverse [ idx] ;
287287 let pos = encoder. position ( ) as u32 ;
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ impl FromHex for str {
146146 }
147147
148148 match modulus {
149- 0 => Ok ( b. into_iter ( ) . collect ( ) ) ,
149+ 0 => Ok ( b) ,
150150 _ => Err ( InvalidHexLength ) ,
151151 }
152152 }
Original file line number Diff line number Diff line change @@ -1200,16 +1200,14 @@ impl<'a> MethodDef<'a> {
12001200 let sp = trait_. span ;
12011201 let variants = & enum_def. variants ;
12021202
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) |
12091208 format ! ( "__arg_{}" , arg_count)
1210- }
1211- } )
1212- . collect :: < Vec < String > > ( ) ;
1209+ )
1210+ ) . collect :: < Vec < String > > ( ) ;
12131211
12141212 let self_arg_idents = self_arg_names. iter ( )
12151213 . map ( |name| cx. ident_of ( & name[ ..] ) )
@@ -1218,7 +1216,7 @@ impl<'a> MethodDef<'a> {
12181216 // The `vi_idents` will be bound, solely in the catch-all, to
12191217 // a series of let statements mapping each self_arg to an int
12201218 // value corresponding to its discriminant.
1221- let vi_idents: Vec < ast :: Ident > = self_arg_names. iter ( )
1219+ let vi_idents = self_arg_names. iter ( )
12221220 . map ( |name| {
12231221 let vi_suffix = format ! ( "{}_vi" , & name[ ..] ) ;
12241222 cx. ident_of ( & vi_suffix[ ..] ) . gensym ( )
You can’t perform that action at this time.
0 commit comments