rust-clippy/tests/ui/empty_drop.rs

31 lines
387 B
Rust
Raw Normal View History

//@run-rustfix
2022-03-25 19:31:52 +00:00
#![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() {}