summary refs log tree commit diff
path: root/src/test/ui/parser/require-parens-for-chained-comparison.rs
blob: 4e97904ed6d5f9f178aa6954b3673368724c1239 (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
fn f<T>() {}
struct X;

fn main() {
    false == false == false;
    //~^ ERROR comparison operators cannot be chained
    //~| HELP split the comparison into two

    false == 0 < 2;
    //~^ ERROR comparison operators cannot be chained
    //~| HELP parenthesize the comparison

    f<X>();
    //~^ ERROR comparison operators cannot be chained
    //~| HELP use `::<...>` instead of `<...>` to specify type arguments

    f<Result<Option<X>, Option<Option<X>>>(1, 2);
    //~^ ERROR comparison operators cannot be chained
    //~| HELP use `::<...>` instead of `<...>` to specify type arguments

    use std::convert::identity;
    let _ = identity<u8>;
    //~^ ERROR comparison operators cannot be chained
    //~| HELP use `::<...>` instead of `<...>` to specify type arguments
    //~| HELP or use `(...)` if you meant to specify fn arguments
}