Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add must_use for CollectorBuilder::finish #2271

Merged
merged 2 commits into from Aug 10, 2022

Conversation

DesmondWillowbrook
Copy link
Contributor

Motivation

Follow up to #2239
Discovered that

    tracing_subscriber::fmt().with_ansi(false).finish();
    tracing::info!("hello");

doesn't actually do anything, because finish returns a Collector and init is the thing that actually installs the collector.

Solution

Added #[must_use] which suggests using try_init instead.

Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, good catch!

tracing-subscriber/src/fmt/mod.rs Outdated Show resolved Hide resolved
@hawkw hawkw enabled auto-merge (squash) August 10, 2022 23:42
@hawkw hawkw merged commit 9a8e7e6 into tokio-rs:master Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants