diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-02-19 01:05:27 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-02-19 01:05:27 -0500 |
commit | 40f4d51da8c799e3dfb525b99def8f2812689f6c (patch) | |
tree | bd9a6687b8c807792f9fcd07da7c21b75ae2f881 /src/bin/rbw/commands.rs | |
parent | d8e88421c54d2e74db2b4bd529067393cfbdbc96 (diff) | |
download | rbw-40f4d51da8c799e3dfb525b99def8f2812689f6c.tar.gz rbw-40f4d51da8c799e3dfb525b99def8f2812689f6c.zip |
clippy
Diffstat (limited to 'src/bin/rbw/commands.rs')
-rw-r--r-- | src/bin/rbw/commands.rs | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/bin/rbw/commands.rs b/src/bin/rbw/commands.rs index 3fa30f4..49c44a4 100644 --- a/src/bin/rbw/commands.rs +++ b/src/bin/rbw/commands.rs @@ -99,8 +99,8 @@ impl DecryptedCipher { for field in &self.fields { displayed |= self.display_field( - field.name.as_deref().unwrap_or_else(|| "(null)"), - Some(field.value.as_deref().unwrap_or_else(|| "")), + field.name.as_deref().unwrap_or("(null)"), + Some(field.value.as_deref().unwrap_or("")), ); } @@ -227,12 +227,11 @@ impl DecryptedCipher { if let Some(given_username) = username { match &self.data { - DecryptedData::Login { username, .. } => { - if let Some(found_username) = username { - if given_username != found_username { - return false; - } - } else { + DecryptedData::Login { + username: Some(found_username), + .. + } => { + if given_username != found_username { return false; } } @@ -273,12 +272,11 @@ impl DecryptedCipher { if let Some(given_username) = username { match &self.data { - DecryptedData::Login { username, .. } => { - if let Some(found_username) = username { - if !found_username.contains(given_username) { - return false; - } - } else { + DecryptedData::Login { + username: Some(found_username), + .. + } => { + if !found_username.contains(given_username) { return false; } } @@ -1391,14 +1389,14 @@ fn parse_editor(contents: &str) -> (Option<String>, Option<String>) { let password = lines.next().map(std::string::ToString::to_string); let mut notes: String = lines - .skip_while(|line| *line == "") + .skip_while(|line| line.is_empty()) .filter(|line| !line.starts_with('#')) .map(|line| format!("{}\n", line)) .collect(); while notes.ends_with('\n') { notes.pop(); } - let notes = if notes == "" { None } else { Some(notes) }; + let notes = if notes.is_empty() { None } else { Some(notes) }; (password, notes) } |