diff --git a/library/compiler-builtins/libm/build.rs b/library/compiler-builtins/libm/build.rs index 41dc920e9f7d..23e1178e3607 100644 --- a/library/compiler-builtins/libm/build.rs +++ b/library/compiler-builtins/libm/build.rs @@ -267,22 +267,17 @@ mod musl_reference_tests { .status() .unwrap(); assert!(status.success()); - let output = Command::new("./gen") - .current_dir(&dst) - .output() - .unwrap(); + let output = Command::new("./gen").current_dir(&dst).output().unwrap(); assert!(output.status.success()); assert!(output.stderr.is_empty()); // Map all the output bytes back to an `i64` and then shove it all into // the expected results. - let mut results = - output.stdout.chunks_exact(8) - .map(|buf| { - let mut exact = [0; 8]; - exact.copy_from_slice(buf); - i64::from_le_bytes(exact) - }); + let mut results = output.stdout.chunks_exact(8).map(|buf| { + let mut exact = [0; 8]; + exact.copy_from_slice(buf); + i64::from_le_bytes(exact) + }); for test in functions.iter_mut().flat_map(|f| f.tests.iter_mut()) { test.output = results.next().unwrap(); @@ -301,7 +296,10 @@ mod musl_reference_tests { src.push_str("fn "); src.push_str(&function.name); src.push_str("_matches_musl() {"); - src.push_str(&format!("static TESTS: &[([i64; {}], i64)]", function.args.len())); + src.push_str(&format!( + "static TESTS: &[([i64; {}], i64)]", + function.args.len() + )); src.push_str(" = &["); for test in function.tests.iter() { src.push_str("(["); @@ -336,9 +334,11 @@ mod musl_reference_tests { Ty::Bool => unreachable!(), }); - src.push_str(r#" + src.push_str( + r#" panic!("INPUT: {:?} EXPECTED: {:?} ACTUAL {:?}", test, expected, output); - "#); + "#, + ); src.push_str("}"); src.push_str("}"); diff --git a/library/compiler-builtins/libm/src/math/atan.rs b/library/compiler-builtins/libm/src/math/atan.rs index a9cdc29333d0..ad1d57c1fe79 100644 --- a/library/compiler-builtins/libm/src/math/atan.rs +++ b/library/compiler-builtins/libm/src/math/atan.rs @@ -148,7 +148,8 @@ mod tests { (-3.0_f64.sqrt() / 3.0, -f64::consts::FRAC_PI_6), (-1.0, -f64::consts::FRAC_PI_4), (-3.0_f64.sqrt(), -f64::consts::FRAC_PI_3), - ].iter() + ] + .iter() { assert!( (atan(*input) - answer) / answer < 1e-5, diff --git a/library/compiler-builtins/libm/src/math/expf.rs b/library/compiler-builtins/libm/src/math/expf.rs index e33425665eb9..baade2552e12 100644 --- a/library/compiler-builtins/libm/src/math/expf.rs +++ b/library/compiler-builtins/libm/src/math/expf.rs @@ -31,7 +31,6 @@ const P2: f32 = -2.7667332906e-3; /* -0xb55215.0p-32 */ pub fn expf(mut x: f32) -> f32 { let x1p127 = f32::from_bits(0x7f000000); // 0x1p127f === 2 ^ 127 let x1p_126 = f32::from_bits(0x800000); // 0x1p-126f === 2 ^ -126 /*original 0x1p-149f ??????????? */ - let mut hx = x.to_bits(); let sign = (hx >> 31) as i32; /* sign bit of x */ let signb: bool = sign != 0; diff --git a/library/compiler-builtins/libm/src/math/fma.rs b/library/compiler-builtins/libm/src/math/fma.rs index 38468ae755f6..acf99a5d4e23 100644 --- a/library/compiler-builtins/libm/src/math/fma.rs +++ b/library/compiler-builtins/libm/src/math/fma.rs @@ -166,13 +166,13 @@ pub fn fma(x: f64, y: f64, z: f64) -> f64 { } if r == c { /* min normal after rounding, underflow depends - on arch behaviour which can be imitated by - a double to float conversion */ + on arch behaviour which can be imitated by + a double to float conversion */ let fltmin: f32 = (x0_ffffff8p_63 * f32::MIN_POSITIVE as f64 * r) as f32; return f64::MIN_POSITIVE / f32::MIN_POSITIVE as f64 * fltmin as f64; } /* one bit is lost when scaled, add another top bit to - only round once at conversion if it is inexact */ + only round once at conversion if it is inexact */ if (rhi << 53) != 0 { i = (rhi >> 1 | (rhi & 1) | 1 << 62) as i64; if sign != 0 { @@ -182,7 +182,7 @@ pub fn fma(x: f64, y: f64, z: f64) -> f64 { r = 2. * r - c; /* remove top bit */ /* raise underflow portably, such that it - cannot be optimized away */ + cannot be optimized away */ { let tiny: f64 = f64::MIN_POSITIVE / f32::MIN_POSITIVE as f64 * r; r += (tiny * tiny) * (r - r); diff --git a/library/compiler-builtins/libm/src/math/pow.rs b/library/compiler-builtins/libm/src/math/pow.rs index 3b789dd9fb30..b5b0407efa19 100644 --- a/library/compiler-builtins/libm/src/math/pow.rs +++ b/library/compiler-builtins/libm/src/math/pow.rs @@ -262,7 +262,7 @@ pub fn pow(x: f64, y: f64) -> f64 { } /* now |1-x| is TINY <= 2**-20, suffice to compute - log(x) by x-x^2/2+x^3/3-x^4/4 */ + log(x) by x-x^2/2+x^3/3-x^4/4 */ let t: f64 = ax - 1.0; /* t has 20 trailing zeros */ let w: f64 = (t * t) * (0.5 - t * (0.3333333333333333333333 - t * 0.25)); let u: f64 = IVLN2_H * t; /* ivln2_h has 21 sig. bits */ diff --git a/library/compiler-builtins/libm/src/math/powf.rs b/library/compiler-builtins/libm/src/math/powf.rs index 5bc5c08e972b..0a26573a3d10 100644 --- a/library/compiler-builtins/libm/src/math/powf.rs +++ b/library/compiler-builtins/libm/src/math/powf.rs @@ -198,7 +198,7 @@ pub fn powf(x: f32, y: f32) -> f32 { } /* now |1-x| is TINY <= 2**-20, suffice to compute - log(x) by x-x^2/2+x^3/3-x^4/4 */ + log(x) by x-x^2/2+x^3/3-x^4/4 */ t = ax - 1.; /* t has 20 trailing zeros */ w = (t * t) * (0.5 - t * (0.333333333333 - t * 0.25)); u = IVLN2_H * t; /* IVLN2_H has 16 sig. bits */ diff --git a/library/compiler-builtins/libm/src/math/rem_pio2.rs b/library/compiler-builtins/libm/src/math/rem_pio2.rs index 98d6b37beb5d..82faf5da97a6 100644 --- a/library/compiler-builtins/libm/src/math/rem_pio2.rs +++ b/library/compiler-builtins/libm/src/math/rem_pio2.rs @@ -10,7 +10,6 @@ // ==================================================== // // Optimized by Bruce D. Evans. */ - use super::rem_pio2_large; // #if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 diff --git a/library/compiler-builtins/libm/src/math/scalbn.rs b/library/compiler-builtins/libm/src/math/scalbn.rs index 2c4ab3660848..d8c8409ac10c 100644 --- a/library/compiler-builtins/libm/src/math/scalbn.rs +++ b/library/compiler-builtins/libm/src/math/scalbn.rs @@ -19,7 +19,7 @@ pub fn scalbn(x: f64, mut n: i32) -> f64 { } } else if n < -1022 { /* make sure final n < -53 to avoid double - rounding in the subnormal range */ + rounding in the subnormal range */ y *= x1p_1022 * x1p53; n += 1022 - 53; if n < -1022 {