mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
60 lines
1 KiB
Rust
60 lines
1 KiB
Rust
// run-rustfix
|
|
|
|
#![warn(clippy::all)]
|
|
#![warn(clippy::redundant_pattern_matching)]
|
|
#![allow(clippy::unit_arg, clippy::let_unit_value, unused_must_use)]
|
|
|
|
fn main() {
|
|
Ok::<i32, i32>(42).is_ok();
|
|
|
|
Err::<i32, i32>(42).is_err();
|
|
|
|
None::<()>.is_none();
|
|
|
|
Some(42).is_some();
|
|
|
|
if Ok::<i32, i32>(42).is_ok() {}
|
|
|
|
if Err::<i32, i32>(42).is_err() {}
|
|
|
|
if None::<i32>.is_none() {}
|
|
|
|
if Some(42).is_some() {}
|
|
|
|
if let Ok(x) = Ok::<i32, i32>(42) {
|
|
println!("{}", x);
|
|
}
|
|
|
|
Ok::<i32, i32>(42).is_ok();
|
|
|
|
Ok::<i32, i32>(42).is_err();
|
|
|
|
Err::<i32, i32>(42).is_err();
|
|
|
|
Err::<i32, i32>(42).is_ok();
|
|
|
|
Some(42).is_some();
|
|
|
|
None::<()>.is_none();
|
|
|
|
let _ = None::<()>.is_none();
|
|
|
|
let _ = Ok::<usize, ()>(4).is_ok();
|
|
|
|
let _ = does_something();
|
|
let _ = returns_unit();
|
|
|
|
let opt = Some(false);
|
|
let x = opt.is_some();
|
|
takes_bool(x);
|
|
}
|
|
|
|
fn takes_bool(_: bool) {}
|
|
|
|
fn does_something() -> bool {
|
|
Ok::<i32, i32>(4).is_ok()
|
|
}
|
|
|
|
fn returns_unit() {
|
|
Ok::<i32, i32>(4).is_ok();
|
|
}
|