rust-clippy/tests/ui/non_expressive_names.rs

59 lines
1.3 KiB
Rust
Raw Normal View History

#![warn(clippy::all)]
#![allow(unused, clippy::println_empty_string, non_snake_case, clippy::let_unit_value)]
#[derive(Clone, Debug)]
enum MaybeInst {
Split,
Split1(usize),
Split2(usize),
}
struct InstSplit {
uiae: usize,
}
impl MaybeInst {
fn fill(&mut self) {
#[allow(non_fmt_panics)]
let filled = match *self {
MaybeInst::Split1(goto1) => panic!("1"),
MaybeInst::Split2(goto2) => panic!("2"),
_ => unimplemented!(),
};
unimplemented!()
}
}
fn underscores_and_numbers() {
2023-04-20 15:19:36 +00:00
let _1 = 1; //~ERROR: consider choosing a more descriptive name
let ____1 = 1; //~ERROR: consider choosing a more descriptive name
let __1___2 = 12; //~ERROR: consider choosing a more descriptive name
2018-12-09 22:26:16 +00:00
let _1_ok = 1;
2017-11-03 20:54:33 +00:00
}
2018-02-02 06:49:47 +00:00
2018-08-15 06:11:07 +00:00
fn issue2927() {
2018-12-09 22:26:16 +00:00
let args = 1;
format!("{:?}", 2);
2018-08-15 06:11:07 +00:00
}
2018-08-25 12:49:56 +00:00
fn issue3078() {
#[allow(clippy::single_match)]
2018-08-25 12:49:56 +00:00
match "a" {
stringify!(a) => {},
2018-12-09 22:26:16 +00:00
_ => {},
2018-08-25 12:49:56 +00:00
}
}
2018-02-02 06:49:47 +00:00
struct Bar;
impl Bar {
fn bar() {
2023-04-20 15:19:36 +00:00
let _1 = 1; //~ERROR: consider choosing a more descriptive name
let ____1 = 1; //~ERROR: consider choosing a more descriptive name
let __1___2 = 12; //~ERROR: consider choosing a more descriptive name
2018-12-09 22:26:16 +00:00
let _1_ok = 1;
2018-02-02 06:49:47 +00:00
}
}
fn main() {}