mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 17:28:07 +00:00
49 lines
899 B
Rust
49 lines
899 B
Rust
//run-rustfix
|
|
#![warn(clippy::unnecessary_literal_unwrap)]
|
|
#![allow(clippy::unnecessary_lazy_evaluations)]
|
|
#![allow(unreachable_code)]
|
|
|
|
fn unwrap_option_some() {
|
|
let _val = 1;
|
|
let _val = 1;
|
|
}
|
|
|
|
fn unwrap_option_none() {
|
|
panic!();
|
|
panic!("this always happens");
|
|
}
|
|
|
|
fn unwrap_result_ok() {
|
|
let _val = 1;
|
|
let _val = 1;
|
|
panic!("{:?}", 1);
|
|
panic!("{1}: {:?}", 1, "this always happens");
|
|
}
|
|
|
|
fn unwrap_result_err() {
|
|
let _val = 1;
|
|
let _val = 1;
|
|
panic!("{:?}", 1);
|
|
panic!("{1}: {:?}", 1, "this always happens");
|
|
}
|
|
|
|
fn unwrap_methods_option() {
|
|
let _val = 1;
|
|
let _val = 1;
|
|
let _val = 1;
|
|
}
|
|
|
|
fn unwrap_methods_result() {
|
|
let _val = 1;
|
|
let _val = 1;
|
|
let _val = 1;
|
|
}
|
|
|
|
fn main() {
|
|
unwrap_option_some();
|
|
unwrap_option_none();
|
|
unwrap_result_ok();
|
|
unwrap_result_err();
|
|
unwrap_methods_option();
|
|
unwrap_methods_result();
|
|
}
|