summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/err_expect.rs
blob: 6e7c47d9ad3cf09f49736c3a092577a5d2aed96e (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
// run-rustfix

#![feature(custom_inner_attributes)]
#![allow(unused)]

struct MyTypeNonDebug;

#[derive(Debug)]
struct MyTypeDebug;

fn main() {
    let test_debug: Result<MyTypeDebug, u32> = Ok(MyTypeDebug);
    test_debug.err().expect("Testing debug type");

    let test_non_debug: Result<MyTypeNonDebug, u32> = Ok(MyTypeNonDebug);
    test_non_debug.err().expect("Testing non debug type");
}

fn msrv_1_16() {
    #![clippy::msrv = "1.16"]

    let x: Result<u32, &str> = Ok(16);
    x.err().expect("16");
}

fn msrv_1_17() {
    #![clippy::msrv = "1.17"]

    let x: Result<u32, &str> = Ok(17);
    x.err().expect("17");
}