Skip to content

Commit ef95f3c

Browse files
committed
clippy
1 parent d2ccb00 commit ef95f3c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/operations/create.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ use std::str;
44
use text_io::read;
55

66
// Internal libraries
7-
use crate::generic::common::{calculate_store_name_hash, does_store_exist, get_all_secrets_from_store, get_path, write_to_file, UserMessage};
7+
use crate::generic::common::{
8+
calculate_store_name_hash, does_store_exist, get_all_secrets_from_store, get_path,
9+
write_to_file, UserMessage,
10+
};
811
use crate::generic::encryption::{create_new_rsa_private_key, encrypt_data_with_private_key};
912
use crate::generic::errors::{PasswordStoreError, Result};
1013
use crate::models::data_model::{Entry, EntryStore};
@@ -52,10 +55,11 @@ pub fn add_to_store<'a>(
5255
let hashed_store_name = calculate_store_name_hash(store_name).to_string();
5356
let path = *get_path(store_name);
5457
// Check if there is already an entry with this name
55-
let curr_secrets = *get_all_secrets_from_store(&path).unwrap_or_else(| | Box::new(EntryStore::new()));
56-
for secret in curr_secrets.entries{
57-
if secret.name == entry_name{
58-
return Err(PasswordStoreError::ErrorEntryAlreadyExists)
58+
let curr_secrets =
59+
*get_all_secrets_from_store(&path).unwrap_or_else(|| Box::new(EntryStore::new()));
60+
for secret in curr_secrets.entries {
61+
if secret.name == entry_name {
62+
return Err(PasswordStoreError::ErrorEntryAlreadyExists);
5963
}
6064
}
6165

0 commit comments

Comments
 (0)