Skip to content

Commit

Permalink
fix(maitake): dead code warning with cfg(loom) (#300)
Browse files Browse the repository at this point in the history
The `Header::STUB_VTABLE` constant is not used when the `loom` cfg is
set, so it was emitting a dead code warning. I fixed this by moving it
into the only function that actually references it, so it's not present
with `--cfg loom`.
  • Loading branch information
hawkw committed Aug 27, 2022
1 parent 3602f28 commit 366d4d5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions maitake/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1029,18 +1029,18 @@ unsafe fn _maitake_header_nop_poll_join(
}

impl Header {
const STUB_VTABLE: Vtable = Vtable {
poll: _maitake_header_nop,
poll_join: _maitake_header_nop_poll_join,
deallocate: _maitake_header_nop_deallocate,
};

#[cfg(not(loom))]
pub(crate) const fn new_stub() -> Self {
const STUB_VTABLE: Vtable = Vtable {
poll: _maitake_header_nop,
poll_join: _maitake_header_nop_poll_join,
deallocate: _maitake_header_nop_deallocate,
};

Self {
run_queue: mpsc_queue::Links::new_stub(),
state: StateCell::new(),
vtable: &Self::STUB_VTABLE,
vtable: &STUB_VTABLE,
span: trace::Span::none(),
id: TaskId::stub(),
}
Expand Down

0 comments on commit 366d4d5

Please sign in to comment.