Skip to content

Commit

Permalink
fix (cli): clippy)
Browse files Browse the repository at this point in the history
  • Loading branch information
taturosati committed Jun 15, 2024
1 parent f8f0a18 commit 0d42af5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cli/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn write_sk(sk: Vec<u8>) -> anyhow::Result<()> {
}

pub fn read_sk() -> anyhow::Result<Vec<u8>> {
Ok(read_bytes(PRIVATE_KEY_FILE)?)
read_bytes(PRIVATE_KEY_FILE)
}

pub fn write_app_data(data: &CredentialsMap) -> anyhow::Result<()> {
Expand Down
12 changes: 6 additions & 6 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async fn sync_with_api(api: Api, key_pair: KeyPair) -> anyhow::Result<Credential
for password in passwords {
credentials
.entry(password.site.clone())
.or_insert(HashMap::new())
.or_default()
.insert(password._id.clone(), password.clone());
}

Expand Down Expand Up @@ -114,7 +114,7 @@ impl App {

self.credentials
.entry(site)
.or_insert(HashMap::new())
.or_default()
.insert(password_id, password);

write_app_data(&self.credentials).expect("Failed to save app data to file");
Expand Down Expand Up @@ -162,14 +162,14 @@ impl App {

let password_enc = self.key_pair.encrypt(&password);
self.api
.edit_password(user_id, password_id.clone(), password_enc.clone().into())
.edit_password(user_id, password_id.clone(), password_enc.clone())
.await?;

self.credentials
.entry(site)
.or_insert(HashMap::new()) // Should never happen
.or_default() // Should never happen
.entry(password_id)
.and_modify(|e| e.password = password_enc.clone().into());
.and_modify(|e| e.password.clone_from(&password_enc));

write_app_data(&self.credentials).expect("Failed to save app data to file");

Expand All @@ -188,7 +188,7 @@ impl App {

self.credentials
.entry(site)
.or_insert(HashMap::new()) // Should never happen
.or_default() // Should never happen
.remove(&password_id);

write_app_data(&self.credentials).expect("Failed to save app data to file");
Expand Down

0 comments on commit 0d42af5

Please sign in to comment.