From 20aec49d15ed4603f2e501460048ea26961d340d Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Fri, 12 Aug 2022 00:07:26 +0200 Subject: [PATCH] Fixes --- src/ipv4.rs | 4 ++-- src/scanner.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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);