Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain why non_snake_case is skipped for binary crates and cleanup tests #130599

Merged
merged 2 commits into from
Sep 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Explain why non_snake_case is skipped for binary crates
jieyouxu committed Sep 21, 2024
commit 43ede7331d6b05f6e3c1b215694db3137c8583c2
3 changes: 3 additions & 0 deletions compiler/rustc_lint/src/nonstandard_style.rs
Original file line number Diff line number Diff line change
@@ -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;
}