diff --git a/crates/ruff_linter/src/rules/pep8_naming/rules/camelcase_imported_as_constant.rs b/crates/ruff_linter/src/rules/pep8_naming/rules/camelcase_imported_as_constant.rs index e41ac229c40449..dae4a24218c7cb 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/rules/camelcase_imported_as_constant.rs +++ b/crates/ruff_linter/src/rules/pep8_naming/rules/camelcase_imported_as_constant.rs @@ -54,7 +54,7 @@ pub(crate) fn camelcase_imported_as_constant( ignore_names: &IgnoreNames, ) -> Option { // Single-character names are ambiguous. It could be a class or a constant. - if asname.chars().count() == 1 { + if asname.chars().skip(1).next().is_none() { return None; } diff --git a/crates/ruff_linter/src/rules/pep8_naming/rules/constant_imported_as_non_constant.rs b/crates/ruff_linter/src/rules/pep8_naming/rules/constant_imported_as_non_constant.rs index f71c5abd634f30..aef85ac15e8be3 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/rules/constant_imported_as_non_constant.rs +++ b/crates/ruff_linter/src/rules/pep8_naming/rules/constant_imported_as_non_constant.rs @@ -53,7 +53,7 @@ pub(crate) fn constant_imported_as_non_constant( ignore_names: &IgnoreNames, ) -> Option { // Single-character names are ambiguous. It could be a class or a constant. - if name.chars().count() == 1 { + if name.chars().skip(1).next().is_none() { return None; }