1
Fork 0

Auto merge of #130599 - jieyouxu:snake_case_binary_cleanup, r=petrochenkov

Explain why `non_snake_case` is skipped for binary crates and cleanup tests

- Explain `non_snake_case` lint is skipped for bin crate names because binaries are not intended to be distributed or consumed like library crates (#45127).
- Coalesce the bunch of tests into a single one but with revisions, which is easier to compare the differences for `non_snake_case` behavior with respect to crate types.

Follow-up to #121749 with some more comments and test cleanup.

cc `@saethlin` who bumped into one of the tests and was confused why it was `only-x86_64-unknown-linux-gnu`.

try-job: dist-i586-gnu-i586-i686-musl
This commit is contained in:
bors 2024-09-21 11:16:38 +00:00
commit f48c99a004
19 changed files with 68 additions and 100 deletions

View file

@ -332,6 +332,9 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
return;
}
// Issue #45127: don't enforce `snake_case` for binary crates as binaries are not intended
// to be distributed and depended on like libraries. The lint is not suppressed for cdylib
// or staticlib because it's not clear what the desired lint behavior for those are.
if cx.tcx.crate_types().iter().all(|&crate_type| crate_type == CrateType::Executable) {
return;
}