1a9dc2e902
As reported in #19140, #44083, and #44565, some users were confused when the dead-code lint reported an enum variant to be "unused" when it was matched on (but not constructed). This wording change makes it clearer that the lint is in fact checking for construction. We continue to say "used" for all other items (it's tempting to say "called" for functions and methods, but this turns out not to be correct: functions can be passed as arguments and the dead-code lint isn't special-casing that or anything). Resolves #19140.
23 lines
645 B
Rust
23 lines
645 B
Rust
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
// file at the top-level directory of this distribution and at
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
// option. This file may not be copied, modified, or distributed
|
|
// except according to those terms.
|
|
|
|
#![deny(dead_code)]
|
|
|
|
#[derive(Clone)]
|
|
enum Enum {
|
|
Variant1, //~ ERROR: variant is never constructed
|
|
Variant2,
|
|
}
|
|
|
|
fn main() {
|
|
let e = Enum::Variant2;
|
|
e.clone();
|
|
}
|