summary refs log tree commit diff
path: root/src/test/ui/parser/require-parens-for-chained-comparison.rs
blob: 9c7a25d589a1f9aafa988098042db58979b5dc5a (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 chained comparison operators require parentheses

    false == 0 < 2;
    //~^ ERROR chained comparison operators require parentheses
    //~| ERROR mismatched types
    //~| ERROR mismatched types

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

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

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