Do not use assert_eq with literal bool

Clippy emits:

  warning: used `assert_eq!` with a literal bool

Use `assert!` instead of `assert_eq!(foo, true)`.
This commit is contained in:
Tobin C. Harding 2022-06-07 14:31:03 +10:00
parent 827fcd8a89
commit 999ac450bb
5 changed files with 14 additions and 14 deletions

View File

@ -1329,18 +1329,18 @@ mod test {
#[test]
fn provably_unspendable_test() {
// p2pk
assert_eq!(hex_script!("410446ef0102d1ec5240f0d061a4246c1bdef63fc3dbab7733052fbbf0ecd8f41fc26bf049ebb4f9527f374280259e7cfa99c48b0e3f39c51347a19a5819651503a5ac").is_provably_unspendable(), false);
assert_eq!(hex_script!("4104ea1feff861b51fe3f5f8a3b12d0f4712db80e919548a80839fc47c6a21e66d957e9c5d8cd108c7a2d2324bad71f9904ac0ae7336507d785b17a2c115e427a32fac").is_provably_unspendable(), false);
assert!(!hex_script!("410446ef0102d1ec5240f0d061a4246c1bdef63fc3dbab7733052fbbf0ecd8f41fc26bf049ebb4f9527f374280259e7cfa99c48b0e3f39c51347a19a5819651503a5ac").is_provably_unspendable());
assert!(!hex_script!("4104ea1feff861b51fe3f5f8a3b12d0f4712db80e919548a80839fc47c6a21e66d957e9c5d8cd108c7a2d2324bad71f9904ac0ae7336507d785b17a2c115e427a32fac").is_provably_unspendable());
// p2pkhash
assert_eq!(hex_script!("76a914ee61d57ab51b9d212335b1dba62794ac20d2bcf988ac").is_provably_unspendable(), false);
assert_eq!(hex_script!("6aa9149eb21980dc9d413d8eac27314938b9da920ee53e87").is_provably_unspendable(), true);
assert!(!hex_script!("76a914ee61d57ab51b9d212335b1dba62794ac20d2bcf988ac").is_provably_unspendable());
assert!(hex_script!("6aa9149eb21980dc9d413d8eac27314938b9da920ee53e87").is_provably_unspendable());
}
#[test]
fn op_return_test() {
assert_eq!(hex_script!("6aa9149eb21980dc9d413d8eac27314938b9da920ee53e87").is_op_return(), true);
assert_eq!(hex_script!("76a914ee61d57ab51b9d212335b1dba62794ac20d2bcf988ac").is_op_return(), false);
assert_eq!(hex_script!("").is_op_return(), false);
assert!(hex_script!("6aa9149eb21980dc9d413d8eac27314938b9da920ee53e87").is_op_return());
assert!(!hex_script!("76a914ee61d57ab51b9d212335b1dba62794ac20d2bcf988ac").is_op_return());
assert!(!hex_script!("").is_op_return());
}
#[test]

View File

@ -597,7 +597,7 @@ mod test {
assert_eq!(version_msg.nonce, 13952548347456104954);
assert_eq!(version_msg.user_agent, "/Satoshi:0.17.1/");
assert_eq!(version_msg.start_height, 560275);
assert_eq!(version_msg.relay, true);
assert!(version_msg.relay);
} else {
panic!("Wrong message type");
}
@ -634,7 +634,7 @@ mod test {
assert_eq!(version_msg.nonce, 13952548347456104954);
assert_eq!(version_msg.user_agent, "/Satoshi:0.17.1/");
assert_eq!(version_msg.start_height, 560275);
assert_eq!(version_msg.relay, true);
assert!(version_msg.relay);
} else {
panic!("Wrong message type");
}

View File

@ -170,7 +170,7 @@ mod tests {
assert_eq!(real_decode.nonce, 16735069437859780935);
assert_eq!(real_decode.user_agent, "/Satoshi:0.9.99/".to_string());
assert_eq!(real_decode.start_height, 302892);
assert_eq!(real_decode.relay, true);
assert!(real_decode.relay);
assert_eq!(serialize(&real_decode), from_sat);
}

View File

@ -139,7 +139,7 @@ mod test {
assert_eq!(version_msg.nonce, 13952548347456104954);
assert_eq!(version_msg.user_agent, "/Satoshi:0.17.1/");
assert_eq!(version_msg.start_height, 560275);
assert_eq!(version_msg.relay, true);
assert!(version_msg.relay);
} else {
panic!("Wrong message type: expected VersionMessage");
}

View File

@ -497,7 +497,7 @@ mod tests {
// testnet compressed
let sk = PrivateKey::from_wif("cVt4o7BGAig1UXywgGSmARhxMdzP5qvQsxKkSsc1XEkw3tDTQFpy").unwrap();
assert_eq!(sk.network, Testnet);
assert_eq!(sk.compressed, true);
assert!(sk.compressed);
assert_eq!(&sk.to_wif(), "cVt4o7BGAig1UXywgGSmARhxMdzP5qvQsxKkSsc1XEkw3tDTQFpy");
let secp = Secp256k1::new();
@ -513,12 +513,12 @@ mod tests {
// mainnet uncompressed
let sk = PrivateKey::from_wif("5JYkZjmN7PVMjJUfJWfRFwtuXTGB439XV6faajeHPAM9Z2PT2R3").unwrap();
assert_eq!(sk.network, Bitcoin);
assert_eq!(sk.compressed, false);
assert!(!sk.compressed);
assert_eq!(&sk.to_wif(), "5JYkZjmN7PVMjJUfJWfRFwtuXTGB439XV6faajeHPAM9Z2PT2R3");
let secp = Secp256k1::new();
let mut pk = sk.public_key(&secp);
assert_eq!(pk.compressed, false);
assert!(!pk.compressed);
assert_eq!(&pk.to_string(), "042e58afe51f9ed8ad3cc7897f634d881fdbe49a81564629ded8156bebd2ffd1af191923a2964c177f5b5923ae500fca49e99492d534aa3759d6b25a8bc971b133");
assert_eq!(pk, PublicKey::from_str("042e58afe51f9ed8ad3cc7897f634d881fdbe49a81564629ded8156bebd2ffd1af191923a2964c177f5b5923ae500fca49e99492d534aa3759d6b25a8bc971b133").unwrap());
let addr = Address::p2pkh(&pk, sk.network);