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

Configuring Unexpected cfgs #58

Merged
merged 2 commits into from
Jul 1, 2024
Merged

Configuring Unexpected cfgs #58

merged 2 commits into from
Jul 1, 2024

Conversation

jmwample
Copy link
Owner

@jmwample jmwample commented Jul 1, 2024

A recent version of rust (I am not sure exactly which) added a check to ensure that all features used in the crate are defined in the Cargo.toml. This caused an error / warning for me because I am using a feature not named in the Cargo.toml called "disabled" to remove certain unfinished, long-running, or inaccurate tests (that I don't want to fully remove) from the compiled test harness.

Previously I was doing this by broadly disabling the unexpected_cfg check entirely for the crate using:

#![allow(unexpected_cfgs)]

With updates included in nightly there is a better solution to this. Which is to inform the compiler of any used, but undeclared features so that any that would be unexpected must be intentional. And the check can catch unintentional unused cfgs for you.

[lints.rust]
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_features, values("disabled"))'] }

thanks to @Urgau for pointing this out in #38

Copy link

codecov bot commented Jul 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.45%. Comparing base (62bb296) to head (b8a7b31).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #58      +/-   ##
==========================================
- Coverage   78.48%   78.45%   -0.04%     
==========================================
  Files          35       35              
  Lines        5681     5687       +6     
  Branches     5681     5687       +6     
==========================================
+ Hits         4459     4462       +3     
- Misses        831      834       +3     
  Partials      391      391              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jmwample jmwample merged commit 9ee2d0e into main Jul 1, 2024
9 checks passed
@jmwample jmwample deleted the check-cfg branch July 1, 2024 04:05
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.

1 participant