Skip to content

Commit 1405ee8

Browse files
committed
address review: remove several #[allow(dead_code)]
1 parent db5e844 commit 1405ee8

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

tokio/src/runtime/driver/op.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ use std::task::Poll;
99
use std::task::Waker;
1010
use std::{io, mem};
1111

12-
#[allow(dead_code)]
1312
#[derive(Debug)]
1413
pub(crate) enum CancelData {
15-
Open(Open),
14+
Open(
15+
// This field isn't accessed directly, but it holds cancellation data,
16+
// so `#[allow(dead_code)]` is needed.
17+
#[allow(dead_code)] Open,
18+
),
1619
}
1720

1821
#[derive(Debug)]
@@ -25,15 +28,17 @@ pub(crate) enum Lifecycle {
2528

2629
/// The submitter no longer has interest in the operation result. The state
2730
/// must be passed to the driver and held until the operation completes.
28-
#[allow(dead_code)]
29-
Cancelled(CancelData),
31+
Cancelled(
32+
// This field isn't accessed directly, but it holds cancellation data,
33+
// so `#[allow(dead_code)]` is needed.
34+
#[allow(dead_code)] CancelData,
35+
),
3036

3137
/// The operation has completed with a single cqe result
3238
Completed(io_uring::cqueue::Entry),
3339
}
3440

3541
pub(crate) enum State {
36-
#[allow(dead_code)]
3742
Initialize(Option<Entry>),
3843
Polled(usize),
3944
Complete,
@@ -53,7 +58,6 @@ impl<T: Cancellable> Op<T> {
5358
///
5459
/// Callers must ensure that parameters of the entry (such as buffer) are valid and will
5560
/// be valid for the entire duration of the operation, otherwise it may cause memory problems.
56-
#[allow(dead_code)]
5761
pub(crate) unsafe fn new(entry: Entry, data: T) -> Self {
5862
let handle = Handle::current();
5963
Self {
@@ -87,7 +91,6 @@ impl<T: Cancellable> Drop for Op<T> {
8791

8892
/// A single CQE result
8993
pub(crate) struct CqeResult {
90-
#[allow(dead_code)]
9194
pub(crate) result: io::Result<u32>,
9295
}
9396

tokio/src/runtime/io/driver/uring.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ impl Drop for UringContext {
181181
}
182182

183183
impl Handle {
184-
#[allow(dead_code)]
185184
fn add_uring_source(&self, uringfd: RawFd) -> io::Result<()> {
186185
let mut source = SourceFd(&uringfd);
187186
self.registry
@@ -276,8 +275,6 @@ impl Handle {
276275
Ok(index)
277276
}
278277

279-
// TODO: Remove this annotation when operations are actually supported
280-
#[allow(unused_variables, unreachable_code)]
281278
pub(crate) fn cancel_op<T: Cancellable>(&self, index: usize, data: Option<T>) {
282279
let mut guard = self.get_uring().lock();
283280
let ctx = &mut *guard;

0 commit comments

Comments
 (0)