Skip to content

Fix disallowed_script_idents FP on identifiers with _ #15123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clippy_lints/src/disallowed_script_idents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ impl EarlyLintPass for DisallowedScriptIdents {
// Fast path for ascii-only idents.
if !symbol_str.is_ascii()
&& let Some(script) = symbol_str.chars().find_map(|c| {
if c.is_ascii() {
return None;
}

c.script_extension()
.iter()
.find(|script| !self.whitelist.contains(script))
Expand Down
14 changes: 14 additions & 0 deletions tests/ui/disallowed_script_idents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,17 @@ fn main() {
let カウンタ = 10;
//~^ disallowed_script_idents
}

fn issue15116() {
const ÄÖÜ: u8 = 0;
const _ÄÖÜ: u8 = 0;
const Ä_ÖÜ: u8 = 0;
const ÄÖ_Ü: u8 = 0;
const ÄÖÜ_: u8 = 0;
let äöüß = 1;
let _äöüß = 1;
let ä_öüß = 1;
let äö_üß = 1;
let äöü_ß = 1;
let äöüß_ = 1;
}