Skip to content

Commit c79838e

Browse files
committed
Auto merge of #4089 - flip1995:id_conv_reg_test, r=Manishearth
Add regression test for identity_conversion FP cc #3913 #4082 #3936 changelog: none
2 parents 2122bdb + a5bcaf5 commit c79838e

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

tests/ui/identity_conversion.rs

+11
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,21 @@ fn test_questionmark() -> Result<(), ()> {
2020
Ok(())
2121
}
2222

23+
fn test_issue_3913() -> Result<(), std::io::Error> {
24+
use std::fs;
25+
use std::path::Path;
26+
27+
let path = Path::new(".");
28+
for _ in fs::read_dir(path)? {}
29+
30+
Ok(())
31+
}
32+
2333
fn main() {
2434
test_generic(10i32);
2535
test_generic2::<i32, i32>(10i32);
2636
test_questionmark().unwrap();
37+
test_issue_3913().unwrap();
2738

2839
let _: String = "foo".into();
2940
let _: String = From::from("foo");

tests/ui/identity_conversion.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,43 +23,43 @@ LL | let _: i32 = 0i32.into();
2323
| ^^^^^^^^^^^ help: consider removing `.into()`: `0i32`
2424

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

3131
error: identical conversion
32-
--> $DIR/identity_conversion.rs:39:21
32+
--> $DIR/identity_conversion.rs:50:21
3333
|
3434
LL | 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:40:13
38+
--> $DIR/identity_conversion.rs:51:13
3939
|
4040
LL | let _ = String::from("foo".to_string());
4141
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `"foo".to_string()`
4242

4343
error: identical conversion
44-
--> $DIR/identity_conversion.rs:41:13
44+
--> $DIR/identity_conversion.rs:52:13
4545
|
4646
LL | let _ = String::from(format!("A: {:04}", 123));
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `format!("A: {:04}", 123)`
4848

4949
error: identical conversion
50-
--> $DIR/identity_conversion.rs:42:13
50+
--> $DIR/identity_conversion.rs:53:13
5151
|
5252
LL | let _ = "".lines().into_iter();
5353
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `"".lines()`
5454

5555
error: identical conversion
56-
--> $DIR/identity_conversion.rs:43:13
56+
--> $DIR/identity_conversion.rs:54:13
5757
|
5858
LL | let _ = vec![1, 2, 3].into_iter().into_iter();
5959
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![1, 2, 3].into_iter()`
6060

6161
error: identical conversion
62-
--> $DIR/identity_conversion.rs:44:21
62+
--> $DIR/identity_conversion.rs:55:21
6363
|
6464
LL | let _: String = format!("Hello {}", "world").into();
6565
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `format!("Hello {}", "world")`

0 commit comments

Comments
 (0)