Description
Inspired by seeing #85738 fixing a typo by replacing target_os = "opensbd"
with target_os = "openbsd"
.
I wonder whether cases like this could be discovered by lints. There are multiple target_*
values that rustc sets, and it would be interesting to think about validating them.
Rust has support for custom target json files, and ideally you would want to have older rustc versions not warn about code supporting targets added by future rustc versoins, making a warn-by-default lint that complains about any non-builtin target_*
value a bit tricky.
However, one could think about an allow-by-default non_builtin_target_cfg
lint, as well as a warn-by-default target_cfg_typo
lint that checks for targets in a close edit distance to a builtin target. If you enable the non_builtin_target_cfg
lint, maybe the target_cfg_typo
could be silenced.
As prior art I was only able to find a clippy lint.