@@ -16,6 +16,7 @@ use hashes::sha256d;
1616use internals:: { compact_size, write_err, ToU64 } ;
1717use io:: { BufRead , Write } ;
1818use primitives:: Sequence ;
19+ use units:: NumOpResult ;
1920
2021use super :: Weight ;
2122use crate :: consensus:: { self , encode, Decodable , Encodable } ;
@@ -27,7 +28,6 @@ use crate::script::{Script, ScriptBuf, ScriptExt as _, ScriptExtPriv as _};
2728use crate :: sighash:: { EcdsaSighashType , TapSighashType } ;
2829use crate :: witness:: Witness ;
2930use crate :: { Amount , FeeRate , SignedAmount } ;
30- use units:: NumOpResult ;
3131
3232#[ rustfmt:: skip] // Keep public re-exports separate.
3333#[ doc( inline) ]
@@ -786,10 +786,7 @@ pub fn effective_value(
786786) -> NumOpResult < SignedAmount > {
787787 let weight = input_weight_prediction. total_weight ( ) ;
788788
789- fee_rate
790- . to_fee ( weight)
791- . map ( Amount :: to_signed)
792- . and_then ( |fee| value. to_signed ( ) - fee) // Cannot overflow.
789+ fee_rate. to_fee ( weight) . map ( Amount :: to_signed) . and_then ( |fee| value. to_signed ( ) - fee) // Cannot overflow.
793790}
794791
795792/// Predicts the weight of a to-be-constructed transaction.
@@ -1943,7 +1940,7 @@ mod tests {
19431940 // needless_borrows_for_generic_args incorrecctly identifies &[] as a needless borrow
19441941 #[ allow( clippy:: needless_borrows_for_generic_args) ]
19451942 fn weight_prediction_new ( ) {
1946- let p2wpkh_max = InputWeightPrediction :: new ( 0 , [ 72 , 33 ] ) ;
1943+ let p2wpkh_max = InputWeightPrediction :: new ( 0 , [ 72 , 33 ] ) ;
19471944 assert_eq ! ( p2wpkh_max. script_size, 1 ) ;
19481945 assert_eq ! ( p2wpkh_max. witness_size, 108 ) ;
19491946 assert_eq ! ( p2wpkh_max. total_weight( ) , Weight :: from_wu( 272 ) ) ;
0 commit comments