mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
27 lines
445 B
Rust
27 lines
445 B
Rust
#![feature(plugin)]
|
|
#![plugin(clippy)]
|
|
|
|
#[deny(cmp_owned)]
|
|
#[allow(unnecessary_operation)]
|
|
fn main() {
|
|
fn with_to_string(x : &str) {
|
|
x != "foo".to_string();
|
|
|
|
|
|
"foo".to_string() != x;
|
|
|
|
}
|
|
|
|
let x = "oh";
|
|
|
|
with_to_string(x);
|
|
|
|
x != "foo".to_owned();
|
|
|
|
// removed String::from_str(..), as it has finally been removed in 1.4.0
|
|
// as of 2015-08-14
|
|
|
|
x != String::from("foo");
|
|
|
|
42.to_string() == "42";
|
|
}
|