mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-19 03:54:40 +00:00
7aee04878f
(Did not touch strings.rs, which is fixed by @llogiq's PR)
16 lines
483 B
Rust
Executable File
16 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
|
|
}
|