mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 17:28:07 +00:00
eb3970285b
In order to switch `clippy::uninlined_format_args` from pedantic to style, all existing tests must not raise a warning. I did not want to change the actual tests, so this is a relatively minor change that: * add `#![allow(clippy::uninlined_format_args)]` where needed * normalizes all allow/deny/warn attributes * all allow attributes are grouped together * sorted alphabetically * the `clippy::*` attributes are listed separate from the other ones. * deny and warn attributes are listed before the allowed ones changelog: none
30 lines
725 B
Rust
30 lines
725 B
Rust
// run-rustfix
|
|
#![warn(clippy::reversed_empty_ranges)]
|
|
#![allow(clippy::uninlined_format_args)]
|
|
|
|
const ANSWER: i32 = 42;
|
|
|
|
fn main() {
|
|
// These should be linted:
|
|
|
|
(42..=21).for_each(|x| println!("{}", x));
|
|
let _ = (ANSWER..21).filter(|x| x % 2 == 0).take(10).collect::<Vec<_>>();
|
|
|
|
for _ in -21..=-42 {}
|
|
for _ in 42u32..21u32 {}
|
|
|
|
// These should be ignored as they are not empty ranges:
|
|
|
|
(21..=42).for_each(|x| println!("{}", x));
|
|
(21..42).for_each(|x| println!("{}", x));
|
|
|
|
let arr = [1, 2, 3, 4, 5];
|
|
let _ = &arr[1..=3];
|
|
let _ = &arr[1..3];
|
|
|
|
for _ in 21..=42 {}
|
|
for _ in 21..42 {}
|
|
|
|
// This range is empty but should be ignored, see issue #5689
|
|
let _ = &arr[0..0];
|
|
}
|