From 40d287fe0a89a26f34e08c290b15f76ef749c832 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Wed, 22 Nov 2023 17:43:46 -0800 Subject: [PATCH] bigint: Stop implementing `Debug` for `OwnedModulus`. This was necessary at some point in the past, but no longer is. It is better to avoid depending on any of the `core::fmt` machinery in these lower layers if we can avoid it. --- src/arithmetic/bigint.rs | 15 ++------------- src/arithmetic/bigint/modulus.rs | 8 -------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/src/arithmetic/bigint.rs b/src/arithmetic/bigint.rs index 71bdd16223..15b24ab8da 100644 --- a/src/arithmetic/bigint.rs +++ b/src/arithmetic/bigint.rs @@ -791,9 +791,8 @@ prefixed_extern! { #[cfg(test)] mod tests { - use super::{modulus::MODULUS_MIN_LIMBS, *}; - use crate::{limb::LIMB_BYTES, test}; - use alloc::format; + use super::*; + use crate::test; // Type-level representation of an arbitrary modulus. struct M {} @@ -928,16 +927,6 @@ mod tests { ) } - #[test] - fn test_modulus_debug() { - let modulus = OwnedModulus::::from_be_bytes( - untrusted::Input::from(&[0xff; LIMB_BYTES * MODULUS_MIN_LIMBS]), - cpu::features(), - ) - .unwrap(); - assert_eq!("Modulus", format!("{:?}", modulus)); - } - fn consume_elem( test_case: &mut test::TestCase, name: &str, diff --git a/src/arithmetic/bigint/modulus.rs b/src/arithmetic/bigint/modulus.rs index 6f00f76d11..3b88c9fb45 100644 --- a/src/arithmetic/bigint/modulus.rs +++ b/src/arithmetic/bigint/modulus.rs @@ -90,14 +90,6 @@ impl Clone for OwnedModulus { } } -impl core::fmt::Debug for OwnedModulus { - fn fmt(&self, fmt: &mut ::core::fmt::Formatter) -> Result<(), ::core::fmt::Error> { - fmt.debug_struct("Modulus") - // TODO: Print modulus value. - .finish() - } -} - impl OwnedModulus { pub(crate) fn from_be_bytes( input: untrusted::Input,