optimize to map and filter in the same step
This commit is contained in:
		
							parent
							
								
									9a1eac7c8a
								
							
						
					
					
						commit
						508ca3352d
					
				| @ -53,10 +53,9 @@ pub async fn init<T: Topology + std::fmt::Debug + Send + Sync + 'static>( | |||||||
| 
 | 
 | ||||||
|     let scores = maestro.scores(); |     let scores = maestro.scores(); | ||||||
|     let scores_read = scores.read().expect("Should be able to read scores"); |     let scores_read = scores.read().expect("Should be able to read scores"); | ||||||
|     let scores_read_vec: Vec<Box<dyn Score<T>>> = |     let filtered: Vec<Box<dyn Score<T>>> = scores_read | ||||||
|         scores_read.iter().map(|s| s.clone_box()).collect(); |  | ||||||
|     let filtered: Vec<&Box<dyn Score<T>>> = scores_read_vec |  | ||||||
|         .iter() |         .iter() | ||||||
|  |         .map(|s| s.clone_box()) | ||||||
|         .filter(|s| s.name().contains(&args.run)) |         .filter(|s| s.name().contains(&args.run)) | ||||||
|         .collect(); |         .collect(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user