split attributes
This commit is contained in:
parent
eedc229049
commit
1341366af9
29 changed files with 1521 additions and 1415 deletions
|
@ -1,5 +1,5 @@
|
|||
use rustc_ast::attr::AttributeExt;
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_attr::AttributeExt;
|
||||
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
|
||||
use rustc_errors::{Diag, LintDiagnostic, MultiSpan};
|
||||
use rustc_feature::{Features, GateIssue};
|
||||
|
|
|
@ -342,8 +342,8 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
|
|||
let crate_ident = if let Some(name) = &cx.tcx.sess.opts.crate_name {
|
||||
Some(Ident::from_str(name))
|
||||
} else {
|
||||
attr::find_by_name(cx.tcx.hir().attrs(hir::CRATE_HIR_ID), sym::crate_name).and_then(
|
||||
|attr| {
|
||||
ast::attr::find_by_name(cx.tcx.hir().attrs(hir::CRATE_HIR_ID), sym::crate_name)
|
||||
.and_then(|attr| {
|
||||
if let AttrKind::Normal(n) = &attr.kind
|
||||
&& let AttrItem { args: AttrArgs::Eq { eq_span: _, expr: ref lit }, .. } =
|
||||
n.as_ref()
|
||||
|
@ -371,8 +371,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
|
|||
} else {
|
||||
None
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
};
|
||||
|
||||
if let Some(ident) = &crate_ident {
|
||||
|
@ -503,7 +502,7 @@ impl<'tcx> LateLintPass<'tcx> for NonUpperCaseGlobals {
|
|||
fn check_item(&mut self, cx: &LateContext<'_>, it: &hir::Item<'_>) {
|
||||
let attrs = cx.tcx.hir().attrs(it.hir_id());
|
||||
match it.kind {
|
||||
hir::ItemKind::Static(..) if !attr::contains_name(attrs, sym::no_mangle) => {
|
||||
hir::ItemKind::Static(..) if !ast::attr::contains_name(attrs, sym::no_mangle) => {
|
||||
NonUpperCaseGlobals::check_upper_case(cx, "static variable", &it.ident);
|
||||
}
|
||||
hir::ItemKind::Const(..) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue