Refactor non_ascii_idents lints, exclude ascii pair for confusable_idents lint.
This commit is contained in:
parent
1a4e2b6f9c
commit
ef24faf130
10 changed files with 141 additions and 167 deletions
|
|
@ -2,8 +2,14 @@
|
|||
#![deny(confusable_idents)]
|
||||
#![allow(uncommon_codepoints, non_upper_case_globals)]
|
||||
|
||||
const s: usize = 42; //~ ERROR identifier pair considered confusable
|
||||
const s: usize = 42;
|
||||
|
||||
fn main() {
|
||||
let s = "rust";
|
||||
let s = "rust"; //~ ERROR identifier pair considered confusable
|
||||
not_affected();
|
||||
}
|
||||
|
||||
fn not_affected() {
|
||||
let s1 = 1;
|
||||
let sl = 'l';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
error: identifier pair considered confusable between `s` and `s`
|
||||
--> $DIR/lint-confusable-idents.rs:5:7
|
||||
error: identifier pair considered confusable between `s` and `s`
|
||||
--> $DIR/lint-confusable-idents.rs:8:9
|
||||
|
|
||||
LL | const s: usize = 42;
|
||||
| ^^
|
||||
| -- this is where the previous identifier occurred
|
||||
...
|
||||
LL | let s = "rust";
|
||||
| - this is where the previous identifier occurred
|
||||
| ^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-confusable-idents.rs:2:9
|
||||
|
|
|
|||
|
|
@ -7,5 +7,7 @@ fn coöperation() {} //~ ERROR identifier contains non-ASCII characters
|
|||
|
||||
fn main() {
|
||||
let naïveté = 2; //~ ERROR identifier contains non-ASCII characters
|
||||
println!("{}", naïveté); //~ ERROR identifier contains non-ASCII characters
|
||||
|
||||
// using the same identifier the second time won't trigger the lint.
|
||||
println!("{}", naïveté);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,5 @@ error: identifier contains non-ASCII characters
|
|||
LL | let naïveté = 2;
|
||||
| ^^^^^^^
|
||||
|
||||
error: identifier contains non-ASCII characters
|
||||
--> $DIR/lint-non-ascii-idents.rs:10:20
|
||||
|
|
||||
LL | println!("{}", naïveté);
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -7,5 +7,7 @@ fn dijkstra() {} //~ ERROR identifier contains uncommon Unicode codepoints
|
|||
|
||||
fn main() {
|
||||
let ㇻㇲㇳ = "rust"; //~ ERROR identifier contains uncommon Unicode codepoints
|
||||
println!("{}", ㇻㇲㇳ); //~ ERROR identifier contains uncommon Unicode codepoints
|
||||
|
||||
// using the same identifier the second time won't trigger the lint.
|
||||
println!("{}", ㇻㇲㇳ);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,5 @@ error: identifier contains uncommon Unicode codepoints
|
|||
LL | let ㇻㇲㇳ = "rust";
|
||||
| ^^^^^^
|
||||
|
||||
error: identifier contains uncommon Unicode codepoints
|
||||
--> $DIR/lint-uncommon-codepoints.rs:10:20
|
||||
|
|
||||
LL | println!("{}", ㇻㇲㇳ);
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
// ignore-tidy-trailing-newlines
|
||||
// error-pattern: aborting due to 3 previous errors
|
||||
#![allow(uncommon_codepoints)]
|
||||
|
||||
y![
|
||||
Ϥ,
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/issue-62524.rs:4:3
|
||||
--> $DIR/issue-62524.rs:6:3
|
||||
|
|
||||
LL | y![
|
||||
| - unclosed delimiter
|
||||
|
|
@ -7,7 +7,7 @@ LL | Ϥ,
|
|||
| ^
|
||||
|
||||
error: macros that expand to items must be delimited with braces or followed by a semicolon
|
||||
--> $DIR/issue-62524.rs:3:3
|
||||
--> $DIR/issue-62524.rs:5:3
|
||||
|
|
||||
LL | y![
|
||||
| ___^
|
||||
|
|
@ -24,7 +24,7 @@ LL | Ϥ,;
|
|||
| ^
|
||||
|
||||
error: cannot find macro `y` in this scope
|
||||
--> $DIR/issue-62524.rs:3:1
|
||||
--> $DIR/issue-62524.rs:5:1
|
||||
|
|
||||
LL | y![
|
||||
| ^
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue