float_literal
: Check HIR tree before checking types.
This commit is contained in:
parent
ca7e5c1353
commit
278e8371e6
@ -62,10 +62,9 @@ declare_lint_pass!(FloatLiteral => [EXCESSIVE_PRECISION, LOSSY_FLOAT_LITERAL]);
|
||||
|
||||
impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
|
||||
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
|
||||
let ty = cx.typeck_results().expr_ty(expr);
|
||||
if let ty::Float(fty) = *ty.kind()
|
||||
&& let hir::ExprKind::Lit(lit) = expr.kind
|
||||
if let hir::ExprKind::Lit(lit) = expr.kind
|
||||
&& let LitKind::Float(sym, lit_float_ty) = lit.node
|
||||
&& let ty::Float(fty) = *cx.typeck_results().expr_ty(expr).kind()
|
||||
{
|
||||
let sym_str = sym.as_str();
|
||||
let formatter = FloatFormat::new(sym_str);
|
||||
|
Loading…
x
Reference in New Issue
Block a user