make cargo test pass + example

This commit is contained in:
Centri3 2023-06-09 14:45:53 -05:00
parent e2ecb132a5
commit 03c8db048e
4 changed files with 110 additions and 103 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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

View File

@ -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