1
Fork 0

Don't lint snake-case on executable crate name

Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
This commit is contained in:
Gil Shoshan 2023-05-03 14:53:54 +03:00 committed by 许杰友 Jieyou Xu (Joe)
parent ef324565d0
commit bf8756d2dd
No known key found for this signature in database
GPG key ID: 95DDEBD74A1DC2C0
17 changed files with 123 additions and 15 deletions

View file

@ -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};
@ -366,7 +367,9 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
})
};
if let Some(ident) = &crate_ident {
if let Some(ident) = &crate_ident
&& cx.tcx.crate_types().iter().all(|&crate_type| crate_type != CrateType::Executable)
{
self.check_snake_case(cx, "crate", ident);
}
}