From 1b1b41a5e6c77f80762be0cff6f759461e70ce61 Mon Sep 17 00:00:00 2001 From: sinkuu Date: Wed, 4 Oct 2017 22:26:41 +0900 Subject: [PATCH] Test if #[allow] works --- tests/ui/identity_conversion.rs | 5 +++++ tests/ui/identity_conversion.stderr | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/ui/identity_conversion.rs b/tests/ui/identity_conversion.rs index 81cbdd9643a..d254b746d79 100644 --- a/tests/ui/identity_conversion.rs +++ b/tests/ui/identity_conversion.rs @@ -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()); diff --git a/tests/ui/identity_conversion.stderr b/tests/ui/identity_conversion.stderr index 8e8d8a70124..152bb8882bd 100644 --- a/tests/ui/identity_conversion.stderr +++ b/tests/ui/identity_conversion.stderr @@ -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()` -- 2.44.0