Skip to content

Commit

Permalink
Allow dead_code in all metric structs
Browse files Browse the repository at this point in the history
Issue is being tracked in
<rust-lang/rust#88900>. Basically the
dead_code lint was changed to ignore derive fmt::Debug implementations,
generally a good thing, but the metrics are only written to and then
printed using the (derived) fmt::Debug implementations so they are
actually read.
  • Loading branch information
Thomasdezeeuw committed Sep 19, 2021
1 parent 88f618e commit aceb699
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/rt/coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub(super) struct Coordinator {

/// Metrics for [`Coordinator`].
#[derive(Debug)]
#[allow(dead_code)] // https://github.com/rust-lang/rust/issues/88900.
struct Metrics<'c, 'l> {
heph_version: &'static str,
os: &'c str,
Expand Down
1 change: 1 addition & 0 deletions src/rt/local/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ pub(super) struct RuntimeInternals {

/// Metrics for [`RuntimeInternals`].
#[derive(Debug)]
#[allow(dead_code)] // https://github.com/rust-lang/rust/issues/88900.
pub(crate) struct Metrics {
id: NonZeroUsize,
scheduler: scheduler::Metrics,
Expand Down
1 change: 1 addition & 0 deletions src/rt/local/scheduler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub(crate) struct Scheduler {

/// Metrics for [`Scheduler`].
#[derive(Debug)]
#[allow(dead_code)] // https://github.com/rust-lang/rust/issues/88900.
pub(crate) struct Metrics {
ready: usize,
inactive: usize,
Expand Down
1 change: 1 addition & 0 deletions src/rt/local/timers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pub(crate) struct Timers {

/// Metrics for [`Timers`].
#[derive(Debug)]
#[allow(dead_code)] // https://github.com/rust-lang/rust/issues/88900.
pub(crate) struct Metrics {
timers: usize,
next_timer: Option<Duration>,
Expand Down
1 change: 1 addition & 0 deletions src/rt/shared/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ pub(crate) struct RuntimeInternals {

/// Metrics for [`RuntimeInternals`].
#[derive(Debug)]
#[allow(dead_code)] // https://github.com/rust-lang/rust/issues/88900.
pub(crate) struct Metrics {
scheduler: scheduler::Metrics,
timers: timers::Metrics,
Expand Down
1 change: 1 addition & 0 deletions src/rt/shared/scheduler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ pub(super) struct Scheduler {

/// Metrics for [`Scheduler`].
#[derive(Debug)]
#[allow(dead_code)] // https://github.com/rust-lang/rust/issues/88900.
pub(crate) struct Metrics {
ready: usize,
inactive: usize,
Expand Down
1 change: 1 addition & 0 deletions src/rt/shared/timers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ struct Epoch {

/// Metrics for [`Timers`].
#[derive(Debug)]
#[allow(dead_code)] // https://github.com/rust-lang/rust/issues/88900.
pub(crate) struct Metrics {
timers: usize,
next_timer: Option<Duration>,
Expand Down
2 changes: 2 additions & 0 deletions src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ pub(crate) struct CoordinatorLog {

/// Metrics for [`CoordinatorLog`].
#[derive(Debug)]
#[allow(dead_code)] // https://github.com/rust-lang/rust/issues/88900.
pub(crate) struct CoordinatorMetrics<'l> {
file: &'l File,
counter: u32,
Expand Down Expand Up @@ -266,6 +267,7 @@ pub(crate) struct Log {

/// Metrics for [`Log`].
#[derive(Debug)]
#[allow(dead_code)] // https://github.com/rust-lang/rust/issues/88900.
pub(crate) struct Metrics {
counter: u32,
}
Expand Down

0 comments on commit aceb699

Please sign in to comment.