Fix fallout in similar_names

This commit is contained in:
flip1995 2020-05-12 16:50:00 +02:00
parent 485229c4a3
commit efd3dcff97
No known key found for this signature in database
GPG Key ID: 2CEFCDB27ED0BE79

View File

@ -5,6 +5,7 @@
use rustc_ast::attr;
use rustc_ast::visit::{walk_block, walk_expr, walk_pat, Visitor};
use rustc_lint::{EarlyContext, EarlyLintPass};
use rustc_middle::lint::in_external_macro;
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::source_map::Span;
use rustc_span::symbol::SymbolStr;
@ -354,12 +355,20 @@ fn visit_mac(&mut self, _mac: &MacCall) {
impl EarlyLintPass for NonExpressiveNames {
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
if in_external_macro(cx.sess, item.span) {
return;
}
if let ItemKind::Fn(_, ref sig, _, Some(ref blk)) = item.kind {
do_check(self, cx, &item.attrs, &sig.decl, blk);
}
}
fn check_impl_item(&mut self, cx: &EarlyContext<'_>, item: &AssocItem) {
if in_external_macro(cx.sess, item.span) {
return;
}
if let AssocItemKind::Fn(_, ref sig, _, Some(ref blk)) = item.kind {
do_check(self, cx, &item.attrs, &sig.decl, blk);
}