Skip to content

Commit 6f01226

Browse files
TaKO8KihawkwJoshua Nelson
authored
docs: add deny(broken_intra_doc_links) (#981)
## Motivation In order to get a compiler warning (or error) when links are broken. Closes #940 ## Solution - [x] add `deny(broken_intra_doc_links)` - [x] add a note to the CONTRIBUTING.md documentation on building docs locally Co-authored-by: Eliza Weisman <eliza@buoyant.io> Co-authored-by: Joshua Nelson <joshua@yottadb.com>
1 parent fba2ed2 commit 6f01226

File tree

17 files changed

+50
-28
lines changed

17 files changed

+50
-28
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,18 @@ To reduce the effort required to review documentation-related changes,
211211
be viewed by clicking the `details` link on the
212212
`netlify/tracing-rs/deploy-preview check` on all pull requests.
213213

214+
### Building Documentation
215+
216+
Tracing's documentation uses nightly-only RustDoc features and lints, like
217+
`doc(cfg)` and `broken_intra_doc_lints`. These features are enabled by
218+
passing `--cfg docsrs` to RustDoc. Therefore, in order to build Tracing's
219+
documentation the same way it would be built by docs.rs, it's necessary to
220+
use the following command:
221+
222+
```bash
223+
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --no-deps
224+
```
225+
214226
### Commits
215227

216228
It is a recommended best practice to keep your changes as logically grouped as

tracing-appender/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
//! # }
3535
//! ```
3636
//! This creates an hourly rotating file appender that writes to `/some/directory/prefix.log.YYYY-MM-DD-HH`.
37-
//! [`Rotation::DAILY`] and [`Rotation::NEVER`] are the other available options.
37+
//! [`Rotation::DAILY`](rolling::Rotation::DAILY) and [`Rotation::NEVER`](rolling::Rotation::NEVER) are the other available options.
3838
//!
3939
//! The file appender implements [`std::io::Write`][write]. To be used with [`tracing_subscriber::FmtSubscriber`][fmt_subscriber],
4040
//! it must be combined with a [`MakeWriter`][make_writer] implementation to be able to record tracing spans/event.
@@ -127,6 +127,7 @@
127127
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png",
128128
issue_tracker_base_url = "https://github.com/tokio-rs/tracing/issues/"
129129
)]
130+
#![cfg_attr(docsrs, deny(broken_intra_doc_links))]
130131
#![warn(
131132
missing_debug_implementations,
132133
missing_docs,

tracing-attributes/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png",
5858
issue_tracker_base_url = "https://github.com/tokio-rs/tracing/issues/"
5959
)]
60+
#![cfg_attr(docsrs, deny(broken_intra_doc_links))]
6061
#![warn(
6162
missing_debug_implementations,
6263
missing_docs,

tracing-core/src/callsite.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl Registry {
7272

7373
/// Trait implemented by callsites.
7474
///
75-
/// These functions are only intended to be called by the [`Registry`] which
75+
/// These functions are only intended to be called by the callsite registry, which
7676
/// correctly handles determining the common interest between all subscribers.
7777
pub trait Callsite: Sync {
7878
/// Sets the [`Interest`] for this callsite.
@@ -114,11 +114,12 @@ pub struct Identifier(
114114
/// [`enabled`] is evaluated for every event.
115115
///
116116
/// This function will also re-compute the global maximum level as determined by
117-
/// the [`Subscriber::max_level_hint`] method. If a [`Subscriber`]
117+
/// the [`max_level_hint`] method. If a [`Subscriber`]
118118
/// implementation changes the value returned by its `max_level_hint`
119119
/// implementation at runtime, then it **must** call this function after that
120120
/// value changes, in order for the change to be reflected.
121121
///
122+
/// [`max_level_hint`]: ../subscriber/trait.Subscriber.html#method.max_level_hint
122123
/// [`Callsite`]: ../callsite/trait.Callsite.html
123124
/// [`enabled`]: ../subscriber/trait.Subscriber.html#tymethod.enabled
124125
/// [`Interest::sometimes()`]: ../subscriber/struct.Interest.html#method.sometimes

tracing-core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
issue_tracker_base_url = "https://github.com/tokio-rs/tracing/issues/"
9292
)]
9393
#![cfg_attr(not(feature = "std"), no_std)]
94-
#![cfg_attr(docsrs, feature(doc_cfg))]
94+
#![cfg_attr(docsrs, feature(doc_cfg), deny(broken_intra_doc_links))]
9595
#![warn(
9696
missing_debug_implementations,
9797
missing_docs,

tracing-error/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
//! supported compiler version is not considered a semver breaking change as
186186
//! long as doing so complies with this policy.
187187
//!
188-
#![cfg_attr(docsrs, feature(doc_cfg))]
188+
#![cfg_attr(docsrs, feature(doc_cfg), deny(broken_intra_doc_links))]
189189
#![doc(html_root_url = "https://docs.rs/tracing-error/0.1.2")]
190190
#![doc(
191191
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png",

tracing-flame/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png",
114114
issue_tracker_base_url = "https://github.com/tokio-rs/tracing/issues/"
115115
)]
116+
#![cfg_attr(docsrs, deny(broken_intra_doc_links))]
116117
#![warn(
117118
missing_debug_implementations,
118119
missing_docs,

tracing-futures/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
while_true
102102
)]
103103
#![cfg_attr(not(feature = "std"), no_std)]
104-
#![cfg_attr(docsrs, feature(doc_cfg))]
104+
#![cfg_attr(docsrs, feature(doc_cfg), deny(broken_intra_doc_links))]
105105
#[cfg(feature = "std-future")]
106106
use pin_project::pin_project;
107107

tracing-journald/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! # tracing-journald
22
//!
3-
//! Support for logging [`tracing`][tracing] events natively to [journald],
3+
//! Support for logging [`tracing`] events natively to [journald],
44
//! preserving structured information.
55
//!
66
//! ## Overview
@@ -36,6 +36,7 @@
3636
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png",
3737
issue_tracker_base_url = "https://github.com/tokio-rs/tracing/issues/"
3838
)]
39+
#![cfg_attr(docsrs, deny(broken_intra_doc_links))]
3940
#[cfg(unix)]
4041
use std::os::unix::net::UnixDatagram;
4142
use std::{fmt, io, io::Write};

tracing-log/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png",
111111
issue_tracker_base_url = "https://github.com/tokio-rs/tracing/issues/"
112112
)]
113-
#![cfg_attr(docsrs, feature(doc_cfg))]
113+
#![cfg_attr(docsrs, feature(doc_cfg), deny(broken_intra_doc_links))]
114114
#![warn(
115115
missing_debug_implementations,
116116
missing_docs,

0 commit comments

Comments
 (0)