diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-09-21 16:10:15 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@sequoia-pgp.org> | 2021-09-30 08:31:03 +0300 |
commit | 795b89ae024d3d49a6f08283184b22770e160317 (patch) | |
tree | ff3b8268f6383e415f19058b308202229956d615 /sq | |
parent | 42fe483fa2138629572e13539d6274e59c28d6d1 (diff) |
When returning an error, use "return" instead of "?"
Instead of
Err(...)?;
which is correct but not idiomatic, write this:
return Err(...);
This was found by clippy lintt try_err:
https://rust-lang.github.io/rust-clippy/master/index.html#try_err
Sponsored-by: author
Diffstat (limited to 'sq')
-rw-r--r-- | sq/src/commands/net.rs | 4 | ||||
-rw-r--r-- | sq/src/sq.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sq/src/commands/net.rs b/sq/src/commands/net.rs index 322ff8a0..899c65fd 100644 --- a/sq/src/commands/net.rs +++ b/sq/src/commands/net.rs @@ -91,9 +91,9 @@ pub fn dispatch_keyserver(config: Config, m: &clap::ArgMatches) -> Result<()> { serialize_keyring(&mut output, &certs, m.is_present("binary"))?; } else { - Err(anyhow::anyhow!( + return Err(anyhow::anyhow!( "Query must be a fingerprint, a keyid, \ - or an email address: {:?}", query))?; + or an email address: {:?}", query)); } }, ("send", Some(m)) => { diff --git a/sq/src/sq.rs b/sq/src/sq.rs index fb6567f5..1c692ec0 100644 --- a/sq/src/sq.rs +++ b/sq/src/sq.rs @@ -137,8 +137,8 @@ fn load_keys<'a, I>(files: I) -> openpgp::Result<Vec<Cert>> let cert = Cert::from_file(f) .context(format!("Failed to load key from file {:?}", f))?; if ! cert.is_tsk() { - Err(anyhow::anyhow!( - "Cert in file {:?} does not contain secret keys", f))?; + return Err(anyhow::anyhow!( + "Cert in file {:?} does not contain secret keys", f)); } certs.push(cert); } |