diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2021-04-06 21:24:59 +0200 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2021-04-09 13:13:58 +0200 |
commit | 5d029cbf42621452666bd084f7beecb7d3d885a4 (patch) | |
tree | 21219c5864beac97ff5c55c78b436918034adcd6 /openpgp/src/packet/userid.rs | |
parent | 9424cd350f32a97479a74d919c646f9e26c2ebce (diff) |
Lint: Remove unnecessary conversions.
- https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
Diffstat (limited to 'openpgp/src/packet/userid.rs')
-rw-r--r-- | openpgp/src/packet/userid.rs | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/openpgp/src/packet/userid.rs b/openpgp/src/packet/userid.rs index 4037f078..f9f3c1a4 100644 --- a/openpgp/src/packet/userid.rs +++ b/openpgp/src/packet/userid.rs @@ -595,14 +595,13 @@ impl UserID { Err(err) => return Err(err.context(format!( "Validating name ({:?})", - name)).into()), + name))), Ok(p) => { if !(p.name().is_some() && p.comment().is_none() && p.email().is_none()) { return Err(Error::InvalidArgument( - format!("Invalid name ({:?})", name) - .into()).into()); + format!("Invalid name ({:?})", name)).into()); } } } @@ -617,14 +616,13 @@ impl UserID { Err(err) => return Err(err.context(format!( "Validating comment ({:?})", - comment)).into()), + comment))), Ok(p) => { if !(p.name().is_none() && p.comment().is_some() && p.email().is_none()) { return Err(Error::InvalidArgument( - format!("Invalid comment ({:?})", comment) - .into()).into()); + format!("Invalid comment ({:?})", comment)).into()); } } } @@ -644,14 +642,14 @@ impl UserID { Err(err) => return Err(err.context(format!( "Validating address ({:?})", - address)).into()), + address))), Ok(p) => { if !(p.name().is_none() && p.comment().is_none() && p.email().is_some()) { return Err(Error::InvalidArgument( - format!("Invalid address address ({:?})", address) - .into()).into()); + format!("Invalid address address ({:?})", address)) + .into()); } } } @@ -673,14 +671,13 @@ impl UserID { Err(err) => return Err(err.context(format!( "Validating User ID ({:?})", - value)).into()), + value))), Ok(p) => { if !(p.name().is_none() == name.is_none() && p.comment().is_none() == comment.is_none() && p.email().is_some()) { return Err(Error::InvalidArgument( - format!("Invalid User ID ({:?})", value) - .into()).into()); + format!("Invalid User ID ({:?})", value)).into()); } } } @@ -857,7 +854,6 @@ impl UserID { Ok(puid) => puid, Err(err) => { // Return the error from the NameAddrOrOther parser. - let err : anyhow::Error = err.into(); return Err(err).context(format!( "Failed to parse User ID: {:?}", s))?; } |