]> git.lizzy.rs Git - rust.git/blob - tests/ui/did_you_mean/issue-54109-without-witness.fixed
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / did_you_mean / issue-54109-without-witness.fixed
1 // run-rustfix
2
3 // This test is to check if suggestions can be applied automatically.
4
5 #![allow(dead_code, unused_parens)]
6
7 fn main() {}
8
9 fn test_and() {
10     let a = true;
11     let b = false;
12
13     let _ = a && b; //~ ERROR `and` is not a logical operator
14
15     if a && b { //~ ERROR `and` is not a logical operator
16         println!("both");
17     }
18 }
19
20 fn test_or() {
21     let a = true;
22     let b = false;
23
24     let _ = a || b; //~ ERROR `or` is not a logical operator
25
26     if a || b { //~ ERROR `or` is not a logical operator
27         println!("both");
28     }
29 }
30
31 fn test_and_par() {
32     let a = true;
33     let b = false;
34     if (a && b) {  //~ ERROR `and` is not a logical operator
35         println!("both");
36     }
37 }
38
39 fn test_or_par() {
40     let a = true;
41     let b = false;
42     if (a || b) {  //~ ERROR `or` is not a logical operator
43         println!("both");
44     }
45 }
46
47 fn test_while_and() {
48     let a = true;
49     let b = false;
50     while a && b {  //~ ERROR `and` is not a logical operator
51         println!("both");
52     }
53 }
54
55 fn test_while_or() {
56     let a = true;
57     let b = false;
58     while a || b { //~ ERROR `or` is not a logical operator
59         println!("both");
60     }
61 }