rust-clippy/tests/ui/unnecessary_literal_unwrap.fixed

34 lines
552 B
Rust
Raw Normal View History

2023-02-16 14:21:43 +00:00
//run-rustfix
#![warn(clippy::unnecessary_literal_unwrap)]
2023-02-16 15:05:56 +00:00
#![allow(clippy::unnecessary_lazy_evaluations)]
2023-02-16 14:21:43 +00:00
fn unwrap_option() {
2023-02-16 14:37:18 +00:00
let _val = 1;
let _val = 1;
}
fn unwrap_result() {
let _val = 1;
let _val = 1;
// let val = Err(1).unwrap_err();
2023-02-16 14:21:43 +00:00
}
2023-02-16 14:43:41 +00:00
fn unwrap_methods_option() {
let _val = 1;
let _val = 1;
2023-02-16 15:05:56 +00:00
let _val = 1;
2023-02-16 14:43:41 +00:00
}
fn unwrap_methods_result() {
let _val = 1;
let _val = 1;
2023-02-16 15:05:56 +00:00
let _val = 1;
2023-02-16 14:43:41 +00:00
}
2023-02-16 14:21:43 +00:00
fn main() {
unwrap_option();
2023-02-16 14:37:18 +00:00
unwrap_result();
2023-02-16 14:43:41 +00:00
unwrap_methods_option();
unwrap_methods_result();
2023-02-16 14:21:43 +00:00
}