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

Remove unnecessary uses of #[cfg(not(test))] #6508

Merged
merged 2 commits into from
Apr 23, 2024

Conversation

avtrujillo
Copy link
Contributor

Motivation

The main and main-rt macro functions both have the #[cfg(not(test))] with a comment indicating that its inclusion is a workaround for rust-lang/rust#62127, which has since been resolved. Because rust-analyzer enables test by default, this means that these functions are greyed out when using rust-analyzer in VSCode without configuration changes.

Solution

Remove all uses of #[cfg(not(test))] in the tokio-macros crate that are accompanied by comments mentioning rust-lang/rust#62127 as the motivation for usage.

It's possible that the usage in

// Always fail if rt is not enabled.
is also unnecessary, since it appears in the context of using main as an identifier. I'm less sure about that one since it doesn't have a comment mentioning rust-lang/rust#62127, so I've left it alone for now.

@Darksonn Darksonn added A-tokio-macros Area: The tokio-macros crate A-tokio Area: The main tokio crate labels Apr 23, 2024
Copy link

@GlenDC GlenDC left a comment

Choose a reason for hiding this comment

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

All good as far as I can see.
Pretty certain you can also remove the same thing in

// Always fail if rt is not enabled.
, as it is the same situation as the cfg_rt! case AFAIK.

A tokio maintainer can probably confirm, this and all, but to me it does look good and working as expected.

Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Thank you.

@Darksonn Darksonn merged commit a73d6bf into tokio-rs:master Apr 23, 2024
71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate A-tokio-macros Area: The tokio-macros crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants