File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
frameworks/Rust/axum/src/pg Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -90,21 +90,18 @@ impl PgConnection {
9090 }
9191
9292 pub async fn update_worlds ( & self , num : usize ) -> Result < Vec < World > , PgError > {
93- let worlds = self . fetch_random_worlds ( num) . await ?;
93+ let mut worlds = self . fetch_random_worlds ( num) . await ?;
9494
9595 // Update the worlds with new random numbers
9696 let mut rng = SmallRng :: from_rng ( & mut thread_rng ( ) ) . unwrap ( ) ;
9797 let mut ids = Vec :: with_capacity ( num) ;
9898 let mut nids = Vec :: with_capacity ( num) ;
99- let worlds: Vec < World > = worlds
100- . into_iter ( )
101- . map ( |mut w| {
102- w. randomnumber = random_id ( & mut rng) ;
103- ids. push ( w. id ) ;
104- nids. push ( w. randomnumber ) ;
105- w
106- } )
107- . collect ( ) ;
99+
100+ for w in & mut worlds {
101+ w. randomnumber = random_id ( & mut rng) ;
102+ ids. push ( w. id ) ;
103+ nids. push ( w. randomnumber ) ;
104+ }
108105
109106 // Update the random worlds in the database.
110107 self . client
You can’t perform that action at this time.
0 commit comments