mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 17:28:07 +00:00
18 lines
237 B
Rust
18 lines
237 B
Rust
|
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();
|
||
|
}
|
||
|
}
|