From 976c11410fa747620b478a338fef0353e8b9929a Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 8 Jun 2025 19:10:36 +0300 Subject: [PATCH] fix `ignore-host` filter --- src/main.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index e27ec62..53e5d3e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -37,19 +37,22 @@ fn main() -> anyhow::Result<()> { let mut index: HashMap = HashMap::with_capacity(argument.capacity); - for line in reader.lines() { + 'l: for line in reader.lines() { let host = line? .split_whitespace() .next() .map(|s| s.into()) .unwrap_or_default(); - if argument.ignore_host.contains(&host) { - if is_debug_d { - debug::info(format!("Host `{host}` ignored by settings")) + for h in &argument.ignore_host { + if h == &host { + if is_debug_d { + debug::info(format!("Host `{h}` ignored by settings")) + } + continue 'l; } - continue; } + index.entry(host).and_modify(|c| *c += 1).or_insert(1); }