From 6c7dffa41b6eca2c8aac641c469f2f754c218548 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 12 Oct 2020 23:35:45 -0400 Subject: clippy --- src/api.rs | 6 +++--- src/bin/rbw/commands.rs | 4 ++-- src/cipherstring.rs | 2 +- src/lib.rs | 1 + src/pinentry.rs | 11 +++++------ 5 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/api.rs b/src/api.rs index fd0a5be..9d9dc57 100644 --- a/src/api.rs +++ b/src/api.rs @@ -150,6 +150,9 @@ impl SyncResCipher { &self, folders: &[SyncResFolder], ) -> Option { + if self.deleted_date.is_some() { + return None; + } let history = if let Some(history) = &self.password_history { history .iter() @@ -172,9 +175,6 @@ impl SyncResCipher { } else { (None, None) }; - if ! self.deleted_date.is_none() { - return None; - }; let data = if let Some(login) = &self.login { crate::db::EntryData::Login { username: login.username.clone(), diff --git a/src/bin/rbw/commands.rs b/src/bin/rbw/commands.rs index f514153..b2f64a3 100644 --- a/src/bin/rbw/commands.rs +++ b/src/bin/rbw/commands.rs @@ -1007,9 +1007,9 @@ fn check_config() -> anyhow::Result<()> { } fn version_or_quit() -> anyhow::Result { - crate::actions::version().or_else(|e| { + crate::actions::version().map_err(|e| { let _ = crate::actions::quit(); - Err(e) + e }) } diff --git a/src/cipherstring.rs b/src/cipherstring.rs index 7f9ce31..d8e27f0 100644 --- a/src/cipherstring.rs +++ b/src/cipherstring.rs @@ -70,7 +70,7 @@ impl CipherString { // the only difference between 4 and 6 is the HMAC256 signature appended at the end // https://github.com/bitwarden/jslib/blob/785b681f61f81690de6df55159ab07ae710bcfad/src/enums/encryptionType.ts#L8 // format is: | - let contents = contents.split("|").next().unwrap(); + let contents = contents.split('|').next().unwrap(); let ciphertext = base64::decode(contents) .context(crate::error::InvalidBase64)?; Ok(Self::Asymmetric { ciphertext }) diff --git a/src/lib.rs b/src/lib.rs index a458415..5044eb2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,7 @@ #![warn(clippy::pedantic)] #![warn(clippy::nursery)] #![allow(clippy::default_trait_access)] +#![allow(clippy::implicit_hasher)] #![allow(clippy::large_enum_variant)] #![allow(clippy::missing_const_for_fn)] #![allow(clippy::missing_errors_doc)] diff --git a/src/pinentry.rs b/src/pinentry.rs index b03c94e..a4627c2 100644 --- a/src/pinentry.rs +++ b/src/pinentry.rs @@ -9,14 +9,13 @@ pub async fn getpin( tty: Option<&str>, ) -> Result { let mut opts = tokio::process::Command::new("pinentry"); - let opts = opts - .stdin(std::process::Stdio::piped()) + opts.stdin(std::process::Stdio::piped()) .stdout(std::process::Stdio::piped()); - let opts = if let Some(tty) = tty { - opts.args(&["-T", tty, "-o", "0"]) + if let Some(tty) = tty { + opts.args(&["-T", tty, "-o", "0"]); } else { - opts.args(&["-o", "0"]) - }; + opts.args(&["-o", "0"]); + } let mut child = opts.spawn().context(crate::error::Spawn)?; // unwrap is safe because we specified stdin as piped in the command opts // above -- cgit v1.2.3-54-g00ecf