aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2018-12-17 05:58:22 -0800
committerDaniel Mueller <deso@posteo.net>2018-12-17 05:58:22 -0800
commit6e77d001bd7e32120bf6ad426da9c8f10dffc716 (patch)
tree48903bef8e35ae3d0a71b6cb25e394b9747a3e85
parentaef092da9fa831252cd830393f9618a66c7a8e6c (diff)
downloadnitrocli-6e77d001bd7e32120bf6ad426da9c8f10dffc716.tar.gz
nitrocli-6e77d001bd7e32120bf6ad426da9c8f10dffc716.tar.bz2
Fix two clippy warnings
After the switch to using the nitrokey crate for communication with the device, we have to warnings standing in the way of enabling clippy unconditionally for the nitrocli crate. This change fixes those two warnings.
-rw-r--r--nitrocli/src/pinentry.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/nitrocli/src/pinentry.rs b/nitrocli/src/pinentry.rs
index 1f1b02a..66ca6be 100644
--- a/nitrocli/src/pinentry.rs
+++ b/nitrocli/src/pinentry.rs
@@ -77,7 +77,7 @@ fn parse_pinentry_passphrase(response: Vec<u8>) -> Result<Vec<u8>, Error> {
// Check if we are dealing with a special "ERR " line and report that
// specially.
- if lines.len() >= 1 && lines[0].starts_with("ERR ") {
+ if !lines.is_empty() && lines[0].starts_with("ERR ") {
let (_, error) = lines[0].split_at(4);
return Err(Error::Error(error.to_string()));
}
@@ -91,7 +91,7 @@ fn parse_pinentry_passphrase(response: Vec<u8>) -> Result<Vec<u8>, Error> {
/// if available. If an error message is set, it is displayed in the passphrase dialog.
pub fn inquire_passphrase(pin_type: PinType, error_msg: Option<&str>) -> Result<Vec<u8>, Error> {
let cache_id = pin_type.cache_id();
- let error_msg = error_msg.map(|msg| msg.replace(" ", "+")).unwrap_or(String::from("+"));
+ let error_msg = error_msg.map(|msg| msg.replace(" ", "+")).unwrap_or_else(|| String::from("+"));
let prompt = pin_type.prompt();
let description = pin_type.description().replace(" ", "+");