diff --git a/lib/img_processors/mod.rs b/lib/img_processors/mod.rs index 0cedda44fd780b8dd8b114649cb0cffc27db86b5..2ff7106518dbf1c6641dc3a86a62145baa9b088c 100644 --- a/lib/img_processors/mod.rs +++ b/lib/img_processors/mod.rs @@ -6,8 +6,8 @@ use crate::config::Config; use crate::display::get_max_resolution; use crate::result::MBGResult; use rayon::prelude::*; -use std::collections::HashMap; use std::collections::hash_map::RandomState; +use std::collections::HashMap; pub mod blur; pub mod border; @@ -86,20 +86,20 @@ pub fn process_image(img_bytes: Vec<u8>) -> MBGResult<DynamicImage> { let (screen_height, screen_width) = get_max_resolution()?; debug!("Maximum resolution: {}x{}", screen_width, screen_height); let image = image::load_from_memory(img_bytes.as_slice())?; - let layers_conf = - conf.processors - .iter() - .fold(HashMap::<usize, Vec<ProcessorParams>>::new(), |mut acc, x| { - let new_processors = if let Some(current) = acc.get(&x.layer) { - let mut mutable = current.clone(); - mutable.push(x.clone()); - mutable - } else { - vec![x.clone()] - }; - acc.insert(x.layer, new_processors); - acc - }); + let layers_conf = conf.processors.iter().fold( + HashMap::<usize, Vec<ProcessorParams>>::new(), + |mut acc, x| { + let new_processors = if let Some(current) = acc.get(&x.layer) { + let mut mutable = current.clone(); + mutable.push(x.clone()); + mutable + } else { + vec![x.clone()] + }; + acc.insert(x.layer, new_processors); + acc + }, + ); let processed_layers = layers_conf .par_iter() .map(|(layer, processors)| {