Rollup merge of #121749 - jieyouxu:issue-45127-fix, r=petrochenkov
Don't lint on executable crates with `non_snake_case` names Revives #111130, cc `@GilShoshan94.` Closes #45127.
This commit is contained in:
commit
10234fc246
17 changed files with 131 additions and 14 deletions
|
@ -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};
|
||||
|
@ -331,6 +332,10 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
|
|||
return;
|
||||
}
|
||||
|
||||
if cx.tcx.crate_types().iter().all(|&crate_type| crate_type == CrateType::Executable) {
|
||||
return;
|
||||
}
|
||||
|
||||
let crate_ident = if let Some(name) = &cx.tcx.sess.opts.crate_name {
|
||||
Some(Ident::from_str(name))
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue