summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/needless_return_with_question_mark.fixed
blob: 52d5418092148c24dde0ca9247eebc9eb9f6f0f4 (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
//@aux-build:proc_macros.rs
#![allow(
    clippy::needless_return,
    clippy::no_effect,
    clippy::unit_arg,
    clippy::useless_conversion,
    unused
)]

#[macro_use]
extern crate proc_macros;

fn a() -> u32 {
    return 0;
}

fn b() -> Result<u32, u32> {
    return Err(0);
}

// Do not lint
fn c() -> Option<()> {
    return None?;
}

fn main() -> Result<(), ()> {
    Err(())?;
    return Ok::<(), ()>(());
    Err(())?;
    Ok::<(), ()>(());
    return Err(().into());
    external! {
        return Err(())?;
    }
    with_span! {
        return Err(())?;
    }
    Err(())
}