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