Closed est31 closed 1 year ago
@rustbot label A-lint
Running a cursory check to find cfg typos across the rust codebase, I couldn't find any:
Maybe it's not that valuable to add this if this doesn't occur in the wild very often?
cc #82450
Yeah I think this can be closed in favour of #82450
Inspired by seeing #85738 fixing a typo by replacing
target_os = "opensbd"
withtarget_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-defaulttarget_cfg_typo
lint that checks for targets in a close edit distance to a builtin target. If you enable thenon_builtin_target_cfg
lint, maybe thetarget_cfg_typo
could be silenced.As prior art I was only able to find a clippy lint.