Prevent symbocalypse

This commit is contained in:
Oliver Scherer
2019-05-17 23:53:54 +02:00
parent 11194e3d05
commit f7f85a0dca
78 changed files with 686 additions and 1160 deletions

View File

@@ -9,7 +9,6 @@ use rustc::{declare_tool_lint, impl_lint_pass};
use syntax::ast::Attribute;
use syntax::source_map::Span;
use crate::utils::sym;
use crate::utils::{in_macro_or_desugar, is_allowed, match_type, paths, span_help_and_lint, LimitStack};
declare_clippy_lint! {
@@ -72,7 +71,7 @@ impl CognitiveComplexity {
..
} = helper;
let ret_ty = cx.tables.node_type(expr.hir_id);
let ret_adjust = if match_type(cx, ret_ty, &*paths::RESULT) {
let ret_adjust = if match_type(cx, ret_ty, &paths::RESULT) {
returns
} else {
returns / 2
@@ -119,7 +118,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CognitiveComplexity {
hir_id: HirId,
) {
let def_id = cx.tcx.hir().local_def_id_from_hir_id(hir_id);
if !cx.tcx.has_attr(def_id, *sym::test) {
if !cx.tcx.has_attr(def_id, sym!(test)) {
self.check(cx, body, span);
}
}