no_zero_width_chars
Flag body-internal zero-width characters (U+200B, U+200C, U+200D, and non-leading U+FEFF). A leading U+FEFF is no_bom’s concern.
As of v0.14 the detection set also covers U+2060 (word joiner) and U+180E (Mongolian vowel separator).
Options
Section titled “Options”This rule takes no kind-specific options.
Plus the common paths, level, id, and when fields. This table is generated from the JSON Schema; option types and defaults are authoritative.
Example
Section titled “Example”An identifier with a hidden zero-width space
Section titled “An identifier with a hidden zero-width space”The rule fires on this repository:
src/src/clean.rssrc/obfuscated.rspub fn normal() {}pub fn sec<U+200B>ret() {}With this .alint.yml:
version: 1rules: - id: no-zwsp kind: no_zero_width_chars paths: "src/**/*.rs" level: erroralint check reports:
--- src/obfuscated.rs ---------------------------------------------------------- x error no-zwsp 1:11 zero-width character U+200B at line 1 col 11
Summary (1 violation): x 1 error 0 passing * 1 failingA file whose only zero-width codepoint is an allowed leading BOM
Section titled “A file whose only zero-width codepoint is an allowed leading BOM”This repository is compliant:
src/src/clean.rssrc/with_bom.rspub fn ok2() {}<U+FEFF>pub fn ok() {}With this .alint.yml:
version: 1rules: - id: no-zwsp kind: no_zero_width_chars paths: "src/**/*.rs" level: erroralint check reports:
v All 1 rule(s) passed.