Skip to content

Commit d363db7

Browse files
committed
Hoist only-executables check above producing crate ident
1 parent bf8756d commit d363db7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: compiler/rustc_lint/src/nonstandard_style.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,10 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
332332
return;
333333
}
334334

335+
if cx.tcx.crate_types().iter().all(|&crate_type| crate_type == CrateType::Executable) {
336+
return;
337+
}
338+
335339
let crate_ident = if let Some(name) = &cx.tcx.sess.opts.crate_name {
336340
Some(Ident::from_str(name))
337341
} else {
@@ -367,9 +371,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
367371
})
368372
};
369373

370-
if let Some(ident) = &crate_ident
371-
&& cx.tcx.crate_types().iter().all(|&crate_type| crate_type != CrateType::Executable)
372-
{
374+
if let Some(ident) = &crate_ident {
373375
self.check_snake_case(cx, "crate", ident);
374376
}
375377
}

0 commit comments

Comments
 (0)