Skip to content

Commit 1c69c6a

Browse files
committed
Mark more tests as run-rustfix
1 parent 90db536 commit 1c69c6a

6 files changed

+50
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// run-rustfix
2+
use std::rc::Rc;
3+
4+
pub fn main() {
5+
let _x = <Vec<i32> as Clone>::clone(&Rc::new(vec![1, 2])).into_iter();
6+
//~^ ERROR [E0507]
7+
}

tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs

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

34
pub fn main() {

tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0507]: cannot move out of an `Rc`
2-
--> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:4:14
2+
--> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:5:14
33
|
44
LL | let _x = Rc::new(vec![1, 2]).into_iter();
55
| ^^^^^^^^^^^^^^^^^^^ ----------- value moved due to this method call
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// run-rustfix
2+
pub struct LipogramCorpora {
3+
selections: Vec<(char, Option<String>)>,
4+
}
5+
6+
impl LipogramCorpora {
7+
pub fn validate_all(&mut self) -> Result<(), char> {
8+
for selection in &self.selections {
9+
if selection.1.is_some() {
10+
if <Option<String> as Clone>::clone(&selection.1).unwrap().contains(selection.0) {
11+
//~^ ERROR cannot move out of `selection.1`
12+
return Err(selection.0);
13+
}
14+
}
15+
}
16+
Ok(())
17+
}
18+
}
19+
20+
pub struct LipogramCorpora2 {
21+
selections: Vec<(char, Result<String, String>)>,
22+
}
23+
24+
impl LipogramCorpora2 {
25+
pub fn validate_all(&mut self) -> Result<(), char> {
26+
for selection in &self.selections {
27+
if selection.1.is_ok() {
28+
if <Result<String, String> as Clone>::clone(&selection.1).unwrap().contains(selection.0) {
29+
//~^ ERROR cannot move out of `selection.1`
30+
return Err(selection.0);
31+
}
32+
}
33+
}
34+
Ok(())
35+
}
36+
}
37+
38+
fn main() {}

tests/ui/suggestions/option-content-move.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// run-rustfix
12
pub struct LipogramCorpora {
23
selections: Vec<(char, Option<String>)>,
34
}

tests/ui/suggestions/option-content-move.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0507]: cannot move out of `selection.1` which is behind a shared reference
2-
--> $DIR/option-content-move.rs:9:20
2+
--> $DIR/option-content-move.rs:10:20
33
|
44
LL | if selection.1.unwrap().contains(selection.0) {
55
| ^^^^^^^^^^^ -------- `selection.1` moved due to this method call
@@ -15,7 +15,7 @@ LL | if <Option<String> as Clone>::clone(&selection.1).unwrap().
1515
| ++++++++++++++++++++++++++++++++++ +
1616

1717
error[E0507]: cannot move out of `selection.1` which is behind a shared reference
18-
--> $DIR/option-content-move.rs:27:20
18+
--> $DIR/option-content-move.rs:28:20
1919
|
2020
LL | if selection.1.unwrap().contains(selection.0) {
2121
| ^^^^^^^^^^^ -------- `selection.1` moved due to this method call

0 commit comments

Comments
 (0)