From 6be3a7f5c6004a5d62185900cb3f4a41f9246d7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=9CM=C3=9C=C5=9E?= <96421894+Tahinli@users.noreply.github.com> Date: Wed, 20 Nov 2024 00:20:40 +0300 Subject: [PATCH] feat: :sparkles: eliminating comments in config --- artificial_bee_colony/src/utils.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/artificial_bee_colony/src/utils.rs b/artificial_bee_colony/src/utils.rs index 20eeeea..56e30e6 100644 --- a/artificial_bee_colony/src/utils.rs +++ b/artificial_bee_colony/src/utils.rs @@ -89,13 +89,17 @@ impl Input { reader .lines() .map(|unchecked_line| unchecked_line.unwrap()) - .filter(|unwrapped_line| !unwrapped_line.starts_with('#')) + .map(|mut line|{ + if let Some(comment_location) = line.find('#') { + let _ = line.split_off(comment_location); + } + line + }) .for_each(|line| { lines.append( &mut line .split('=') .map(|splitted| splitted.trim().to_string()) - .filter(|trimmed| !trimmed.starts_with('#')) .collect::>(), ) });