Skip to content

Commit

Permalink
chore: Add some lint checks (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
mox692 committed Mar 4, 2024
1 parent a9e84ad commit 9700cda
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/lib.rs
@@ -1,3 +1,9 @@
#![warn(
missing_debug_implementations,
missing_docs,
rust_2018_idioms,
unreachable_pub
)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(docsrs, allow(unused_attributes))]

Expand Down
3 changes: 3 additions & 0 deletions src/runtime.rs
Expand Up @@ -1218,6 +1218,7 @@ impl Iterator for RuntimeIntervals {
}

impl RuntimeMonitor {
/// Creates a new [`RuntimeMonitor`].
pub fn new(runtime: &runtime::Handle) -> RuntimeMonitor {
let runtime = runtime.metrics();

Expand Down Expand Up @@ -1435,6 +1436,7 @@ impl Worker {
}

impl RuntimeMetrics {
/// Returns the ratio of the [`RuntimeMetrics::total_polls_count`] to the [`RuntimeMetrics::total_noop_count`].
pub fn mean_polls_per_park(&self) -> f64 {
let total_park_count = self.total_park_count - self.total_noop_count;
if total_park_count == 0 {
Expand All @@ -1444,6 +1446,7 @@ impl RuntimeMetrics {
}
}

/// Returns the ratio of the [`RuntimeMetrics::total_busy_duration`] to the [`RuntimeMetrics::elapsed`].
pub fn busy_ratio(&self) -> f64 {
self.total_busy_duration.as_nanos() as f64 / self.elapsed.as_nanos() as f64
}
Expand Down
5 changes: 3 additions & 2 deletions src/task.rs
Expand Up @@ -523,6 +523,7 @@ pub struct TaskMonitorBuilder {
}

impl TaskMonitorBuilder {
/// Creates a new [`TaskMonitorBuilder`].
pub fn new() -> Self {
Self {
slow_poll_threshold: None,
Expand Down Expand Up @@ -2440,9 +2441,9 @@ impl<T: Stream> Stream for Instrumented<T> {
}

fn instrument_poll<T, Out>(
cx: &mut Context,
cx: &mut Context<'_>,
instrumented: Pin<&mut Instrumented<T>>,
poll_fn: impl FnOnce(Pin<&mut T>, &mut Context) -> Poll<Out>,
poll_fn: impl FnOnce(Pin<&mut T>, &mut Context<'_>) -> Poll<Out>,
) -> Poll<Out> {
let poll_start = Instant::now();
let this = instrumented.project();
Expand Down

0 comments on commit 9700cda

Please sign in to comment.