Test if #[allow] works

This commit is contained in:
sinkuu 2017-10-04 22:26:41 +09:00
parent 771d2220d2
commit 1b1b41a5e6
2 changed files with 11 additions and 6 deletions

View File

@ -28,6 +28,11 @@ fn main() {
let _: String = "foo".into();
let _: String = From::from("foo");
let _ = String::from("foo");
#[allow(identity_conversion)]
{
let _: String = "foo".into();
let _ = String::from("foo");
}
let _: String = "foo".to_string().into();
let _: String = From::from("foo".to_string());

View File

@ -23,20 +23,20 @@ error: identical conversion
| ^^^^^^^^^^^ help: consider removing `.into()`: `0i32`
error: identical conversion
--> $DIR/identity_conversion.rs:32:21
--> $DIR/identity_conversion.rs:37:21
|
32 | let _: String = "foo".to_string().into();
37 | let _: String = "foo".to_string().into();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `"foo".to_string()`
error: identical conversion
--> $DIR/identity_conversion.rs:33:21
--> $DIR/identity_conversion.rs:38:21
|
33 | let _: String = From::from("foo".to_string());
38 | let _: String = From::from("foo".to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `From::from()`: `"foo".to_string()`
error: identical conversion
--> $DIR/identity_conversion.rs:34:13
--> $DIR/identity_conversion.rs:39:13
|
34 | let _ = String::from("foo".to_string());
39 | let _ = String::from("foo".to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `"foo".to_string()`