#[must_use]
fn get_exemptions(interned_name: &str) -> Option<&'static [&'static str]> {
- for &list in ALLOWED_TO_BE_SIMILAR {
- if allowed_to_be_similar(interned_name, list) {
- return Some(list);
- }
- }
- None
+ ALLOWED_TO_BE_SIMILAR
+ .iter()
+ .find(|&&list| allowed_to_be_similar(interned_name, list))
+ .copied()
}
#[must_use]
}
}
- #[allow(clippy::too_many_lines)]
+ #[expect(clippy::too_many_lines)]
fn check_ident(&mut self, ident: Ident) {
let interned_name = ident.name.as_str();
if interned_name.chars().any(char::is_uppercase) {
return;
}
- if interned_name.chars().all(|c| c.is_digit(10) || c == '_') {
+ if interned_name.chars().all(|c| c.is_ascii_digit() || c == '_') {
span_lint(
self.0.cx,
JUST_UNDERSCORES_AND_DIGITS,
// add the pattern after the expression because the bindings aren't available
// yet in the init
// expression
- SimilarNamesNameVisitor(self).visit_pat(&*local.pat);
+ SimilarNamesNameVisitor(self).visit_pat(&local.pat);
}
fn visit_block(&mut self, blk: &'tcx Block) {
self.single_char_names.push(vec![]);