Merge rust-bitcoin/rust-bitcoin#2428: Remove the remaining TODOs

c69caafefc Remove attribute comments (Tobin C. Harding)
3e83ef9276 Remove consensus error wrapper TODO (Tobin C. Harding)
bfabea94e9 Remove unwrap comment (Tobin C. Harding)
8bdaf4a34d Remove carrying_mul TODO (Tobin C. Harding)

Pull request description:

  Add issues and remove the TODOs from the code.

  Resolves: #2368

ACKs for top commit:
  apoelstra:
    ACK c69caafefc
  Kixunil:
    ACK c69caafefc

Tree-SHA512: b10a3de8da7ace890735023f8441605dd11b0227c27a2357556b8aaa8276a7f34ed220e3bcbc93aad4b35357319318ff7de27210e8f60dd90f6c55af23e21470
This commit is contained in:
Andrew Poelstra 2024-02-02 23:30:34 +00:00
commit a3c4194c3f
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
4 changed files with 2 additions and 9 deletions

View File

@ -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)

View File

@ -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)]

View File

@ -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);

View File

@ -716,15 +716,12 @@ 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 => {
// 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)