From e316e6e7195993b7dd0e005d2f22f29dfea023c5 Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Tue, 14 Jan 2025 12:22:52 +0000 Subject: [PATCH] Fix `missing_panics_doc` clippy lint in units Change the lint to `warn` and allow for the functions that can't panic. --- units/Cargo.toml | 2 +- units/src/amount/signed.rs | 1 + units/src/amount/unsigned.rs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/units/Cargo.toml b/units/Cargo.toml index d0368dace..5c76f052e 100644 --- a/units/Cargo.toml +++ b/units/Cargo.toml @@ -107,7 +107,7 @@ maybe_infinite_iter = "warn" mismatching_type_param_order = "warn" missing_errors_doc = "allow" # TODO: Still needs considering. 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. mut_mut = "warn" naive_bytecount = "warn" diff --git a/units/src/amount/signed.rs b/units/src/amount/signed.rs index 4580af033..ada79d170 100644 --- a/units/src/amount/signed.rs +++ b/units/src/amount/signed.rs @@ -193,6 +193,7 @@ impl SignedAmount { /// assert_eq!(amount.to_float_in(Denomination::Bitcoin), 0.001) /// ``` #[cfg(feature = "alloc")] + #[allow(clippy::missing_panics_doc)] pub fn to_float_in(self, denom: Denomination) -> f64 { self.to_string_in(denom).parse::().unwrap() } diff --git a/units/src/amount/unsigned.rs b/units/src/amount/unsigned.rs index 9ac7e4497..443b1fcd8 100644 --- a/units/src/amount/unsigned.rs +++ b/units/src/amount/unsigned.rs @@ -199,6 +199,7 @@ impl Amount { /// assert_eq!(amount.to_float_in(Denomination::Bitcoin), 0.001) /// ``` #[cfg(feature = "alloc")] + #[allow(clippy::missing_panics_doc)] pub fn to_float_in(self, denom: Denomination) -> f64 { self.to_string_in(denom).parse::().unwrap() }