mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 01:17:16 +00:00
52 lines
1.6 KiB
Text
52 lines
1.6 KiB
Text
error: this creates an owned instance just for comparison
|
|
--> $DIR/cmp_owned.rs:18:14
|
|
|
|
|
18 | x != "foo".to_string();
|
|
| ^^^^^^^^^^^^^^^^^ help: try: `"foo"`
|
|
|
|
|
= note: `-D clippy::cmp-owned` implied by `-D warnings`
|
|
|
|
error: this creates an owned instance just for comparison
|
|
--> $DIR/cmp_owned.rs:20:9
|
|
|
|
|
20 | "foo".to_string() != x;
|
|
| ^^^^^^^^^^^^^^^^^ help: try: `"foo"`
|
|
|
|
error: this creates an owned instance just for comparison
|
|
--> $DIR/cmp_owned.rs:27:10
|
|
|
|
|
27 | x != "foo".to_owned();
|
|
| ^^^^^^^^^^^^^^^^ help: try: `"foo"`
|
|
|
|
error: this creates an owned instance just for comparison
|
|
--> $DIR/cmp_owned.rs:29:10
|
|
|
|
|
29 | x != String::from("foo");
|
|
| ^^^^^^^^^^^^^^^^^^^ help: try: `"foo"`
|
|
|
|
error: this creates an owned instance just for comparison
|
|
--> $DIR/cmp_owned.rs:33:5
|
|
|
|
|
33 | Foo.to_owned() == Foo;
|
|
| ^^^^^^^^^^^^^^ help: try: `Foo`
|
|
|
|
error: this creates an owned instance just for comparison
|
|
--> $DIR/cmp_owned.rs:35:30
|
|
|
|
|
35 | "abc".chars().filter(|c| c.to_owned() != 'X');
|
|
| ^^^^^^^^^^^^ help: try: `*c`
|
|
|
|
error: this creates an owned instance just for comparison
|
|
--> $DIR/cmp_owned.rs:42:5
|
|
|
|
|
42 | y.to_owned() == *x;
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `y == x`
|
|
|
|
error: this creates an owned instance just for comparison
|
|
--> $DIR/cmp_owned.rs:49:9
|
|
|
|
|
49 | self.to_owned() == *other
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ try implementing the comparison without allocating
|
|
|
|
error: aborting due to 8 previous errors
|
|
|