mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Mark more tests as run-rustfix
This commit is contained in:
parent
90db536741
commit
1c69c6ab08
@ -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;
|
||||
|
||||
pub fn main() {
|
||||
|
@ -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
|
||||
|
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 {
|
||||
selections: Vec<(char, Option<String>)>,
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user