summaryrefslogtreecommitdiffstats
path: root/src/test/ui/did_you_mean/issue-54109-without-witness.rs
blob: 00660a938d5d625b6e7be016d3f5d6c359698532 (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 and b; //~ ERROR `and` is not a logical operator

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

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

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

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

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

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

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

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