Skip to content

Commit 321cb85

Browse files
committed
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)`.
1 parent 032a5e0 commit 321cb85

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

src/blockdata/script.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,18 +1329,18 @@ mod test {
13291329
#[test]
13301330
fn provably_unspendable_test() {
13311331
// p2pk
1332-
assert_eq!(hex_script!("410446ef0102d1ec5240f0d061a4246c1bdef63fc3dbab7733052fbbf0ecd8f41fc26bf049ebb4f9527f374280259e7cfa99c48b0e3f39c51347a19a5819651503a5ac").is_provably_unspendable(), false);
1333-
assert_eq!(hex_script!("4104ea1feff861b51fe3f5f8a3b12d0f4712db80e919548a80839fc47c6a21e66d957e9c5d8cd108c7a2d2324bad71f9904ac0ae7336507d785b17a2c115e427a32fac").is_provably_unspendable(), false);
1332+
assert!(!hex_script!("410446ef0102d1ec5240f0d061a4246c1bdef63fc3dbab7733052fbbf0ecd8f41fc26bf049ebb4f9527f374280259e7cfa99c48b0e3f39c51347a19a5819651503a5ac").is_provably_unspendable());
1333+
assert!(!hex_script!("4104ea1feff861b51fe3f5f8a3b12d0f4712db80e919548a80839fc47c6a21e66d957e9c5d8cd108c7a2d2324bad71f9904ac0ae7336507d785b17a2c115e427a32fac").is_provably_unspendable());
13341334
// p2pkhash
1335-
assert_eq!(hex_script!("76a914ee61d57ab51b9d212335b1dba62794ac20d2bcf988ac").is_provably_unspendable(), false);
1336-
assert_eq!(hex_script!("6aa9149eb21980dc9d413d8eac27314938b9da920ee53e87").is_provably_unspendable(), true);
1335+
assert!(!hex_script!("76a914ee61d57ab51b9d212335b1dba62794ac20d2bcf988ac").is_provably_unspendable());
1336+
assert!(hex_script!("6aa9149eb21980dc9d413d8eac27314938b9da920ee53e87").is_provably_unspendable());
13371337
}
13381338

13391339
#[test]
13401340
fn op_return_test() {
1341-
assert_eq!(hex_script!("6aa9149eb21980dc9d413d8eac27314938b9da920ee53e87").is_op_return(), true);
1342-
assert_eq!(hex_script!("76a914ee61d57ab51b9d212335b1dba62794ac20d2bcf988ac").is_op_return(), false);
1343-
assert_eq!(hex_script!("").is_op_return(), false);
1341+
assert!(hex_script!("6aa9149eb21980dc9d413d8eac27314938b9da920ee53e87").is_op_return());
1342+
assert!(!hex_script!("76a914ee61d57ab51b9d212335b1dba62794ac20d2bcf988ac").is_op_return());
1343+
assert!(!hex_script!("").is_op_return());
13441344
}
13451345

13461346
#[test]

src/network/message.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ mod test {
597597
assert_eq!(version_msg.nonce, 13952548347456104954);
598598
assert_eq!(version_msg.user_agent, "/Satoshi:0.17.1/");
599599
assert_eq!(version_msg.start_height, 560275);
600-
assert_eq!(version_msg.relay, true);
600+
assert!(version_msg.relay);
601601
} else {
602602
panic!("Wrong message type");
603603
}
@@ -634,7 +634,7 @@ mod test {
634634
assert_eq!(version_msg.nonce, 13952548347456104954);
635635
assert_eq!(version_msg.user_agent, "/Satoshi:0.17.1/");
636636
assert_eq!(version_msg.start_height, 560275);
637-
assert_eq!(version_msg.relay, true);
637+
assert!(version_msg.relay);
638638
} else {
639639
panic!("Wrong message type");
640640
}

src/network/message_network.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ mod tests {
170170
assert_eq!(real_decode.nonce, 16735069437859780935);
171171
assert_eq!(real_decode.user_agent, "/Satoshi:0.9.99/".to_string());
172172
assert_eq!(real_decode.start_height, 302892);
173-
assert_eq!(real_decode.relay, true);
173+
assert!(real_decode.relay);
174174

175175
assert_eq!(serialize(&real_decode), from_sat);
176176
}

src/network/stream_reader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ mod test {
139139
assert_eq!(version_msg.nonce, 13952548347456104954);
140140
assert_eq!(version_msg.user_agent, "/Satoshi:0.17.1/");
141141
assert_eq!(version_msg.start_height, 560275);
142-
assert_eq!(version_msg.relay, true);
142+
assert!(version_msg.relay);
143143
} else {
144144
panic!("Wrong message type: expected VersionMessage");
145145
}

src/util/key.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ mod tests {
497497
// testnet compressed
498498
let sk = PrivateKey::from_wif("cVt4o7BGAig1UXywgGSmARhxMdzP5qvQsxKkSsc1XEkw3tDTQFpy").unwrap();
499499
assert_eq!(sk.network, Testnet);
500-
assert_eq!(sk.compressed, true);
500+
assert!(sk.compressed);
501501
assert_eq!(&sk.to_wif(), "cVt4o7BGAig1UXywgGSmARhxMdzP5qvQsxKkSsc1XEkw3tDTQFpy");
502502

503503
let secp = Secp256k1::new();
@@ -513,12 +513,12 @@ mod tests {
513513
// mainnet uncompressed
514514
let sk = PrivateKey::from_wif("5JYkZjmN7PVMjJUfJWfRFwtuXTGB439XV6faajeHPAM9Z2PT2R3").unwrap();
515515
assert_eq!(sk.network, Bitcoin);
516-
assert_eq!(sk.compressed, false);
516+
assert!(!sk.compressed);
517517
assert_eq!(&sk.to_wif(), "5JYkZjmN7PVMjJUfJWfRFwtuXTGB439XV6faajeHPAM9Z2PT2R3");
518518

519519
let secp = Secp256k1::new();
520520
let mut pk = sk.public_key(&secp);
521-
assert_eq!(pk.compressed, false);
521+
assert!(!pk.compressed);
522522
assert_eq!(&pk.to_string(), "042e58afe51f9ed8ad3cc7897f634d881fdbe49a81564629ded8156bebd2ffd1af191923a2964c177f5b5923ae500fca49e99492d534aa3759d6b25a8bc971b133");
523523
assert_eq!(pk, PublicKey::from_str("042e58afe51f9ed8ad3cc7897f634d881fdbe49a81564629ded8156bebd2ffd1af191923a2964c177f5b5923ae500fca49e99492d534aa3759d6b25a8bc971b133").unwrap());
524524
let addr = Address::p2pkh(&pk, sk.network);

0 commit comments

Comments
 (0)