rust/tests/ui/single_char_idents.rs

60 lines
814 B
Rust
Raw Normal View History

2023-06-09 13:33:30 -05:00
//@aux-build:proc_macros.rs
#![allow(nonstandard_style, unused)]
2023-06-09 14:45:53 -05:00
#![warn(clippy::single_char_idents)]
2023-06-09 13:33:30 -05:00
extern crate proc_macros;
use proc_macros::external;
use proc_macros::with_span;
struct A {
a: u32,
i: u32,
A: u32,
I: u32,
}
struct B(u32);
struct i;
enum C {
D,
E,
F,
j,
}
struct Vec4 {
x: u32,
y: u32,
z: u32,
w: u32,
}
struct AA<T, E>(T, E);
fn main() {
// Allowed idents
let w = 1;
// Ok, not this one
// let i = 1;
let j = 1;
let n = 1;
let x = 1;
let y = 1;
let z = 1;
for j in 0..1000 {}
// Do not lint code from external macros
external! { for j in 0..1000 {} }
// Do not lint code from procedural macros
with_span! {
span
for j in 0..1000 {}
}
}
fn b() {}
fn owo() {}