]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/methods.rs
tests: use fragment of lint text for error checking
[rust.git] / tests / compile-fail / methods.rs
1 #![feature(plugin)]
2 #![plugin(clippy)]
3
4 #[deny(option_unwrap_used, result_unwrap_used)]
5 #[deny(str_to_string, string_to_string)]
6 fn main() {
7     let opt = Some(0);
8     let _ = opt.unwrap();  //~ERROR used unwrap() on an Option
9
10     let res: Result<i32, ()> = Ok(0);
11     let _ = res.unwrap();  //~ERROR used unwrap() on a Result
12
13     let string = "str".to_string();  //~ERROR `str.to_owned()` is faster
14     let _again = string.to_string();  //~ERROR `String.to_string()` is a no-op
15 }