Skip to content

Use CARGO_CFG_FEATURE - #88

Merged
lukaslueg merged 1 commit into
lukaslueg:masterfrom
jayvdb:use-cargo1.85-features
Oct 8, 2025
Merged

Use CARGO_CFG_FEATURE#88
lukaslueg merged 1 commit into
lukaslueg:masterfrom
jayvdb:use-cargo1.85-features

Conversation

@jayvdb

@jayvdb jayvdb commented Sep 29, 2025

Copy link
Copy Markdown
Contributor

Close #83

@jayvdb
jayvdb force-pushed the use-cargo1.85-features branch from 90a829c to 622fdb4 Compare September 29, 2025 00:51
@jayvdb
jayvdb marked this pull request as ready for review September 29, 2025 01:05
Comment thread src/environment.rs Outdated
let mut features: Vec<String> = self
.get_override_var("FEATURES")
.unwrap_or_else(|| {
self.get_var::<Vec<String>>("CARGO_CFG_FEATURE")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why is get_var required here, instead of just self.get() (like here)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It looked a bit messy using .get() and then parse_from_env here in order to get a Vec<String>.

happy to switch to that if you prefer it.

also happy for you to take over to adjust this PR to how you prefer it.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

afaics it'd more appropriate to simply get CARGO_CFG_FEATURE from the env directly (if it is defined at all) in case there is no override, and use that exclusively instead of CARGO_FEATURE_.... The .get_var() in the current PR goes through the whole machinery of tracking unused overrides, which .get_override_var("FEATURES") already does for this case. It's not a problem to not use parse_from_env() to "parse" CARGO_CFG_FEATURE, since we only ever need to split the string on ,

@jayvdb
jayvdb force-pushed the use-cargo1.85-features branch from 622fdb4 to 56b5689 Compare October 5, 2025 01:30
Comment thread mise.toml Outdated
@@ -0,0 +1,2 @@
[tools]
osv-scanner = "latest"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This was committed in error?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sorry, yes it was

@jayvdb
jayvdb force-pushed the use-cargo1.85-features branch from 56b5689 to d9469cc Compare October 8, 2025 01:08
@lukaslueg
lukaslueg merged commit d79b349 into lukaslueg:master Oct 8, 2025
13 checks passed
@lukaslueg

Copy link
Copy Markdown
Owner

Thanks

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.

Detect availability and use CARGO_CFG_FEATURE

2 participants