mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-16 18:44:56 +00:00
61 lines
1.0 KiB
Rust
61 lines
1.0 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();
|
|
}
|