Skip to content

Commit 094ec4f

Browse files
authored
refactor: remove type info from Display for newtypes. (#349)
1 parent 74a5129 commit 094ec4f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/_macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ macro_rules! impl_f64_newtypes {
325325
($type: ty) => {
326326
impl std::fmt::Display for $type {
327327
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
328-
write!(f, "{}({})", stringify!($type), self.0)
328+
write!(f, "{}", self.0)
329329
}
330330
}
331331

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,17 +525,17 @@ mod tests {
525525
let mut output = String::new();
526526
std::fmt::write(&mut output, format_args!("{}", x))
527527
.expect("Error occurred while trying to write in String");
528-
assert_eq!(output, "Position(1)".to_string());
528+
assert_eq!(output, "1".to_string());
529529
let x = Time::from(1.0);
530530
let mut output = String::new();
531531
std::fmt::write(&mut output, format_args!("{}", x))
532532
.expect("Error occurred while trying to write in String");
533-
assert_eq!(output, "Time(1)".to_string());
533+
assert_eq!(output, "1".to_string());
534534
let x = Location::from(1.0);
535535
let mut output = String::new();
536536
std::fmt::write(&mut output, format_args!("{}", x))
537537
.expect("Error occurred while trying to write in String");
538-
assert_eq!(output, "Location(1)".to_string());
538+
assert_eq!(output, "1".to_string());
539539
}
540540
}
541541

0 commit comments

Comments
 (0)