1 use clippy_utils::diagnostics::span_lint;
2 use rustc_lint::EarlyContext;
5 use super::MIXED_CASE_HEX_LITERALS;
7 pub(super) fn check(cx: &EarlyContext<'_>, lit_span: Span, suffix: &str, lit_snip: &str) {
8 let Some(maybe_last_sep_idx) = lit_snip.len().checked_sub(suffix.len() + 1) else {
9 return; // It's useless so shouldn't lint.
11 if maybe_last_sep_idx <= 2 {
12 // It's meaningless or causes range error.
15 let mut seen = (false, false);
16 for ch in lit_snip.as_bytes()[2..=maybe_last_sep_idx].iter() {
18 b'a'..=b'f' => seen.0 = true,
19 b'A'..=b'F' => seen.1 = true,
25 MIXED_CASE_HEX_LITERALS,
27 "inconsistent casing in hexadecimal literal",