chore: fix doc issues (#3292)

There are a few warnings when building the docs causing failures on CI.

This change fixes those and adds `unsound_local_offset` as an unexpeced cfg.
This commit is contained in:
Hayden Stainsby 2025-05-30 10:43:38 +02:00
parent 4deba4aaea
commit 92fa6ce273
3 changed files with 14 additions and 20 deletions

View File

@ -22,4 +22,4 @@ members = [
# This will be ignored with Rust older than 1.74, but for now that's okay;
# we're only using it to fix check-cfg issues that first appeared in Rust 1.80.
[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(flaky_tests)", "cfg(tracing_unstable)"] }
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(flaky_tests)", "cfg(tracing_unstable)", "cfg(unsound_local_offset)"] }

View File

@ -21,9 +21,9 @@
//! ```
//!
//! This crate can be used in a few ways to record spans/events:
//! - Using a [`RollingFileAppender`][rolling_struct] to perform writes to a log file. This will block on writes.
//! - Using *any* type implementing [`std::io::Write`][write] in a non-blocking fashion.
//! - Using a combination of [`NonBlocking`][non_blocking] and [`RollingFileAppender`][rolling_struct] to allow writes to a log file
//! - Using a [`RollingFileAppender`] to perform writes to a log file. This will block on writes.
//! - Using *any* type implementing [`std::io::Write`] in a non-blocking fashion.
//! - Using a combination of [`NonBlocking`] and [`RollingFileAppender`] to allow writes to a log file
//! without blocking.
//!
//! ## File Appender
@ -48,7 +48,7 @@
//! # }
//! ```
//!
//! The file appender implements [`std::io::Write`][write]. To be used with
//! The file appender implements [`std::io::Write`]. To be used with
//! [`tracing_subscriber::FmtSubscriber`][fmt_subscriber], it must be combined with a
//! [`MakeWriter`][make_writer] implementation to be able to record tracing spans/event.
//!
@ -68,12 +68,12 @@
//! .init();
//! # }
//! ```
//! **Note:** `_guard` is a [`WorkerGuard`][guard] which is returned by [`tracing_appender::non_blocking`][non_blocking]
//! **Note:** `_guard` is a [`WorkerGuard`] which is returned by [`tracing_appender::non_blocking`][non_blocking]
//! to ensure buffered logs are flushed to their output in the case of abrupt terminations of a process.
//! See [`WorkerGuard` module][guard] for more details.
//!
//! The example below demonstrates the construction of a [`tracing_appender::non_blocking`][non_blocking]
//! writer constructed with a [`std::io::Write`][write]:
//! writer constructed with a [`std::io::Write`]:
//!
//! ```rust
//! use std::io::Error;

View File

@ -31,9 +31,7 @@
//! Unintentional drops of `WorkerGuard` remove the guarantee that logs will be flushed
//! during a program's termination, in a panic or otherwise.
//!
//! See [`WorkerGuard`][worker_guard] for examples of using the guard.
//!
//! [worker_guard]: WorkerGuard
//! See [`WorkerGuard`] for examples of using the guard.
//!
//! # Examples
//!
@ -60,12 +58,11 @@ use tracing_subscriber::fmt::MakeWriter;
/// The default maximum number of buffered log lines.
///
/// If [`NonBlocking`][non-blocking] is lossy, it will drop spans/events at capacity.
/// If [`NonBlocking`][non-blocking] is _not_ lossy,
/// backpressure will be exerted on senders, causing them to block their
/// respective threads until there is available capacity.
/// If [`NonBlocking`] is lossy, it will drop spans/events at capacity.
/// If [`NonBlocking`] is _not_ lossy, backpressure will be exerted on
/// senders, causing them to block their respective threads until there
/// is available capacity.
///
/// [non-blocking]: NonBlocking
/// Recommended to be a power of 2.
pub const DEFAULT_BUFFERED_LINES_LIMIT: usize = 128_000;
@ -116,11 +113,10 @@ pub struct WorkerGuard {
/// `NonBlocking` moves the writing out of an application's data path by sending spans and events
/// to a dedicated logging thread.
///
/// This struct implements [`MakeWriter`][make_writer] from the `tracing-subscriber`
/// This struct implements [`MakeWriter`] from the `tracing-subscriber`
/// crate. Therefore, it can be used with the [`tracing_subscriber::fmt`][fmt] module
/// or with any other subscriber/layer implementation that uses the `MakeWriter` trait.
///
/// [make_writer]: tracing_subscriber::fmt::MakeWriter
/// [fmt]: mod@tracing_subscriber::fmt
#[derive(Clone, Debug)]
pub struct NonBlocking {
@ -184,9 +180,7 @@ impl NonBlocking {
}
}
/// A builder for [`NonBlocking`][non-blocking].
///
/// [non-blocking]: NonBlocking
/// A builder for [`NonBlocking`].
#[derive(Debug)]
pub struct NonBlockingBuilder {
buffered_lines_limit: usize,