1
Fork 0

Move NumericLiteral to its own module.

This commit is contained in:
mlegner 2020-03-03 17:58:37 +01:00
parent 73deb723dd
commit d14fdc0203
No known key found for this signature in database
GPG key ID: 8373ED3B4CCFA845
7 changed files with 243 additions and 241 deletions

View file

@ -1,5 +1,4 @@
use crate::utils::span_lint_and_sugg;
use crate::utils::sugg::format_numeric_literal;
use crate::utils::{numeric_literal, span_lint_and_sugg};
use if_chain::if_chain;
use rustc::ty;
use rustc_ast::ast::{FloatTy, LitFloatType, LitKind};
@ -109,7 +108,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for FloatLiteral {
expr.span,
"literal cannot be represented as the underlying type without loss of precision",
"consider changing the type or replacing it with",
format_numeric_literal(&float_str, type_suffix, true),
numeric_literal::format(&float_str, type_suffix, true),
Applicability::MachineApplicable,
);
}
@ -120,7 +119,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for FloatLiteral {
expr.span,
"float has excessive precision",
"consider changing the type or truncating it to",
format_numeric_literal(&float_str, type_suffix, true),
numeric_literal::format(&float_str, type_suffix, true),
Applicability::MachineApplicable,
);
}