1 use clippy_utils::diagnostics::span_lint_and_then;
2 use rustc_ast::ast::Lit;
3 use rustc_errors::Applicability;
4 use rustc_lint::EarlyContext;
6 use super::ZERO_PREFIXED_LITERAL;
8 pub(super) fn check(cx: &EarlyContext<'_>, lit: &Lit, lit_snip: &str) {
11 ZERO_PREFIXED_LITERAL,
13 "this is a decimal constant",
17 "if you mean to use a decimal constant, remove the `0` to avoid confusion",
18 lit_snip.trim_start_matches(|c| c == '_' || c == '0').to_string(),
19 Applicability::MaybeIncorrect,
23 "if you mean to use an octal constant, use `0o`",
24 format!("0o{}", lit_snip.trim_start_matches(|c| c == '_' || c == '0')),
25 Applicability::MaybeIncorrect,