Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Fix Display impls #8

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "malachite-bigint"
version = "0.2.1"
version = "0.2.2"
authors = ["Steve Shi <[email protected]>"]
edition = "2021"
license = "LGPL-3.0-only"
Expand Down
8 changes: 7 additions & 1 deletion src/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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");
}
8 changes: 7 additions & 1 deletion src/biguint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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");
}