-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
A-lintArea: New lintsArea: New lints
Description
What it does
I am not sure if lints can or should make assumptions about the file they are defined in, but it would be good to flag usage of the env!
(and option_env!
) macro in build scripts. In all likelihood this is wrong. It certainly is wrong for CARGO_*
variables [0].
Advantage
It is easy to miss this wrong usage, as it may not break immediately.
Drawbacks
None that I can think of.
Example
env!("CARGO_PKG_VERSION")
Could be written as:
std::env::var("CARGO_PKG_VERSION").expect("CARGO_PKG_VERSION variable not set")
Comparison with existing lints
Not aware of existing lints doing something similar.
Additional Context
No response
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lints