Skip to content

Commit 015538f

Browse files
committed
Change 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 <#122587>
1 parent 73476d4 commit 015538f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/tools/clippy/clippy_lints/src/float_literal.rs

+11-4
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
8383
LitFloatType::Unsuffixed => None,
8484
};
8585
let (is_whole, is_inf, mut float_str) = match fty {
86-
FloatTy::F16 => unimplemented!("f16_f128"),
86+
FloatTy::F16 => {
87+
// FIXME(f16_f128): do a check like the others when parsing is available
88+
return;
89+
},
8790
FloatTy::F32 => {
8891
let value = sym_str.parse::<f32>().unwrap();
8992

@@ -94,7 +97,10 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
9497

9598
(value.fract() == 0.0, value.is_infinite(), formatter.format(value))
9699
},
97-
FloatTy::F128 => unimplemented!("f16_f128"),
100+
FloatTy::F128 => {
101+
// FIXME(f16_f128): do a check like the others when parsing is available
102+
return;
103+
},
98104
};
99105

100106
if is_inf {
@@ -139,10 +145,11 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
139145
#[must_use]
140146
fn max_digits(fty: FloatTy) -> u32 {
141147
match fty {
142-
FloatTy::F16 => unimplemented!("f16_f128"),
148+
// FIXME(f16_f128): return a real value once core is available
149+
FloatTy::F16 => 0,
143150
FloatTy::F32 => f32::DIGITS,
144151
FloatTy::F64 => f64::DIGITS,
145-
FloatTy::F128 => unimplemented!("f16_f128"),
152+
FloatTy::F128 => 0,
146153
}
147154
}
148155

0 commit comments

Comments
 (0)