Clippy fixes.

This commit is contained in:
Eduard Tolosa 2025-04-20 14:48:57 -05:00
parent cf75cafee7
commit 7e683bd1ae
4 changed files with 10 additions and 23 deletions

View file

@ -14,6 +14,7 @@ use {
},
};
#[must_use]
pub fn return_tokio_asyncresolver(
nameserver_ips: HashSet<String>,
options: ResolverOpts,
@ -92,7 +93,7 @@ pub async fn return_hosts_data(options: &LibOptions) -> HashMap<String, DomainDa
if options.show_ip_address && !domain_data.is_wildcard {
println!("{};{:?}", host, domain_data.ipv4_addresses);
} else if !domain_data.is_wildcard {
println!("{}", host)
println!("{host}");
}
}

View file

@ -146,7 +146,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
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()

View file

@ -6,7 +6,7 @@ use {
},
};
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Default)]
pub struct DomainData {
pub ipv4_addresses: HashSet<String>,
pub ipv6_addresses: HashSet<String>,
@ -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<String>,

View file

@ -15,7 +15,7 @@ pub async fn return_file_lines(file: String) -> HashSet<String> {
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<String> {
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<String> {
if !quiet_flag {
println!("Running wildcards detection for {}...\n", target)
println!("Running wildcards detection for {target}...\n");
}
let mut generated_wilcards: HashSet<String> = HashSet::new();
for _ in 1..20 {
@ -69,13 +69,10 @@ pub async fn detect_wildcards(
generated_wilcards.retain(|ip| ip.parse::<Ipv4Addr>().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
}