Skip to content

clippy::disallowed_script_idents has false positive if there is an _ underscore in the ident #15116

@wbcat

Description

@wbcat

Summary

The lint produces false positives if there is an underscore _ in/after the ident, not if _ is at the beginning of the ident

Lint Name

clippy::disallowed_script_idents

Reproducer

I tried this code:

#![warn(clippy::disallowed_script_idents)]
fn main() {
	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;
}

I saw this happen:
cargo clippy

warning: identifier `Ä_ÖÜ` has a Unicode script that is not allowed by configuration: Common
 --> src/main.rs:7:8
  |
7 |     const Ä_ÖÜ: u8 = 0;
  |           ^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_script_idents

I expected to see this happen:

Version


Additional Labels

No response

Activity

added
C-bugCategory: Clippy is not doing the correct thing
I-false-positiveIssue: The lint was triggered on code it shouldn't have
on Jun 23, 2025
added a commit that references this issue on Jun 28, 2025
428208e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @wbcat

      Issue actions

        clippy::disallowed_script_idents has false positive if there is an _ underscore in the ident · Issue #15116 · rust-lang/rust-clippy