exhaustive_items.fixed 525 字节
Newer Older
M
Manish Goregaokar 已提交
1 2 3 4 5 6 7 8 9 10
// run-rustfix

#![deny(clippy::exhaustive_enums)]
#![allow(unused)]

fn main() {
    // nop
}

#[non_exhaustive]
11
pub enum Exhaustive {
M
Manish Goregaokar 已提交
12 13 14 15 16 17
    Foo,
    Bar,
    Baz,
    Quux(String),
}

18
// no warning, already non_exhaustive
M
Manish Goregaokar 已提交
19
#[non_exhaustive]
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
pub enum NonExhaustive {
    Foo,
    Bar,
    Baz,
    Quux(String),
}

// no warning, private
enum ExhaustivePrivate {
    Foo,
    Bar,
    Baz,
    Quux(String),
}

// no warning, private
#[non_exhaustive]
enum NonExhaustivePrivate {
M
Manish Goregaokar 已提交
38 39 40 41 42
    Foo,
    Bar,
    Baz,
    Quux(String),
}