add list of characters to uncommon codepoints lint
This commit is contained in:
parent
0011fac90d
commit
f3682a1304
6 changed files with 26 additions and 7 deletions
|
@ -1107,7 +1107,9 @@ pub struct IdentifierNonAsciiChar;
|
|||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_identifier_uncommon_codepoints)]
|
||||
pub struct IdentifierUncommonCodepoints;
|
||||
pub struct IdentifierUncommonCodepoints {
|
||||
pub codepoints: Vec<char>,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_confusable_identifier_pair)]
|
||||
|
|
|
@ -190,7 +190,16 @@ impl EarlyLintPass for NonAsciiIdents {
|
|||
if check_uncommon_codepoints
|
||||
&& !symbol_str.chars().all(GeneralSecurityProfile::identifier_allowed)
|
||||
{
|
||||
cx.emit_span_lint(UNCOMMON_CODEPOINTS, sp, IdentifierUncommonCodepoints);
|
||||
cx.emit_span_lint(
|
||||
UNCOMMON_CODEPOINTS,
|
||||
sp,
|
||||
IdentifierUncommonCodepoints {
|
||||
codepoints: symbol_str
|
||||
.chars()
|
||||
.filter(|c| !GeneralSecurityProfile::identifier_allowed(*c))
|
||||
.collect(),
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue