Skip to content

Commit

Permalink
No need for dead code if struct fields are public
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jun 8, 2024
1 parent 4db08b1 commit 479744e
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions tests/test_option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,41 @@ pub mod structs {

#[derive(Error, Debug)]
#[error("...")]
#[allow(dead_code)]
pub struct OptSourceNoBacktrace {
#[source]
source: Option<anyhow::Error>,
pub source: Option<anyhow::Error>,
}

#[derive(Error, Debug)]
#[error("...")]
#[allow(dead_code)]
pub struct OptSourceAlwaysBacktrace {
#[source]
source: Option<anyhow::Error>,
backtrace: Backtrace,
pub source: Option<anyhow::Error>,
pub backtrace: Backtrace,
}

#[derive(Error, Debug)]
#[error("...")]
#[allow(dead_code)]
pub struct NoSourceOptBacktrace {
#[backtrace]
backtrace: Option<Backtrace>,
pub backtrace: Option<Backtrace>,
}

#[derive(Error, Debug)]
#[error("...")]
#[allow(dead_code)]
pub struct AlwaysSourceOptBacktrace {
source: anyhow::Error,
pub source: anyhow::Error,
#[backtrace]
backtrace: Option<Backtrace>,
pub backtrace: Option<Backtrace>,
}

#[derive(Error, Debug)]
#[error("...")]
#[allow(dead_code)]
pub struct OptSourceOptBacktrace {
#[source]
source: Option<anyhow::Error>,
pub source: Option<anyhow::Error>,
#[backtrace]
backtrace: Option<Backtrace>,
pub backtrace: Option<Backtrace>,
}
}

Expand Down

0 comments on commit 479744e

Please sign in to comment.