diff options
| author | Centri3 <114838443+Centri3@users.noreply.github.com> | 2023-06-09 14:45:53 -0500 |
|---|---|---|
| committer | Centri3 <114838443+Centri3@users.noreply.github.com> | 2023-06-12 03:21:43 -0500 |
| commit | 03c8db048e97835c3431eac5da90e207b0a458f6 (patch) | |
| tree | 3b71700ae6ba7131447a2aff9c4d0a117907094a | |
| parent | e2ecb132a5ccf238129acdbaff89bed6023a593e (diff) | |
| download | rust-03c8db048e97835c3431eac5da90e207b0a458f6.tar.gz rust-03c8db048e97835c3431eac5da90e207b0a458f6.zip | |
make cargo test pass + example
| -rw-r--r-- | clippy_lints/src/single_char_idents.rs | 11 | ||||
| -rw-r--r-- | tests/ui/single_char_idents.rs (renamed from tests/ui/single_letter_idents.rs) | 2 | ||||
| -rw-r--r-- | tests/ui/single_char_idents.stderr | 100 | ||||
| -rw-r--r-- | tests/ui/single_letter_idents.stderr | 100 |
4 files changed, 110 insertions, 103 deletions
diff --git a/clippy_lints/src/single_char_idents.rs b/clippy_lints/src/single_char_idents.rs index 0125b576f43..17a2ebe93ed 100644 --- a/clippy_lints/src/single_char_idents.rs +++ b/clippy_lints/src/single_char_idents.rs @@ -19,10 +19,17 @@ declare_clippy_lint! { /// /// ### Example /// ```rust,ignore - /// for i in collection { - /// let x = i.x; + /// for m in movies { + /// let title = m.t; /// } /// ``` + /// Use instead: + /// ```rust,ignore + /// for movie in movies { + /// let title = movie.title; + /// } + /// ``` + /// ``` #[clippy::version = "1.72.0"] pub SINGLE_CHAR_IDENTS, restriction, diff --git a/tests/ui/single_letter_idents.rs b/tests/ui/single_char_idents.rs index b33c569d318..386633161fe 100644 --- a/tests/ui/single_letter_idents.rs +++ b/tests/ui/single_char_idents.rs @@ -1,6 +1,6 @@ //@aux-build:proc_macros.rs #![allow(nonstandard_style, unused)] -#![warn(clippy::single_letter_idents)] +#![warn(clippy::single_char_idents)] extern crate proc_macros; use proc_macros::external; diff --git a/tests/ui/single_char_idents.stderr b/tests/ui/single_char_idents.stderr new file mode 100644 index 00000000000..ceedab9c0da --- /dev/null +++ b/tests/ui/single_char_idents.stderr @@ -0,0 +1,100 @@ +error: this ident comprises of a single char + --> $DIR/single_char_idents.rs:9:8 + | +LL | struct A { + | ^ + | + = note: `-D clippy::single-char-idents` implied by `-D warnings` + +error: this ident comprises of a single char + --> $DIR/single_char_idents.rs:10:5 + | +LL | a: u32, + | ^ + +error: this ident comprises of a single char + --> $DIR/single_char_idents.rs:12:5 + | +LL | A: u32, + | ^ + +error: this ident comprises of a single char + --> $DIR/single_char_idents.rs:13:5 + | +LL | I: u32, + | ^ + +error: this ident comprises of a single char + --> $DIR/single_char_idents.rs:16:8 + | +LL | struct B(u32); + | ^ + +error: this ident comprises of a single char + --> $DIR/single_char_idents.rs:20:6 + | +LL | enum C { + | ^ + +error: this ident comprises of a single char + --> $DIR/single_char_idents.rs:21:5 + | +LL | D, + | ^ + +error: this ident comprises of a single char + --> $DIR/single_char_idents.rs:22:5 + | +LL | E, + | ^ + +error: this ident comprises of a single char + --> $DIR/single_char_idents.rs:23:5 + | +LL | F, + | ^ + +error: this ident comprises of a single char + --> $DIR/single_char_idents.rs:31:5 + | +LL | w: u32, + | ^ + +error: this ident comprises of a single char + --> $DIR/single_char_idents.rs:34:11 + | +LL | struct AA<T, E>(T, E); + | ^ + +error: this ident comprises of a single char + --> $DIR/single_char_idents.rs:34:14 + | +LL | struct AA<T, E>(T, E); + | ^ + +error: this ident comprises of a single char + --> $DIR/single_char_idents.rs:34:17 + | +LL | struct AA<T, E>(T, E); + | ^ + +error: this ident comprises of a single char + --> $DIR/single_char_idents.rs:34:20 + | +LL | struct AA<T, E>(T, E); + | ^ + +error: this ident comprises of a single char + --> $DIR/single_char_idents.rs:38:9 + | +LL | let w = 1; + | ^ + +error: this ident comprises of a single char + --> $DIR/single_char_idents.rs:58:4 + | +LL | fn b() {} + | ^ + +error: aborting due to 16 previous errors + diff --git a/tests/ui/single_letter_idents.stderr b/tests/ui/single_letter_idents.stderr deleted file mode 100644 index 712c1664235..00000000000 --- a/tests/ui/single_letter_idents.stderr +++ /dev/null @@ -1,100 +0,0 @@ -error: this ident comprises of a single letter - --> $DIR/single_letter_idents.rs:9:8 - | -LL | struct A { - | ^ - | - = note: `-D clippy::single-letter-idents` implied by `-D warnings` - -error: this ident comprises of a single letter - --> $DIR/single_letter_idents.rs:10:5 - | -LL | a: u32, - | ^ - -error: this ident comprises of a single letter - --> $DIR/single_letter_idents.rs:12:5 - | -LL | A: u32, - | ^ - -error: this ident comprises of a single letter - --> $DIR/single_letter_idents.rs:13:5 - | -LL | I: u32, - | ^ - -error: this ident comprises of a single letter - --> $DIR/single_letter_idents.rs:16:8 - | -LL | struct B(u32); - | ^ - -error: this ident comprises of a single letter - --> $DIR/single_letter_idents.rs:20:6 - | -LL | enum C { - | ^ - -error: this ident comprises of a single letter - --> $DIR/single_letter_idents.rs:21:5 - | -LL | D, - | ^ - -error: this ident comprises of a single letter - --> $DIR/single_letter_idents.rs:22:5 - | -LL | E, - | ^ - -error: this ident comprises of a single letter - --> $DIR/single_letter_idents.rs:23:5 - | -LL | F, - | ^ - -error: this ident comprises of a single letter - --> $DIR/single_letter_idents.rs:31:5 - | -LL | w: u32, - | ^ - -error: this ident comprises of a single letter - --> $DIR/single_letter_idents.rs:34:11 - | -LL | struct AA<T, E>(T, E); - | ^ - -error: this ident comprises of a single letter - --> $DIR/single_letter_idents.rs:34:14 - | -LL | struct AA<T, E>(T, E); - | ^ - -error: this ident comprises of a single letter - --> $DIR/single_letter_idents.rs:34:17 - | -LL | struct AA<T, E>(T, E); - | ^ - -error: this ident comprises of a single letter - --> $DIR/single_letter_idents.rs:34:20 - | -LL | struct AA<T, E>(T, E); - | ^ - -error: this ident comprises of a single letter - --> $DIR/single_letter_idents.rs:38:9 - | -LL | let w = 1; - | ^ - -error: this ident comprises of a single letter - --> $DIR/single_letter_idents.rs:58:4 - | -LL | fn b() {} - | ^ - -error: aborting due to 16 previous errors - |
