Skip to content

Commit 65993ee

Browse files
committed
run-rustfix
1 parent ba3cf12 commit 65993ee

18 files changed

+61
-21
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// run-rustfix
2+
struct X {}
3+
fn main() {
4+
let _ = vec![X {}]; //…
5+
//~^ ERROR expected value, found struct `X`
6+
}
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
// run-rustfix
12
struct X {}
23
fn main() {
3-
vec![X]; //…
4+
let _ = vec![X]; //…
45
//~^ ERROR expected value, found struct `X`
56
}

src/test/ui/suggestions/issue-61226.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0423]: expected value, found struct `X`
2-
--> $DIR/issue-61226.rs:3:10
2+
--> $DIR/issue-61226.rs:4:18
33
|
44
LL | struct X {}
55
| ----------- `X` defined here
66
LL | fn main() {
7-
LL | vec![X]; //…
8-
| ^ help: use struct literal syntax instead: `X {}`
7+
LL | let _ = vec![X]; //…
8+
| ^ help: use struct literal syntax instead: `X {}`
99

1010
error: aborting due to previous error
1111

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// run-rustfix
2+
fn main() {
3+
let _ = Box::new("foo".to_string());
4+
//~^ ERROR expected type, found
5+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
// run-rustfix
12
fn main() {
2-
Box:new("foo".to_string())
3+
let _ = Box:new("foo".to_string());
34
//~^ ERROR expected type, found
45
}

src/test/ui/suggestions/type-ascription-instead-of-method.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
error: expected type, found `"foo"`
2-
--> $DIR/type-ascription-instead-of-method.rs:2:13
2+
--> $DIR/type-ascription-instead-of-method.rs:3:21
33
|
4-
LL | Box:new("foo".to_string())
5-
| - ^^^^^ expected type
6-
| |
7-
| help: maybe write a path separator here: `::`
4+
LL | let _ = Box:new("foo".to_string());
5+
| - ^^^^^ expected type
6+
| |
7+
| help: maybe write a path separator here: `::`
88
|
99
= note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>`
1010

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// run-rustfix
2+
fn main() -> Result<(), ()> {
3+
let _ = vec![Ok(2)].into_iter().collect::<Result<Vec<_>,_>>()?;
4+
//~^ ERROR expected `::`, found `(`
5+
Ok(())
6+
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
// run-rustfix
12
fn main() -> Result<(), ()> {
2-
vec![Ok(2)].into_iter().collect:<Result<Vec<_>,_>>()?;
3+
let _ = vec![Ok(2)].into_iter().collect:<Result<Vec<_>,_>>()?;
34
//~^ ERROR expected `::`, found `(`
45
Ok(())
56
}

src/test/ui/suggestions/type-ascription-instead-of-path-2.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
error: expected `::`, found `(`
2-
--> $DIR/type-ascription-instead-of-path-2.rs:2:55
2+
--> $DIR/type-ascription-instead-of-path-2.rs:3:63
33
|
4-
LL | vec![Ok(2)].into_iter().collect:<Result<Vec<_>,_>>()?;
5-
| - ^ expected `::`
6-
| |
7-
| help: maybe write a path separator here: `::`
4+
LL | let _ = vec![Ok(2)].into_iter().collect:<Result<Vec<_>,_>>()?;
5+
| - ^ expected `::`
6+
| |
7+
| help: maybe write a path separator here: `::`
88
|
99
= note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>`
1010

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// run-rustfix
2+
fn main() {
3+
let _ = Option::Some("");
4+
//~^ ERROR expected type, found
5+
}

src/test/ui/suggestions/type-ascription-instead-of-variant.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// run-rustfix
12
fn main() {
23
let _ = Option:Some("");
34
//~^ ERROR expected type, found

src/test/ui/suggestions/type-ascription-instead-of-variant.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: expected type, found `""`
2-
--> $DIR/type-ascription-instead-of-variant.rs:2:25
2+
--> $DIR/type-ascription-instead-of-variant.rs:3:25
33
|
44
LL | let _ = Option:Some("");
55
| - ^^ expected type
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// run-rustfix
2+
use std::collections::BTreeMap;
3+
4+
fn main() {
5+
println!("{}", std::mem::size_of::<BTreeMap<u32, u32>>());
6+
//~^ ERROR casts cannot be followed by a function call
7+
}

src/test/ui/type/ascription/issue-54516.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// run-rustfix
12
use std::collections::BTreeMap;
23

34
fn main() {

src/test/ui/type/ascription/issue-54516.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: casts cannot be followed by a function call
2-
--> $DIR/issue-54516.rs:4:20
2+
--> $DIR/issue-54516.rs:5:20
33
|
44
LL | println!("{}", std::mem:size_of::<BTreeMap<u32, u32>>());
55
| ^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// run-rustfix
2+
fn main() {
3+
let _: usize = std::mem::size_of::<u32>();
4+
//~^ ERROR casts cannot be followed by a function call
5+
}
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
// run-rustfix
12
fn main() {
2-
let u: usize = std::mem:size_of::<u32>();
3+
let _: usize = std::mem:size_of::<u32>();
34
//~^ ERROR casts cannot be followed by a function call
45
}

src/test/ui/type/ascription/issue-60933.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: casts cannot be followed by a function call
2-
--> $DIR/issue-60933.rs:2:20
2+
--> $DIR/issue-60933.rs:3:20
33
|
4-
LL | let u: usize = std::mem:size_of::<u32>();
4+
LL | let _: usize = std::mem:size_of::<u32>();
55
| ^^^^^^^^-^^^^^^^^^^^^^^
66
| |
77
| help: maybe write a path separator here: `::`

0 commit comments

Comments
 (0)