Collapse if statements
Clippy emits: warning: this `if` statement can be collapsed As suggested, collapse the if statements into a single statement, with no loss of clarity.
This commit is contained in:
parent
229fcb9f1f
commit
0f8f4c5609
|
@ -693,11 +693,11 @@ impl Address {
|
||||||
|
|
||||||
/// Constructs an [`Address`] from an output script (`scriptPubkey`).
|
/// Constructs an [`Address`] from an output script (`scriptPubkey`).
|
||||||
pub fn from_script(script: &script::Script, network: Network) -> Option<Address> {
|
pub fn from_script(script: &script::Script, network: Network) -> Option<Address> {
|
||||||
if script.is_witness_program() {
|
if script.is_witness_program()
|
||||||
if script.witness_version() == Some(WitnessVersion::V0) && !(script.is_v0_p2wpkh() || script.is_v0_p2wsh()) {
|
&& script.witness_version() == Some(WitnessVersion::V0)
|
||||||
|
&& !(script.is_v0_p2wpkh() || script.is_v0_p2wsh()) {
|
||||||
return None
|
return None
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Some(Address {
|
Some(Address {
|
||||||
payload: Payload::from_script(script)?,
|
payload: Payload::from_script(script)?,
|
||||||
|
|
Loading…
Reference in New Issue