Merge rust-bitcoin/rust-bitcoin#3899: units: Fix `missing_panics_doc` clippy lint

e316e6e719 Fix `missing_panics_doc` clippy lint in units (Jamil Lambert, PhD)

Pull request description:

  Change the units `missing_panics_doc` clippy lint to `warn` and allow for the functions that can't panic.

  One of the TODO lints in Issue #3825

ACKs for top commit:
  tcharding:
    ACK e316e6e719
  apoelstra:
    ACK e316e6e7195993b7dd0e005d2f22f29dfea023c5; successfully ran local tests

Tree-SHA512: 3db74e499dc590a5158869d1a80613d37b3fb09f2d428918dc23b9f1521496d8afff63988f022d6cfd7688d33295f976effe73adbadd8da93dae8fb5d2d13dc5
This commit is contained in:
merge-script 2025-01-16 00:08:05 +00:00
commit 7706675876
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
3 changed files with 3 additions and 1 deletions

View File

@ -107,7 +107,7 @@ maybe_infinite_iter = "warn"
mismatching_type_param_order = "warn" mismatching_type_param_order = "warn"
missing_errors_doc = "allow" # TODO: Still needs considering. missing_errors_doc = "allow" # TODO: Still needs considering.
missing_fields_in_debug = "warn" missing_fields_in_debug = "warn"
missing_panics_doc = "allow" # TODO: Still needs considering. missing_panics_doc = "warn"
must_use_candidate = "allow" # Useful for audit but many false positives. must_use_candidate = "allow" # Useful for audit but many false positives.
mut_mut = "warn" mut_mut = "warn"
naive_bytecount = "warn" naive_bytecount = "warn"

View File

@ -193,6 +193,7 @@ impl SignedAmount {
/// assert_eq!(amount.to_float_in(Denomination::Bitcoin), 0.001) /// assert_eq!(amount.to_float_in(Denomination::Bitcoin), 0.001)
/// ``` /// ```
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
#[allow(clippy::missing_panics_doc)]
pub fn to_float_in(self, denom: Denomination) -> f64 { pub fn to_float_in(self, denom: Denomination) -> f64 {
self.to_string_in(denom).parse::<f64>().unwrap() self.to_string_in(denom).parse::<f64>().unwrap()
} }

View File

@ -199,6 +199,7 @@ impl Amount {
/// assert_eq!(amount.to_float_in(Denomination::Bitcoin), 0.001) /// assert_eq!(amount.to_float_in(Denomination::Bitcoin), 0.001)
/// ``` /// ```
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
#[allow(clippy::missing_panics_doc)]
pub fn to_float_in(self, denom: Denomination) -> f64 { pub fn to_float_in(self, denom: Denomination) -> f64 {
self.to_string_in(denom).parse::<f64>().unwrap() self.to_string_in(denom).parse::<f64>().unwrap()
} }