diff --git a/Cargo.toml b/Cargo.toml index 24ea488..8434644 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "malachite-bigint" -version = "0.2.1" +version = "0.2.2" authors = ["Steve Shi "] edition = "2021" license = "LGPL-3.0-only" diff --git a/src/bigint.rs b/src/bigint.rs index d10a06e..e568d53 100644 --- a/src/bigint.rs +++ b/src/bigint.rs @@ -79,7 +79,7 @@ impl Neg for Sign { From, Into, )] -#[display("{}", "self.0")] +#[display("{}", self.0)] #[into(owned, ref, ref_mut)] pub struct BigInt(Integer); @@ -680,3 +680,9 @@ fn test_to_signed_bytes() { let i2 = BigInt::from_signed_bytes_le(&b); assert_eq!(i, i2); } + +#[test] +fn test_display_bigint() { + let n = BigInt::from_str("1234567890").unwrap(); + assert_eq!(format!("{}", n), "1234567890"); +} diff --git a/src/biguint.rs b/src/biguint.rs index 3906ebb..a08677f 100644 --- a/src/biguint.rs +++ b/src/biguint.rs @@ -54,7 +54,7 @@ impl_primitive_convert!(BigUint, f64); From, Into, )] -#[display("{}", "self.0")] +#[display("{}", self.0)] #[into(owned, ref, ref_mut)] pub struct BigUint(pub(crate) Natural); @@ -487,3 +487,9 @@ impl BigUint { fn test_from_string_base() { assert!(BigUint::from_str_radix("1000000000000000111111100112abcdefg", 16).is_err()); } + +#[test] +fn test_display_biguint() { + let x = BigUint::from_str_radix("1234567890", 10).unwrap(); + assert_eq!(format!("{}", x), "1234567890"); +}