Mark more tests as run-rustfix

This commit is contained in:
Esteban Küber 2023-11-20 23:57:59 +00:00
parent 90db536741
commit 1c69c6ab08
6 changed files with 50 additions and 3 deletions

View File

@ -0,0 +1,7 @@
// run-rustfix
use std::rc::Rc;
pub fn main() {
let _x = <Vec<i32> as Clone>::clone(&Rc::new(vec![1, 2])).into_iter();
//~^ ERROR [E0507]
}

View File

@ -1,3 +1,4 @@
// run-rustfix
use std::rc::Rc;
pub fn main() {

View File

@ -1,5 +1,5 @@
error[E0507]: cannot move out of an `Rc`
--> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:4:14
--> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:5:14
|
LL | let _x = Rc::new(vec![1, 2]).into_iter();
| ^^^^^^^^^^^^^^^^^^^ ----------- value moved due to this method call

View File

@ -0,0 +1,38 @@
// run-rustfix
pub struct LipogramCorpora {
selections: Vec<(char, Option<String>)>,
}
impl LipogramCorpora {
pub fn validate_all(&mut self) -> Result<(), char> {
for selection in &self.selections {
if selection.1.is_some() {
if <Option<String> as Clone>::clone(&selection.1).unwrap().contains(selection.0) {
//~^ ERROR cannot move out of `selection.1`
return Err(selection.0);
}
}
}
Ok(())
}
}
pub struct LipogramCorpora2 {
selections: Vec<(char, Result<String, String>)>,
}
impl LipogramCorpora2 {
pub fn validate_all(&mut self) -> Result<(), char> {
for selection in &self.selections {
if selection.1.is_ok() {
if <Result<String, String> as Clone>::clone(&selection.1).unwrap().contains(selection.0) {
//~^ ERROR cannot move out of `selection.1`
return Err(selection.0);
}
}
}
Ok(())
}
}
fn main() {}

View File

@ -1,3 +1,4 @@
// run-rustfix
pub struct LipogramCorpora {
selections: Vec<(char, Option<String>)>,
}

View File

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