summaryrefslogtreecommitdiffstats
path: root/src/test/ui/did_you_mean/issue-54109-without-witness.fixed
blob: 5079a37f4da7f9821ec4d390ece765a06ea69d45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// run-rustfix

// This test is to check if suggestions can be applied automatically.

#![allow(dead_code, unused_parens)]

fn main() {}

fn test_and() {
    let a = true;
    let b = false;

    let _ = a && b; //~ ERROR `and` is not a logical operator

    if a && b { //~ ERROR `and` is not a logical operator
        println!("both");
    }
}

fn test_or() {
    let a = true;
    let b = false;

    let _ = a || b; //~ ERROR `or` is not a logical operator

    if a || b { //~ ERROR `or` is not a logical operator
        println!("both");
    }
}

fn test_and_par() {
    let a = true;
    let b = false;
    if (a && b) {  //~ ERROR `and` is not a logical operator
        println!("both");
    }
}

fn test_or_par() {
    let a = true;
    let b = false;
    if (a || b) {  //~ ERROR `or` is not a logical operator
        println!("both");
    }
}

fn test_while_and() {
    let a = true;
    let b = false;
    while a && b {  //~ ERROR `and` is not a logical operator
        println!("both");
    }
}

fn test_while_or() {
    let a = true;
    let b = false;
    while a || b { //~ ERROR `or` is not a logical operator
        println!("both");
    }
}