Use if let instead of destructuring pattern

Clippy emits:

 warning: you seem to be trying to use `match` for destructuring a
 single pattern. Consider using `if let`

As suggested, use `if let`.
This commit is contained in:
Tobin C. Harding 2022-06-07 14:22:38 +10:00
parent a9365375c1
commit 229fcb9f1f
1 changed files with 2 additions and 3 deletions

View File

@ -178,9 +178,8 @@ impl FromStr for PsbtSighashType {
// NB: some of Schnorr sighash types are non-standard for pre-taproot
// inputs. We also do not support SIGHASH_RESERVED in verbatim form
// ("0xFF" string should be used instead).
match SchnorrSighashType::from_str(s) {
Ok(ty) => return Ok(ty.into()),
Err(_) => {}
if let Ok(ty) = SchnorrSighashType::from_str(s) {
return Ok(ty.into());
}
// We accept non-standard sighash values.