Skip to content

Commit eb53535

Browse files
ben0x539kaffarell
authored andcommitted
docs: use intra-doc links instead of relative file paths (tokio-rs#2068)
eventually realized it's because a lot of stuff is reexported in parent modules and so the file path based relative links couldn't possibly work in all contexts. Looks like master already underwent this treatment but I suspect this is easier than backporting. Intra-doc links seem pretty good. I started with ``` find -name \*.rs -exec sed -i -e ' s@\(//. \[[^]]*\]:\s\+\)[:"]\?\.\./\w\+\.\(\w\+\)\.html@\1super::\2@; s@\(//. \[[^]]*\]:\s\+\)[:"]\?\.\./\(\w\+\)/\w\+\.\(\w\+\)\.html@\1super::\2::\3@; s@\(//. \[[^]]*\]:\s\+\)[:"]\?\.\./\.\./\w\+\.\(\w\+\)\.html@\1super::super::\2@; s@\(//. \[[^]]*\]:\s\+\)[:"]\?\.\./\.\./\(\w\+\)/\w\+\.\(\w\+\)\.html@\1super::super::\2::\3@; s@\(//. \[[^]]*\]:\s\+\)[:"]\?\.\./\(\w\+\)/index\.html@\1super::\2@; s@\(//. \[[^]]*\]:\s\+\)[:"]\?\.\./index\.html@\1super@; s@\(//. \[[^]]*\]:\s\+\)[:"]\?\.\./\(\w\+\)/\?$@\1super::\2@; s@\(//. \[[^]]*\]:\s\+\)[:"]\?\./\w\+\.\(\w\+\)\.html@\1self::\2@; s@\(//. \[[^]]*\]:\s\+\)[:"]\?\./\(\w\+\)/\w\+\.\(\w\+\)\.html@\1self::\2::\3@; s@\(//. \[[^]]*\]:\s\+\)[:"]\?\./\(\w\+\)/index\.html@\1self::\2@; s@\(//. \[[^]]*\]:\s\+\)[:"]\?\./index\.html@\1self@; s@\(//. \[[^]]*\]:\s\+\)[:"]\?\./\(\w\+\)/\?$@\1self::\2@; s@\(//. \[[^]]*\]:\s\+\)[:"]\?\w\+\.\(\w\+\)\.html@\1self::\2@; s@\(//. \[[^]]*\]:\s\+\)[:"]\?\(\w\+\)/\w\+\.\(\w\+\)\.html@\1self::\2::\3@; s@\(//. \[[^]]*\]:\s\+\)[:"]\?\(\w\+\)/index\.html@\1self::\2@; s@\(//. \[[^]]*\]:\s\+\)[:"]\?index\.html@\1self@; s@\(//. \[[^]]*\]:\s\+\)[:"]\?\(\w\+\)/\?$@\1self::\2@; s@\(//. \[[^]]*\]:\s\+[A-Za-z_0-9:]\+\)#method\.\(\w\+\)@\1::\2@; ' {} + ``` and then removed redundant `self::`s when I realized you don't actually need a `::` in the links, and fixed stuff up by hand as I ran into errors from ``` x='--cfg docsrs --cfg tracing_unstable'; RUSTFLAGS=$x RUSTDOCFLAGS=$x cargo doc --all-features ``` I hope that's roughly how the docs are supposed to work. I understand this is a relatively big unsolicited change in that it touches a whole lot of files (definitely went further than I originally intended), I'm happy to revise or split or reduce scope of this PR as desired.
1 parent 6510c82 commit eb53535

File tree

10 files changed

+199
-134
lines changed

10 files changed

+199
-134
lines changed

tracing-core/src/callsite.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,8 @@ pub struct Identifier(
138138
/// fn`s are available on stable Rust, this will no longer be necessary.
139139
/// Thus, these fields are *not* considered stable public API, and they may
140140
/// change warning. Do not rely on any fields on `Identifier`. When
141-
/// constructing new `Identifier`s, use the `identify_callsite!` macro or
142-
/// the `Callsite::id` function instead.
143-
// TODO: When `Callsite::id` is a const fn, this need no longer be `pub`.
141+
/// constructing new `Identifier`s, use the `identify_callsite!` macro
142+
/// instead.
144143
#[doc(hidden)]
145144
pub &'static dyn Callsite,
146145
);

tracing-core/src/dispatcher.rs

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@
123123
//! currently default `Dispatch`. This is used primarily by `tracing`
124124
//! instrumentation.
125125
//!
126-
//! [`Subscriber`]: struct.Subscriber.html
127-
//! [`with_default`]: fn.with_default.html
128-
//! [`set_global_default`]: fn.set_global_default.html
129-
//! [`get_default`]: fn.get_default.html
130-
//! [`Dispatch`]: struct.Dispatch.html
126+
//! [`Subscriber`]: Subscriber
127+
//! [`with_default`]: with_default
128+
//! [`set_global_default`]: set_global_default
129+
//! [`get_default`]: get_default
130+
//! [`Dispatch`]: Dispatch
131131
use crate::{
132132
callsite, span,
133133
subscriber::{self, NoSubscriber, Subscriber},
@@ -151,7 +151,7 @@ use crate::stdlib::{
151151

152152
/// `Dispatch` trace data to a [`Subscriber`].
153153
///
154-
/// [`Subscriber`]: trait.Subscriber.html
154+
/// [`Subscriber`]: Subscriber
155155
#[derive(Clone)]
156156
pub struct Dispatch {
157157
subscriber: Arc<dyn Subscriber + Send + Sync>,
@@ -213,10 +213,10 @@ pub struct DefaultGuard(Option<Dispatch>);
213213
/// <code>set_global_default</code></a> instead.
214214
/// </pre>
215215
///
216-
/// [span]: ../span/index.html
217-
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
218-
/// [`Event`]: ../event/struct.Event.html
219-
/// [`set_global_default`]: ../fn.set_global_default.html
216+
/// [span]: super::span
217+
/// [`Subscriber`]: super::subscriber::Subscriber
218+
/// [`Event`]: super::event::Event
219+
/// [`set_global_default`]: super::set_global_default
220220
#[cfg(feature = "std")]
221221
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
222222
pub fn with_default<T>(dispatcher: &Dispatch, f: impl FnOnce() -> T) -> T {
@@ -237,7 +237,7 @@ pub fn with_default<T>(dispatcher: &Dispatch, f: impl FnOnce() -> T) -> T {
237237
/// <code>set_global_default</code></a> instead.
238238
/// </pre>
239239
///
240-
/// [`set_global_default`]: ../fn.set_global_default.html
240+
/// [`set_global_default`]: super::set_global_default
241241
#[cfg(feature = "std")]
242242
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
243243
#[must_use = "Dropping the guard unregisters the dispatcher."]
@@ -261,9 +261,9 @@ pub fn set_default(dispatcher: &Dispatch) -> DefaultGuard {
261261
/// executables that depend on the library try to set the default later.
262262
/// </pre></div>
263263
///
264-
/// [span]: ../span/index.html
265-
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
266-
/// [`Event`]: ../event/struct.Event.html
264+
/// [span]: super::span
265+
/// [`Subscriber`]: super::subscriber::Subscriber
266+
/// [`Event`]: super::event::Event
267267
pub fn set_global_default(dispatcher: Dispatch) -> Result<(), SetGlobalDefaultError> {
268268
// if `compare_exchange` returns Result::Ok(_), then `new` has been set and
269269
// `current`—now the prior value—has been returned in the `Ok()` branch.
@@ -319,7 +319,7 @@ impl error::Error for SetGlobalDefaultError {}
319319
/// called while inside of another `get_default`, that closure will be provided
320320
/// with `Dispatch::none` rather than the previously set dispatcher.
321321
///
322-
/// [dispatcher]: ../dispatcher/struct.Dispatch.html
322+
/// [dispatcher]: super::dispatcher::Dispatch
323323
#[cfg(feature = "std")]
324324
pub fn get_default<T, F>(mut f: F) -> T
325325
where
@@ -342,7 +342,7 @@ where
342342
/// called while inside of another `get_default`, that closure will be provided
343343
/// with `Dispatch::none` rather than the previously set dispatcher.
344344
///
345-
/// [dispatcher]: ../dispatcher/struct.Dispatch.html
345+
/// [dispatcher]: super::dispatcher::Dispatch
346346
#[cfg(feature = "std")]
347347
#[doc(hidden)]
348348
#[inline(never)]
@@ -357,7 +357,7 @@ pub fn get_current<T>(f: impl FnOnce(&Dispatch) -> T) -> Option<T> {
357357

358358
/// Executes a closure with a reference to the current [dispatcher].
359359
///
360-
/// [dispatcher]: ../dispatcher/struct.Dispatch.html
360+
/// [dispatcher]: super::dispatcher::Dispatch
361361
#[cfg(not(feature = "std"))]
362362
#[doc(hidden)]
363363
pub fn get_current<T>(f: impl FnOnce(&Dispatch) -> T) -> Option<T> {
@@ -367,7 +367,7 @@ pub fn get_current<T>(f: impl FnOnce(&Dispatch) -> T) -> Option<T> {
367367

368368
/// Executes a closure with a reference to the current [dispatcher].
369369
///
370-
/// [dispatcher]: ../dispatcher/struct.Dispatch.html
370+
/// [dispatcher]: super::dispatcher::Dispatch
371371
#[cfg(not(feature = "std"))]
372372
pub fn get_default<T, F>(mut f: F) -> T
373373
where
@@ -406,7 +406,7 @@ impl Dispatch {
406406

407407
/// Returns a `Dispatch` that forwards to the given [`Subscriber`].
408408
///
409-
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
409+
/// [`Subscriber`]: super::subscriber::Subscriber
410410
pub fn new<S>(subscriber: S) -> Self
411411
where
412412
S: Subscriber + Send + Sync + 'static,
@@ -428,8 +428,8 @@ impl Dispatch {
428428
/// This calls the [`register_callsite`] function on the [`Subscriber`]
429429
/// that this `Dispatch` forwards to.
430430
///
431-
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
432-
/// [`register_callsite`]: ../subscriber/trait.Subscriber.html#method.register_callsite
431+
/// [`Subscriber`]: super::subscriber::Subscriber
432+
/// [`register_callsite`]: super::subscriber::Subscriber::register_callsite
433433
#[inline]
434434
pub fn register_callsite(&self, metadata: &'static Metadata<'static>) -> subscriber::Interest {
435435
self.subscriber.register_callsite(metadata)
@@ -442,9 +442,9 @@ impl Dispatch {
442442
/// This calls the [`max_level_hint`] function on the [`Subscriber`]
443443
/// that this `Dispatch` forwards to.
444444
///
445-
/// [level]: ../struct.Level.html
446-
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
447-
/// [`register_callsite`]: ../subscriber/trait.Subscriber.html#method.max_level_hint
445+
/// [level]: super::Level
446+
/// [`Subscriber`]: super::subscriber::Subscriber
447+
/// [`register_callsite`]: super::subscriber::Subscriber::max_level_hint
448448
// TODO(eliza): consider making this a public API?
449449
#[inline]
450450
pub(crate) fn max_level_hint(&self) -> Option<LevelFilter> {
@@ -457,9 +457,9 @@ impl Dispatch {
457457
/// This calls the [`new_span`] function on the [`Subscriber`] that this
458458
/// `Dispatch` forwards to.
459459
///
460-
/// [ID]: ../span/struct.Id.html
461-
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
462-
/// [`new_span`]: ../subscriber/trait.Subscriber.html#method.new_span
460+
/// [ID]: super::span::Id
461+
/// [`Subscriber`]: super::subscriber::Subscriber
462+
/// [`new_span`]: super::subscriber::Subscriber::new_span
463463
#[inline]
464464
pub fn new_span(&self, span: &span::Attributes<'_>) -> span::Id {
465465
self.subscriber.new_span(span)
@@ -470,8 +470,8 @@ impl Dispatch {
470470
/// This calls the [`record`] function on the [`Subscriber`] that this
471471
/// `Dispatch` forwards to.
472472
///
473-
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
474-
/// [`record`]: ../subscriber/trait.Subscriber.html#method.record
473+
/// [`Subscriber`]: super::subscriber::Subscriber
474+
/// [`record`]: super::subscriber::Subscriber::record
475475
#[inline]
476476
pub fn record(&self, span: &span::Id, values: &span::Record<'_>) {
477477
self.subscriber.record(span, values)
@@ -483,8 +483,8 @@ impl Dispatch {
483483
/// This calls the [`record_follows_from`] function on the [`Subscriber`]
484484
/// that this `Dispatch` forwards to.
485485
///
486-
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
487-
/// [`record_follows_from`]: ../subscriber/trait.Subscriber.html#method.record_follows_from
486+
/// [`Subscriber`]: super::subscriber::Subscriber
487+
/// [`record_follows_from`]: super::subscriber::Subscriber::record_follows_from
488488
#[inline]
489489
pub fn record_follows_from(&self, span: &span::Id, follows: &span::Id) {
490490
self.subscriber.record_follows_from(span, follows)
@@ -496,9 +496,9 @@ impl Dispatch {
496496
/// This calls the [`enabled`] function on the [`Subscriber`] that this
497497
/// `Dispatch` forwards to.
498498
///
499-
/// [metadata]: ../metadata/struct.Metadata.html
500-
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
501-
/// [`enabled`]: ../subscriber/trait.Subscriber.html#method.enabled
499+
/// [metadata]: super::metadata::Metadata
500+
/// [`Subscriber`]: super::subscriber::Subscriber
501+
/// [`enabled`]: super::subscriber::Subscriber::enabled
502502
#[inline]
503503
pub fn enabled(&self, metadata: &Metadata<'_>) -> bool {
504504
self.subscriber.enabled(metadata)
@@ -509,9 +509,9 @@ impl Dispatch {
509509
/// This calls the [`event`] function on the [`Subscriber`] that this
510510
/// `Dispatch` forwards to.
511511
///
512-
/// [`Event`]: ../event/struct.Event.html
513-
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
514-
/// [`event`]: ../subscriber/trait.Subscriber.html#method.event
512+
/// [`Event`]: super::event::Event
513+
/// [`Subscriber`]: super::subscriber::Subscriber
514+
/// [`event`]: super::subscriber::Subscriber::event
515515
#[inline]
516516
pub fn event(&self, event: &Event<'_>) {
517517
self.subscriber.event(event)
@@ -522,8 +522,8 @@ impl Dispatch {
522522
/// This calls the [`enter`] function on the [`Subscriber`] that this
523523
/// `Dispatch` forwards to.
524524
///
525-
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
526-
/// [`enter`]: ../subscriber/trait.Subscriber.html#method.enter
525+
/// [`Subscriber`]: super::subscriber::Subscriber
526+
/// [`enter`]: super::subscriber::Subscriber::enter
527527
pub fn enter(&self, span: &span::Id) {
528528
self.subscriber.enter(span);
529529
}
@@ -533,8 +533,8 @@ impl Dispatch {
533533
/// This calls the [`exit`] function on the [`Subscriber`] that this
534534
/// `Dispatch` forwards to.
535535
///
536-
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
537-
/// [`exit`]: ../subscriber/trait.Subscriber.html#method.exit
536+
/// [`Subscriber`]: super::subscriber::Subscriber
537+
/// [`exit`]: super::subscriber::Subscriber::exit
538538
pub fn exit(&self, span: &span::Id) {
539539
self.subscriber.exit(span);
540540
}
@@ -549,10 +549,10 @@ impl Dispatch {
549549
/// This calls the [`clone_span`] function on the `Subscriber` that this
550550
/// `Dispatch` forwards to.
551551
///
552-
/// [span ID]: ../span/struct.Id.html
553-
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
554-
/// [`clone_span`]: ../subscriber/trait.Subscriber.html#method.clone_span
555-
/// [`new_span`]: ../subscriber/trait.Subscriber.html#method.new_span
552+
/// [span ID]: super::span::Id
553+
/// [`Subscriber`]: super::subscriber::Subscriber
554+
/// [`clone_span`]: super::subscriber::Subscriber::clone_span
555+
/// [`new_span`]: super::subscriber::Subscriber::new_span
556556
#[inline]
557557
pub fn clone_span(&self, id: &span::Id) -> span::Id {
558558
self.subscriber.clone_span(id)
@@ -575,10 +575,10 @@ impl Dispatch {
575575
/// instead of this method.
576576
/// </pre>
577577
///
578-
/// [span ID]: ../span/struct.Id.html
579-
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
580-
/// [`drop_span`]: ../subscriber/trait.Subscriber.html#method.drop_span
581-
/// [`new_span`]: ../subscriber/trait.Subscriber.html#method.new_span
578+
/// [span ID]: super::span::Id
579+
/// [`Subscriber`]: super::subscriber::Subscriber
580+
/// [`drop_span`]: super::subscriber::Subscriber::drop_span
581+
/// [`new_span`]: super::subscriber::Subscriber::new_span
582582
/// [`try_close`]: #method.try_close
583583
#[inline]
584584
#[deprecated(since = "0.1.2", note = "use `Dispatch::try_close` instead")]
@@ -598,10 +598,10 @@ impl Dispatch {
598598
/// This calls the [`try_close`] function on the [`Subscriber`] that this
599599
/// `Dispatch` forwards to.
600600
///
601-
/// [span ID]: ../span/struct.Id.html
602-
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
603-
/// [`try_close`]: ../subscriber/trait.Subscriber.html#method.try_close
604-
/// [`new_span`]: ../subscriber/trait.Subscriber.html#method.new_span
601+
/// [span ID]: super::span::Id
602+
/// [`Subscriber`]: super::subscriber::Subscriber
603+
/// [`try_close`]: super::subscriber::Subscriber::try_close
604+
/// [`new_span`]: super::subscriber::Subscriber::new_span
605605
pub fn try_close(&self, id: span::Id) -> bool {
606606
self.subscriber.try_close(id)
607607
}
@@ -611,7 +611,7 @@ impl Dispatch {
611611
/// This calls the [`current`] function on the `Subscriber` that this
612612
/// `Dispatch` forwards to.
613613
///
614-
/// [`current`]: ../subscriber/trait.Subscriber.html#method.current
614+
/// [`current`]: super::subscriber::Subscriber::current_span
615615
#[inline]
616616
pub fn current_span(&self) -> span::Current {
617617
self.subscriber.current_span()

0 commit comments

Comments
 (0)