Skip to content

Commit 1b1b41a

Browse files
committed
Test if #[allow] works
1 parent 771d222 commit 1b1b41a

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

tests/ui/identity_conversion.rs

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ fn main() {
2828
let _: String = "foo".into();
2929
let _: String = From::from("foo");
3030
let _ = String::from("foo");
31+
#[allow(identity_conversion)]
32+
{
33+
let _: String = "foo".into();
34+
let _ = String::from("foo");
35+
}
3136

3237
let _: String = "foo".to_string().into();
3338
let _: String = From::from("foo".to_string());

tests/ui/identity_conversion.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ error: identical conversion
2323
| ^^^^^^^^^^^ help: consider removing `.into()`: `0i32`
2424

2525
error: identical conversion
26-
--> $DIR/identity_conversion.rs:32:21
26+
--> $DIR/identity_conversion.rs:37:21
2727
|
28-
32 | let _: String = "foo".to_string().into();
28+
37 | let _: String = "foo".to_string().into();
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `"foo".to_string()`
3030

3131
error: identical conversion
32-
--> $DIR/identity_conversion.rs:33:21
32+
--> $DIR/identity_conversion.rs:38:21
3333
|
34-
33 | let _: String = From::from("foo".to_string());
34+
38 | let _: String = From::from("foo".to_string());
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `From::from()`: `"foo".to_string()`
3636

3737
error: identical conversion
38-
--> $DIR/identity_conversion.rs:34:13
38+
--> $DIR/identity_conversion.rs:39:13
3939
|
40-
34 | let _ = String::from("foo".to_string());
40+
39 | let _ = String::from("foo".to_string());
4141
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `"foo".to_string()`
4242

0 commit comments

Comments
 (0)