mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
7aee04878f
(Did not touch strings.rs, which is fixed by @llogiq's PR)
15 lines
483 B
Rust
Executable file
15 lines
483 B
Rust
Executable file
#![feature(plugin)]
|
|
#![plugin(clippy)]
|
|
|
|
#[deny(option_unwrap_used, result_unwrap_used)]
|
|
#[deny(str_to_string, string_to_string)]
|
|
fn main() {
|
|
let opt = Some(0);
|
|
let _ = opt.unwrap(); //~ERROR used unwrap() on an Option
|
|
|
|
let res: Result<i32, ()> = Ok(0);
|
|
let _ = res.unwrap(); //~ERROR used unwrap() on a Result
|
|
|
|
let string = "str".to_string(); //~ERROR `str.to_owned()` is faster
|
|
let _again = string.to_string(); //~ERROR `String.to_string()` is a no-op
|
|
}
|