Adjust #[no_mangle]
-related checks and lints for impl
items
This commit is contained in:
parent
c84beefd83
commit
0bb2ea653e
13 changed files with 573 additions and 56 deletions
|
@ -391,9 +391,14 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
|
|||
_: Span,
|
||||
id: hir::HirId,
|
||||
) {
|
||||
let attrs = cx.tcx.hir().attrs(id);
|
||||
match &fk {
|
||||
FnKind::Method(ident, ..) => match method_context(cx, id) {
|
||||
FnKind::Method(ident, sig, ..) => match method_context(cx, id) {
|
||||
MethodLateContext::PlainImpl => {
|
||||
if sig.header.abi != Abi::Rust && cx.sess().contains_name(attrs, sym::no_mangle)
|
||||
{
|
||||
return;
|
||||
}
|
||||
self.check_snake_case(cx, "method", ident);
|
||||
}
|
||||
MethodLateContext::TraitAutoImpl => {
|
||||
|
@ -402,7 +407,6 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
|
|||
_ => (),
|
||||
},
|
||||
FnKind::ItemFn(ident, _, header, _) => {
|
||||
let attrs = cx.tcx.hir().attrs(id);
|
||||
// Skip foreign-ABI #[no_mangle] functions (Issue #31924)
|
||||
if header.abi != Abi::Rust && cx.sess().contains_name(attrs, sym::no_mangle) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue