Skip to content

Commit

Permalink
Breaking: remove pretty_float! macro
Browse files Browse the repository at this point in the history
  • Loading branch information
notmgsk committed Jul 22, 2021
1 parent 4b8b923 commit bca463c
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,22 +192,6 @@ macro_rules! format_complex {
}};
}

// Display floats in a human-friendly way using scientific notation.
// See https://internals.rust-lang.org/t/pre-rfc-draft-g-or-floating-points-for-humans/9110/8
#[macro_export]
macro_rules! pretty_float {
($value: expr) => {{
let mut attempt = format!("{:.2e}", $value);
if attempt.ends_with("e0") {
attempt = format!("{:.2}", $value)
}
if attempt.ends_with(".00") {
attempt = format!("{:.0}", $value)
}
attempt
}};
}

impl fmt::Display for Expression {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use Expression::*;
Expand Down

0 comments on commit bca463c

Please sign in to comment.