Skip to content

Commit

Permalink
bigint: Stop implementing Debug for OwnedModulus.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
briansmith committed Nov 23, 2023
1 parent 6de2724 commit 40d287f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
15 changes: 2 additions & 13 deletions src/arithmetic/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down Expand Up @@ -928,16 +927,6 @@ mod tests {
)
}

#[test]
fn test_modulus_debug() {
let modulus = OwnedModulus::<M>::from_be_bytes(
untrusted::Input::from(&[0xff; LIMB_BYTES * MODULUS_MIN_LIMBS]),
cpu::features(),
)
.unwrap();
assert_eq!("Modulus", format!("{:?}", modulus));
}

fn consume_elem<M>(
test_case: &mut test::TestCase,
name: &str,
Expand Down
8 changes: 0 additions & 8 deletions src/arithmetic/bigint/modulus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,6 @@ impl<M: PublicModulus> Clone for OwnedModulus<M> {
}
}

impl<M: PublicModulus> core::fmt::Debug for OwnedModulus<M> {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter) -> Result<(), ::core::fmt::Error> {
fmt.debug_struct("Modulus")
// TODO: Print modulus value.
.finish()
}
}

impl<M> OwnedModulus<M> {
pub(crate) fn from_be_bytes(
input: untrusted::Input,
Expand Down

0 comments on commit 40d287f

Please sign in to comment.