From 8bdaf4a34d1f1b8758040ccf806de2104b61af85 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 1 Feb 2024 12:28:43 +1100 Subject: [PATCH 1/4] Remove carrying_mul TODO Add an issue and remove the TODO from the code. ref: https://github.com/rust-bitcoin/rust-bitcoin/issues/2425 --- bitcoin/src/pow.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/bitcoin/src/pow.rs b/bitcoin/src/pow.rs index d0990b05..ad38dd86 100644 --- a/bitcoin/src/pow.rs +++ b/bitcoin/src/pow.rs @@ -442,7 +442,6 @@ impl U256 { [self.1 as u64, (self.1 >> 64) as u64, self.0 as u64, (self.0 >> 64) as u64]; for word in &mut split_le { - // TODO: Use `carrying_mul` when stabilized: https://github.com/rust-lang/rust/issues/85532 // This will not overflow, for proof see https://github.com/rust-bitcoin/rust-bitcoin/pull/1496#issuecomment-1365938572 let n = carry + u128::from(rhs) * u128::from(*word); From bfabea94e9082a9d329a03458831e7dcf5324ab8 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 1 Feb 2024 12:32:42 +1100 Subject: [PATCH 2/4] Remove unwrap comment Add an issue and remove the TODO from the code. ref: https://github.com/rust-bitcoin/rust-bitcoin/issues/2426 --- units/src/amount.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/units/src/amount.rs b/units/src/amount.rs index 1045038d..2981e067 100644 --- a/units/src/amount.rs +++ b/units/src/amount.rs @@ -716,7 +716,6 @@ impl Amount { /// The function panics if the argument multiplied by the number of sats /// per bitcoin overflows a u64 type. pub const fn from_int_btc(btc: u64) -> Amount { - // TODO replace whith unwrap() when available in const context. match btc.checked_mul(100_000_000) { Some(amount) => Amount::from_sat(amount), None => { From 3e83ef9276bdea515593d4f2053742fb5f1bc9f8 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 1 Feb 2024 14:59:45 +1100 Subject: [PATCH 3/4] Remove consensus error wrapper TODO Add an issue and remove the TODO from the code. ref: https://github.com/rust-bitcoin/rust-bitcoin/issues/2429 --- bitcoin/src/consensus/serde.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/bitcoin/src/consensus/serde.rs b/bitcoin/src/consensus/serde.rs index 6c9c9c32..a6b88aed 100644 --- a/bitcoin/src/consensus/serde.rs +++ b/bitcoin/src/consensus/serde.rs @@ -98,7 +98,6 @@ pub mod hex { } // Newtypes to hide internal details. - // TODO: statically prove impossible cases /// Error returned when a hex string decoder can't be created. #[derive(Debug, Clone, Copy, PartialEq, Eq)] From c69caafefca08453dbc13a64c5933f7efe209272 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 1 Feb 2024 12:37:53 +1100 Subject: [PATCH 4/4] Remove attribute comments Add an issue and remove the TODO from the code as well as the attribute comments, leave a single comment as an explanation of why the unusual code block. ref: https://github.com/rust-bitcoin/rust-bitcoin/issues/2427 --- bitcoin/src/blockdata/weight.rs | 4 +--- units/src/amount.rs | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bitcoin/src/blockdata/weight.rs b/bitcoin/src/blockdata/weight.rs index 3fad1a1c..4843685e 100644 --- a/bitcoin/src/blockdata/weight.rs +++ b/bitcoin/src/blockdata/weight.rs @@ -63,11 +63,9 @@ impl Weight { match vb.checked_mul(Self::WITNESS_SCALE_FACTOR) { Some(weight) => Weight(weight), None => { - // TODO replace with panic!() when MSRV = 1.57+ + // When MSRV is 1.57+ we can use `panic!()`. #[allow(unconditional_panic)] - // disabling this lint until panic!() can be used. #[allow(clippy::let_unit_value)] - // disabling this lint until panic!() can be used. #[allow(clippy::out_of_bounds_indexing)] let _int_overflow_scaling_weight = [(); 0][1]; Weight(0) diff --git a/units/src/amount.rs b/units/src/amount.rs index 2981e067..08c0491a 100644 --- a/units/src/amount.rs +++ b/units/src/amount.rs @@ -719,11 +719,9 @@ impl Amount { match btc.checked_mul(100_000_000) { Some(amount) => Amount::from_sat(amount), None => { - // TODO replace with panic!() when MSRV = 1.57+ + // When MSRV is 1.57+ we can use `panic!()`. #[allow(unconditional_panic)] - // disabling this lint until panic!() can be used. #[allow(clippy::let_unit_value)] - // disabling this lint until panic!() can be used. #[allow(clippy::out_of_bounds_indexing)] let _int_overflow_converting_btc_to_sats = [(); 0][1]; Amount(0)