diff --git a/src/dnslib.rs b/src/dnslib.rs index 93345c8..8e4dd9f 100644 --- a/src/dnslib.rs +++ b/src/dnslib.rs @@ -14,6 +14,7 @@ use { }, }; +#[must_use] pub fn return_tokio_asyncresolver( nameserver_ips: HashSet, options: ResolverOpts, @@ -92,7 +93,7 @@ pub async fn return_hosts_data(options: &LibOptions) -> HashMap Result<(), Box> { wildcard_ips = utils::detect_wildcards(&domain, &trustable_resolver, quiet_flag).await; buffer .lines() - .map(|word| format!("{}.{}", word, domain)) + .map(|word| format!("{word}.{domain}")) .collect() } else { buffer.lines().map(str::to_owned).collect() diff --git a/src/structs.rs b/src/structs.rs index f408081..3da267b 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -6,7 +6,7 @@ use { }, }; -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct DomainData { pub ipv4_addresses: HashSet, pub ipv6_addresses: HashSet, @@ -14,17 +14,6 @@ pub struct DomainData { pub is_wildcard: bool, } -impl Default for DomainData { - fn default() -> Self { - DomainData { - ipv4_addresses: HashSet::new(), - ipv6_addresses: HashSet::new(), - cname: String::from(""), - is_wildcard: false, - } - } -} - #[derive(Clone, Debug)] pub struct LibOptions { pub hosts: HashSet, diff --git a/src/utils.rs b/src/utils.rs index 1e9df99..e6b3a31 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -15,7 +15,7 @@ pub async fn return_file_lines(file: String) -> HashSet { let mut f = match File::open(&file).await { Ok(file) => file, Err(e) => { - eprintln!("Error opening resolvers file. Error: {}", e); + eprintln!("Error opening resolvers file. Error: {e}"); std::process::exit(1) } }; @@ -25,7 +25,7 @@ pub async fn return_file_lines(file: String) -> HashSet { Ok(a) => a, _ => unreachable!("Error reading to string."), }; - buffer.lines().map(|f| format!("{}:53", f)).collect() + buffer.lines().map(|f| format!("{f}:53")).collect() } pub async fn detect_wildcards( @@ -34,7 +34,7 @@ pub async fn detect_wildcards( quiet_flag: bool, ) -> HashSet { if !quiet_flag { - println!("Running wildcards detection for {}...\n", target) + println!("Running wildcards detection for {target}...\n"); } let mut generated_wilcards: HashSet = HashSet::new(); for _ in 1..20 { @@ -69,13 +69,10 @@ pub async fn detect_wildcards( generated_wilcards.retain(|ip| ip.parse::().is_ok()); if !generated_wilcards.is_empty() && !quiet_flag { - println!( - "Wilcards detected for {} and wildcard's IP saved for furter work.", - target - ); - println!("Wilcard IPs: {:?}\n", generated_wilcards) + println!("Wilcards detected for {target} and wildcard's IP saved for furter work."); + println!("Wilcard IPs: {generated_wilcards:?}\n"); } else if !quiet_flag { - println!("No wilcards detected for {}, nice!\n", target) + println!("No wilcards detected for {target}, nice!\n"); } generated_wilcards }