From b3260e04fb8fd9c7ce7760e713ff0c81b49b30a9 Mon Sep 17 00:00:00 2001 From: Oleksandr Kozachuk Date: Thu, 2 Feb 2023 10:54:08 +0100 Subject: [PATCH] Do not print error on adding, when exactly the same already exist, it ignores it then silently. --- hel/src/commands.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hel/src/commands.rs b/hel/src/commands.rs index 01087ad..dfd49b1 100644 --- a/hel/src/commands.rs +++ b/hel/src/commands.rs @@ -94,8 +94,10 @@ impl<'a> LKEval<'a> { let mut fix = false; { let pwname = &name.lock().borrow().name.to_string(); - if state.db.get(pwname).is_some() { - out.e(format!("error: password {} already exist", pwname)); + if let Some(oldname) = state.db.get(pwname) { + if name.lock().borrow().to_string() != oldname.lock().borrow().to_string() { + out.e(format!("error: password {} already exist", pwname)); + } } else { state.db.insert(pwname.to_string(), name.clone()); fix = true;