## Motivation There has been interest around publishing tracing-mock to crates.io for some time. In order to make this possible, documentation and some code clean up is needed. The `expect` module, which contains constructor functions for many of the other `tracing-mock` modules needs documentation and examples. This change adds documentation to the `expect` module and all the public APIs within it. This includes doctests on all the methods which serve as examples. ## Solution The lint for `missing_docs` has been enabled for the entire `tracing-mock` crate! This has been done together with all the other lints that are enabled on the other crates in this project. The `event::msg("message")` constructor was removed, in favor of requiring an explicit construction via `expect::event().with_fields(expect::msg("message"))`. This is appropriate to reduce the API surface that would need to be supported in the future and also because the `event::msg` constructor could be overridden by a subsequent usage of `with_fields`. The shorthand `expect::message()` was renamed to `expect::msg` to make this change less burdensome. The `span::named("name")` constructor was removed, in favor of requiring an explicit construction via `expect::span.with_name("name")`. The latter isn't much longer and since #3097, a string with the name can be passed directly everywhere that an `ExpectedSpan` is required. This change also sets the `missing_docs` lint to warn for the entire `tracing-mock` crate, making it ready to publish (once backported). Refs: #539
46 lines
1.2 KiB
Rust
46 lines
1.2 KiB
Rust
#![doc = include_str!("../README.md")]
|
|
#![cfg_attr(
|
|
docsrs,
|
|
// Allows displaying cfgs/feature flags in the documentation.
|
|
feature(doc_cfg),
|
|
// Fail the docs build if any intra-docs links are broken
|
|
deny(rustdoc::broken_intra_doc_links),
|
|
)]
|
|
#![doc(
|
|
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png",
|
|
html_favicon_url = "https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/favicon.ico",
|
|
issue_tracker_base_url = "https://github.com/tokio-rs/tracing/issues/"
|
|
)]
|
|
#![warn(
|
|
missing_debug_implementations,
|
|
missing_docs,
|
|
rust_2018_idioms,
|
|
unreachable_pub,
|
|
bad_style,
|
|
dead_code,
|
|
improper_ctypes,
|
|
non_shorthand_field_patterns,
|
|
no_mangle_generic_items,
|
|
overflowing_literals,
|
|
path_statements,
|
|
patterns_in_fns_without_body,
|
|
private_interfaces,
|
|
private_bounds,
|
|
unconditional_recursion,
|
|
unused,
|
|
unused_allocation,
|
|
unused_comparisons,
|
|
unused_parens,
|
|
while_true
|
|
)]
|
|
|
|
pub mod ancestry;
|
|
pub mod collector;
|
|
pub mod event;
|
|
pub mod expect;
|
|
pub mod field;
|
|
mod metadata;
|
|
pub mod span;
|
|
|
|
#[cfg(feature = "tracing-subscriber")]
|
|
pub mod subscriber;
|