summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/empty_drop.rs
blob: 6c15cb9330276ff7dcbdcc484bd81119d7d11997 (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
//@run-rustfix
#![warn(clippy::empty_drop)]
#![allow(unused)]

// should cause an error
struct Foo;

impl Drop for Foo {
    fn drop(&mut self) {}
}

// shouldn't cause an error
struct Bar;

impl Drop for Bar {
    fn drop(&mut self) {
        println!("dropping bar!");
    }
}

// should error
struct Baz;

impl Drop for Baz {
    fn drop(&mut self) {
        {}
    }
}

fn main() {}