File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed
Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change @@ -114,20 +114,13 @@ pub fn uu_app() -> Command {
114114
115115// We use String as a representation of node here
116116// but using integer may improve performance.
117-
117+ # [ derive ( Default ) ]
118118struct Node < ' input > {
119119 successor_names : Vec < & ' input str > ,
120120 predecessor_count : usize ,
121121}
122122
123123impl < ' input > Node < ' input > {
124- fn new ( ) -> Self {
125- Node {
126- successor_names : Vec :: new ( ) ,
127- predecessor_count : 0 ,
128- }
129- }
130-
131124 fn add_successor ( & mut self , successor_name : & ' input str ) {
132125 self . successor_names . push ( successor_name) ;
133126 }
@@ -139,7 +132,7 @@ struct Graph<'input> {
139132
140133impl < ' input > Graph < ' input > {
141134 fn add_node ( & mut self , name : & ' input str ) {
142- self . nodes . entry ( name) . or_insert_with ( Node :: new ) ;
135+ self . nodes . entry ( name) . or_default ( ) ;
143136 }
144137
145138 fn add_edge ( & mut self , from : & ' input str , to : & ' input str ) {
You can’t perform that action at this time.
0 commit comments