]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/option-content-move.rs
Update tests for changes to cannot move errors
[rust.git] / src / test / ui / suggestions / option-content-move.rs
1 //run-rustfix
2
3 pub struct LipogramCorpora {
4     selections: Vec<(char, Option<String>)>,
5 }
6
7 impl LipogramCorpora {
8     pub fn validate_all(&mut self) -> Result<(), char> {
9         for selection in &self.selections {
10             if selection.1.is_some() {
11                 if selection.1.unwrap().contains(selection.0) {
12                 //~^ ERROR cannot move out of `selection.1`
13                     return Err(selection.0);
14                 }
15             }
16         }
17         Ok(())
18     }
19 }
20
21 pub struct LipogramCorpora2 {
22     selections: Vec<(char, Result<String, String>)>,
23 }
24
25 impl LipogramCorpora2 {
26     pub fn validate_all(&mut self) -> Result<(), char> {
27         for selection in &self.selections {
28             if selection.1.is_ok() {
29                 if selection.1.unwrap().contains(selection.0) {
30                 //~^ ERROR cannot move out of `selection.1`
31                     return Err(selection.0);
32                 }
33             }
34         }
35         Ok(())
36     }
37 }
38
39 fn main() {}