diff --git a/src/ipv4.rs b/src/ipv4.rs index 5a55216..c4e4076 100644 --- a/src/ipv4.rs +++ b/src/ipv4.rs @@ -61,7 +61,7 @@ pub struct IPv4Range { } impl IPv4Range { - pub fn new(from: u32, to: u32, id_ignore: &mut Vec) -> Self { + pub fn new(from: u32, to: u32, id_ignore: Vec) -> Self { let to = to.clamp(0, u32::max_value()); if from >= to { @@ -71,7 +71,7 @@ impl IPv4Range { Self { id_start: from, id_end: to, - id_ignore: id_ignore.to_vec(), + id_ignore, } } } diff --git a/src/scanner.rs b/src/scanner.rs index 9f4d126..f8ee93f 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -41,7 +41,7 @@ fn create_scan_worker( thread_id: u32, ips_per_thread: u32, target_port: u16, - ignorelist: &mut Vec, + ignorelist: Vec, ) -> JoinHandle> { let (f, t) = ( (thread_id * ips_per_thread), @@ -67,7 +67,7 @@ fn start_scan( let mut threads: Vec>> = Vec::new(); for thread_id in 0..num_threads { - let id_ignorelist = ignorelist.unwrap().cloned().unwrap_or_else(Vec::new()); + let id_ignorelist = ignorelist.clone().unwrap_or_default(); // Create a worker let worker = create_scan_worker(thread_id, ips_per_thread, target_port, id_ignorelist);