mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-21 02:23:19 +00:00
19 lines
284 B
Rust
19 lines
284 B
Rust
#![allow(clippy::unnecessary_literal_unwrap)]
|
|
|
|
trait IsErr {
|
|
fn is_err(&self, err: &str) -> bool;
|
|
}
|
|
|
|
impl<T> IsErr for Option<T> {
|
|
fn is_err(&self, _err: &str) -> bool {
|
|
true
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let t = Some(1);
|
|
|
|
if t.is_err("") {
|
|
t.unwrap();
|
|
}
|
|
}
|