Add stubs for f16
and f128
to clippy
This commit is contained in:
parent
7be6e2178e
commit
17930c9614
@ -81,6 +81,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
|
|||||||
LitFloatType::Unsuffixed => None,
|
LitFloatType::Unsuffixed => None,
|
||||||
};
|
};
|
||||||
let (is_whole, is_inf, mut float_str) = match fty {
|
let (is_whole, is_inf, mut float_str) = match fty {
|
||||||
|
FloatTy::F16 => unimplemented!("f16_f128"),
|
||||||
FloatTy::F32 => {
|
FloatTy::F32 => {
|
||||||
let value = sym_str.parse::<f32>().unwrap();
|
let value = sym_str.parse::<f32>().unwrap();
|
||||||
|
|
||||||
@ -91,6 +92,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
|
|||||||
|
|
||||||
(value.fract() == 0.0, value.is_infinite(), formatter.format(value))
|
(value.fract() == 0.0, value.is_infinite(), formatter.format(value))
|
||||||
},
|
},
|
||||||
|
FloatTy::F128 => unimplemented!("f16_f128"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if is_inf {
|
if is_inf {
|
||||||
@ -135,8 +137,10 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
|
|||||||
#[must_use]
|
#[must_use]
|
||||||
fn max_digits(fty: FloatTy) -> u32 {
|
fn max_digits(fty: FloatTy) -> u32 {
|
||||||
match fty {
|
match fty {
|
||||||
|
FloatTy::F16 => unimplemented!("f16_f128"),
|
||||||
FloatTy::F32 => f32::DIGITS,
|
FloatTy::F32 => f32::DIGITS,
|
||||||
FloatTy::F64 => f64::DIGITS,
|
FloatTy::F64 => f64::DIGITS,
|
||||||
|
FloatTy::F128 => unimplemented!("f16_f128"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -778,8 +778,10 @@ pub fn mir_to_const<'tcx>(lcx: &LateContext<'tcx>, result: mir::Const<'tcx>) ->
|
|||||||
let range = alloc_range(offset + size * idx, size);
|
let range = alloc_range(offset + size * idx, size);
|
||||||
let val = alloc.read_scalar(&lcx.tcx, range, /* read_provenance */ false).ok()?;
|
let val = alloc.read_scalar(&lcx.tcx, range, /* read_provenance */ false).ok()?;
|
||||||
res.push(match flt {
|
res.push(match flt {
|
||||||
|
FloatTy::F16 => unimplemented!("f16_f128"),
|
||||||
FloatTy::F32 => Constant::F32(f32::from_bits(val.to_u32().ok()?)),
|
FloatTy::F32 => Constant::F32(f32::from_bits(val.to_u32().ok()?)),
|
||||||
FloatTy::F64 => Constant::F64(f64::from_bits(val.to_u64().ok()?)),
|
FloatTy::F64 => Constant::F64(f64::from_bits(val.to_u64().ok()?)),
|
||||||
|
FloatTy::F128 => unimplemented!("f16_f128"),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Some(Constant::Vec(res))
|
Some(Constant::Vec(res))
|
||||||
|
Loading…
Reference in New Issue
Block a user