diff --git a/src/commands/core/actor.rs b/src/commands/core/actor.rs index 67b2b04..caee909 100644 --- a/src/commands/core/actor.rs +++ b/src/commands/core/actor.rs @@ -154,10 +154,8 @@ fn prompt_finder( }) .context("finder was unable to prompt with suggestions")?; - if suggestion.is_none() { - if !variable_history.contains(&output) { - filesystem::save_variable_history(variable_name, &output); - } + if suggestion.is_none() && !variable_history.contains(&output) { + filesystem::save_variable_history(variable_name, &output); } Ok(output) diff --git a/src/filesystem.rs b/src/filesystem.rs index 154af32..4b81fcf 100644 --- a/src/filesystem.rs +++ b/src/filesystem.rs @@ -111,7 +111,7 @@ pub fn get_variable_history(variable: &str) -> Vec { reader .lines() - .filter_map(|line| line.ok()) + .map_while(|line| line.ok()) .filter_map(|line| { let parts: Vec<&str> = line.splitn(2, ':').collect(); if parts.len() == 2 && parts[0] == variable {