about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/track-diagnostics-clippy.rs
blob: 3bae23f19849564605c3da94412ca0d2186c0898 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//@compile-flags: -Z track-diagnostics
//@no-rustfix

// Normalize the emitted location so this doesn't need
// updating everytime someone adds or removes a line.
//@normalize-stderr-test: ".rs:\d+:\d+" -> ".rs:LL:CC"
//@normalize-stderr-test: "src/tools/clippy/" -> ""

#![warn(clippy::let_and_return, clippy::unnecessary_cast)]

fn main() {
    // Check the provenance of a lint sent through `LintContext::span_lint()`
    let a = 3u32;
    let b = a as u32;
    //~^ unnecessary_cast

    // Check the provenance of a lint sent through `TyCtxt::node_span_lint()`
    let c = {
        let d = 42;
        d
        //~^ let_and_return
    };
}