@@ -8,30 +8,44 @@ use core::ops::ControlFlow;
88use rustc_ast:: ast:: Attribute ;
99use rustc_hir:: intravisit:: FnKind ;
1010use rustc_hir:: { Body , Expr , ExprKind , FnDecl } ;
11- use rustc_lint:: { LateContext , LateLintPass , LintContext } ;
11+ use rustc_lint:: Level :: Allow ;
12+ use rustc_lint:: { LateContext , LateLintPass , Lint , LintContext } ;
1213use rustc_session:: impl_lint_pass;
1314use rustc_span:: def_id:: LocalDefId ;
1415use rustc_span:: { Span , sym} ;
1516
16- declare_clippy_lint ! {
17- /// ### What it does
18- /// Checks for methods with high cognitive complexity.
19- ///
20- /// ### Why is this bad?
21- /// Methods of high cognitive complexity tend to be hard to
22- /// both read and maintain. Also LLVM will tend to optimize small methods better.
23- ///
24- /// ### Known problems
25- /// Sometimes it's hard to find a way to reduce the
26- /// complexity.
27- ///
28- /// ### Example
29- /// You'll see it when you get the warning.
30- #[ clippy:: version = "1.35.0" ]
31- pub COGNITIVE_COMPLEXITY ,
32- nursery,
33- "functions that should be split up into multiple functions"
34- }
17+ use crate :: LintInfo ;
18+
19+ pub static COGNITIVE_COMPLEXITY : & Lint = & Lint {
20+ name : & "clippy::COGNITIVE_COMPLEXITY" ,
21+ default_level : Allow ,
22+ desc : "functions that should be split up into multiple functions" ,
23+ edition_lint_opts : None ,
24+ report_in_external_macro : true ,
25+ future_incompatible : None ,
26+ is_externally_loaded : true ,
27+ crate_level_only : false ,
28+ loadbearing : true ,
29+ ..Lint :: default_fields_for_macro ( )
30+ } ;
31+ pub ( crate ) static COGNITIVE_COMPLEXITY_INFO : & ' static LintInfo = & LintInfo {
32+ lint : & COGNITIVE_COMPLEXITY ,
33+ category : crate :: LintCategory :: Nursery ,
34+ explanation : r"### What it does
35+ Checks for methods with high cognitive complexity.
36+
37+ ### Why is this bad?
38+ Methods of high cognitive complexity tend to be hard to both read and maintain.
39+ Also LLVM will tend to optimize small methods better.
40+
41+ ### Known problems
42+ Sometimes it's hard to find a way to reduce the complexity.
43+
44+ ### Example
45+ You'll see it when you get the warning." ,
46+ version : Some ( "1.35.0" ) ,
47+ location : "#L0" ,
48+ } ;
3549
3650pub struct CognitiveComplexity {
3751 limit : LimitStack ,
0 commit comments