From: Tobin Harding Date: Wed, 23 Dec 2020 03:07:09 +0000 (+1100) Subject: Use count instead of collect and len X-Git-Tag: v0.5.0~10^2~15 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/struct.OddLengthStringError.html?a=commitdiff_plain;h=79cab93d49f03f480df03287cdf645dc07bc6c93;p=bdk Use count instead of collect and len Clippy emits warning: warning: avoid using `collect()` when not needed As suggested by clippy just use `count` directly on the iterator instead of `collect` followed by `len`. --- diff --git a/src/wallet/tx_builder.rs b/src/wallet/tx_builder.rs index 35c7d073..9a9b8d2e 100644 --- a/src/wallet/tx_builder.rs +++ b/src/wallet/tx_builder.rs @@ -736,9 +736,9 @@ mod test { let filtered = get_test_utxos() .into_iter() .filter(|u| change_spend_policy.is_satisfied_by(u)) - .collect::>(); + .count(); - assert_eq!(filtered.len(), 2); + assert_eq!(filtered, 2); } #[test]