Skip to content

Commit fd413c2

Browse files
committed
don't lint snake-case on executable crate name
1 parent 82cd953 commit fd413c2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

compiler/rustc_lint/src/nonstandard_style.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use rustc_hir::def::{DefKind, Res};
1010
use rustc_hir::intravisit::FnKind;
1111
use rustc_hir::{GenericParamKind, PatKind};
1212
use rustc_middle::ty;
13+
use rustc_session::config::CrateType;
1314
use rustc_span::def_id::LocalDefId;
1415
use rustc_span::symbol::{sym, Ident};
1516
use rustc_span::{BytePos, Span};
@@ -366,7 +367,11 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
366367
})
367368
};
368369

369-
if let Some(ident) = &crate_ident {
370+
if let Some(ident) = &crate_ident
371+
&& cx.tcx.sess.crate_types().iter().all(|&crate_type| {
372+
crate_type != CrateType::Executable
373+
})
374+
{
370375
self.check_snake_case(cx, "crate", ident);
371376
}
372377
}

0 commit comments

Comments
 (0)