Mark more tests as run-rustfix
This commit is contained in:
parent
90db536741
commit
1c69c6ab08
6 changed files with 50 additions and 3 deletions
|
@ -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]
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-rustfix
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0507]: cannot move out of an `Rc`
|
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();
|
LL | let _x = Rc::new(vec![1, 2]).into_iter();
|
||||||
| ^^^^^^^^^^^^^^^^^^^ ----------- value moved due to this method call
|
| ^^^^^^^^^^^^^^^^^^^ ----------- value moved due to this method call
|
||||||
|
|
38
tests/ui/suggestions/option-content-move.fixed
Normal file
38
tests/ui/suggestions/option-content-move.fixed
Normal 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() {}
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-rustfix
|
||||||
pub struct LipogramCorpora {
|
pub struct LipogramCorpora {
|
||||||
selections: Vec<(char, Option<String>)>,
|
selections: Vec<(char, Option<String>)>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0507]: cannot move out of `selection.1` which is behind a shared reference
|
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) {
|
LL | if selection.1.unwrap().contains(selection.0) {
|
||||||
| ^^^^^^^^^^^ -------- `selection.1` moved due to this method call
|
| ^^^^^^^^^^^ -------- `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
|
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) {
|
LL | if selection.1.unwrap().contains(selection.0) {
|
||||||
| ^^^^^^^^^^^ -------- `selection.1` moved due to this method call
|
| ^^^^^^^^^^^ -------- `selection.1` moved due to this method call
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue