Skip to content

Commit f48c99a

Browse files
committed
Auto merge of rust-lang#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 (rust-lang#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 rust-lang#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
2 parents 74fd001 + 9ae1fb4 commit f48c99a

19 files changed

+68
-100
lines changed

compiler/rustc_lint/src/nonstandard_style.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,9 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
332332
return;
333333
}
334334

335+
// Issue #45127: don't enforce `snake_case` for binary crates as binaries are not intended
336+
// to be distributed and depended on like libraries. The lint is not suppressed for cdylib
337+
// or staticlib because it's not clear what the desired lint behavior for those are.
335338
if cx.tcx.crate_types().iter().all(|&crate_type| crate_type == CrateType::Executable) {
336339
return;
337340
}

tests/ui/lint/non-snake-case/lint-non-snake-case-crate-bin.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/ui/lint/non-snake-case/lint-non-snake-case-crate-bin2.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/ui/lint/non-snake-case/lint-non-snake-case-crate-bin3.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/ui/lint/non-snake-case/lint-non-snake-case-crate-cdylib.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/ui/lint/non-snake-case/lint-non-snake-case-crate-dylib.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/ui/lint/non-snake-case/lint-non-snake-case-crate-lib.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/ui/lint/non-snake-case/lint-non-snake-case-crate-proc-macro.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/ui/lint/non-snake-case/lint-non-snake-case-crate-proc-macro.stderr

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/ui/lint/non-snake-case/lint-non-snake-case-crate-rlib.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)