Skip to content

Commit

Permalink
don't lint snake-case on executable crate name
Browse files Browse the repository at this point in the history
  • Loading branch information
GilShoshan94 committed May 3, 2023
1 parent 82cd953 commit fd413c2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion compiler/rustc_lint/src/nonstandard_style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use rustc_hir::def::{DefKind, Res};
use rustc_hir::intravisit::FnKind;
use rustc_hir::{GenericParamKind, PatKind};
use rustc_middle::ty;
use rustc_session::config::CrateType;
use rustc_span::def_id::LocalDefId;
use rustc_span::symbol::{sym, Ident};
use rustc_span::{BytePos, Span};
Expand Down Expand Up @@ -366,7 +367,11 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
})
};

if let Some(ident) = &crate_ident {
if let Some(ident) = &crate_ident
&& cx.tcx.sess.crate_types().iter().all(|&crate_type| {
crate_type != CrateType::Executable
})
{
self.check_snake_case(cx, "crate", ident);
}
}
Expand Down

0 comments on commit fd413c2

Please sign in to comment.