fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

1.41.0
1004 B39 linesraw
1//run-rustfix
2
3pub struct LipogramCorpora {
4    selections: Vec<(char, Option<String>)>,
5}
6
7impl 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.as_ref().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
21pub struct LipogramCorpora2 {
22    selections: Vec<(char, Result<String, String>)>,
23}
24
25impl 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.as_ref().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
39fn main() {}