diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-03-26 21:23:50 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-26 21:23:50 +0100 |
| commit | 7af95edd29dd95a20feb45f4effce571936bf51f (patch) | |
| tree | 613c8194f9341c84d61b76602e0ce587bd550340 /src/tools | |
| parent | ac5ffa51cd6bfdaa0edfc8774b150ae3c175682f (diff) | |
| parent | 2cfd5326a58bb782dd725a481c82dbb05817d654 (diff) | |
| download | rust-7af95edd29dd95a20feb45f4effce571936bf51f.tar.gz rust-7af95edd29dd95a20feb45f4effce571936bf51f.zip | |
Rollup merge of #123087 - tgross35:clippy-f16-f128-check-stubs, r=blyxyas
Change `f16` and `f128` clippy stubs to be nonpanicking It turns out there is a bit of a circular dependency - I cannot add anything to `core` because Clippy fails, and I can't actually add correct Clippy implementations without new implementations from `core`. Change some of the Clippy stubs from `unimplemented!` to success values and leave a FIXME in their place to mitigate this. Fixes <https://github.com/rust-lang/rust/issues/122587>
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/float_literal.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/tools/clippy/clippy_lints/src/float_literal.rs b/src/tools/clippy/clippy_lints/src/float_literal.rs index 07fbb1cb5c9..981a76d683d 100644 --- a/src/tools/clippy/clippy_lints/src/float_literal.rs +++ b/src/tools/clippy/clippy_lints/src/float_literal.rs @@ -83,7 +83,10 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral { LitFloatType::Unsuffixed => None, }; let (is_whole, is_inf, mut float_str) = match fty { - FloatTy::F16 => unimplemented!("f16_f128"), + FloatTy::F16 => { + // FIXME(f16_f128): do a check like the others when parsing is available + return; + }, FloatTy::F32 => { let value = sym_str.parse::<f32>().unwrap(); @@ -94,7 +97,10 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral { (value.fract() == 0.0, value.is_infinite(), formatter.format(value)) }, - FloatTy::F128 => unimplemented!("f16_f128"), + FloatTy::F128 => { + // FIXME(f16_f128): do a check like the others when parsing is available + return; + }, }; if is_inf { @@ -139,10 +145,11 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral { #[must_use] fn max_digits(fty: FloatTy) -> u32 { match fty { - FloatTy::F16 => unimplemented!("f16_f128"), + // FIXME(f16_f128): replace the magic numbers once `{f16,f128}::DIGITS` are available + FloatTy::F16 => 3, FloatTy::F32 => f32::DIGITS, FloatTy::F64 => f64::DIGITS, - FloatTy::F128 => unimplemented!("f16_f128"), + FloatTy::F128 => 33, } } |
