Public report — rust-analyzer, published 28 Sep 2026.
Concrete security findings (which rule fired, in which file, on which line; CVE IDs, secret matches,
dependency versions) are REDACTED in this version; ask the repo owner for the full report.
Public
Codebase surveyMeasured under the Code Assurance Index · rubric rubric-2026.09.16 (frozen) · verify this surveyFiledcd_7a10394fd61244f6b63eff0f2d06a2f7
Filed 28 September 2026, 22:21 UTC
Public
Large · 450,652 LoC · 45 projects · rebuild ~3.9 person-years · weakest lens: Security (61%)
Findings by grade
71 critical2544 serious32 minor47 could not be resolved — could be critical — see Limitations
This survey was produced by
Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
28 September 2026, 21:58 UTC
A measurement, not a certificate. The Code Assurance Index does not certify,
approve or guarantee this codebase; it records a reproducible number and the evidence it was computed from. The
standard is authored by Canine Development, who also build Watchdog — its only implementation today. That is said
here so the number is checked rather than believed.
Grounded in facts. Every number here is computed, not narrated — reproducible, tool-backed, and traceable to a line of code. How to trust this ▸
2585findings with an exact file:lineof 2647 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
52/132dimensions across the health lenses450652 LoC · 45 projects — wide & deep
The system holds an adequate standing with an overall health score of 63%, indicating a workable asset that carries real, compounding risks. This large codebase, comprising over 450,000 lines of production code, represents significant value with a rebuild cost estimated at €570,000. While the system functions, its current state imposes a hidden tax on delivery speed and increases exposure to operational failures.
The most immediate financial leverage lies in improving test reliability. The top-ranked fix requires only a few engineer-days but prevents an annual drag of up to 111 engineer-days caused by the complexity and duplication in the code. This investment pays for itself within two months, effectively eliminating a recurring cost that slows down every change to the 165,000 lines modified annually. Without this fix, the team continues to pay a velocity tax of 4–10% on every modification, slowing feature delivery and increasing defect rates.
Security presents the second critical risk. As the weakest lens at 61%, the system’s large size concentrates operational and business risk here. A breach or compliance failure in such a substantial asset could be catastrophic. The lack of documented architectural decisions further exacerbates this, making it difficult to assess security boundaries or onboard new engineers safely. This gap in maturity means the team cannot easily verify if the system is secure or if changes will introduce new vulnerabilities.
Despite these risks, the system demonstrates genuine strength in performance, scoring 85%, and has no boilerplate code, indicating a focused, logic-heavy core. However, the absence of measured data on domain modeling and event-driven patterns means the full picture is partial. To stabilize the business value, the team must first add a testing section to the root documentation to enable reliable execution. This single action unlocks the ability to safely address the security gaps and reduce the ongoing velocity tax, providing the highest return on effort for the organization.
How the score is built — each lens's share of the headlineWidth is the lens's weight in the worst-heaviest fold (the weakest area pulls hardest); colour is that lens's own band. A lens fixes the score in proportion to its width.
D22 · Duplicate read operation across different types. `SourceDatabase` is the primary database trait, but `Files` exposes an identical `file_text` method. This suggests `Files` is either a redundant wrapper or a legacy alias, creating confusion about which type to use for reading file content.
D22 · Duplicate write operation with inconsistent signatures. `SourceDatabase` has `set_file_text` as a direct method, while `Files` has `set_file_text` that takes the database as an explicit argument. This inconsistency in how the database context is passed (implicit receiver vs explicit parameter) is confusing.
D22 · Same duplication issue as above for the durability-aware variant. `Files` duplicates the functionality of `SourceDatabase` with an inconsistent signature (explicit db parameter).
D22 · Duplicate read operation. `Files.source_root` duplicates `SourceDatabase.source_root` with inconsistent signature (explicit db parameter in `Files`).
A full-fidelity diff against the previous run's complete recorded findings — line-move tolerant: a finding that only shifted line counts as unchanged, only genuinely new titles/files surface here.
Rebuild cost & value ~ Modeled — €190,000–€950,000
0.9× (at 63% quality) — the last 20% of quality is most of the work
Size & shape
Large · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)
This codebase represents roughly ~3.9 person-years of build effort (about ~€570,000 to rebuild). Its weakest lens is Security at 61% — the part of that asset most exposed by the findings below.
How we model this: boilerplate at a scaffolding rate + logic × domain Standard (×1.0) — standard service × a 0.9× quality factor, at €60–95/h; indicative, ±~30% · size measured directly from source · effort from total production LoC as straight-line logic (the tier split is a C#-only syntax walk), a conservative lower bound. Indicative only — most sensitive to the hourly rate and the domain tier (both tunable in config).
Top priorities
The highest-leverage moves; the full ranked list is in the Roadmap below.
1
Resolve the 1 No ADRs found finding(s) in ADR Quality.
Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree, with each file named `NNNN-title` in whatever markup those docs already use, is the most discoverable form).
The top-ranked fix costs roughly 1–3 engineer-days once. Not doing it costs about 18.5–111 engineer-days every year, paid as drag on the ~164,984 lines this team changes annually — a bill that arrives whether or not anyone books it. On those figures the fix breaks even in roughly 1–2 months and is free after that. Method, stated so this is not read as a quotation: debt from the ranked task's effort band; interest = annual changed lines (measured, annualised from the 90-day window) ÷ an ASSUMED 150–400 lines per engineer-day × the 4–10% drag implied by the code-quality signals; breaking point = debt ÷ annual interest. A modelled planning range built from measured inputs and one named assumption — not a quotation, a valuation, or a certified figure.
Evidence: D15 churn: 40,681 line(s) changed over a 90-day window ⇒ ~164,984/year · D1/D2/D4 code quality: averaging 6.2/10 ⇒ a 4–10% drag on each change · top-ranked remediation: Low effort ⇒ about 1–3 engineer-day(s)
→ Do the top-ranked fix now if this code will still be yours in 2 months.
Value concentrated against a weak lens · Medium · Value at risk
This is a Large asset (~3.9 person-years to rebuild), and its weakest lens is Security at 61%. The operational and business risk on an asset this size concentrates there — that's where remediation buys the most protection.
→ Direct remediation budget at Security first — highest risk-reduction per euro on an asset this size.
Highest-leverage move · Medium · Leverage
Of everything flagged, the best return on effort is: Add a 'Testing' section to the root README — how to run the test suite. The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Add a 'Testing' section to the root README — how to run the test suite.
A velocity tax on every change · Medium · Economics
The code-quality signals (complexity, duplication, cohesion) average 6.2/10, which acts as a tax on every change in the weaker areas: modifications there plausibly cost on the order of 4–10% more than in clean code, and the tax compounds as the codebase grows. (A modelled estimate, not a measured fact.)
Evidence: D1/D2/D4 code quality: averaging 6.2/10 across the code-quality signals actually measured
→ Pay it down where churn is highest — the hotspots — not everywhere; that's where the tax is actually paid.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways — a layering smell or cycle. A clean layered graph has none.
Architecture — module dependency matrix
Rows and columns are the same modules, ordered so that a module only depends on ones above it. A cell means the row depends on the column, and its number is how many type pairs create that dependency. Read one thing: is anything above the diagonal? A mark there is a dependency cycle. (A cycle is all this shows — an unusual but cycle-free dependency sits below the diagonal like any other.)
1029 modules, 4518 dependencies. 6 dependency cycles across 270 modules, marked above the diagonal.
Showing the 40 most-connected modules; 989 more are not drawn.
Module dependency matrix. The row depends on the column; the number is how many type pairs create the dependency. A cell above the diagonal is part of a dependency cycle.
syntax.ast.syntax_factory uses parser.test_data.parser.ok.0020_type_param_bounds. Changing parser.test_data.parser.ok.0020_type_param_bounds can break syntax.ast.syntax_factory, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
2→8 syntax.ast.syntax_factory depends on syntax.ast.generated.nodescycle✕
Type pairs
74 distinct (type in syntax.ast.syntax_factory → type in syntax.ast.generated.nodes) references. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
syntax.syntax_editor uses parser.test_data.parser.inline.ok.fn_decl. Changing parser.test_data.parser.inline.ok.fn_decl can break syntax.syntax_editor, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
text_size.size uses parser.test_data.parser.ok.0020_type_param_bounds. Changing parser.test_data.parser.ok.0020_type_param_bounds can break text_size.size, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
text_size.size uses parser.test_data.parser.inline.ok.fn_decl. Changing parser.test_data.parser.inline.ok.fn_decl can break text_size.size, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
text_size.range uses parser.test_data.parser.inline.ok.fn_decl. Changing parser.test_data.parser.inline.ok.fn_decl can break text_size.range, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
7→1 syntax.ast.generated.tokens depends on parser.test_data.parser.ok.0020_type_param_bounds✕
Type pairs
10 distinct (type in syntax.ast.generated.tokens → type in parser.test_data.parser.ok.0020_type_param_bounds) references.
syntax.ast.generated.tokens uses parser.test_data.parser.ok.0020_type_param_bounds. Changing parser.test_data.parser.ok.0020_type_param_bounds can break syntax.ast.generated.tokens, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
7→5 syntax.ast.generated.tokens depends on text_size.size✕
Type pairs
1 distinct (type in syntax.ast.generated.tokens → type in text_size.size) reference.
syntax.ast.generated.tokens uses hir_expand.mod_path. Changing hir_expand.mod_path can break syntax.ast.generated.tokens, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
8→1 syntax.ast.generated.nodes depends on parser.test_data.parser.ok.0020_type_param_bounds✕
Type pairs
181 distinct (type in syntax.ast.generated.nodes → type in parser.test_data.parser.ok.0020_type_param_bounds) references. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
syntax.ast.generated.nodes uses parser.test_data.parser.ok.0020_type_param_bounds. Changing parser.test_data.parser.ok.0020_type_param_bounds can break syntax.ast.generated.nodes, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
8→2 syntax.ast.generated.nodes depends on syntax.ast.syntax_factory✕
Type pairs
1 distinct (type in syntax.ast.generated.nodes → type in syntax.ast.syntax_factory) reference.
syntax.ast.generated.nodes uses syntax.ast.generated.tokens. Changing syntax.ast.generated.tokens can break syntax.ast.generated.nodes, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
8→10 syntax.ast.generated.nodes depends on parser.test_data.parser.inline.ok.fn_declcycle✕
Type pairs
9 distinct (type in syntax.ast.generated.nodes → type in parser.test_data.parser.inline.ok.fn_decl) references.
syntax.ast.generated.nodes uses parser.test_data.parser.inline.ok.fn_decl. Changing parser.test_data.parser.inline.ok.fn_decl can break syntax.ast.generated.nodes, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
8→16 syntax.ast.generated.nodes depends on hir_expand.namecycle✕
Type pairs
3 distinct (type in syntax.ast.generated.nodes → type in hir_expand.name) references.
syntax.ast.generated.nodes uses hir_def.hir. Changing hir_def.hir can break syntax.ast.generated.nodes, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
8→20 syntax.ast.generated.nodes depends on hir.term_search.exprcycle✕
Type pairs
42 distinct (type in syntax.ast.generated.nodes → type in hir.term_search.expr) references. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
syntax.ast.generated.nodes uses hir_def.item_tree. Changing hir_def.item_tree can break syntax.ast.generated.nodes, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
8→28 syntax.ast.generated.nodes depends on hircycle✕
Type pairs
162 distinct (type in syntax.ast.generated.nodes → type in hir) references. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
syntax.ast.generated.nodes uses hir_def.expr_store.path. Changing hir_def.expr_store.path can break syntax.ast.generated.nodes, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
8→31 syntax.ast.generated.nodes depends on hir_expand.mod_pathcycle✕
Type pairs
190 distinct (type in syntax.ast.generated.nodes → type in hir_expand.mod_path) references. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
parser.test_data.parser.inline.ok.fn_decl uses hir_def.expr_store. Changing hir_def.expr_store can break parser.test_data.parser.inline.ok.fn_decl, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
10→19 parser.test_data.parser.inline.ok.fn_decl depends on hir_ty.displaycycle✕
Type pairs
3 distinct (type in parser.test_data.parser.inline.ok.fn_decl → type in hir_ty.display) references.
parser.test_data.parser.inline.ok.fn_decl uses hir_ty.display. Changing hir_ty.display can break parser.test_data.parser.inline.ok.fn_decl, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
10→24 parser.test_data.parser.inline.ok.fn_decl depends on hir_defcycle✕
Type pairs
1 distinct (type in parser.test_data.parser.inline.ok.fn_decl → type in hir_def) reference.
parser.test_data.parser.inline.ok.fn_decl uses base_db.input. Changing base_db.input can break parser.test_data.parser.inline.ok.fn_decl, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
11→1 hir_ty.next_solver.predicate depends on parser.test_data.parser.ok.0020_type_param_bounds✕
Type pairs
4 distinct (type in hir_ty.next_solver.predicate → type in parser.test_data.parser.ok.0020_type_param_bounds) references.
hir_ty.next_solver.predicate uses parser.test_data.parser.ok.0020_type_param_bounds. Changing parser.test_data.parser.ok.0020_type_param_bounds can break hir_ty.next_solver.predicate, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
11→10 hir_ty.next_solver.predicate depends on parser.test_data.parser.inline.ok.fn_decl✕
Type pairs
1 distinct (type in hir_ty.next_solver.predicate → type in parser.test_data.parser.inline.ok.fn_decl) reference.
hir_ty.next_solver.predicate uses parser.test_data.parser.inline.ok.fn_decl. Changing parser.test_data.parser.inline.ok.fn_decl can break hir_ty.next_solver.predicate, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
11→14 hir_ty.next_solver.predicate depends on hir_ty.next_solver.internercycle✕
Type pairs
3 distinct (type in hir_ty.next_solver.predicate → type in hir_ty.next_solver.interner) references.
hir_ty.next_solver.predicate uses hir_ty.next_solver.interner. Changing hir_ty.next_solver.interner can break hir_ty.next_solver.predicate, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
11→15 hir_ty.next_solver.predicate depends on hir_tycycle✕
Type pairs
2 distinct (type in hir_ty.next_solver.predicate → type in hir_ty) references.
hir_ty.next_solver.ty uses parser.test_data.parser.ok.0020_type_param_bounds. Changing parser.test_data.parser.ok.0020_type_param_bounds can break hir_ty.next_solver.ty, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
12→10 hir_ty.next_solver.ty depends on parser.test_data.parser.inline.ok.fn_decl✕
Type pairs
1 distinct (type in hir_ty.next_solver.ty → type in parser.test_data.parser.inline.ok.fn_decl) reference.
hir_ty.next_solver.ty uses parser.test_data.parser.inline.ok.fn_decl. Changing parser.test_data.parser.inline.ok.fn_decl can break hir_ty.next_solver.ty, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
12→11 hir_ty.next_solver.ty depends on hir_ty.next_solver.predicate✕
Type pairs
2 distinct (type in hir_ty.next_solver.ty → type in hir_ty.next_solver.predicate) references.
hir_ty.next_solver.infer uses parser.test_data.parser.ok.0020_type_param_bounds. Changing parser.test_data.parser.ok.0020_type_param_bounds can break hir_ty.next_solver.infer, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
13→10 hir_ty.next_solver.infer depends on parser.test_data.parser.inline.ok.fn_decl✕
Type pairs
2 distinct (type in hir_ty.next_solver.infer → type in parser.test_data.parser.inline.ok.fn_decl) references.
hir_ty.next_solver.infer uses parser.test_data.parser.inline.ok.fn_decl. Changing parser.test_data.parser.inline.ok.fn_decl can break hir_ty.next_solver.infer, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
13→11 hir_ty.next_solver.infer depends on hir_ty.next_solver.predicate✕
Type pairs
1 distinct (type in hir_ty.next_solver.infer → type in hir_ty.next_solver.predicate) reference.
hir_ty.next_solver.interner uses parser.test_data.parser.ok.0020_type_param_bounds. Changing parser.test_data.parser.ok.0020_type_param_bounds can break hir_ty.next_solver.interner, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
14→10 hir_ty.next_solver.interner depends on parser.test_data.parser.inline.ok.fn_decl✕
Type pairs
2 distinct (type in hir_ty.next_solver.interner → type in parser.test_data.parser.inline.ok.fn_decl) references.
hir_ty.next_solver.interner uses parser.test_data.parser.inline.ok.fn_decl. Changing parser.test_data.parser.inline.ok.fn_decl can break hir_ty.next_solver.interner, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
14→11 hir_ty.next_solver.interner depends on hir_ty.next_solver.predicate✕
Type pairs
2 distinct (type in hir_ty.next_solver.interner → type in hir_ty.next_solver.predicate) references.
hir_ty.next_solver.interner uses hir_ty.next_solver.predicate. Changing hir_ty.next_solver.predicate can break hir_ty.next_solver.interner, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
14→12 hir_ty.next_solver.interner depends on hir_ty.next_solver.ty✕
Type pairs
3 distinct (type in hir_ty.next_solver.interner → type in hir_ty.next_solver.ty) references.
hir_ty uses parser.test_data.parser.ok.0020_type_param_bounds. Changing parser.test_data.parser.ok.0020_type_param_bounds can break hir_ty, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
15→8 hir_ty depends on syntax.ast.generated.nodes✕
Type pairs
1 distinct (type in hir_ty → type in syntax.ast.generated.nodes) reference.
hir_ty.display uses parser.test_data.parser.ok.0020_type_param_bounds. Changing parser.test_data.parser.ok.0020_type_param_bounds can break hir_ty.display, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
19→7 hir_ty.display depends on syntax.ast.generated.tokens✕
Type pairs
1 distinct (type in hir_ty.display → type in syntax.ast.generated.tokens) reference.
hir_ty.display uses parser.test_data.parser.inline.ok.fn_decl. Changing parser.test_data.parser.inline.ok.fn_decl can break hir_ty.display, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
19→11 hir_ty.display depends on hir_ty.next_solver.predicate✕
Type pairs
1 distinct (type in hir_ty.display → type in hir_ty.next_solver.predicate) reference.
hir.semantics uses parser.test_data.parser.ok.0020_type_param_bounds. Changing parser.test_data.parser.ok.0020_type_param_bounds can break hir.semantics, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
hir.semantics uses syntax.ast.generated.tokens. Changing syntax.ast.generated.tokens can break hir.semantics, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
21→8 hir.semantics depends on syntax.ast.generated.nodes✕
Type pairs
32 distinct (type in hir.semantics → type in syntax.ast.generated.nodes) references. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
hir.semantics uses parser.test_data.parser.inline.ok.fn_decl. Changing parser.test_data.parser.inline.ok.fn_decl can break hir.semantics, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
21→14 hir.semantics depends on hir_ty.next_solver.interner✕
Type pairs
1 distinct (type in hir.semantics → type in hir_ty.next_solver.interner) reference.
hir_def uses parser.test_data.parser.ok.0020_type_param_bounds. Changing parser.test_data.parser.ok.0020_type_param_bounds can break hir_def, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
hir_ty.infer uses parser.test_data.parser.ok.0020_type_param_bounds. Changing parser.test_data.parser.ok.0020_type_param_bounds can break hir_ty.infer, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
26→10 hir_ty.infer depends on parser.test_data.parser.inline.ok.fn_decl✕
Type pairs
1 distinct (type in hir_ty.infer → type in parser.test_data.parser.inline.ok.fn_decl) reference.
hir_ty.infer uses parser.test_data.parser.inline.ok.fn_decl. Changing parser.test_data.parser.inline.ok.fn_decl can break hir_ty.infer, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
26→12 hir_ty.infer depends on hir_ty.next_solver.ty✕
Type pairs
8 distinct (type in hir_ty.infer → type in hir_ty.next_solver.ty) references.
hir_def.expr_store.path uses parser.test_data.parser.ok.0020_type_param_bounds. Changing parser.test_data.parser.ok.0020_type_param_bounds can break hir_def.expr_store.path, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
29→12 hir_def.expr_store.path depends on hir_ty.next_solver.ty✕
Type pairs
1 distinct (type in hir_def.expr_store.path → type in hir_ty.next_solver.ty) reference.
hir_expand.mod_path uses parser.test_data.parser.inline.ok.fn_decl. Changing parser.test_data.parser.inline.ok.fn_decl can break hir_expand.mod_path, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→16 hir_expand.mod_path depends on hir_expand.name✕
Type pairs
1 distinct (type in hir_expand.mod_path → type in hir_expand.name) reference.
base_db.input uses parser.test_data.parser.inline.ok.fn_decl. Changing parser.test_data.parser.inline.ok.fn_decl can break base_db.input, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
33→14 base_db.input depends on hir_ty.next_solver.interner✕
Type pairs
2 distinct (type in base_db.input → type in hir_ty.next_solver.interner) references.
ide_assists.assist_context uses syntax.ast.generated.tokens. Changing syntax.ast.generated.tokens can break ide_assists.assist_context, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→8 ide_assists.assist_context depends on syntax.ast.generated.nodes✕
Type pairs
1 distinct (type in ide_assists.assist_context → type in syntax.ast.generated.nodes) reference.
ide_assists.assist_context uses parser.test_data.parser.inline.ok.fn_decl. Changing parser.test_data.parser.inline.ok.fn_decl can break ide_assists.assist_context, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→21 ide_assists.assist_context depends on hir.semantics✕
Type pairs
1 distinct (type in ide_assists.assist_context → type in hir.semantics) reference.
ide_completion.context uses parser.test_data.parser.ok.0020_type_param_bounds. Changing parser.test_data.parser.ok.0020_type_param_bounds can break ide_completion.context, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→6 ide_completion.context depends on text_size.range✕
Type pairs
1 distinct (type in ide_completion.context → type in text_size.range) reference.
rust_analyzer.config uses parser.test_data.parser.inline.ok.fn_decl. Changing parser.test_data.parser.inline.ok.fn_decl can break rust_analyzer.config, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
rust_analyzer.global_state uses parser.test_data.parser.ok.0020_type_param_bounds. Changing parser.test_data.parser.ok.0020_type_param_bounds can break rust_analyzer.global_state, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
rust_analyzer.global_state uses syntax.ast.generated.tokens. Changing syntax.ast.generated.tokens can break rust_analyzer.global_state, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→25 rust_analyzer.global_state depends on ide_db✕
Type pairs
1 distinct (type in rust_analyzer.global_state → type in ide_db) reference.
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A03:2021 — Injection
54
High / Critical
A06:2021 — Vulnerable & Outdated Components
19
High / Critical
A05:2021 — Security Misconfiguration
2
High / Critical
Roadmap
Begin by adding a testing section to the root README and establishing a structured repository for architecture decision records to clarify context and consequences. Strengthen security and performance by enabling automated dependency review tools to catch issues early. Finally, implement a draft release or manual gate to prevent bad builds from reaching users, ensuring a safe and controlled deployment process.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 1 No ADRs found finding(s) in ADR Quality.
Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree, with each file named `NNNN-title` in whatever markup those docs already use, is the most discoverable form).
Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.
Stamp a version in your build/package manifest (e.g. csproj <Version>, package.json, pyproject.toml, Cargo.toml, or a VERSION file) or tag releases with semver so builds and releases are traceable.
Every finding carries one of four grades. Three say how serious it is. The fourth says this
survey could not settle it — and it is a grade, not a gap.
Critical — 71
A definite problem that already costs you something and drags the score down: a
missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here
tends to cause failures elsewhere.
Serious — 2544
Likely wrong, but not failing yet. It degrades
the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to
carry for two years either.
Minor — 32
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 47
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 47 of 52 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 5 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 52 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 2585 of 2647 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D6 Cohesion (LCOM4) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT READ here — but this repository measures it: a Codecov configuration (.codecov.yml) and a coverage step in CI (`cargo llvm-cov`) shows that coverage is collected and tracked in your own CI. The built-in collector has no runner for this ecosystem (.rs, .ts), so the analyzer could not read the number — a gap in the analyzer's language coverage, not an unmeasured repo. Not scored. To have the real number read, produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`, or lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`, or lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This repository declares 1 of its own test(s) unreliable. The built-in reliability runner does not support this repository's ecosystem (.rs, .ts), so the suite was not re-run and no reliability score is given — these are the repository's own declarations, not our measurement.
D15 Churn × Complexity Hotspots — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. A hotspot's complexity is meant to be the worst body its churn actually touched. For crates/hir-expand/src/builtin/fn_macro.rs, crates/hir-def/src/builtin_derive.rs that could not be established — the complexity reader for the file reports no body extents, or the history carries no per-line attribution — so the row quotes the file's worst body, which the counted changes may never have touched. The churn count is unaffected.
AX1 Captive dependencies — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
AX2 Stateful singletons — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
AX6 Interface segregation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
C2 Access Controls — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
C3 Audit Trail — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
C4 Data Retention — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
C5 Data-Subject Rights — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
ED5 Idempotency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check finds retry-prone mutations by walking the repository's declared types, and NONE was loaded on this run, so it had nothing to look at. That is a limit of the analyzer's reach — it reads .NET projects — not a finding that this repository has no command handlers or message consumers.
GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
P10 Library API & versioning — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads NuGet packaging and C# public API only, and no .NET project was loaded for this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
PF1 Benchmark discipline — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
PF2 Allocation hygiene — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
S1 Web-Security Posture — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
X1 Async correctness — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X10 Duplicated predicate — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X12 Unreachable branch — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X13 Undrained process stream — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X14 Bypassable address classification — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X15 Unvalidated length from an untrusted reader — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X16 Unfloored truncation loop — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X17 Uncapped recursion over a caller-supplied document — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X18 Disposal-pattern correctness — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X19 Unrestored process-global state — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X2 Cancellation propagation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X20 Mistyped argument guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X21 Side-effecting pattern guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X22 Contradicted release guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X23 Unguarded diagnostic materialisation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X24 Document value interpolated into markup unescaped — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X25 Inert configuration knob — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X26 Unsynchronised callback handoff — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X27 Collection changed while being enumerated — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X28 Index access outside its own emptiness guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X29 Per-element action decided by a fixed element — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X3 Exception handling — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X30 Support guard that admits what it rejects — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X32 Type resolved by simple name across every loaded assembly — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X4 Structured logging — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X5 Nullable reference types — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X6 Hand-rolled structured-format parsing — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X7 Silent fallback defaults — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
Repo exclusion declarations: 6 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.
Limitations & what we did not check
Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement. Its critique rows are drawn from a closed category vocabulary and each row means the same thing in every run, so two scans can be compared row by row; the SET that fires is still a sample, and does not repeat exactly. Measured on one frozen input, six scans at one engine SHA: 2-5 critique rows per scan, 8 distinct rows across the six, 3 of those 8 seen in only one scan. So a D19 row is evidence about the documentation, but a COUNT of D19 rows is not a quantity — never read a change in it as an improvement or a regression.
D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
D22 Internal API Consistency: API-surface coherence is an LLM judgement over a sample of the public surface — consistency of intent across the whole API is approximated, not exhaustively verified.
D23 Boundary Type-Coupling: Boundary leakage is detected from type references across detected contexts — leaks that flow through primitives, serialization or shared infrastructure may not surface as a typed reference.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
The LLM boundary
LLM-set scores this run (5): D19, D21, D22, D26, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
284 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was Evaluator::exec_intrinsic at 198. A further 62 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being HlTag::as_str at 60 — they are counted neither in the figure above nor in this dimension's score. 21 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: crates/ide/src/syntax_highlighting/tags.rs (HlTag::as_str at 60), crates/rust-analyzer/src/lsp/semantic_tokens.rs (SupportedType::fmt at 58), xtask/src/codegen/grammar.rs (Field::method_name at 33), crates/syntax/src/ast/expr_ext.rs (BinExpr::op_details at 30), crates/hir-ty/src/next_solver/interner.rs (DbInterner::require_trait_lang_item at 29), and 16 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.
+ 80 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 39 ide finding(s) in Cyclomatic Complexity — start with render.rs (5), highlight.rs (4), signature_help.rs (3). — One of this dimension's main actionable groups (39 warning-level).
Resolve the 25 ide_assists finding(s) in Cyclomatic Complexity — start with convert_closure_to_fn.rs (2), extract_function.rs (2), inline_call.rs. — One of this dimension's main actionable groups (25 warning-level).
Resolve the 16 ide_completion finding(s) in Cyclomatic Complexity — start with analysis.rs (4), pattern.rs (2), expr.rs. — One of this dimension's main actionable groups (16 warning-level).
Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 122 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 51 ide_assists finding(s) in Cognitive Complexity — start with convert_closure_to_fn.rs (4), extract_function.rs (4), gen_trait_fn_body.rs (3). — One of this dimension's main actionable groups (51 warning-level).
Resolve the 46 ide finding(s) in Cognitive Complexity — start with render.rs (5), highlight.rs (4), rename.rs (3). — One of this dimension's main actionable groups (46 warning-level).
Resolve the 23 ide_completion finding(s) in Cognitive Complexity — start with analysis.rs (4), expr.rs (2), function.rs (2). — One of this dimension's main actionable groups (23 warning-level).
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.5 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 97 FileTooLong finding(s) in God Classes — start with lib.rs (7), lower.rs (3), display.rs (2). — One of this dimension's main actionable groups (97 warning-level).
Resolve the 70 MethodTooLong finding(s) in God Classes — start with lower.rs (6), eval.rs (6), analysis_stats.rs (5). — One of this dimension's main actionable groups (70 warning-level).
Resolve the 60 FunctionTooLong finding(s) in God Classes — start with analysis.rs (4), display.rs (3), highlight.rs (3). — One of this dimension's main actionable groups (60 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
374 duplicated block group(s) detected. A further 14 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 1 of the 388 are in trees this repository does not ship — vendored, example/demo, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
+ 87 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 43 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with gen_trait_fn_body.rs (4), lib.rs (3), expr.rs (2). — One of this dimension's main actionable groups (43 warning-level).
Resolve the 41 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with consteval.rs (3), lib.rs (2), eval.rs (2). — One of this dimension's main actionable groups (41 warning-level).
Resolve the 40 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with lower.rs (3), lib.rs (2), display.rs (2). — One of this dimension's main actionable groups (40 warning-level).
Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling6.9 / 10Adequate✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
43 production modules (Cargo+npm), 0 dependency cycle(s), 7 unstable depended-on module(s). Read from the build's own module declarations; 8 module(s) off the main sequence, with abstractness counted on 40 of the 43 (the rest declare no modelled class or interface, export only macros, or are not Gradle/Maven modules or Cargo crates).
Off the main sequence: edition · ×8
Unstable project hir-def
Unstable project hir-ty
Unstable project ide-completion
Unstable project ide-diagnostics
+ 3 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 8 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (8 warning-level).
Resolve the 1 Unstable project hir-def finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Unstable project hir-ty finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
8252 test methods: 8140 unit, 112 integration, 0 BDD, 0 e2e. The Rust suite contributes 8252 `#[test]` function(s) across 466 file(s) declaring at least one; its unit/integration split is Cargo's own — 13 of those file(s) are integration-test targets under a crate's tests/ directory, and the rest are #[test] functions compiled into the crate they test.
What it measures: Whether dependencies are current, secure, and not bloated.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.
14 outdated, 0 yanked direct Cargo dependencies. 49 of 54 direct crates were graded against crates.io (0 not published there, 5 not resolved by a committed REDACTED). Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.
Outdated: borsh · ×14
What to do
Enforce Dependency Hygiene in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Top hotspots: crates/hir-def/src/expr_store/lower.rs (30×89=2670); crates/hir-ty/src/mir/lower.rs (19×131=2489); crates/hir-ty/src/mir/eval.rs (16×100=1600) Repeated repair below the complexity floor: crates/hir-ty/src/generics.rs (4 of 7 changes were fixes); crates/hir-ty/src/next_solver/generics.rs (4 of 6 changes were fixes)
Resolve the 54 Hotspot finding(s) in Churn × Complexity Hotspots — start with lower.rs (3), render.rs (2), lib.rs (2). — One of this dimension's main actionable groups (54 warning-level).
Resolve the 2 Repeated repair finding(s) in Churn × Complexity Hotspots — start with generics.rs (2). — One of this dimension's main actionable groups (2 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor9.5 / 10Exemplary✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
34 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is crates/hir-ty/src/next_solver/infer/region_constraints/mod.rs. Counted over 747 of the 1426 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Off-boarding risk: anonymized user #1 · ×3
Further sole-owners (lower concentration)
✓ On the Gold path — maintain.
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
1033 deducted task-comment markers across 450652 LoC (0.2/KLoC) → score 9.5. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
FixmeComment repeated across 16 filescrates/hir-def/src/expr_store/lower.rs:444
What to do
Resolve the 933 FixmeComment finding(s) in Explicit Debt — start with lib.rs (66), lower.rs (39), tests.rs (26). — One of this dimension's main actionable groups (933 warning-level).
Resolve the 32 XxxComment finding(s) in Explicit Debt — start with decl_check.rs (5), item_scope.rs (2), match_check.rs (2). — One of this dimension's main actionable groups (32 warning-level).
Resolve the 25 HackComment finding(s) in Explicit Debt — start with source_analyzer.rs (5), matcher.rs (3), callee.rs (2). — One of this dimension's main actionable groups (25 warning-level).
Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.
The repository's root README and its subdirectories are well written for their audience (the project itself) with a clear overview, installation/usage quick start, architecture documentation, security/privacy sections, and extensive contributing guidance. The book/docs directory is the true project-wide reference: it contains an outstanding Contributing Quick Start covering code style, issue labels, Zulip discussion, CI, and a full summary of all the books' topics plus links to every source document (installation.md, troubleshooting.md, configuration.md, security.md, privacy.md, features.md, editor_features.md, contributing/README.md). The Rust Analyzer documentation is clear and complete for a tool whose scope is best described by its READMEs. The architecture/design docs are also present (24 markdown files), covering cargo invocation strategies, sysroot configuration, diagnostics settings, and the binary installation path. The body of each document is clipped mid-sentence by the scanner; this does not imply any content gap but confirms that the visible text reflects what exists in the outline. There are no missing-overview or missing-installation findings because the root README states what rust-analyzer is for and how to install it, and those sections appear elsewhere.
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.
0 naming inconsistencies across 0 sampled symbols.
✓ On the Gold path — maintain.
Detailed fixes: d21_recommendation.md.
Do you agree with this assessment?
D22 · Internal API ConsistencyStrong◐ Sampled · advisory
What it measures: Whether the internal API surface is consistent and coherent.
Method: Judged by language model at low temperature over a sample of the public API surface (IsPackable or .Contracts types). Sampled, advisory; confidence discounted by model uncertainty.
7 API inconsistencies across a 400-member sample of 1829 exposed types.
Duplicate read operation across different types. `SourceDatabase` is the primary database trait, but `Files` exposes an identical `file_text` method. This suggests `Files` is either a redundant wrapper or a legacy alias, creating confusion about which type to use for reading file content.
Duplicate write operation with inconsistent signatures. `SourceDatabase` has `set_file_text` as a direct method, while `Files` has `set_file_text` that takes the database as an explicit argument. This inconsistency in how the database context is passed (implicit receiver vs explicit parameter) is confusing.
Same duplication issue as above for the durability-aware variant. `Files` duplicates the functionality of `SourceDatabase` with an inconsistent signature (explicit db parameter).
Duplicate read operation. `Files.source_root` duplicates `SourceDatabase.source_root` with inconsistent signature (explicit db parameter in `Files`).
Duplicate read operation. `Files.file_source_root` duplicates `SourceDatabase.file_source_root` with inconsistent signature.
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 Duplicate read operation across different types. `SourceDatabase` is the… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Duplicate write operation with inconsistent signatures. `SourceDatabase`… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Same duplication issue as above for the durability-aware variant.… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d22_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether domain types (IDs, enums, value objects) leak across bounded-context boundaries.
Method: Cross-context domain-type leakage via Roslyn structural classification (strongly-typed IDs / value objects) over every public surface. Exhaustive, deterministic, type-level aggregate-boundary check.
Coverage: Bounded contexts derived from NAMESPACE prefix (or graph-inferred where available); cross-boundary domain-type leakage then checked exhaustively over every public member of every type.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
54 finding(s): 0 critical, 54 high, 0 medium, 0 low. 42 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 6 file(s) — `crates/hir-ty/src/next_solver/infer/mod.rs` (line 528), `crates/hir/src/lib.rs` (line 4534, line 4548, line 4631, …), `crates/rust-analyzer/src/handlers/dispatch.rs` (line 111, line 112, line 140, …), `crates/syntax-bridge/src/lib.rs` (line 221), `crates/syntax/test_data/parser/fuzz-failures/0000.rs`, … (+1 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 2 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 3 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4). — One of this dimension's main actionable groups (4 issue-level).
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
No action in Static Analysis (SAST) — all 41 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (41 issue-level, 0 of them charged here).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir/Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex, Go, Java and Kotlin via Maven/Gradle, npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.
Resolve the 11 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (11). — One of this dimension's main actionable groups (11 issue-level).
Resolve the 4 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (4). — One of this dimension's main actionable groups (4 warning-level).
Resolve the 2 Medium vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 1 High IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Medium IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
17 of 747 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is crates/ide/src/view_syntax_tree.rs. Counted over 747 of the 1426 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Resolve the 2 Orphaned knowledge finding(s) in Knowledge Freshness — start with view_syntax_tree.rs, notes.rs. — One of this dimension's main actionable groups (2 issue-level).
Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 14 Change coupling finding(s) in Change Coupling — start with lower.rs (3), test_db.rs (2), expander.rs (2). — One of this dimension's main actionable groups (14 warning-level).
Resolve the 1 Change-coupling hub finding(s) in Change Coupling — start with mutability.rs. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 0 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
What to do
The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Do you agree with this assessment?
AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified
Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.
Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.
Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.
Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.
Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
741 code files changed in the last 6 months but the README was not touched — it may no longer reflect the system.
What to do
Add a 'Testing' section to the root README — how to run the test suite.
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
Add a README to the 41 of 48 project(s) that lack one — worth up to 1.7 pts.
Review the README against recent changes; refresh the parts that drifted.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree, with each file named `NNNN-title` in whatever markup those docs already use, is the most discoverable form).
Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
Only 23/29 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `crates/mbe`, `crates/proc-macro-srv-cli`, `crates/syntax-bridge`, `crates/test-utils`, `lib/ungrammar/ungrammar2json` and 1 more.
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
Consider OpenTelemetry tracing/metrics (opentelemetry with tracing-opentelemetry) and a health-check endpoint (a /health route on your axum/actix router) for operability.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
What to do
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
What to do
Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.
Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.
Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.
What to do
Stamp a version in your build/package manifest (e.g. csproj <Version>, package.json, pyproject.toml, Cargo.toml, or a VERSION file) or tag releases with semver so builds and releases are traceable.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from the language model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin) or inside a Java method returning a Reactor Mono/Flux — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
`main` is async and calls readFileSync — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — editors/code/tests/runTests.ts:6
What to do
TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
Do you agree with this assessment?
R1 · Type Safety10.0 / 10Exemplary✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
React / JS · Code Health — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Deterministic.
editors/code/src/commands.ts:210 · editors/code/src/commands.ts:247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — editors/code/src/commands.ts:210
editors/code/src/commands.ts:722 · editors/code/src/commands.ts:786 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — editors/code/src/commands.ts:722
editors/code/src/commands.ts:622 · editors/code/src/commands.ts:727 · editors/code/src/commands.ts:791 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. — editors/code/src/commands.ts:622
editors/code/src/commands.ts:648 · editors/code/src/commands.ts:817 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — editors/code/src/commands.ts:648
editors/code/src/commands.ts:1032 · editors/code/src/commands.ts:1067 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — editors/code/src/commands.ts:1032
editors/code/src/commands.ts:1058 · editors/code/src/commands.ts:1083 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — editors/code/src/commands.ts:1058
editors/code/src/commands.ts:102 · editors/code/src/commands.ts:279 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — editors/code/src/commands.ts:102
REDACTED:203 · editors/code/src/ctx.ts:223 — the two spans are one implementation copied and then locally edited — 58 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — REDACTED:203
editors/code/src/commands.ts:55 · editors/code/src/commands.ts:770 · editors/code/src/commands.ts:836 · editors/code/src/commands.ts:966 — all 4 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — editors/code/src/commands.ts:55
editors/code/src/commands.ts:767 · editors/code/src/commands.ts:833 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — editors/code/src/commands.ts:767
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Architecture — Conformance to the detected frontend architecture layout (feature-sliced / layered src) plus cross-package deep-import rules (D-386).
Method: Conformance to the detected frontend layout (feature-sliced / layered src) plus cross-package deep-import rules, over the module graph. Deterministic.
editors/code/src/client.ts:5 imports vscode-languageclient/lib/common/utils/is, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — editors/code/src/client.ts:5
editors/code/src/config.ts:1 imports vscode-languageclient/lib/common/utils/is, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — editors/code/src/config.ts:1
What to do
Fix the listed violations: import through public entries (package exports / slice index), never reach into another layer or package's internals.
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
getDebugConfiguration has cyclomatic complexity 20 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — editors/code/src/debug.ts:81
toggleCheckOnSave has cyclomatic complexity 16 and cognitive complexity 15; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — editors/code/src/config.ts:305
getServer has cyclomatic complexity 15 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:36
(anonymous) has cyclomatic complexity 15 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — editors/code/src/client.ts:60
substituteVariablesInEnv has cyclomatic complexity 13 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — editors/code/src/config.ts:482
What to do
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Do you agree with this assessment?
R3 · Large Files4.0 / 10Weak✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
3 file(s) over 400 lines (counted as significant lines — blank lines excluded — over production source only, tests excluded), largest first: editors/code/src/commands.ts (1416), editors/code/src/ctx.ts (572), editors/code/src/config.ts (546).
What to do
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Do you agree with this assessment?
R4 · Test Coverage10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.
Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.
React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).
Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.
What to do
Bump outdated dependencies to current versions to limit upgrade debt.
Do you agree with this assessment?
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.
Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.
Do you agree with this assessment?
R7 · Dead Code9.9 / 10Exemplary✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
Nothing imports this binding — it is safe to review for removal. (×2) — editors/code/src/lsp_ext.ts:160, REDACTED:231
What to do
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.
Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.
Imported but not declared in any reachable package.json — installs work only by hoisting accident. — editors/code/src/config.ts:7
Declared in editors/code/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it. (×3)
What to do
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.
Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.
Break each cycle by extracting the shared piece into a module both sides can import.
Do you agree with this assessment?
Reference — by lens
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 2 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
D11 Test Reliability — 1 observation(s) recorded · This repository declares 1 of its own test(s) unreliable. The built-in reliability runner does not support this repository's ecosystem (.rs, .ts), so the suite was not re-run and no reliability score is given — these are the repository's own declarations, not our measurement.
P12 CI test-gate honesty — 1 observation(s) recorded · Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
Not evidenced — 4 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 74 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — Frontend below the scale floor (17 DOM element(s) < 25) — too little surface to assess accessibility.
AC2 Forms & labels — Frontend below the scale floor (17 DOM element(s) < 25) — too little surface to assess accessibility.
AC3 Page structure — Frontend below the scale floor (17 DOM element(s) < 25) — too little surface to assess accessibility.
AC4 Keyboard semantics — Frontend below the scale floor (17 DOM element(s) < 25) — too little surface to assess accessibility.
AC5 ARIA correctness — Frontend below the scale floor (17 DOM element(s) < 25) — too little surface to assess accessibility.
AC6 Visual & motion safety — Frontend below the scale floor (17 DOM element(s) < 25) — too little surface to assess accessibility.
AC7 A11y enforcement — Frontend below the scale floor (17 DOM element(s) < 25) — too little surface to assess accessibility.
AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX2 Stateful singletons — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — docker build failed (exit 1) — DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
Install the buildx component to build images with BuildKit:
https://docs.docker.com/go/bui…; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
D10 Test Quality — ~52724 lines of test source are present (.rs, .ts) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
D14 License Compliance — Not scored — this repository's 275 shipped crate(s) were read from its REDACTED, but crates.io could not be asked for the licence of 61 of them (HTTP 429 Unknown Error), and a licence verdict over part of a dependency graph is not a licence verdict. Nothing is asserted about this repository's licensing in either direction.
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D24 Comment Value — No inline comments to assess — comment value is not applicable here.
D25 ADR Conformance — no ADRs to check
D27 Navigability — symbol resolution incomplete — too few calls resolved to assess navigability
D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D6 Cohesion (LCOM4) — D6 reads a CS/VB/GO/SCALA/SWIFT/DART/JAVA/PY/KT/TS/TSX/MTS/CTS/JS/JSX/MJS/CJS/PHP class graph only — this repository's production source is .rs, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
D8 Code Coverage — Coverage not included — suite not readable by the collector
DM1 Domain Modelling — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 2 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit); 280 value object(s)
ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
ED5 Idempotency — This check finds retry-prone mutations (command handlers and message/event consumers) by walking the repository's declared types, and none was loaded here, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
ES1 Event Sourcing — not scored — this repository shows only 1 of the 3 signals this lens looks for (2 aggregate(s) with Apply/When folds)
GD1 Unfinished & placeholder code — no source files were read — this check reads C# syntax, and none was loaded for this repository. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P10 Library API & versioning — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JavaScript/TypeScript, Python, Rust source, so there is no service whose uptime a failing dependency could take down
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
PF1 Benchmark discipline — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
PF2 Allocation hygiene — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X1 Async correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X10 Duplicated predicate — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X12 Unreachable branch — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X13 Undrained process stream — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X14 Bypassable address classification — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X15 Unvalidated length from an untrusted reader — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X16 Unfloored truncation loop — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X17 Uncapped recursion over a caller-supplied document — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X18 Disposal-pattern correctness — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X19 Unrestored process-global state — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X2 Cancellation propagation — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X20 Mistyped argument guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X21 Side-effecting pattern guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X22 Contradicted release guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X23 Unguarded diagnostic materialisation — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X24 Document value interpolated into markup unescaped — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X25 Inert configuration knob — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X26 Unsynchronised callback handoff — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X27 Collection changed while being enumerated — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X28 Index access outside its own emptiness guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X29 Per-element action decided by a fixed element — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X3 Exception handling — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X30 Support guard that admits what it rejects — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X32 Type resolved by simple name across every loaded assembly — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X6 Hand-rolled structured-format parsing — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X7 Silent fallback defaults — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
Orphaned knowledge crates/ide/src/view_syntax_tree.rs— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge xtask/src/publish/notes.rs— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
D11 · Test Reliability· Test declared unreliable · ×1
Test declared unreliable: ratoml_inherit_config_from_ws_root crates/rust-analyzer/tests/slow-tests/ratoml.rs:453— This test is disabled or skipped with a reason naming unreliability — the repository's own words: "flaky test that tends to hang". A test that is skipped for flakiness is neither passing nor protecting the code it covers; either stabilise it or delete it, but do not leave it disabled indefinitely. (Found by reading the repository's own test source — the suite itself was not re-run, since the reliability runner does not support this ecosystem.)
Unlisted import 'lodash' editors/code/src/config.ts:7— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
FixmeComment crates/base-db/src/lib.rs:271— // FIXME: this *somehow* should be platform agnostic... — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/base-db/src/lib.rs:359— // FIXME: VFS rewrite should allow us to get rid of this wrapper — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/base-db/src/input.rs:369— // FIXME: This ought to be a `VfsPath` or something opaque. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/cfg/src/cfg_expr.rs:96— // FIXME: Parsing from `tt` is only used in a handful of places, reconsider — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/test_db.rs:191— // FIXME: handle `mod` inside block expression — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/resolver.rs:625— // FIXME: should we provide `self` here? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/resolver.rs:690— // FIXME(trait_alias): Trait alias brings aliased traits in scope! Note that supertraits of — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/resolver.rs:931— // FIXME: This adds as many module scopes as there are blocks, but resolving in each — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/resolver.rs:1138— // FIXME: This adds as many module scopes as there are blocks, but resolving in each — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/nameres.rs:128— // FIXME: There are probably some other things that could be here, but this is less severe and you — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/nameres.rs:195— // FIXME: Figure out a better way for the IDE layer to resolve these? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/nameres.rs:636— // FIXME: this can use some more human-readable format (ideally, an IR — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/lib.rs:160— // FIXME: Store this as an erased `salsa::Id` to save space — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/lib.rs:630— // FIXME: Store this as an erased `salsa::Id` to save space — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/lib.rs:646— // FIXME: Store this as an erased `salsa::Id` to save space — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/lib.rs:715— // FIXME: Store this as an erased `salsa::Id` to save space — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/lib.rs:904— // FIXME: not every function, ... is actually an assoc item. maybe we should make — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/lib.rs:959— // FIXME: Check callers of this, this method likely can be removed — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/lang_item.rs:356— // FIXME: Should we remove this? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/lang_item.rs:622— // FIXME(swatinem): the following lang items are used for async lowering and — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/item_tree.rs:504— // FIXME: Would be nice to encode `None` into this — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/item_scope.rs:162— // FIXME: Macro shadowing in one module is not properly handled. Non-item place macros will — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/item_scope.rs:202— // FIXME: shadowing — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/nameres/path_resolution.rs:640— // FIXME: shadowing — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/item_scope.rs:571— // FIXME: This is only used in collection, we should move the relevant parts of it out of ItemScope — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FileTooLong: expr_store/lower.rs crates/hir-def/src/expr_store/lower.rs— FileTooLong — 2641 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 81% of them inside a single declaration: ExprCollector (3 blocks, 508-3760). The bar is 500 significant lines; this is 2141 over it, 5.28× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: mir/eval.rs crates/hir-ty/src/mir/eval.rs— FileTooLong — 2615 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 78% of them inside a single declaration: Evaluator (2 blocks, 172-3219). The bar is 500 significant lines; this is 2115 over it, 5.23× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: src/config.rs crates/rust-analyzer/src/config.rs— FileTooLong — 2389 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1889 over it, 4.78× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/display.rs crates/hir-ty/src/display.rs— FileTooLong — 2040 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1540 over it, 4.08× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/lower.rs crates/hir-ty/src/lower.rs— FileTooLong — 2017 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 46 free functions. The bar is 500 significant lines; this is 1517 over it, 4.03× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: handlers/request.rs crates/rust-analyzer/src/handlers/request.rs— FileTooLong — 1948 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 80 free functions. The bar is 500 significant lines; this is 1448 over it, 3.90× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/semantics.rs crates/hir/src/semantics.rs— FileTooLong — 1903 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1403 over it, 3.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: nameres/collector.rs crates/hir-def/src/nameres/collector.rs— FileTooLong — 1813 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1313 over it, 3.63× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: next_solver/interner.rs crates/hir-ty/src/next_solver/interner.rs— FileTooLong — 1804 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1304 over it, 3.61× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: mir/lower.rs crates/hir-ty/src/mir/lower.rs— FileTooLong — 1783 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 76% of them inside a single declaration: MirLowerCtx (2 blocks, 82-2059). The bar is 500 significant lines; this is 1283 over it, 3.57× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: src/infer.rs crates/hir-ty/src/infer.rs— FileTooLong — 1678 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1178 over it, 3.36× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/source_analyzer.rs crates/hir/src/source_analyzer.rs— FileTooLong — 1613 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 75% of them inside a single declaration: SourceAnalyzer (2 blocks, 77-1751). The bar is 500 significant lines; this is 1113 over it, 3.23× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: syntax_factory/constructors.rs crates/syntax/src/ast/syntax_factory/constructors.rs— FileTooLong — 1578 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 99% of them inside a single declaration: SyntaxFactory (2 blocks, 15-2413). The bar is 500 significant lines; this is 1078 over it, 3.16× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: lsp/to_proto.rs crates/rust-analyzer/src/lsp/to_proto.rs— FileTooLong — 1540 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 52 free functions. The bar is 500 significant lines; this is 1040 over it, 3.08× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/diagnostics.rs crates/hir/src/diagnostics.rs— FileTooLong — 1512 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1012 over it, 3.02× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: context/analysis.rs crates/ide-completion/src/context/analysis.rs— FileTooLong — 1481 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 981 over it, 2.96× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: handlers/extract_function.rs crates/ide-assists/src/handlers/extract_function.rs— FileTooLong — 1452 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 36 free functions. The bar is 500 significant lines; this is 952 over it, 2.90× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/workspace.rs crates/project-model/src/workspace.rs— FileTooLong — 1397 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 897 over it, 2.79× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: infer/expr.rs crates/hir-ty/src/infer/expr.rs— FileTooLong — 1373 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 97% of them inside a single declaration: InferenceContext (55-2171). The bar is 500 significant lines; this is 873 over it, 2.75× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: method_resolution/probe.rs crates/hir-ty/src/method_resolution/probe.rs— FileTooLong — 1220 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 720 over it, 2.44× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: cli/analysis_stats.rs crates/rust-analyzer/src/cli/analysis_stats.rs— FileTooLong — 1213 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 86% of them inside a single declaration: AnalysisStats (51-1481). The bar is 500 significant lines; this is 713 over it, 2.43× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: eval/shim.rs crates/hir-ty/src/mir/eval/shim.rs— FileTooLong — 1204 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 98% of them inside a single declaration: Evaluator (31-1640). The bar is 500 significant lines; this is 704 over it, 2.41× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: builtin/derive_macro.rs crates/hir-expand/src/builtin/derive_macro.rs— FileTooLong — 1111 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 611 over it, 2.22× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/lib.rs crates/hir-expand/src/lib.rs— FileTooLong — 1076 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 576 over it, 2.15× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/commands.ts editors/code/src/commands.ts— FileTooLong — 1042 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 542 over it, 2.08× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
MethodTooLong: MirLowerCtx.lower_expr_to_place_without_adjust crates/hir-ty/src/mir/lower.rs:469— MethodTooLong — lower_expr_to_place_without_adjust runs 688 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 588 over it, 6.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Evaluator.exec_intrinsic crates/hir-ty/src/mir/eval/shim.rs:561— MethodTooLong — exec_intrinsic runs 661 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 561 over it, 6.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Ty.hir_fmt crates/hir-ty/src/display.rs:1282— MethodTooLong — hir_fmt runs 439 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 339 over it, 4.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: InferenceContext.infer_expr_inner crates/hir-ty/src/infer/expr.rs:317— MethodTooLong — infer_expr_inner runs 393 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 293 over it, 3.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Evaluator.eval_rvalue crates/hir-ty/src/mir/eval.rs:1177— MethodTooLong — eval_rvalue runs 390 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 290 over it, 3.90× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ExprCollector.maybe_collect_expr crates/hir-def/src/expr_store/lower.rs:1417— MethodTooLong — maybe_collect_expr runs 378 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 278 over it, 3.78× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MirLowerCtx.pattern_match_inner crates/hir-ty/src/mir/lower/pattern_matching.rs:117— MethodTooLong — pattern_match_inner runs 317 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 217 over it, 3.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: TokenStream.from_str crates/proc-macro-srv/src/token_stream.rs:50— MethodTooLong — from_str runs 296 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 196 over it, 2.96× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AnyDiagnostic.inference_diagnostic crates/hir/src/diagnostics.rs:1549— MethodTooLong — inference_diagnostic runs 292 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 192 over it, 2.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AnalysisStats.run_inference crates/rust-analyzer/src/cli/analysis_stats.rs:774— MethodTooLong — run_inference runs 288 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 188 over it, 2.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DefCollector.resolve_macros crates/hir-def/src/nameres/collector.rs:1306— MethodTooLong — resolve_macros runs 280 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 180 over it, 2.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ModCollector.collect crates/hir-def/src/nameres/collector.rs:1898— MethodTooLong — collect runs 271 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 171 over it, 2.71× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Printer.print_expr_in crates/hir-def/src/expr_store/pretty.rs:531— MethodTooLong — print_expr_in runs 248 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 148 over it, 2.48× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AnalysisStats.run crates/rust-analyzer/src/cli/analysis_stats.rs:52— MethodTooLong — run runs 237 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 137 over it, 2.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: FindUsages.short_associated_function_fast_search crates/ide-db/src/search.rs:601— MethodTooLong — short_associated_function_fast_search runs 219 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 119 over it, 2.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: GlobalState.handle_event crates/rust-analyzer/src/main_loop.rs:315— MethodTooLong — handle_event runs 219 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 119 over it, 2.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: SourceAnalyzer.resolve_path crates/hir/src/source_analyzer.rs:1157— MethodTooLong — resolve_path runs 217 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 117 over it, 2.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: InferenceContext.resolve_variant crates/hir-ty/src/infer.rs:2225— MethodTooLong — resolve_variant runs 207 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 107 over it, 2.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ProjectWorkspace.load_cargo crates/project-model/src/workspace.rs:209— MethodTooLong — load_cargo runs 202 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 102 over it, 2.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ExprCollector.lower_inline_asm crates/hir-def/src/expr_store/lower/asm.rs:17— MethodTooLong — lower_inline_asm runs 197 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 97 over it, 1.97× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: GlobalState.switch_workspaces crates/rust-analyzer/src/reload.rs:467— MethodTooLong — switch_workspaces runs 180 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 80 over it, 1.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Scip.run crates/rust-analyzer/src/cli/scip.rs:24— MethodTooLong — run runs 179 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 79 over it, 1.79× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ExprCollector.collect_pat crates/hir-def/src/expr_store/lower.rs:2912— MethodTooLong — collect_pat runs 166 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 66 over it, 1.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: InferenceContext.infer_closure crates/hir-ty/src/infer/closure.rs:68— MethodTooLong — infer_closure runs 161 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 61 over it, 1.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Expr.gen_source_code crates/hir/src/term_search/expr.rs:102— MethodTooLong — gen_source_code runs 159 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 59 over it, 1.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_completion::context::analysis::classify_name_ref crates/ide-completion/src/context/analysis.rs:952— FunctionTooLong — ide_completion::context::analysis::classify_name_ref runs 561 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 461 over it, 5.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: hir_expand::builtin::derive_macro::coerce_pointee_expand crates/hir-expand/src/builtin/derive_macro.rs:1128— FunctionTooLong — hir_expand::builtin::derive_macro::coerce_pointee_expand runs 328 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 228 over it, 3.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide::hover::render::definition crates/ide/src/hover/render.rs:446— FunctionTooLong — ide::hover::render::definition runs 288 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 188 over it, 2.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_completion::completions::postfix::complete_postfix crates/ide-completion/src/completions/postfix.rs:33— FunctionTooLong — ide_completion::completions::postfix::complete_postfix runs 228 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 128 over it, 2.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_completion::context::analysis::expected_type_and_name crates/ide-completion/src/context/analysis.rs:591— FunctionTooLong — ide_completion::context::analysis::expected_type_and_name runs 226 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 126 over it, 2.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: hir_ty::layout::layout_of_ty_query crates/hir-ty/src/layout.rs:164— FunctionTooLong — hir_ty::layout::layout_of_ty_query runs 225 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 125 over it, 2.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_assists::handlers::convert_closure_to_fn::convert_closure_to_fn crates/ide-assists/src/handlers/convert_closure_to_fn.rs:54— FunctionTooLong — ide_assists::handlers::convert_closure_to_fn::convert_closure_to_fn runs 216 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 116 over it, 2.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: hir_ty::display::render_const_scalar_inner crates/hir-ty/src/display.rs:820— FunctionTooLong — hir_ty::display::render_const_scalar_inner runs 201 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 101 over it, 2.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: client.createClient editors/code/src/client.ts:13— FunctionTooLong — createClient runs 200 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 100 over it, 2.00× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: commands.viewMemoryLayout editors/code/src/commands.ts:1342— FunctionTooLong — viewMemoryLayout runs 193 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 93 over it, 1.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: hir_def::hir::format_args::parse crates/hir-def/src/hir/format_args.rs:172— FunctionTooLong — hir_def::hir::format_args::parse runs 192 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 92 over it, 1.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: hir_expand::fixup::fixup_syntax crates/hir-expand/src/fixup.rs:52— FunctionTooLong — hir_expand::fixup::fixup_syntax runs 189 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 89 over it, 1.89× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_db::prime_caches::parallel_prime_caches crates/ide-db/src/prime_caches.rs:31— FunctionTooLong — ide_db::prime_caches::parallel_prime_caches runs 184 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 84 over it, 1.84× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_assists::handlers::add_missing_match_arms::add_missing_match_arms crates/ide-assists/src/handlers/add_missing_match_arms.rs:41— FunctionTooLong — ide_assists::handlers::add_missing_match_arms::add_missing_match_arms runs 182 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 82 over it, 1.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_completion::context::analysis::expand crates/ide-completion/src/context/analysis.rs:172— FunctionTooLong — ide_completion::context::analysis::expand runs 180 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 80 over it, 1.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide::inlay_hints::adjustment::hints crates/ide/src/inlay_hints/adjustment.rs:23— FunctionTooLong — ide::inlay_hints::adjustment::hints runs 180 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 80 over it, 1.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mbe::expander::matcher::match_loop_inner crates/mbe/src/expander/matcher.rs:366— FunctionTooLong — mbe::expander::matcher::match_loop_inner runs 175 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 75 over it, 1.75× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_assists::handlers::extract_variable::extract_variable crates/ide-assists/src/handlers/extract_variable.rs:74— FunctionTooLong — ide_assists::handlers::extract_variable::extract_variable runs 169 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 69 over it, 1.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_diagnostics::semantic_diagnostics crates/ide-diagnostics/src/lib.rs:375— FunctionTooLong — ide_diagnostics::semantic_diagnostics runs 165 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 65 over it, 1.65× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: hir_expand::cfg_process::macro_input_callback crates/hir-expand/src/cfg_process.rs:47— FunctionTooLong — hir_expand::cfg_process::macro_input_callback runs 160 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 60 over it, 1.60× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: hir_def::expr_store::lower::path::lower_path crates/hir-def/src/expr_store/lower/path.rs:41— FunctionTooLong — hir_def::expr_store::lower::path::lower_path runs 158 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 58 over it, 1.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: rust_analyzer::lsp::to_proto::completion_item crates/rust-analyzer/src/lsp/to_proto.rs:290— FunctionTooLong — rust_analyzer::lsp::to_proto::completion_item runs 156 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 56 over it, 1.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: hir_ty::next_solver::consts::valtree::allocation_to_const crates/hir-ty/src/next_solver/consts/valtree.rs:73— FunctionTooLong — hir_ty::next_solver::consts::valtree::allocation_to_const runs 149 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 49 over it, 1.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide::inlay_hints::lifetime::hints_ crates/ide/src/inlay_hints/lifetime.rs:194— FunctionTooLong — ide::inlay_hints::lifetime::hints_ runs 149 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 49 over it, 1.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide::syntax_highlighting::highlight::highlight_def crates/ide/src/syntax_highlighting/highlight.rs:451— FunctionTooLong — ide::syntax_highlighting::highlight::highlight_def runs 149 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 49 over it, 1.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Hotspot: crates/hir-def/src/expr_store/lower.rs crates/hir-def/src/expr_store/lower.rs:1417— crates/hir-def/src/expr_store/lower.rs changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 89 in ExprCollector::maybe_collect_expr at line 1417. 9 of those changes were fix/bug commits, and the other 21 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-def/src/expr_store/lower.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ty/src/mir/lower.rs crates/hir-ty/src/mir/lower.rs:469— crates/hir-ty/src/mir/lower.rs changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 131 in MirLowerCtx::lower_expr_to_place_without_adjust at line 469. 5 of those changes were fix/bug commits, and the other 14 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-ty/src/mir/lower.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ty/src/mir/eval.rs crates/hir-ty/src/mir/eval.rs:1177— crates/hir-ty/src/mir/eval.rs changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 100 in Evaluator::eval_rvalue at line 1177. 5 of those changes were fix/bug commits, and the other 11 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-ty/src/mir/eval.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ty/src/infer/expr.rs crates/hir-ty/src/infer/expr.rs:317— crates/hir-ty/src/infer/expr.rs changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 84 in InferenceContext::infer_expr_inner at line 317. 6 of those changes were fix/bug commits, and the other 13 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-ty/src/infer/expr.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ty/src/mir/eval/shim.rs crates/hir-ty/src/mir/eval/shim.rs:561— crates/hir-ty/src/mir/eval/shim.rs changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 198 in Evaluator::exec_intrinsic at line 561. 2 of those changes were fix/bug commits, and the other 6 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-ty/src/mir/eval/shim.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ty/src/infer.rs crates/hir-ty/src/infer.rs:2225— crates/hir-ty/src/infer.rs changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in InferenceContext::resolve_variant at line 2225. 3 of those changes were fix/bug commits, and the other 22 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-ty/src/infer.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir/src/diagnostics.rs crates/hir/src/diagnostics.rs:1549— crates/hir/src/diagnostics.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 59 in AnyDiagnostic::inference_diagnostic at line 1549. 1 of those changes was a fix/bug commit, and the other 13 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir/src/diagnostics.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/rust-analyzer/src/main_loop.rs crates/rust-analyzer/src/main_loop.rs:315— crates/rust-analyzer/src/main_loop.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 74 in GlobalState::handle_event at line 315. 3 of those changes were fix/bug commits, and the other 6 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/rust-analyzer/src/main_loop.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/ide/src/hover/render.rs crates/ide/src/hover/render.rs:446— crates/ide/src/hover/render.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 64 in ide::hover::render::definition at line 446. 2 of those changes were fix/bug commits, and the other 8 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/ide/src/hover/render.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir/src/source_analyzer.rs crates/hir/src/source_analyzer.rs:1157— crates/hir/src/source_analyzer.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 45 in SourceAnalyzer::resolve_path at line 1157. 7 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir/src/source_analyzer.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/rust-analyzer/src/config.rs crates/rust-analyzer/src/config.rs:3750— crates/rust-analyzer/src/config.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in rust_analyzer::config::field_props at line 3750. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/rust-analyzer/src/config.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-def/src/nameres/collector.rs crates/hir-def/src/nameres/collector.rs:1898— crates/hir-def/src/nameres/collector.rs changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in ModCollector::collect at line 1898. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-def/src/nameres/collector.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ty/src/lower.rs crates/hir-ty/src/lower.rs:1011— crates/hir-ty/src/lower.rs changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in TyLoweringContext::lower_dyn_trait at line 1011. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-ty/src/lower.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/ide-diagnostics/src/lib.rs crates/ide-diagnostics/src/lib.rs:375— crates/ide-diagnostics/src/lib.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 92 in ide_diagnostics::semantic_diagnostics at line 375. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/ide-diagnostics/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-expand/src/builtin/derive_macro.rs crates/hir-expand/src/builtin/derive_macro.rs:1128— crates/hir-expand/src/builtin/derive_macro.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 57 in hir_expand::builtin::derive_macro::coerce_pointee_expand at line 1128. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-expand/src/builtin/derive_macro.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-def/src/attrs.rs crates/hir-def/src/attrs.rs:131— crates/hir-def/src/attrs.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 71 in hir_def::attrs::match_attr_flags at line 131. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-def/src/attrs.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-def/src/expr_store.rs crates/hir-def/src/expr_store.rs:671— crates/hir-def/src/expr_store.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in ExpressionStore::visit_expr_children at line 671. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-def/src/expr_store.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/ide-assists/src/handlers/extract_variable.rs crates/ide-assists/src/handlers/extract_variable.rs:74— crates/ide-assists/src/handlers/extract_variable.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in ide_assists::handlers::extract_variable::extract_variable at line 74. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/ide-assists/src/handlers/extract_variable.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir/src/semantics.rs crates/hir/src/semantics.rs:1237— crates/hir/src/semantics.rs changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in SemanticsImpl::descend_into_macros_impl at line 1237. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir/src/semantics.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-def/src/resolver.rs crates/hir-def/src/resolver.rs:353— crates/hir-def/src/resolver.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in Resolver::resolve_path_in_value_ns_with_prefix_info at line 353. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-def/src/resolver.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/rust-analyzer/src/cli/analysis_stats.rs crates/rust-analyzer/src/cli/analysis_stats.rs:52— crates/rust-analyzer/src/cli/analysis_stats.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in AnalysisStats::run at line 52. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/rust-analyzer/src/cli/analysis_stats.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-expand/src/lib.rs crates/hir-expand/src/lib.rs:788— crates/hir-expand/src/lib.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in MacroCallId::expand_speculative at line 788. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-expand/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ty/src/mir/lower/pattern_matching.rs crates/hir-ty/src/mir/lower/pattern_matching.rs:117— crates/hir-ty/src/mir/lower/pattern_matching.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in MirLowerCtx::pattern_match_inner at line 117. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-ty/src/mir/lower/pattern_matching.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/ide-completion/src/render.rs crates/ide-completion/src/render.rs:408— crates/ide-completion/src/render.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in ide_completion::render::render_resolution_path at line 408. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/ide-completion/src/render.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:502— crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in ExprUseVisitor::walk_expr at line 502. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
ide_assists::handlers::inline_call::inline (cognitive 76) crates/ide-assists/src/handlers/inline_call.rs:338— ide_assists::handlers::inline_call::inline has cognitive complexity 76 (threshold 15). Drivers by points: if/else 25 (46 pts), match/switch 8 (14 pts), boolean chains 8, loops 5 (8 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::convert_closure_to_fn::convert_closure_to_fn (cognitive 59) crates/ide-assists/src/handlers/convert_closure_to_fn.rs:54— ide_assists::handlers::convert_closure_to_fn::convert_closure_to_fn has cognitive complexity 59 (threshold 15). Drivers by points: if/else 23 (43 pts), match/switch 5 (8 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::extract_variable::extract_variable (cognitive 56) crates/ide-assists/src/handlers/extract_variable.rs:74— ide_assists::handlers::extract_variable::extract_variable has cognitive complexity 56 (threshold 15). Drivers by points: if/else 20 (36 pts), match/switch 10 (16 pts), boolean chains 3, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::unwrap_return_type::unwrap_return_type (cognitive 54) crates/ide-assists/src/handlers/unwrap_return_type.rs:40— ide_assists::handlers::unwrap_return_type::unwrap_return_type has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (37 pts), match/switch 5 (12 pts), boolean chains 4, loops 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::inline_type_alias::create_replacement (cognitive 52) crates/ide-assists/src/handlers/inline_type_alias.rs:320— ide_assists::handlers::inline_type_alias::create_replacement has cognitive complexity 52 (threshold 15). Drivers by points: if/else 16 (44 pts), loops 4, boolean chains 2, match/switch 1 (2 pts) (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ide_assists::handlers::add_missing_match_arms::add_missing_match_arms (cognitive 44) crates/ide-assists/src/handlers/add_missing_match_arms.rs:41— ide_assists::handlers::add_missing_match_arms::add_missing_match_arms has cognitive complexity 44 (threshold 15). Drivers by points: if/else 23 (32 pts), boolean chains 6, match/switch 3 (4 pts), loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::utils::gen_trait_fn_body::gen_partial_eq (cognitive 44) crates/ide-assists/src/utils/gen_trait_fn_body.rs:414— ide_assists::utils::gen_trait_fn_body::gen_partial_eq has cognitive complexity 44 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 5 (16 pts), match/switch 5 (9 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::add_turbo_fish::add_turbo_fish (cognitive 39) crates/ide-assists/src/handlers/add_turbo_fish.rs:31— ide_assists::handlers::add_turbo_fish::add_turbo_fish has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (30 pts), match/switch 7, loops 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::apply_demorgan::apply_demorgan (cognitive 36) crates/ide-assists/src/handlers/apply_demorgan.rs:40— ide_assists::handlers::apply_demorgan::apply_demorgan has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (30 pts), match/switch 2 (3 pts), loops 2, boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::generate_new::generate_new (cognitive 35) crates/ide-assists/src/handlers/generate_new.rs:36— ide_assists::handlers::generate_new::generate_new has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (24 pts), match/switch 4 (6 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::extract_function::update_external_control_flow (cognitive 35) crates/ide-assists/src/handlers/extract_function.rs:2128— ide_assists::handlers::extract_function::update_external_control_flow has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (24 pts), match/switch 3 (9 pts), boolean chains 1, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::convert_closure_to_fn::compute_closure_type_params (cognitive 30) crates/ide-assists/src/handlers/convert_closure_to_fn.rs:351— ide_assists::handlers::convert_closure_to_fn::compute_closure_type_params has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 5 (11 pts), match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::convert_bool_to_enum::replace_usages (cognitive 30) crates/ide-assists/src/handlers/convert_bool_to_enum.rs:212— ide_assists::handlers::convert_bool_to_enum::replace_usages has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (26 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::generate_delegate_methods::generate_delegate_methods (cognitive 29) crates/ide-assists/src/handlers/generate_delegate_methods.rs:51— ide_assists::handlers::generate_delegate_methods::generate_delegate_methods has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 4 (8 pts), boolean chains 2, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::extract_module::extract_module (cognitive 29) crates/ide-assists/src/handlers/extract_module.rs:56— ide_assists::handlers::extract_module::extract_module has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 5 (8 pts), boolean chains 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::wrap_return_type::wrap_return_type (cognitive 28) crates/ide-assists/src/handlers/wrap_return_type.rs:43— ide_assists::handlers::wrap_return_type::wrap_return_type has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 4 (8 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::extract_expressions_from_format_string::extract_expressions_from_format_string (cognitive 28) crates/ide-assists/src/handlers/extract_expressions_from_format_string.rs:31— ide_assists::handlers::extract_expressions_from_format_string::extract_expressions_from_format_string has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 4 (9 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::extract_function::extract_function (cognitive 27) crates/ide-assists/src/handlers/extract_function.rs:67— ide_assists::handlers::extract_function::extract_function has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 4, boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::generate_documentation_template::introduction_builder (cognitive 27) crates/ide-assists/src/handlers/generate_documentation_template.rs:187— ide_assists::handlers::generate_documentation_template::introduction_builder has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::remove_dbg::compute_dbg_replacement (cognitive 25) crates/ide-assists/src/handlers/remove_dbg.rs:72— ide_assists::handlers::remove_dbg::compute_dbg_replacement has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 4 (8 pts), boolean chains 5 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::extract_type_alias::collect_used_generics (cognitive 25) crates/ide-assists/src/handlers/extract_type_alias.rs:110— ide_assists::handlers::extract_type_alias::collect_used_generics has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 5 (9 pts), boolean chains 2 (nesting depth added 11). Of this number, 24 points are the body's own statements and 1 belongs to one function item inside it that branches. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_assists::handlers::wrap_unwrap_cfg_attr::attempt_get_derive (cognitive 24) crates/ide-assists/src/handlers/wrap_unwrap_cfg_attr.rs:38— ide_assists::handlers::wrap_unwrap_cfg_attr::attempt_get_derive has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, loops 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::extract_function::make_body (cognitive 23) crates/ide-assists/src/handlers/extract_function.rs:1800— ide_assists::handlers::extract_function::make_body has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 11 (23 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_assists::handlers::remove_unused_imports::remove_unused_imports (cognitive 23) crates/ide-assists/src/handlers/remove_unused_imports.rs:36— ide_assists::handlers::remove_unused_imports::remove_unused_imports has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (10 pts), match/switch 6 (9 pts), loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::merge_match_arms::get_arm_types::recurse (cognitive 23) crates/ide-assists/src/handlers/merge_match_arms.rs:130— ide_assists::handlers::merge_match_arms::get_arm_types::recurse has cognitive complexity 23 (threshold 15). Drivers by points: loops 4 (13 pts), if/else 3 (7 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
ide::syntax_highlighting::traverse (cognitive 103) crates/ide/src/syntax_highlighting.rs:226— ide::syntax_highlighting::traverse has cognitive complexity 103 (threshold 15). Drivers by points: if/else 17 (50 pts), match/switch 16 (49 pts), boolean chains 3, loops 1 (nesting depth added 66). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::hover::render::definition (cognitive 92) crates/ide/src/hover/render.rs:446— ide::hover::render::definition has cognitive complexity 92 (threshold 15). Drivers by points: if/else 34 (64 pts), match/switch 16 (28 pts) (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::folding_ranges::folding_ranges (cognitive 76) crates/ide/src/folding_ranges.rs:61— ide::folding_ranges::folding_ranges has cognitive complexity 76 (threshold 15). Drivers by points: if/else 18 (65 pts), match/switch 3 (8 pts), boolean chains 2, loops 1 (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ide::syntax_highlighting::highlight::highlight_def (cognitive 69) crates/ide/src/syntax_highlighting/highlight.rs:451— ide::syntax_highlighting::highlight::highlight_def has cognitive complexity 69 (threshold 15). Drivers by points: if/else 22 (42 pts), match/switch 9 (22 pts), boolean chains 5 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::rename::transform_method_call_into_assoc_fn (cognitive 62) crates/ide/src/rename.rs:627— ide::rename::transform_method_call_into_assoc_fn has cognitive complexity 62 (threshold 15). Drivers by points: if/else 12 (41 pts), match/switch 4 (14 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::highlight_related::highlight_references (cognitive 60) crates/ide/src/highlight_related.rs:152— ide::highlight_related::highlight_references has cognitive complexity 60 (threshold 15). Drivers by points: if/else 17 (40 pts), match/switch 5 (14 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::inlay_hints::adjustment::hints (cognitive 56) crates/ide/src/inlay_hints/adjustment.rs:23— ide::inlay_hints::adjustment::hints has cognitive complexity 56 (threshold 15). Drivers by points: if/else 26 (36 pts), boolean chains 10, match/switch 3 (7 pts), loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::rename::transform_assoc_fn_into_method_call (cognitive 44) crates/ide/src/rename.rs:411— ide::rename::transform_assoc_fn_into_method_call has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (27 pts), match/switch 3 (11 pts), loops 3 (6 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::inlay_hints::implicit_drop::hints (cognitive 40) crates/ide/src/inlay_hints/implicit_drop.rs:24— ide::inlay_hints::implicit_drop::hints has cognitive complexity 40 (threshold 15). Drivers by points: match/switch 6 (24 pts), if/else 6 (15 pts), loops 1 (nesting depth added 27). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide::inlay_hints::closing_brace::hints (cognitive 39) crates/ide/src/inlay_hints/closing_brace.rs:21— ide::inlay_hints::closing_brace::hints has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (27 pts), match/switch 4 (9 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::inlay_hints::lifetime::hints_ (cognitive 38) crates/ide/src/inlay_hints/lifetime.rs:194— ide::inlay_hints::lifetime::hints_ has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (18 pts), match/switch 9 (13 pts), boolean chains 6, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::syntax_highlighting::highlight::highlight_name_ref (cognitive 38) crates/ide/src/syntax_highlighting/highlight.rs:258— ide::syntax_highlighting::highlight::highlight_name_ref has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (28 pts), match/switch 5 (8 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::signature_help::signature_help_for_call (cognitive 35) crates/ide/src/signature_help.rs:159— ide::signature_help::signature_help_for_call has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 8 (17 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::annotations::annotations (cognitive 35) crates/ide/src/annotations.rs:58— ide::annotations::annotations has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 5, match/switch 4 (5 pts), loops 1 (2 pts) (nesting depth added 11). Of this number, 29 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::view_syntax_tree::syntax_node_to_json (cognitive 35) crates/ide/src/view_syntax_tree.rs:31— ide::view_syntax_tree::syntax_node_to_json has cognitive complexity 35 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 5 (15 pts), loops 2 (5 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::hover::hover_offset (cognitive 33) crates/ide/src/hover.rs:159— ide::hover::hover_offset has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 7, match/switch 3 (5 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::join_lines::remove_newline (cognitive 33) crates/ide/src/join_lines.rs:82— ide::join_lines::remove_newline has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (21 pts), match/switch 4 (8 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::syntax_highlighting::highlight::punctuation (cognitive 32) crates/ide/src/syntax_highlighting/highlight.rs:93— ide::syntax_highlighting::highlight::punctuation has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 4 (7 pts), boolean chains 3 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide::inlay_hints::param_name::hints (cognitive 28) crates/ide/src/inlay_hints/param_name.rs:19— ide::inlay_hints::param_name::hints has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 5 (9 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::moniker::def_to_non_local_moniker (cognitive 28) crates/ide/src/moniker.rs:283— ide::moniker::def_to_non_local_moniker has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 5 (10 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::signature_help::signature_help (cognitive 27) crates/ide/src/signature_help.rs:73— ide::signature_help::signature_help has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (23 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::inlay_hints::bind_pat::hints (cognitive 27) crates/ide/src/inlay_hints/bind_pat.rs:22— ide::inlay_hints::bind_pat::hints has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 5, match/switch 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::hover::render::render_memory_layout (cognitive 27) crates/ide/src/hover/render.rs:1165— ide::hover::render::render_memory_layout has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (14 pts), match/switch 5 (10 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ide::goto_definition::goto_definition (cognitive 26) crates/ide/src/goto_definition.rs:58— ide::goto_definition::goto_definition has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::highlight_related::highlight_branch_exit_points (cognitive 26) crates/ide/src/highlight_related.rs:308— ide::highlight_related::highlight_branch_exit_points has cognitive complexity 26 (threshold 15). Drivers by points: loops 5 (12 pts), if/else 4 (9 pts), match/switch 2 (5 pts) (nesting depth added 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
Duplicated block (6 lines × 2) crates/hir/src/source_analyzer.rs:1546— crates/hir/src/source_analyzer.rs:1546-1551 | crates/hir/src/source_analyzer.rs:1563-1568 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/hir/src/term_search/expr.rs:130— crates/hir/src/term_search/expr.rs:130-135 | crates/hir/src/term_search/expr.rs:159-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/hir/src/term_search/expr.rs:130— crates/hir/src/term_search/expr.rs:130-135 | crates/hir/src/term_search/expr.rs:271-276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/hir-def/src/expr_store/lower.rs:1179— crates/hir-def/src/expr_store/lower.rs:1179-1184 | crates/hir-def/src/expr_store/lower.rs:1208-1213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/hir-def/src/item_scope.rs:244— crates/hir-def/src/item_scope.rs:244-249 | crates/hir-def/src/item_scope.rs:259-264 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/hir-ty/src/infer/coerce.rs:1000— crates/hir-ty/src/infer/coerce.rs:1000-1005 | crates/hir-ty/src/infer/coerce.rs:1007-1012 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/hir-ty/src/mir/eval/shim.rs:235— crates/hir-ty/src/mir/eval/shim.rs:235-240 | crates/hir-ty/src/mir/eval/shim.rs:247-252 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/hir-ty/src/next_solver/consts/valtree.rs:163— crates/hir-ty/src/next_solver/consts/valtree.rs:163-168 | crates/hir-ty/src/next_solver/consts/valtree.rs:236-241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/hir-ty/src/next_solver/infer/errors.rs:161— crates/hir-ty/src/next_solver/infer/errors.rs:161-166 | crates/hir-ty/src/next_solver/infer/errors.rs:168-173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/hir-ty/src/next_solver/interner.rs:1215— crates/hir-ty/src/next_solver/interner.rs:1215-1220 | crates/hir-ty/src/next_solver/interner.rs:1229-1234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/ide-assists/src/handlers/expand_glob_import.rs:51— crates/ide-assists/src/handlers/expand_glob_import.rs:51-56 | crates/ide-assists/src/handlers/expand_glob_import.rs:109-114 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/ide-assists/src/handlers/unwrap_return_type.rs:41— crates/ide-assists/src/handlers/unwrap_return_type.rs:41-46 | crates/ide-assists/src/handlers/wrap_return_type.rs:44-49 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) crates/ide-assists/src/handlers/convert_from_to_tryfrom.rs:45— crates/ide-assists/src/handlers/convert_from_to_tryfrom.rs:45-50 | crates/ide-assists/src/handlers/convert_into_to_from.rs:60-65 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) crates/ide-assists/src/handlers/convert_for_to_while_let.rs:152— crates/ide-assists/src/handlers/convert_for_to_while_let.rs:152-157 | crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs:194-199 — before extracting anything, compare `crates/ide-assists/src/handlers/convert_for_to_while_let.rs` and `crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) crates/ide-assists/src/handlers/convert_for_to_while_let.rs:158— crates/ide-assists/src/handlers/convert_for_to_while_let.rs:158-163 | crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs:200-205 — before extracting anything, compare `crates/ide-assists/src/handlers/convert_for_to_while_let.rs` and `crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) crates/ide-assists/src/utils/gen_trait_fn_body.rs:56— crates/ide-assists/src/utils/gen_trait_fn_body.rs:56-61 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:166-171 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/ide-assists/src/utils/gen_trait_fn_body.rs:197— crates/ide-assists/src/utils/gen_trait_fn_body.rs:197-202 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:231-236 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/ide-assists/src/utils/gen_trait_fn_body.rs:391— crates/ide-assists/src/utils/gen_trait_fn_body.rs:391-397 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:671-676 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/ide-assists/src/utils/gen_trait_fn_body.rs:503— crates/ide-assists/src/utils/gen_trait_fn_body.rs:503-508 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:536-541 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/ide-assists/src/handlers/remove_unused_param.rs:166— crates/ide-assists/src/handlers/remove_unused_param.rs:166-171 | crates/ide-assists/src/handlers/remove_unused_param.rs:191-196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/load-cargo/src/lib.rs:596— crates/load-cargo/src/lib.rs:596-601 | crates/load-cargo/src/lib.rs:633-638 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:456— crates/rust-analyzer/src/cli/analysis_stats.rs:456-461 | crates/rust-analyzer/src/cli/analysis_stats.rs:1339-1344 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:844— crates/rust-analyzer/src/cli/analysis_stats.rs:844-849 | crates/rust-analyzer/src/cli/analysis_stats.rs:1265-1270 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/rust-analyzer/src/handlers/request.rs:1074— crates/rust-analyzer/src/handlers/request.rs:1074-1079 | crates/rust-analyzer/src/handlers/request.rs:1108-1113 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/syntax/src/syntax_editor/edits.rs:131— crates/syntax/src/syntax_editor/edits.rs:131-136 | crates/syntax/src/syntax_editor/edits.rs:148-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/hir/src/lib.rs:3900— crates/hir/src/lib.rs:3900-3904 | crates/hir/src/lib.rs:3918-3922 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/hir/src/source_analyzer.rs:1513— crates/hir/src/source_analyzer.rs:1513-1517 | crates/hir/src/source_analyzer.rs:1529-1533 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/hir-def/src/expr_store/lower.rs:1185— crates/hir-def/src/expr_store/lower.rs:1185-1189 | crates/hir-def/src/expr_store/lower.rs:1196-1200 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/hir-ty/src/consteval.rs:180— crates/hir-ty/src/consteval.rs:180-184 | crates/hir-ty/src/next_solver/ty.rs:692-696 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) crates/hir-ty/src/consteval.rs:191— crates/hir-ty/src/consteval.rs:191-195 | crates/hir-ty/src/next_solver/ty.rs:700-704 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) crates/hir-ty/src/consteval.rs:200— crates/hir-ty/src/consteval.rs:200-204 | crates/hir-ty/src/next_solver/ty.rs:706-710 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) crates/hir-ty/src/infer/cast.rs:462— crates/hir-ty/src/infer/cast.rs:462-466 | crates/hir-ty/src/infer/cast.rs:492-496 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/hir-ty/src/method_resolution.rs:594— crates/hir-ty/src/method_resolution.rs:594-598 | crates/hir-ty/src/method_resolution.rs:710-714 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/hir-ty/src/mir/eval.rs:1976— crates/hir-ty/src/mir/eval.rs:1976-1980 | crates/hir-ty/src/mir/eval.rs:1988-1992 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/hir-ty/src/mir/eval.rs:1992— crates/hir-ty/src/mir/eval.rs:1992-1996 | crates/hir-ty/src/mir/eval.rs:2001-2005 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/ide/src/navigation_target.rs:713— crates/ide/src/navigation_target.rs:713-717 | crates/ide/src/navigation_target.rs:785-789 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/ide/src/interpret.rs:43— crates/ide/src/interpret.rs:43-47 | crates/ide/src/interpret.rs:71-75 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/ide-assists/src/handlers/convert_bool_to_enum.rs:494— crates/ide-assists/src/handlers/convert_bool_to_enum.rs:494-498 | crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs:242-246 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) crates/ide-assists/src/handlers/introduce_named_lifetime.rs:102— crates/ide-assists/src/handlers/introduce_named_lifetime.rs:102-106 | crates/ide-assists/src/handlers/introduce_named_lifetime.rs:171-175 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:76— crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:76-80 | crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:78-82 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) crates/ide-assists/src/handlers/apply_demorgan.rs:276— crates/ide-assists/src/handlers/apply_demorgan.rs:276-280 | crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs:227-231 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) crates/ide-assists/src/utils/gen_trait_fn_body.rs:179— crates/ide-assists/src/utils/gen_trait_fn_body.rs:179-183 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:213-217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/ide-completion/src/completions/record.rs:32— crates/ide-completion/src/completions/record.rs:32-36 | crates/ide-completion/src/completions/record.rs:60-64 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/ide-db/src/imports/merge_imports.rs:505— crates/ide-db/src/imports/merge_imports.rs:505-509 | crates/ide-db/src/imports/merge_imports.rs:530-534 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/ide-db/src/syntax_helpers/format_string.rs:254— crates/ide-db/src/syntax_helpers/format_string.rs:254-258 | crates/ide-db/src/syntax_helpers/format_string.rs:272-276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/ide-db/src/syntax_helpers/node_ext.rs:98— crates/ide-db/src/syntax_helpers/node_ext.rs:98-102 | crates/ide-db/src/syntax_helpers/node_ext.rs:139-143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/ide-ssr/src/fragments.rs:29— crates/ide-ssr/src/fragments.rs:29-33 | crates/ide-ssr/src/fragments.rs:52-56 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/parser/src/grammar/items.rs:368— crates/parser/src/grammar/items.rs:368-372 | crates/parser/src/grammar/items.rs:377-381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/parser/src/grammar/expressions/atom.rs:326— crates/parser/src/grammar/expressions/atom.rs:326-330 | crates/parser/src/grammar/patterns.rs:225-231 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) crates/syntax/src/syntax_editor/edits.rs:247— crates/syntax/src/syntax_editor/edits.rs:247-251 | crates/syntax/src/syntax_editor/edits.rs:263-267 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir/src/lib.rs:5434— crates/hir/src/lib.rs:5434-5442 | crates/hir/src/lib.rs:5543-5551 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir/src/semantics/source_to_def.rs:681— crates/hir/src/semantics/source_to_def.rs:681-689 | crates/hir/src/semantics/source_to_def.rs:692-700 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir/src/semantics.rs:2617— crates/hir/src/semantics.rs:2617-2625 | crates/hir/src/semantics.rs:2629-2637 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir/src/symbols.rs:290— crates/hir/src/symbols.rs:290-298 | crates/hir/src/symbols.rs:331-339 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir/src/term_search/tactics.rs:54— crates/hir/src/term_search/tactics.rs:54-62 | crates/hir/src/term_search/tactics.rs:104-112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-def/src/attrs.rs:661— crates/hir-def/src/attrs.rs:661-669 | crates/hir-def/src/attrs.rs:673-681 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-def/src/expr_store/lower.rs:1142— crates/hir-def/src/expr_store/lower.rs:1142-1150 | crates/hir-def/src/expr_store/lower.rs:1186-1194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-def/src/expr_store/lower.rs:2747— crates/hir-def/src/expr_store/lower.rs:2747-2755 | crates/hir-def/src/expr_store/lower.rs:2760-2768 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-def/src/import_map.rs:250— crates/hir-def/src/import_map.rs:250-258 | crates/hir-def/src/import_map.rs:296-304 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-def/src/nameres/path_resolution.rs:269— crates/hir-def/src/nameres/path_resolution.rs:269-277 | crates/hir-def/src/nameres/path_resolution.rs:384-392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-def/src/src.rs:155— crates/hir-def/src/src.rs:155-163 | crates/hir-def/src/src.rs:170-178 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-expand/src/builtin/fn_macro.rs:880— crates/hir-expand/src/builtin/fn_macro.rs:880-888 | crates/hir-expand/src/builtin/fn_macro.rs:956-964 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-ty/src/consteval.rs:234— crates/hir-ty/src/consteval.rs:234-242 | crates/hir-ty/src/consteval.rs:272-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-ty/src/display.rs:850— crates/hir-ty/src/display.rs:850-858 | crates/hir-ty/src/display.rs:1123-1131 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-ty/src/display.rs:869— crates/hir-ty/src/display.rs:869-877 | crates/hir-ty/src/display.rs:1142-1150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-ty/src/infer/closure/analysis.rs:1225— crates/hir-ty/src/infer/closure/analysis.rs:1225-1233 | crates/hir-ty/src/infer/closure/analysis.rs:1240-1248 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-ty/src/lower.rs:1484— crates/hir-ty/src/lower.rs:1484-1492 | crates/hir-ty/src/lower.rs:2286-2294 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-ty/src/next_solver/def_id.rs:252— crates/hir-ty/src/next_solver/def_id.rs:252-260 | crates/hir-ty/src/next_solver/def_id.rs:279-287 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/ide/src/signature_help.rs:516— crates/ide/src/signature_help.rs:516-524 | crates/ide/src/signature_help.rs:642-650 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/ide-assists/src/handlers/generate_delegate_trait.rs:285— crates/ide-assists/src/handlers/generate_delegate_trait.rs:285-294 | crates/ide-assists/src/handlers/generate_delegate_trait.rs:395-403 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/ide-assists/src/handlers/introduce_named_lifetime.rs:138— crates/ide-assists/src/handlers/introduce_named_lifetime.rs:138-146 | crates/ide-assists/src/handlers/introduce_named_lifetime.rs:197-205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/ide-assists/src/handlers/move_from_mod_rs.rs:31— crates/ide-assists/src/handlers/move_from_mod_rs.rs:31-39 | crates/ide-assists/src/handlers/move_to_mod_rs.rs:31-39 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9 lines × 2) crates/ide-assists/src/handlers/replace_method_eager_lazy.rs:32— crates/ide-assists/src/handlers/replace_method_eager_lazy.rs:32-40 | crates/ide-assists/src/handlers/replace_method_eager_lazy.rs:142-150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/ide-assists/src/handlers/convert_for_to_while_let.rs:38— crates/ide-assists/src/handlers/convert_for_to_while_let.rs:38-46 | crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs:104-112 — before extracting anything, compare `crates/ide-assists/src/handlers/convert_for_to_while_let.rs` and `crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) crates/ide-assists/src/handlers/generate_impl.rs:49— crates/ide-assists/src/handlers/generate_impl.rs:49-57 | crates/ide-assists/src/handlers/generate_impl.rs:97-105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
ide::hover::render::definition (cyclomatic 64) crates/ide/src/hover/render.rs:446— ide::hover::render::definition has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::syntax_highlighting::highlight::highlight_def (cyclomatic 61) crates/ide/src/syntax_highlighting/highlight.rs:451— ide::syntax_highlighting::highlight::highlight_def has cyclomatic complexity 61 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::inlay_hints::adjustment::hints (cyclomatic 53) crates/ide/src/inlay_hints/adjustment.rs:23— ide::inlay_hints::adjustment::hints has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::syntax_highlighting::traverse (cyclomatic 47) crates/ide/src/syntax_highlighting.rs:226— ide::syntax_highlighting::traverse has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::syntax_highlighting::highlight::punctuation (cyclomatic 40) crates/ide/src/syntax_highlighting/highlight.rs:93— ide::syntax_highlighting::highlight::punctuation has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::inlay_hints::lifetime::hints_ (cyclomatic 34) crates/ide/src/inlay_hints/lifetime.rs:194— ide::inlay_hints::lifetime::hints_ has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::folding_ranges::folding_ranges (cyclomatic 31) crates/ide/src/folding_ranges.rs:61— ide::folding_ranges::folding_ranges has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::inlay_hints::closing_brace::hints (cyclomatic 31) crates/ide/src/inlay_hints/closing_brace.rs:21— ide::inlay_hints::closing_brace::hints has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::moniker::def_to_kind (cyclomatic 30) crates/ide/src/moniker.rs:183— ide::moniker::def_to_kind has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::hover::hover_offset (cyclomatic 30) crates/ide/src/hover.rs:159— ide::hover::hover_offset has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::syntax_highlighting::highlight::highlight_name_ref (cyclomatic 30) crates/ide/src/syntax_highlighting/highlight.rs:258— ide::syntax_highlighting::highlight::highlight_name_ref has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::file_structure::structure_node (cyclomatic 26) crates/ide/src/file_structure.rs:82— ide::file_structure::structure_node has cyclomatic complexity 26 (threshold 15). Of this number, 23 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::inlay_hints::hints (cyclomatic 26) crates/ide/src/inlay_hints.rs:207— ide::inlay_hints::hints has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::hover::render::render_memory_layout (cyclomatic 26) crates/ide/src/hover/render.rs:1165— ide::hover::render::render_memory_layout has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::signature_help::signature_help_for_call (cyclomatic 25) crates/ide/src/signature_help.rs:159— ide::signature_help::signature_help_for_call has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::goto_type_definition::goto_type_definition (cyclomatic 25) crates/ide/src/goto_type_definition.rs:16— ide::goto_type_definition::goto_type_definition has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::rename::transform_method_call_into_assoc_fn (cyclomatic 24) crates/ide/src/rename.rs:627— ide::rename::transform_method_call_into_assoc_fn has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::annotations::annotations (cyclomatic 24) crates/ide/src/annotations.rs:58— ide::annotations::annotations has cyclomatic complexity 24 (threshold 15). Of this number, 20 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::doc_links::filename_and_frag_for_def (cyclomatic 24) crates/ide/src/doc_links.rs:647— ide::doc_links::filename_and_frag_for_def has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::highlight_related::highlight_references (cyclomatic 23) crates/ide/src/highlight_related.rs:152— ide::highlight_related::highlight_references has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::goto_definition::goto_definition (cyclomatic 22) crates/ide/src/goto_definition.rs:58— ide::goto_definition::goto_definition has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::inlay_hints::bind_pat::hints (cyclomatic 22) crates/ide/src/inlay_hints/bind_pat.rs:22— ide::inlay_hints::bind_pat::hints has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::join_lines::remove_newline (cyclomatic 22) crates/ide/src/join_lines.rs:82— ide::join_lines::remove_newline has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::hover::render::literal (cyclomatic 21) crates/ide/src/hover/render.rs:849— ide::hover::render::literal has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::typing::on_eq_typed (cyclomatic 20) crates/ide/src/typing.rs:219— ide::typing::on_eq_typed has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 3 function items inside it that branch (assign_expr, let_stmt, assign_to_eq). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
XxxComment crates/base-db/src/change.rs:81— // XXX: can't actually remove the file, just reset the text — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-def/src/resolver.rs:1324— // XXX: hack, account for local (and only local) shadowing. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-def/src/item_scope.rs:365— /// XXX: this is O(N) rather than O(1), try to not introduce new usages. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-def/src/item_scope.rs:380— /// XXX: this is O(N) rather than O(1), try to not introduce new usages. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-def/src/import_map.rs:802— // XXX: The rendered paths are relative to the defining crate. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-def/src/dyn_map.rs:80— /// XXX: AST Nodes and SyntaxNodes have identity equality semantics: nodes are — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-ty/src/autoderef.rs:55— // XXX: The recursion limit for `Autoderef` is currently 20, so `Vec::contains()` shouldn't — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-ty/src/diagnostics/match_check.rs:115— // XXX(iDawer): Collecting pattern adjustments feels imprecise to me. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-ty/src/diagnostics/match_check.rs:187— // XXX(iDawer): field lookup is inefficient — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-ty/src/diagnostics/decl_check.rs:256— // XXX: only look at source_map if we do have missing fields — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-ty/src/diagnostics/decl_check.rs:342— // XXX: Only look at sources if we do have incorrect names. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-ty/src/diagnostics/decl_check.rs:432— // XXX: Only look at sources if we do have incorrect names. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-ty/src/diagnostics/decl_check.rs:522— // XXX: only look at sources if we do have incorrect names — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-ty/src/diagnostics/decl_check.rs:593— // XXX: only look at sources if we do have incorrect names — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir/src/source_analyzer.rs:1808— // XXX: during completion, cursor might be outside of any particular — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir/src/semantics/source_to_def.rs:732— /// XXX: this might be the same def as, for example an `EnumId`. However, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/ide-assists/src/handlers/replace_if_let_with_match.rs:357— // XXX: Perhaps we can extract a let statement to improve — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/ide-assists/src/handlers/replace_if_let_with_match.rs:490— // XXX: Use descend pat for sema analysis — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:202— // XXX: SyntaxEditor cannot insert after deleted element — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:245— // XXX: SyntaxEditor cannot insert after deleted element — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:59— // XXX: We don't currently provide this assist for struct definitions inside macros, but if we — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/ide-completion/src/completions/type.rs:107— // XXX: For parity with Rust bug #22519, this does not complete Ty::AssocType.
XxxComment crates/ide-completion/src/completions/expr.rs:194— // XXX: For parity with Rust bug #22519, this does not complete Ty::AssocType.
XxxComment crates/ide-diagnostics/src/handlers/type_mismatch.rs:414— // XXX: maybe should check if ctx is async — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:767— // XXX: we iterate subtrees in reverse to guarantee — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
Duplicated block (7 lines × 2) crates/hir/src/source_analyzer.rs:1317— crates/hir/src/source_analyzer.rs:1317-1323 | crates/hir/src/source_analyzer.rs:1408-1414 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/hir-def/src/item_scope.rs:259— crates/hir-def/src/item_scope.rs:259-265 | crates/hir-def/src/item_scope.rs:274-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/hir-def/src/item_scope.rs:774— crates/hir-def/src/item_scope.rs:774-780 | crates/hir-def/src/item_scope.rs:792-798 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/hir-def/src/resolver.rs:202— crates/hir-def/src/resolver.rs:202-208 | crates/hir-def/src/resolver.rs:386-392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/hir-def/src/resolver.rs:230— crates/hir-def/src/resolver.rs:230-236 | crates/hir-def/src/resolver.rs:459-465 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/hir-ty/src/display.rs:996— crates/hir-ty/src/display.rs:996-1002 | crates/hir-ty/src/display.rs:1022-1028 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/hir-ty/src/lower/path.rs:363— crates/hir-ty/src/lower/path.rs:363-369 | crates/hir-ty/src/lower/path.rs:419-425 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/ide/src/signature_help.rs:595— crates/ide/src/signature_help.rs:595-601 | crates/ide/src/signature_help.rs:729-735 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/ide/src/typing.rs:259— crates/ide/src/typing.rs:259-265 | crates/ide/src/typing.rs:295-301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/ide/src/inlay_hints/lifetime.rs:79— crates/ide/src/inlay_hints/lifetime.rs:79-85 | crates/ide/src/inlay_hints/lifetime.rs:146-152 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/ide-assists/src/handlers/add_missing_match_arms.rs:167— crates/ide-assists/src/handlers/add_missing_match_arms.rs:167-173 | crates/ide-assists/src/handlers/add_missing_match_arms.rs:200-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:162— crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:162-168 | crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:151-157 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) crates/ide-db/src/active_parameter.rs:177— crates/ide-db/src/active_parameter.rs:177-183 | crates/syntax/src/ast/node_ext.rs:59-65 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) crates/ide-db/src/syntax_helpers/node_ext.rs:179— crates/ide-db/src/syntax_helpers/node_ext.rs:179-185 | crates/ide-db/src/syntax_helpers/node_ext.rs:207-213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/ide-diagnostics/src/handlers/type_mismatch.rs:392— crates/ide-diagnostics/src/handlers/type_mismatch.rs:392-398 | crates/ide-diagnostics/src/handlers/type_mismatch.rs:416-422 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/parser/src/grammar/items/adt.rs:143— crates/parser/src/grammar/items/adt.rs:143-149 | crates/parser/src/grammar/items/adt.rs:155-161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:370— crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:370-376 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:389-395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/proc-macro-srv/src/token_stream.rs:294— crates/proc-macro-srv/src/token_stream.rs:294-300 | crates/proc-macro-srv/src/token_stream.rs:310-316 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:1197— crates/rust-analyzer/src/cli/analysis_stats.rs:1197-1203 | crates/rust-analyzer/src/cli/analysis_stats.rs:1235-1241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/rust-analyzer/src/handlers/dispatch.rs:117— crates/rust-analyzer/src/handlers/dispatch.rs:117-123 | crates/rust-analyzer/src/handlers/dispatch.rs:192-198 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/syntax/src/ast/syntax_factory/constructors.rs:593— crates/syntax/src/ast/syntax_factory/constructors.rs:593-599 | crates/syntax/src/ast/syntax_factory/constructors.rs:796-802 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/macros/src/lib.rs:100— crates/macros/src/lib.rs:100-106 | crates/macros/src/lib.rs:118-124 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/hir-def/src/expr_store/pretty.rs:486— crates/hir-def/src/expr_store/pretty.rs:486-492 | crates/hir-def/src/item_tree/pretty.rs:63-69 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) crates/ide-db/src/imports/merge_imports.rs:647— crates/ide-db/src/imports/merge_imports.rs:647-653 | crates/ide/src/folding_ranges.rs:385-391 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) crates/hir/src/attrs.rs:282— crates/hir/src/attrs.rs:282-288 | crates/ide/src/navigation_target.rs:621-627 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) crates/hir/src/lib.rs:2506— crates/hir/src/lib.rs:2506-2513 | crates/hir/src/lib.rs:2515-2522 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/hir/src/semantics/child_by_source.rs:75— crates/hir/src/semantics/child_by_source.rs:75-82 | crates/hir/src/semantics/child_by_source.rs:102-109 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/hir/src/semantics/source_to_def.rs:633— crates/hir/src/semantics/source_to_def.rs:633-640 | crates/hir/src/semantics/source_to_def.rs:644-651 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/hir-def/src/expr_store/scope.rs:163— crates/hir-def/src/expr_store/scope.rs:163-170 | crates/hir-def/src/expr_store/scope.rs:182-189 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/hir-def/src/find_path.rs:406— crates/hir-def/src/find_path.rs:406-413 | crates/hir-def/src/find_path.rs:423-430 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/hir-def/src/hir/format_args.rs:353— crates/hir-def/src/hir/format_args.rs:353-360 | crates/hir-def/src/hir/format_args.rs:377-384 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/hir-def/src/item_scope.rs:657— crates/hir-def/src/item_scope.rs:657-664 | crates/hir-def/src/item_scope.rs:674-681 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/hir-def/src/nameres/collector.rs:692— crates/hir-def/src/nameres/collector.rs:692-699 | crates/hir-def/src/nameres/collector.rs:749-756 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/hir-def/src/nameres/collector.rs:2569— crates/hir-def/src/nameres/collector.rs:2569-2576 | crates/hir-def/src/nameres/collector.rs:2645-2652 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/hir-def/src/nameres/collector.rs:2583— crates/hir-def/src/nameres/collector.rs:2583-2590 | crates/hir-def/src/nameres/collector.rs:2655-2662 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/hir-ty/src/infer.rs:2321— crates/hir-ty/src/infer.rs:2321-2328 | crates/hir-ty/src/infer.rs:2370-2377 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/ide/src/hover/render.rs:122— crates/ide/src/hover/render.rs:122-129 | crates/ide/src/hover/render.rs:167-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/ide/src/hover/render.rs:553— crates/ide/src/hover/render.rs:553-560 | crates/ide/src/hover/render.rs:587-594 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/ide-assists/src/handlers/convert_to_guarded_return.rs:125— crates/ide-assists/src/handlers/convert_to_guarded_return.rs:125-132 | crates/ide-assists/src/handlers/convert_to_guarded_return.rs:204-211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/ide-assists/src/handlers/generate_enum_is_method.rs:59— crates/ide-assists/src/handlers/generate_enum_is_method.rs:59-66 | crates/ide-assists/src/handlers/generate_enum_projection_method.rs:137-144 — before extracting anything, compare `crates/ide-assists/src/handlers/generate_enum_is_method.rs` and `crates/ide-assists/src/handlers/generate_enum_projection_method.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:290— crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:290-297 | crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:348-355 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) crates/ide-assists/src/handlers/convert_closure_to_fn.rs:115— crates/ide-assists/src/handlers/convert_closure_to_fn.rs:115-122 | crates/ide-assists/src/handlers/convert_closure_to_fn.rs:126-133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/ide-assists/src/handlers/bind_unused_param.rs:27— crates/ide-assists/src/handlers/bind_unused_param.rs:27-34 | crates/ide-assists/src/handlers/remove_unused_param.rs:69-76 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) crates/ide-completion/src/completions/attribute.rs:101— crates/ide-completion/src/completions/attribute.rs:101-108 | crates/ide-completion/src/completions/item_list.rs:47-54 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) crates/ide-completion/src/completions/expr.rs:171— crates/ide-completion/src/completions/expr.rs:171-178 | crates/ide-completion/src/completions/type.rs:95-102 — before extracting anything, compare `crates/ide-completion/src/completions/expr.rs` and `crates/ide-completion/src/completions/type.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) crates/intern/src/gc.rs:137— crates/intern/src/gc.rs:137-144 | crates/intern/src/gc.rs:150-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/proc-macro-srv/src/token_stream.rs:209— crates/proc-macro-srv/src/token_stream.rs:209-216 | crates/proc-macro-srv/src/token_stream.rs:235-242 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/syntax/src/ast/syntax_factory/constructors.rs:1259— crates/syntax/src/ast/syntax_factory/constructors.rs:1259-1266 | crates/syntax/src/ast/syntax_factory/constructors.rs:1960-1969 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) lib/smol_str/src/serde.rs:45— lib/smol_str/src/serde.rs:45-52 | lib/smol_str/src/serde.rs:55-62 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/hir-def/src/lib.rs:856— crates/hir-def/src/lib.rs:856-863 | crates/hir-ty/src/next_solver/def_id.rs:175-182 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
TooManyMethods: InferenceContext crates/hir-ty/src/infer.rs:1325— TooManyMethods — 207 methods, declared across 15 files: src/infer.rs (55), infer/pat.rs (36), infer/expr.rs (33), infer/closure.rs (19), +11 more file(s). The bar is 30 methods; this is 177 over it, 6.90× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SyntaxFactory crates/syntax/src/ast/syntax_factory.rs:16— TooManyMethods — 157 methods, declared across 2 files: syntax_factory/constructors.rs (153), ast/syntax_factory.rs (4). The bar is 30 methods; this is 127 over it, 5.23× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SemanticsImpl crates/hir/src/semantics.rs:171— TooManyMethods — 139 methods. The bar is 30 methods; this is 109 over it, 4.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ExprCollector crates/hir-def/src/expr_store/lower.rs:508— TooManyMethods — 113 methods, declared across 3 files: expr_store/lower.rs (107), lower/format_args.rs (5), lower/asm.rs (1). The bar is 30 methods; this is 83 over it, 3.77× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: InferCtxt crates/hir-ty/src/next_solver/infer/mod.rs:231— TooManyMethods — 111 methods, declared across 13 files: infer/mod.rs (71), snapshot/mod.rs (10), canonical/instantiate.rs (6), outlives/obligations.rs (5), +9 more file(s). The bar is 30 methods; this is 81 over it, 3.70× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Config crates/rust-analyzer/src/config.rs:1110— TooManyMethods — 84 methods. The bar is 30 methods; this is 54 over it, 2.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Analysis crates/ide/src/lib.rs:243— TooManyMethods — 79 methods. The bar is 30 methods; this is 49 over it, 2.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SourceAnalyzer crates/hir/src/source_analyzer.rs:77— TooManyMethods — 70 methods. The bar is 30 methods; this is 40 over it, 2.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Evaluator crates/hir-ty/src/mir/eval.rs:172— TooManyMethods — 69 methods, declared across 3 files: mir/eval.rs (55), eval/shim.rs (12), shim/simd.rs (2). The bar is 30 methods; this is 39 over it, 2.30× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Ty crates/hir-ty/src/next_solver/ty.rs:55— TooManyMethods — 69 methods. The bar is 30 methods; this is 39 over it, 2.30× the bar. Most of these members implement ty.Ty (69 of 69 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
TooManyMethods: MirLowerCtx crates/hir-ty/src/mir/lower.rs:82— TooManyMethods — 67 methods, declared across 3 files: mir/lower.rs (49), lower/pattern_matching.rs (11), lower/as_place.rs (7). The bar is 30 methods; this is 37 over it, 2.23× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ItemScope crates/hir-def/src/item_scope.rs:125— TooManyMethods — 55 methods. The bar is 30 methods; this is 25 over it, 1.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: GlobalState crates/rust-analyzer/src/global_state.rs:86— TooManyMethods — 51 methods, declared across 4 files: src/main_loop.rs (18), src/global_state.rs (16), src/reload.rs (13), lsp/utils.rs (4). The bar is 30 methods; this is 21 over it, 1.70× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ClientCapabilities crates/rust-analyzer/src/lsp/capabilities.rs:198— TooManyMethods — 45 methods. The bar is 30 methods; this is 15 over it, 1.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: TyLoweringContext crates/hir-ty/src/lower.rs:209— TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Resolver crates/hir-def/src/resolver.rs:44— TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ExprUseVisitor crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:407— TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SourceToDefCtx crates/hir/src/semantics/source_to_def.rs:188— TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: FamousDefs crates/ide-db/src/famous_defs.rs:21— TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DefMap crates/hir-def/src/nameres.rs:172— TooManyMethods — 42 methods, declared across 3 files: src/nameres.rs (28), nameres/path_resolution.rs (12), nameres/attr_resolution.rs (2). The bar is 30 methods; this is 12 over it, 1.40× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: InferenceTable crates/hir-ty/src/infer/unify.rs:131— TooManyMethods — 41 methods, declared across 3 files: infer/unify.rs (38), infer/autoderef.rs (2), src/method_resolution.rs (1). The bar is 30 methods; this is 11 over it, 1.37× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: InferenceResult crates/hir-ty/src/infer.rs:754— TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ProbeContext crates/hir-ty/src/method_resolution/probe.rs:48— TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Completions crates/ide-completion/src/completions.rs:57— TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Semantics crates/hir/src/semantics.rs:162— TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ExprCollector crates/hir-def/src/expr_store/lower.rs:508— ClassTooLong — 2143 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 113 methods, 3 blocks, lines 508-3760. The bar is 400 significant lines; this is 1743 over it, 5.36× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Evaluator crates/hir-ty/src/mir/eval.rs:172— ClassTooLong — 2037 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 69 methods, 2 blocks, lines 172-3219. The bar is 400 significant lines; this is 1637 over it, 5.09× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: MirLowerCtx crates/hir-ty/src/mir/lower.rs:82— ClassTooLong — 1350 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 67 methods, 2 blocks, lines 82-2059. The bar is 400 significant lines; this is 950 over it, 3.38× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: SourceAnalyzer crates/hir/src/source_analyzer.rs:77— ClassTooLong — 1202 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 70 methods, 2 blocks, lines 77-1751. The bar is 400 significant lines; this is 802 over it, 3.01× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DefCollector crates/hir-def/src/nameres/collector.rs:232— ClassTooLong — 1005 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 22 methods, 2 blocks, lines 232-1881. The bar is 400 significant lines; this is 605 over it, 2.51× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DbInterner crates/hir-ty/src/next_solver/interner.rs:342— ClassTooLong — 997 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 19 methods, 4 blocks, lines 342-2310. The bar is 400 significant lines; this is 597 over it, 2.49× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Ty crates/hir-ty/src/next_solver/ty.rs:55— ClassTooLong — 840 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 69 methods, 12 blocks, lines 55-1409. The bar is 400 significant lines; this is 440 over it, 2.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: InferenceContext crates/hir-ty/src/infer.rs:1325— ClassTooLong — 823 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 207 methods, 2 blocks, lines 1325-2592. The bar is 400 significant lines; this is 423 over it, 2.06× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: TyLoweringContext crates/hir-ty/src/lower.rs:209— ClassTooLong — 730 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 44 methods, 3 blocks, lines 209-1376. The bar is 400 significant lines; this is 330 over it, 1.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ProjectWorkspace crates/project-model/src/workspace.rs:55— ClassTooLong — 728 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 19 methods, 3 blocks, lines 55-1102. The bar is 400 significant lines; this is 328 over it, 1.82× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ExprUseVisitor crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:407— ClassTooLong — 713 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 43 methods, 3 blocks, lines 407-1762. The bar is 400 significant lines; this is 313 over it, 1.78× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ProbeContext crates/hir-ty/src/method_resolution/probe.rs:48— ClassTooLong — 709 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 39 methods, 4 blocks, lines 48-2082. The bar is 400 significant lines; this is 309 over it, 1.77× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Printer crates/hir-def/src/expr_store/pretty.rs:450— ClassTooLong — 681 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 18 methods, 3 blocks, lines 450-1411. The bar is 400 significant lines; this is 281 over it, 1.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ModCollector crates/hir-def/src/nameres/collector.rs:1884— ClassTooLong — 636 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 12 methods, 2 blocks, lines 1884-2782. The bar is 400 significant lines; this is 236 over it, 1.59× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PathLoweringContext crates/hir-ty/src/lower/path.rs:58— ClassTooLong — 635 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 25 methods, 2 blocks, lines 58-1004. The bar is 400 significant lines; this is 235 over it, 1.59× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: FindUsages crates/ide-db/src/search.rs:441— ClassTooLong — 606 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 20 methods, 2 blocks, lines 441-1376. The bar is 400 significant lines; this is 206 over it, 1.52× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Resolver crates/hir-def/src/resolver.rs:44— ClassTooLong — 582 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 43 methods, 4 blocks, lines 44-1183. The bar is 400 significant lines; this is 182 over it, 1.46× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: AnyDiagnostic crates/hir/src/diagnostics.rs:131— ClassTooLong — 533 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 9 methods. The bar is 400 significant lines; this is 133 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ItemScope crates/hir-def/src/item_scope.rs:125— ClassTooLong — 474 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 55 methods, 4 blocks, lines 125-904. The bar is 400 significant lines; this is 74 over it, 1.19× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: InferCtxt crates/hir-ty/src/next_solver/infer/mod.rs:231— ClassTooLong — 453 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 111 methods, 2 blocks, lines 231-1276. The bar is 400 significant lines; this is 53 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: AttrFlags crates/hir-def/src/attrs.rs:287— ClassTooLong — 448 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 24 methods. The bar is 400 significant lines; this is 48 over it, 1.12× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Analysis crates/ide/src/lib.rs:243— ClassTooLong — 440 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 79 methods, 2 blocks, lines 243-977. The bar is 400 significant lines; this is 40 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DiagnosticsCollector crates/hir/src/diagnostics.rs:719— ClassTooLong — 434 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 23 methods, 2 blocks, lines 719-1414. The bar is 400 significant lines; this is 34 over it, 1.09× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DeclValidator crates/hir-ty/src/diagnostics/decl_check.rs:125— ClassTooLong — 421 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 21 methods, 2 blocks, lines 125-776. The bar is 400 significant lines; this is 21 over it, 1.05× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: GlobalState crates/rust-analyzer/src/global_state.rs:86— ClassTooLong — 412 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 51 methods, 3 blocks, lines 86-823. The bar is 400 significant lines; this is 12 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ide_assists::handlers::inline_call::inline (cyclomatic 46) crates/ide-assists/src/handlers/inline_call.rs:338— ide_assists::handlers::inline_call::inline has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::extract_variable::extract_variable (cyclomatic 36) crates/ide-assists/src/handlers/extract_variable.rs:74— ide_assists::handlers::extract_variable::extract_variable has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::convert_closure_to_fn::convert_closure_to_fn (cyclomatic 32) crates/ide-assists/src/handlers/convert_closure_to_fn.rs:54— ide_assists::handlers::convert_closure_to_fn::convert_closure_to_fn has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::add_missing_match_arms::add_missing_match_arms (cyclomatic 30) crates/ide-assists/src/handlers/add_missing_match_arms.rs:41— ide_assists::handlers::add_missing_match_arms::add_missing_match_arms has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::unwrap_return_type::unwrap_return_type (cyclomatic 28) crates/ide-assists/src/handlers/unwrap_return_type.rs:40— ide_assists::handlers::unwrap_return_type::unwrap_return_type has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::add_turbo_fish::add_turbo_fish (cyclomatic 22) crates/ide-assists/src/handlers/add_turbo_fish.rs:31— ide_assists::handlers::add_turbo_fish::add_turbo_fish has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::remove_dbg::compute_dbg_replacement (cyclomatic 20) crates/ide-assists/src/handlers/remove_dbg.rs:72— ide_assists::handlers::remove_dbg::compute_dbg_replacement has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ide_assists::handlers::inline_type_alias::create_replacement (cyclomatic 20) crates/ide-assists/src/handlers/inline_type_alias.rs:320— ide_assists::handlers::inline_type_alias::create_replacement has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::extract_function::extract_function (cyclomatic 20) crates/ide-assists/src/handlers/extract_function.rs:67— ide_assists::handlers::extract_function::extract_function has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::extract_type_alias::collect_used_generics (cyclomatic 20) crates/ide-assists/src/handlers/extract_type_alias.rs:110— ide_assists::handlers::extract_type_alias::collect_used_generics has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_assists::utils::gen_trait_fn_body::gen_partial_eq (cyclomatic 20) crates/ide-assists/src/utils/gen_trait_fn_body.rs:414— ide_assists::utils::gen_trait_fn_body::gen_partial_eq has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ide_assists::handlers::convert_let_else_to_match::remove_mut_and_collect_idents (cyclomatic 19) crates/ide-assists/src/handlers/convert_let_else_to_match.rs:124— ide_assists::handlers::convert_let_else_to_match::remove_mut_and_collect_idents has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::apply_demorgan::apply_demorgan (cyclomatic 18) crates/ide-assists/src/handlers/apply_demorgan.rs:40— ide_assists::handlers::apply_demorgan::apply_demorgan has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::generate_new::generate_new (cyclomatic 18) crates/ide-assists/src/handlers/generate_new.rs:36— ide_assists::handlers::generate_new::generate_new has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::unwrap_branch::unwrap_branch (cyclomatic 18) crates/ide-assists/src/handlers/unwrap_branch.rs:32— ide_assists::handlers::unwrap_branch::unwrap_branch has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ide_assists::handlers::wrap_return_type::wrap_return_type (cyclomatic 18) crates/ide-assists/src/handlers/wrap_return_type.rs:43— ide_assists::handlers::wrap_return_type::wrap_return_type has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::extract_module::extract_module (cyclomatic 18) crates/ide-assists/src/handlers/extract_module.rs:56— ide_assists::handlers::extract_module::extract_module has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::extract_function::make_body (cyclomatic 17) crates/ide-assists/src/handlers/extract_function.rs:1800— ide_assists::handlers::extract_function::make_body has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: FunctionBody::external_control_flow (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
ide_assists::handlers::toggle_macro_delimiter::toggle_macro_delimiter (cyclomatic 17) crates/ide-assists/src/handlers/toggle_macro_delimiter.rs:29— ide_assists::handlers::toggle_macro_delimiter::toggle_macro_delimiter has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_assists::handlers::convert_bool_to_enum::replace_usages (cyclomatic 17) crates/ide-assists/src/handlers/convert_bool_to_enum.rs:212— ide_assists::handlers::convert_bool_to_enum::replace_usages has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::auto_import::relevance_score (cyclomatic 17) crates/ide-assists/src/handlers/auto_import.rs:258— ide_assists::handlers::auto_import::relevance_score has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_assists::handlers::convert_closure_to_fn::compute_closure_type_params (cyclomatic 16) crates/ide-assists/src/handlers/convert_closure_to_fn.rs:351— ide_assists::handlers::convert_closure_to_fn::compute_closure_type_params has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::generate_delegate_methods::generate_delegate_methods (cyclomatic 16) crates/ide-assists/src/handlers/generate_delegate_methods.rs:51— ide_assists::handlers::generate_delegate_methods::generate_delegate_methods has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::wrap_unwrap_cfg_attr::attempt_get_derive (cyclomatic 16) crates/ide-assists/src/handlers/wrap_unwrap_cfg_attr.rs:38— ide_assists::handlers::wrap_unwrap_cfg_attr::attempt_get_derive has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::extract_expressions_from_format_string::extract_expressions_from_format_string (cyclomatic 16) crates/ide-assists/src/handlers/extract_expressions_from_format_string.rs:31— ide_assists::handlers::extract_expressions_from_format_string::extract_expressions_from_format_string has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HackComment crates/hir-def/src/nameres.rs:93— /// HACK: In order to test builtin derive expansion, we gate their fast path with this atomic when cfg(test). — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/builtin_derive.rs:29— // HACK: Fake the param. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/infer/op.rs:233— // HACK(eddyb) Bypass checks due to reborrows being in — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/infer/callee.rs:207— // Hack: we know that there are traits implementing Fn for &F — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/infer/callee.rs:267— // HACK(async_closures): For async closures, prefer `AsyncFn*` — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:887— // HACK: this could be a fake pattern corresponding to a deref inserted by match — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/next_solver/ty.rs:1212— // HACK: Coroutine witness types are lifetime erased, so they — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/next_solver/interner.rs:1711— // HACK: For integer and float variables we have to manually look at all impls — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/next_solver/infer/errors.rs:372— /// HACK: We walk the nested obligations for a well-formed arg manually, — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir/src/source_analyzer.rs:846— // HACK: subst for `poll()` coincides with that for `Future` because `poll()` itself — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir/src/source_analyzer.rs:880— // HACK: subst for all methods coincides with that for their trait because the methods — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir/src/source_analyzer.rs:907— // HACK: subst for all methods coincides with that for their trait because the methods — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir/src/source_analyzer.rs:924— // HACK: subst for `index()` coincides with that for `Index` because `index()` itself — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir/src/source_analyzer.rs:939— // HACK: subst for `branch()` coincides with that for `Try` because `branch()` itself — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir/src/diagnostics.rs:1072— // HACK: When specialization is enabled in the current crate, and there exists — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/ide/src/expand_macro.rs:241— // hack until we get hygiene working (same character amount to preserve formatting as much as possible) — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/mbe/src/expander/matcher.rs:422— // HACK: here we use `meta_result` to pass `TtIter` back to caller because — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/mbe/src/expander/matcher.rs:567— // HACK: here we use `meta_result` to pass `TtIter` back to caller because — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/mbe/src/expander/matcher.rs:791— // HACK: Macro expansion should not be done using "rollback and try another alternative". — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/rust-analyzer/src/global_state.rs:198— /// HACK: Workaround for <https://github.com/rust-lang/rust-analyzer/issues/19709> — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/rust-analyzer/src/diagnostics/flycheck_to_proto.rs:28— // HACK: special case for `warnings` rustc lint. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/rust-analyzer/src/diagnostics/flycheck_to_proto.rs:36— // HACK: special case for `warnings` rustc lint. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment editors/code/src/client.ts:23— // HACK: This is a workaround, when the client has been disposed, VSCode — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment lib/text-size/src/range.rs:126— // HACK for const fn: math on primitives only — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment lib/text-size/src/range.rs:133— // HACK for const fn: math on primitives only — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
ide_completion::context::analysis::classify_name_ref (cognitive 172) crates/ide-completion/src/context/analysis.rs:952— ide_completion::context::analysis::classify_name_ref has cognitive complexity 172 (threshold 15). Drivers by points: if/else 48 (80 pts), match/switch 33 (68 pts), boolean chains 15, loops 2 (9 pts) (nesting depth added 74). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::completions::expr::complete_expr_path (cognitive 128) crates/ide-completion/src/completions/expr.rs:47— ide_completion::completions::expr::complete_expr_path has cognitive complexity 128 (threshold 15). Drivers by points: if/else 36 (84 pts), match/switch 13 (32 pts), boolean chains 6, loops 2 (6 pts) (nesting depth added 71). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::context::analysis::expected_type_and_name (cognitive 62) crates/ide-completion/src/context/analysis.rs:591— ide_completion::context::analysis::expected_type_and_name has cognitive complexity 62 (threshold 15). Drivers by points: if/else 14 (28 pts), match/switch 11 (23 pts), boolean chains 6, loops 3 (5 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::completions::postfix::complete_postfix (cognitive 61) crates/ide-completion/src/completions/postfix.rs:33— ide_completion::completions::postfix::complete_postfix has cognitive complexity 61 (threshold 15). Drivers by points: if/else 27 (36 pts), match/switch 10 (15 pts), boolean chains 10 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::context::analysis::expand (cognitive 58) crates/ide-completion/src/context/analysis.rs:172— ide_completion::context::analysis::expand has cognitive complexity 58 (threshold 15). Drivers by points: if/else 14 (45 pts), match/switch 4 (6 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ide_completion::completions::type::complete_type_path (cognitive 50) crates/ide-completion/src/completions/type.rs:12— ide_completion::completions::type::complete_type_path has cognitive complexity 50 (threshold 15). Drivers by points: if/else 9 (28 pts), match/switch 8 (16 pts), loops 2 (6 pts) (nesting depth added 31). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_completion::completions::use_::complete_use_path (cognitive 42) crates/ide-completion/src/completions/use_.rs:13— ide_completion::completions::use_::complete_use_path has cognitive complexity 42 (threshold 15). Drivers by points: if/else 7 (23 pts), match/switch 4 (9 pts), loops 2 (7 pts), boolean chains 3 (nesting depth added 26). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_completion::completions::item_list::add_keywords (cognitive 36) crates/ide-completion/src/completions/item_list.rs:75— ide_completion::completions::item_list::add_keywords has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 8 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::context::analysis::analyze (cognitive 33) crates/ide-completion/src/context/analysis.rs:442— ide_completion::context::analysis::analyze has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 8, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::render::function::add_call_parens (cognitive 31) crates/ide-completion/src/render/function.rs:212— ide_completion::render::function::add_call_parens has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (18 pts), match/switch 4 (12 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::completions::pattern::complete_pattern_path (cognitive 27) crates/ide-completion/src/completions/pattern.rs:129— ide_completion::completions::pattern::complete_pattern_path has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 6 (15 pts), if/else 3 (9 pts), loops 1 (3 pts) (nesting depth added 17). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_completion::completions::attribute::complete_attribute_path (cognitive 26) crates/ide-completion/src/completions/attribute.rs:70— ide_completion::completions::attribute::complete_attribute_path has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (14 pts), match/switch 4 (7 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ide_completion::completions::pattern::complete_pattern (cognitive 22) crates/ide-completion/src/completions/pattern.rs:13— ide_completion::completions::pattern::complete_pattern has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 5 (8 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::completions::item_list::trait_impl::get_transformed_fn (cognitive 21) crates/ide-completion/src/completions/item_list/trait_impl.rs:321— ide_completion::completions::item_list::trait_impl::get_transformed_fn has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 3 (8 pts), boolean chains 1 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_completion::render::function::render (cognitive 19) crates/ide-completion/src/render/function.rs:50— ide_completion::render::function::render has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, match/switch 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ide_completion::completions::attribute::cfg::complete_cfg (cognitive 18) crates/ide-completion/src/completions/attribute/cfg.rs:12— ide_completion::completions::attribute::cfg::complete_cfg has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 4 (6 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::completions::attribute::derive::complete_derive_path (cognitive 17) crates/ide-completion/src/completions/attribute/derive.rs:13— ide_completion::completions::attribute::derive::complete_derive_path has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_completion::completions::mod_::complete_mod (cognitive 17) crates/ide-completion/src/completions/mod_.rs:15— ide_completion::completions::mod_::complete_mod has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::completions::postfix::format_like::add_format_like_completions (cognitive 17) crates/ide-completion/src/completions/postfix/format_like.rs:44— ide_completion::completions::postfix::format_like::add_format_like_completions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::completions::fn_param::fill_fn_params (cognitive 16) crates/ide-completion/src/completions/fn_param.rs:80— ide_completion::completions::fn_param::fill_fn_params has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 4 (5 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_completion::completions::item_list::trait_impl::add_type_alias_impl (cognitive 16) crates/ide-completion/src/completions/item_list/trait_impl.rs:403— ide_completion::completions::item_list::trait_impl::add_type_alias_impl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 2 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::render::render_resolution_path (cognitive 16) crates/ide-completion/src/render.rs:408— ide_completion::render::render_resolution_path has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), match/switch 4 (5 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::completions::expr::complete_expr (cognitive 16) crates/ide-completion/src/completions/expr.rs:457— ide_completion::completions::expr::complete_expr has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), loops 2 (6 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::infer_expr_inner (cognitive 96) crates/hir-ty/src/infer/expr.rs:317— InferenceContext::infer_expr_inner has cognitive complexity 96 (threshold 15). Drivers by points: if/else 27 (50 pts), match/switch 15 (33 pts), loops 4 (10 pts), boolean chains 3 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::resolve_variant (cognitive 79) crates/hir-ty/src/infer.rs:2225— InferenceContext::resolve_variant has cognitive complexity 79 (threshold 15). Drivers by points: if/else 28 (60 pts), match/switch 7 (13 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 39). Of this number, 77 points are the body's own statements and 2 belong to one function item inside it that branches. This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
InferenceContext::check_record_expr_fields (cognitive 57) crates/hir-ty/src/infer/expr.rs:968— InferenceContext::check_record_expr_fields has cognitive complexity 57 (threshold 15). Drivers by points: if/else 20 (41 pts), loops 3 (7 pts), match/switch 2 (7 pts), boolean chains 2 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::check_call_arguments (cognitive 48) crates/hir-ty/src/infer/expr.rs:1921— InferenceContext::check_call_arguments has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (28 pts), match/switch 5 (15 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::try_find_coercion_lub (cognitive 40) crates/hir-ty/src/infer/coerce.rs:926— InferenceContext::try_find_coercion_lub has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (20 pts), match/switch 6 (12 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
InferenceContext::analyze_closure (cognitive 39) crates/hir-ty/src/infer/closure/analysis.rs:229— InferenceContext::analyze_closure has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (30 pts), loops 3 (5 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::infer_ref_pat (cognitive 39) crates/hir-ty/src/infer/pat.rs:1356— InferenceContext::infer_ref_pat has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (29 pts), boolean chains 5, match/switch 3 (5 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::infer_mut_expr_without_adjust (cognitive 38) crates/hir-ty/src/infer/mutability.rs:55— InferenceContext::infer_mut_expr_without_adjust has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (26 pts), match/switch 4 (8 pts), loops 2 (4 pts) (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
InferenceContext::compute_min_captures (cognitive 31) crates/hir-ty/src/infer/closure/analysis.rs:724— InferenceContext::compute_min_captures has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 5 (13 pts), if/else 5 (11 pts), loops 4 (7 pts) (nesting depth added 17). Of this number, 29 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::deduce_closure_signature_from_predicates (cognitive 30) crates/hir-ty/src/infer/closure.rs:418— InferenceContext::deduce_closure_signature_from_predicates has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 3 (9 pts), boolean chains 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::resolve_value_path_inner (cognitive 26) crates/hir-ty/src/infer/path.rs:146— InferenceContext::resolve_value_path_inner has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 4 (13 pts) (nesting depth added 14). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::resolve_all (cognitive 26) crates/hir-ty/src/infer.rs:1618— InferenceContext::resolve_all has cognitive complexity 26 (threshold 15). Drivers by points: loops 15 (25 pts), if/else 1 (nesting depth added 10). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
InferenceContext::infer_pat_inner (cognitive 25) crates/hir-ty/src/infer/pat.rs:377— InferenceContext::infer_pat_inner has cognitive complexity 25 (threshold 15). Drivers by points: loops 3 (8 pts), match/switch 4 (7 pts), if/else 5 (6 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::infer_mut_expr (cognitive 24) crates/hir-ty/src/infer/mutability.rs:21— InferenceContext::infer_mut_expr has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 3 (12 pts), if/else 3 (10 pts), loops 1 (2 pts) (nesting depth added 17). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
InferenceContext::compute_definition_site_hidden_types (cognitive 22) crates/hir-ty/src/infer/opaques.rs:67— InferenceContext::compute_definition_site_hidden_types has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (7 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::calculate_diverging_fallback (cognitive 19) crates/hir-ty/src/infer/fallback.rs:233— InferenceContext::calculate_diverging_fallback has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 5 (8 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::check_record_pat_fields (cognitive 19) crates/hir-ty/src/infer/pat.rs:1154— InferenceContext::check_record_pat_fields has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 2 (4 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::struct_tail_with_normalize (cognitive 19) crates/hir-ty/src/infer.rs:2037— InferenceContext::struct_tail_with_normalize has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (12 pts), if/else 3 (6 pts), loops 1 (nesting depth added 11). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
InferenceContext::infer_method_call (cognitive 17) crates/hir-ty/src/infer/expr.rs:1774— InferenceContext::infer_method_call has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 5 (9 pts), if/else 3 (5 pts), loops 1 (3 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
InferenceContext::infer_tuple_struct_pat (cognitive 17) crates/hir-ty/src/infer/pat.rs:1046— InferenceContext::infer_tuple_struct_pat has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (7 pts), if/else 4 (5 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::try_index_step (cognitive 16) crates/hir-ty/src/infer/place_op.rs:106— InferenceContext::try_index_step has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TodoComment crates/hir-ty/src/infer/closure.rs:1161— // TODO: def id needs to be changed? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/hir-ty/src/next_solver/predicate.rs:435— // TODO implement Debug by hand — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/hir-ty/src/next_solver/infer/relate/generalize.rs:153— /// todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide-assists/src/handlers/unwrap_type_to_generic_arg.rs:15— // todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide-assists/src/handlers/unwrap_type_to_generic_arg.rs:21— // todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide-assists/src/handlers/generate_function.rs:52— // todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide-assists/src/handlers/generate_blanket_trait_impl.rs:55— // todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide-assists/src/handlers/add_missing_impl_members.rs:44— // todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide-completion/src/context.rs:50— // TODO: Add try_tok and default_tok — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide-diagnostics/src/handlers/explicit_drop_method_use.rs:51— // TODO: handle macro calls. Rough plan: — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide-diagnostics/src/handlers/explicit_drop_method_use.rs:92— // TODO: make this work in macros? Might not be worth it, as this is a niche way to trigger this — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide/src/moniker.rs:250— /// `BuiltinLifetime`, `TupleField`, `ToolModule`, and `InlineAsmRegOrRegClass`. TODO: it might be — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/proc-macro-api/src/bidirectional_protocol.rs:59— // TODO: Avoid `AssertUnwindSafe` by making the callback `UnwindSafe` once `SourceDatabase` — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/rust-analyzer/src/discover.rs:65— // TODO: are we sure the extra env should be empty? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/rust-analyzer/src/tracing/config.rs:89— // TODO: remove `.with_filter(LevelFilter::OFF)` on the `None` branch. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/rust-analyzer/src/tracing/config.rs:101— // TODO: remove `.with_filter(LevelFilter::OFF)` on the `None` branch. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/test-utils/src/minicore.rs:83— //! todo: panic — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/test-utils/src/minicore.rs:2505— // :todo — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment editors/code/src/debug.ts:166— // TODO: remove lldb-dap-specific post-processing once — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment editors/code/src/config.ts:575— // TODO: support for remote workspaces? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
ide_db::syntax_helpers::format_string::lex_format_specifiers (cognitive 101) crates/ide-db/src/syntax_helpers/format_string.rs:45— ide_db::syntax_helpers::format_string::lex_format_specifiers has cognitive complexity 101 (threshold 15). Drivers by points: if/else 18 (62 pts), match/switch 7 (29 pts), boolean chains 7, loops 3 (nesting depth added 66). Of this number, 92 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ide_db::imports::insert_use::guess_granularity_from_scope (cognitive 41) crates/ide-db/src/imports/insert_use.rs:340— ide_db::imports::insert_use::guess_granularity_from_scope has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (32 pts), boolean chains 6, match/switch 2, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::rename::source_edit_from_def (cognitive 41) crates/ide-db/src/rename.rs:673— ide_db::rename::source_edit_from_def has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (27 pts), match/switch 3 (8 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ide_db::prime_caches::parallel_prime_caches (cognitive 40) crates/ide-db/src/prime_caches.rs:31— ide_db::prime_caches::parallel_prime_caches has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 8 (14 pts), match/switch 6 (8 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::traits::diff_assoc_items (cognitive 33) crates/ide-db/src/traits.rs:56— ide_db::traits::diff_assoc_items has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 3 (7 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::syntax_helpers::format_string_exprs::parse_format_exprs (cognitive 30) crates/ide-db/src/syntax_helpers/format_string_exprs.rs:44— ide_db::syntax_helpers::format_string_exprs::parse_format_exprs has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::imports::merge_imports::recursive_normalize (cognitive 29) crates/ide-db/src/imports/merge_imports.rs:292— ide_db::imports::merge_imports::recursive_normalize has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (24 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::imports::merge_imports::version_sort::version_sort (cognitive 28) crates/ide-db/src/imports/merge_imports.rs:978— ide_db::imports::merge_imports::version_sort::version_sort has cognitive complexity 28 (threshold 15). Drivers by points: match/switch 5 (14 pts), if/else 3 (11 pts), boolean chains 2, loops 1 (nesting depth added 17). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_db::syntax_helpers::node_ext::walk_patterns_in_expr (cognitive 25) crates/ide-db/src/syntax_helpers/node_ext.rs:116— ide_db::syntax_helpers::node_ext::walk_patterns_in_expr has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 3 (8 pts), boolean chains 1, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::rename::source_edit_from_name_ref (cognitive 24) crates/ide-db/src/rename.rs:578— ide_db::rename::source_edit_from_name_ref has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::symbol_index::resolve_path_to_modules (cognitive 23) crates/ide-db/src/symbol_index.rs:290— ide_db::symbol_index::resolve_path_to_modules has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (11 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::imports::merge_imports::recursive_merge (cognitive 23) crates/ide-db/src/imports/merge_imports.rs:120— ide_db::imports::merge_imports::recursive_merge has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 2 (6 pts), boolean chains 3, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::syntax_helpers::tree_diff::diff::go (cognitive 23) crates/ide-db/src/syntax_helpers/tree_diff.rs:79— ide_db::syntax_helpers::tree_diff::diff::go has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 3 (6 pts), loops 2 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::imports::insert_use::insert_use_with_editor_ (cognitive 22) crates/ide-db/src/imports/insert_use.rs:425— ide_db::imports::insert_use::insert_use_with_editor_ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::syntax_helpers::node_ext::preorder_expr_with_ctx_checker (cognitive 21) crates/ide-db/src/syntax_helpers/node_ext.rs:69— ide_db::syntax_helpers::node_ext::preorder_expr_with_ctx_checker has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::imports::insert_use::insert_use_with_alias_option_with_editor (cognitive 19) crates/ide-db/src/imports/insert_use.rs:214— ide_db::imports::insert_use::insert_use_with_alias_option_with_editor has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 4 (6 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_db::rust_doc::format_docs_ (cognitive 19) crates/ide-db/src/rust_doc.rs:40— ide_db::rust_doc::format_docs_ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::syntax_helpers::node_ext::for_each_tail_expr (cognitive 16) crates/ide-db/src/syntax_helpers/node_ext.rs:283— ide_db::syntax_helpers::node_ext::for_each_tail_expr has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), match/switch 3 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_db::rename::rename_field_constructors (cognitive 16) crates/ide-db/src/rename.rs:425— ide_db::rename::rename_field_constructors has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, loops 5 (7 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Duplicated block (11 lines × 2) crates/hir/src/lib.rs:3312— crates/hir/src/lib.rs:3312-3322 | crates/hir/src/lib.rs:3353-3363 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/hir-def/src/expr_store/pretty.rs:589— crates/hir-def/src/expr_store/pretty.rs:589-599 | crates/hir-def/src/expr_store/pretty.rs:608-618 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/hir-def/src/expr_store.rs:794— crates/hir-def/src/expr_store.rs:794-804 | crates/hir-def/src/expr_store.rs:829-839 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/hir-def/src/item_scope.rs:922— crates/hir-def/src/item_scope.rs:922-932 | crates/hir-def/src/item_scope.rs:935-945 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/hir-ty/src/lower/path.rs:749— crates/hir-ty/src/lower/path.rs:749-761 | crates/hir-ty/src/method_resolution/confirm.rs:409-419 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11 lines × 2) crates/hir-ty/src/lower.rs:1652— crates/hir-ty/src/lower.rs:1652-1662 | crates/hir-ty/src/lower.rs:1683-1693 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/hir-ty/src/lower.rs:1768— crates/hir-ty/src/lower.rs:1768-1778 | crates/hir-ty/src/lower.rs:2286-2296 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/hir-ty/src/mir/eval/shim.rs:621— crates/hir-ty/src/mir/eval/shim.rs:621-631 | crates/hir-ty/src/mir/eval/shim.rs:693-703 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/hir-ty/src/mir/eval.rs:2613— crates/hir-ty/src/mir/eval.rs:2613-2623 | crates/hir-ty/src/mir/eval.rs:2634-2644 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/hir-ty/src/mir/eval.rs:2799— crates/hir-ty/src/mir/eval.rs:2799-2809 | crates/hir-ty/src/mir/eval.rs:2811-2821 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/hir-ty/src/mir/lower.rs:534— crates/hir-ty/src/mir/lower.rs:534-544 | crates/hir-ty/src/mir/lower.rs:1042-1052 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/ide-assists/src/handlers/generate_enum_is_method.rs:117— crates/ide-assists/src/handlers/generate_enum_is_method.rs:117-127 | crates/ide-assists/src/handlers/generate_enum_projection_method.rs:198-208 — before extracting anything, compare `crates/ide-assists/src/handlers/generate_enum_is_method.rs` and `crates/ide-assists/src/handlers/generate_enum_projection_method.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) crates/ide-completion/src/completions/type.rs:68— crates/ide-completion/src/completions/type.rs:68-78 | crates/ide-completion/src/completions/type.rs:111-121 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/mbe/src/expander/matcher.rs:523— crates/mbe/src/expander/matcher.rs:523-533 | crates/mbe/src/expander/matcher.rs:543-553 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/proc-macro-srv/src/token_stream.rs:195— crates/proc-macro-srv/src/token_stream.rs:195-205 | crates/proc-macro-srv/src/token_stream.rs:221-231 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/rust-analyzer/src/lsp/to_proto.rs:1829— crates/rust-analyzer/src/lsp/to_proto.rs:1829-1839 | crates/rust-analyzer/src/lsp/to_proto.rs:1883-1893 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/syntax/src/validation.rs:375— crates/syntax/src/validation.rs:375-385 | crates/syntax/src/validation.rs:388-398 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs:101— crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs:101-111 | crates/proc-macro-srv/src/server_impl/token_id.rs:94-104 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) crates/hir/src/semantics/child_by_source.rs:64— crates/hir/src/semantics/child_by_source.rs:64-73 | crates/hir/src/semantics/child_by_source.rs:91-100 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/hir-def/src/attrs.rs:533— crates/hir-def/src/attrs.rs:533-542 | crates/hir-def/src/attrs.rs:544-553 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/hir-def/src/item_scope.rs:697— crates/hir-def/src/item_scope.rs:697-706 | crates/hir-def/src/item_scope.rs:713-722 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/hir-ty/src/display.rs:1172— crates/hir-ty/src/display.rs:1172-1181 | crates/hir-ty/src/display.rs:1188-1197 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/hir-ty/src/lower/path.rs:352— crates/hir-ty/src/lower/path.rs:352-361 | crates/hir-ty/src/lower/path.rs:408-417 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/hir-ty/src/lower.rs:1486— crates/hir-ty/src/lower.rs:1486-1495 | crates/hir-ty/src/lower.rs:1823-1832 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/hir-ty/src/lower.rs:2823— crates/hir-ty/src/lower.rs:2823-2832 | crates/hir-ty/src/lower.rs:2920-2929 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/ide/src/runnables.rs:382— crates/ide/src/runnables.rs:382-391 | crates/ide/src/runnables.rs:473-482 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/ide/src/inlay_hints/lifetime.rs:35— crates/ide/src/inlay_hints/lifetime.rs:35-44 | crates/ide/src/inlay_hints/lifetime.rs:91-100 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/ide/src/inlay_hints/extern_block.rs:40— crates/ide/src/inlay_hints/extern_block.rs:40-49 | crates/ide/src/inlay_hints/extern_block.rs:58-67 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/ide-completion/src/completions/attribute.rs:90— crates/ide-completion/src/completions/attribute.rs:90-99 | crates/ide-completion/src/completions/attribute/derive.rs:21-30 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) crates/ide-db/src/syntax_helpers/format_string.rs:131— crates/ide-db/src/syntax_helpers/format_string.rs:131-140 | crates/ide-db/src/syntax_helpers/format_string.rs:214-223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/ide-diagnostics/src/handlers/unresolved_field.rs:44— crates/ide-diagnostics/src/handlers/unresolved_field.rs:44-53 | crates/ide-diagnostics/src/handlers/unresolved_method.rs:41-50 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) crates/load-cargo/src/lib.rs:656— crates/load-cargo/src/lib.rs:656-665 | crates/load-cargo/src/lib.rs:703-712 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:852— crates/rust-analyzer/src/cli/analysis_stats.rs:852-861 | crates/rust-analyzer/src/cli/analysis_stats.rs:1273-1282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/syntax-bridge/src/lib.rs:549— crates/syntax-bridge/src/lib.rs:549-558 | crates/syntax-bridge/src/lib.rs:591-600 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/hir-def/src/expr_store/pretty.rs:908— crates/hir-def/src/expr_store/pretty.rs:908-917 | crates/hir-def/src/expr_store/pretty.rs:1010-1019 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
ide_completion::context::analysis::classify_name_ref (cyclomatic 152) crates/ide-completion/src/context/analysis.rs:952— ide_completion::context::analysis::classify_name_ref has cyclomatic complexity 152 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_completion::completions::expr::complete_expr_path (cyclomatic 73) crates/ide-completion/src/completions/expr.rs:47— ide_completion::completions::expr::complete_expr_path has cyclomatic complexity 73 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_completion::context::analysis::expected_type_and_name (cyclomatic 49) crates/ide-completion/src/context/analysis.rs:591— ide_completion::context::analysis::expected_type_and_name has cyclomatic complexity 49 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_completion::completions::postfix::complete_postfix (cyclomatic 45) crates/ide-completion/src/completions/postfix.rs:33— ide_completion::completions::postfix::complete_postfix has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_completion::completions::type::complete_type_path (cyclomatic 41) crates/ide-completion/src/completions/type.rs:12— ide_completion::completions::type::complete_type_path has cyclomatic complexity 41 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_completion::completions::pattern::complete_pattern (cyclomatic 31) crates/ide-completion/src/completions/pattern.rs:13— ide_completion::completions::pattern::complete_pattern has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_completion::context::analysis::expand (cyclomatic 27) crates/ide-completion/src/context/analysis.rs:172— ide_completion::context::analysis::expand has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_completion::completions::pattern::complete_pattern_path (cyclomatic 25) crates/ide-completion/src/completions/pattern.rs:129— ide_completion::completions::pattern::complete_pattern_path has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_completion::completions::item_list::add_keywords (cyclomatic 25) crates/ide-completion/src/completions/item_list.rs:75— ide_completion::completions::item_list::add_keywords has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_completion::render::render_resolution_path (cyclomatic 24) crates/ide-completion/src/render.rs:408— ide_completion::render::render_resolution_path has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_completion::completions::attribute::complete_attribute_path (cyclomatic 23) crates/ide-completion/src/completions/attribute.rs:70— ide_completion::completions::attribute::complete_attribute_path has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ide_completion::context::analysis::analyze (cyclomatic 22) crates/ide-completion/src/context/analysis.rs:442— ide_completion::context::analysis::analyze has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_completion::completions::use_::complete_use_path (cyclomatic 22) crates/ide-completion/src/completions/use_.rs:13— ide_completion::completions::use_::complete_use_path has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_completion::render::function::render (cyclomatic 18) crates/ide-completion/src/render/function.rs:50— ide_completion::render::function::render has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ide_completion::completions::complete_name_ref (cyclomatic 18) crates/ide-completion/src/completions.rs:727— ide_completion::completions::complete_name_ref has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_completion::completions::attribute::cfg::complete_cfg (cyclomatic 16) crates/ide-completion/src/completions/attribute/cfg.rs:12— ide_completion::completions::attribute::cfg::complete_cfg has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
rust_analyzer::config::patch_old_style::patch_json_for_outdated_configs (cognitive 135) crates/rust-analyzer/src/config/patch_old_style.rs:10— rust_analyzer::config::patch_old_style::patch_json_for_outdated_configs has cognitive complexity 135 (threshold 15). Drivers by points: loops 41 (82 pts), match/switch 43 (44 pts), if/else 6 (7 pts), boolean chains 2 (nesting depth added 43). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
rust_analyzer::handlers::notification::run_flycheck (cognitive 69) crates/rust-analyzer/src/handlers/notification.rs:329— rust_analyzer::handlers::notification::run_flycheck has cognitive complexity 69 (threshold 15). Drivers by points: if/else 11 (36 pts), match/switch 6 (19 pts), loops 3 (11 pts), boolean chains 3 (nesting depth added 46). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
rust_analyzer::lsp::to_proto::completion_item (cognitive 45) crates/rust-analyzer/src/lsp/to_proto.rs:290— rust_analyzer::lsp::to_proto::completion_item has cognitive complexity 45 (threshold 15). Drivers by points: if/else 30 (38 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 9). Of this number, 43 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
rust_analyzer::lsp::to_proto::code_lens (cognitive 38) crates/rust-analyzer/src/lsp/to_proto.rs:1758— rust_analyzer::lsp::to_proto::code_lens has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (29 pts), match/switch 3 (6 pts), boolean chains 3 (nesting depth added 23). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
rust_analyzer::handlers::request::handle_runnables (cognitive 38) crates/rust-analyzer/src/handlers/request.rs:1016— rust_analyzer::handlers::request::handle_runnables has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (28 pts), boolean chains 6, loops 2 (3 pts), match/switch 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rust_analyzer::diagnostics::flycheck_to_proto::map_rust_diagnostic_to_lsp (cognitive 37) crates/rust-analyzer/src/diagnostics/flycheck_to_proto.rs:281— rust_analyzer::diagnostics::flycheck_to_proto::map_rust_diagnostic_to_lsp has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 5 (7 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rust_analyzer::handlers::request::run_rustfmt (cognitive 32) crates/rust-analyzer/src/handlers/request.rs:2405— rust_analyzer::handlers::request::run_rustfmt has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 6, match/switch 4 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rust_analyzer::lsp::to_proto::merge_text_and_snippet_edits (cognitive 23) crates/rust-analyzer/src/lsp/to_proto.rs:1196— rust_analyzer::lsp::to_proto::merge_text_and_snippet_edits has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (9 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rust_analyzer::handlers::notification::handle_did_save_text_document (cognitive 20) crates/rust-analyzer/src/handlers/notification.rs:161— rust_analyzer::handlers::notification::handle_did_save_text_document has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rust_analyzer::handlers::request::handle_run_test (cognitive 19) crates/rust-analyzer/src/handlers/request.rs:250— rust_analyzer::handlers::request::handle_run_test has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 2 (7 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rust_analyzer::handlers::request::handle_workspace_symbol (cognitive 19) crates/rust-analyzer/src/handlers/request.rs:676— rust_analyzer::handlers::request::handle_workspace_symbol has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 6, boolean chains 2, loops 1 (nesting depth added 5). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 2 function items inside it that branch (decide_search_kind_and_scope, exec_query). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
rust_analyzer::handlers::request::handle_code_action (cognitive 19) crates/rust-analyzer/src/handlers/request.rs:1499— rust_analyzer::handlers::request::handle_code_action has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rust_analyzer::lsp::to_proto::semantic_tokens (cognitive 18) crates/rust-analyzer/src/lsp/to_proto.rs:748— rust_analyzer::lsp::to_proto::semantic_tokens has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 2 (6 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rust_analyzer::handlers::request::handle_parent_module (cognitive 18) crates/rust-analyzer/src/handlers/request.rs:931— rust_analyzer::handlers::request::handle_parent_module has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (13 pts), if/else 3 (5 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
rust_analyzer::session::run_session (cognitive 16) crates/rust-analyzer/src/session.rs:37— rust_analyzer::session::run_session has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 4, boolean chains 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::display::render_const_scalar_inner (cognitive 87) crates/hir-ty/src/display.rs:820— hir_ty::display::render_const_scalar_inner has cognitive complexity 87 (threshold 15). Drivers by points: if/else 27 (67 pts), match/switch 6 (13 pts), loops 3 (7 pts) (nesting depth added 51). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_ty::display::write_bounds_like_dyn_trait (cognitive 77) crates/hir-ty/src/display.rs:2100— hir_ty::display::write_bounds_like_dyn_trait has cognitive complexity 77 (threshold 15). Drivers by points: if/else 26 (69 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::layout::layout_of_ty_query (cognitive 75) crates/hir-ty/src/layout.rs:164— hir_ty::layout::layout_of_ty_query has cognitive complexity 75 (threshold 15). Drivers by points: if/else 20 (54 pts), match/switch 9 (21 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::lower::resolve_type_param_assoc_type_shorthand (cognitive 51) crates/hir-ty/src/lower.rs:2099— hir_ty::lower::resolve_type_param_assoc_type_shorthand has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (39 pts), match/switch 2 (7 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::lower::path::substs_from_args_and_bindings (cognitive 50) crates/hir-ty/src/lower/path.rs:1155— hir_ty::lower::path::substs_from_args_and_bindings has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (31 pts), loops 3 (10 pts), match/switch 3 (9 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::next_solver::consts::valtree::allocation_to_const (cognitive 46) crates/hir-ty/src/next_solver/consts/valtree.rs:73— hir_ty::next_solver::consts::valtree::allocation_to_const has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (38 pts), match/switch 4 (8 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::lower::generic_predicates (cognitive 45) crates/hir-ty/src/lower.rs:2518— hir_ty::lower::generic_predicates has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (34 pts), loops 3 (6 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 24). Of this number, 43 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::display::render_const_scalar_from_valtree_inner (cognitive 35) crates/hir-ty/src/display.rs:1095— hir_ty::display::render_const_scalar_from_valtree_inner has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (26 pts), match/switch 3 (5 pts), loops 2 (4 pts) (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_ty::mir::lower::mir_body_for_closure_query (cognitive 25) crates/hir-ty/src/mir/lower.rs:2105— hir_ty::mir::lower::mir_body_for_closure_query has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 4 (7 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::next_solver::util::sizedness_fast_path (cognitive 20) crates/hir-ty/src/next_solver/util.rs:646— hir_ty::next_solver::util::sizedness_fast_path has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, loops 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::lower::path::check_generic_args_len (cognitive 17) crates/hir-ty/src/lower/path.rs:1062— hir_ty::lower::path::check_generic_args_len has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6, match/switch 3 (6 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::dyn_compatibility::virtual_call_violations_for_method (cognitive 17) crates/hir-ty/src/dyn_compatibility.rs:319— hir_ty::dyn_compatibility::virtual_call_violations_for_method has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
hir_ty::traits::check_orphan_rules (cognitive 17) crates/hir-ty/src/traits.rs:334— hir_ty::traits::check_orphan_rules has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 3 (7 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::drop::has_drop_glue_impl (cognitive 17) crates/hir-ty/src/drop.rs:52— hir_ty::drop::has_drop_glue_impl has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::consteval::literal_ty (cognitive 16) crates/hir-ty/src/consteval.rs:151— hir_ty::consteval::literal_ty has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 7 (16 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_ty::layout::layout_of_ty_query (cyclomatic 59) crates/hir-ty/src/layout.rs:164— hir_ty::layout::layout_of_ty_query has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_ty::display::render_const_scalar_inner (cyclomatic 57) crates/hir-ty/src/display.rs:820— hir_ty::display::render_const_scalar_inner has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_ty::next_solver::consts::valtree::allocation_to_const (cyclomatic 40) crates/hir-ty/src/next_solver/consts/valtree.rs:73— hir_ty::next_solver::consts::valtree::allocation_to_const has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_ty::display::render_const_scalar_from_valtree_inner (cyclomatic 36) crates/hir-ty/src/display.rs:1095— hir_ty::display::render_const_scalar_from_valtree_inner has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_ty::display::write_bounds_like_dyn_trait (cyclomatic 36) crates/hir-ty/src/display.rs:2100— hir_ty::display::write_bounds_like_dyn_trait has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_ty::consteval::literal_ty (cyclomatic 24) crates/hir-ty/src/consteval.rs:151— hir_ty::consteval::literal_ty has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_ty::lower::resolve_type_param_assoc_type_shorthand (cyclomatic 24) crates/hir-ty/src/lower.rs:2099— hir_ty::lower::resolve_type_param_assoc_type_shorthand has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_ty::lower::path::substs_from_args_and_bindings (cyclomatic 23) crates/hir-ty/src/lower/path.rs:1155— hir_ty::lower::path::substs_from_args_and_bindings has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_ty::drop::has_drop_glue_impl (cyclomatic 23) crates/hir-ty/src/drop.rs:52— hir_ty::drop::has_drop_glue_impl has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_ty::lower::path::check_generic_args_len (cyclomatic 17) crates/hir-ty/src/lower/path.rs:1062— hir_ty::lower::path::check_generic_args_len has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_ty::mir::lower::mir_body_for_closure_query (cyclomatic 17) crates/hir-ty/src/mir/lower.rs:2105— hir_ty::mir::lower::mir_body_for_closure_query has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_ty::infer::infer_query_with_inspect (cyclomatic 16) crates/hir-ty/src/infer.rs:122— hir_ty::infer::infer_query_with_inspect has cyclomatic complexity 16 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
hir_ty::consteval::intern_const_ref (cyclomatic 16) crates/hir-ty/src/consteval.rs:79— hir_ty::consteval::intern_const_ref has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_ty::lower::generic_predicates (cyclomatic 16) crates/hir-ty/src/lower.rs:2518— hir_ty::lower::generic_predicates has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_def::expr_store::lower::path::lower_path (cognitive 72) crates/hir-def/src/expr_store/lower/path.rs:41— hir_def::expr_store::lower::path::lower_path has cognitive complexity 72 (threshold 15). Drivers by points: if/else 25 (47 pts), match/switch 7 (19 pts), boolean chains 5, loops 1 (nesting depth added 34). Of this number, 71 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::hir::format_args::parse (cognitive 54) crates/hir-def/src/hir/format_args.rs:172— hir_def::hir::format_args::parse has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (27 pts), match/switch 10 (25 pts), loops 2 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::attrs::match_attr_flags (cognitive 46) crates/hir-def/src/attrs.rs:131— hir_def::attrs::match_attr_flags has cognitive complexity 46 (threshold 15). Drivers by points: match/switch 11 (31 pts), if/else 6 (13 pts), boolean chains 2 (nesting depth added 27). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_def::attrs::parse_repr_tt (cognitive 42) crates/hir-def/src/attrs.rs:1272— hir_def::attrs::parse_repr_tt has cognitive complexity 42 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 4 (16 pts), boolean chains 2, loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::expr_store::lower::lower_body (cognitive 34) crates/hir-def/src/expr_store/lower.rs:70— hir_def::expr_store::lower::lower_body has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 4 (9 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::expr_store::pretty::print_generic_params (cognitive 29) crates/hir-def/src/expr_store/pretty.rs:368— hir_def::expr_store::pretty::print_generic_params has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (4 pts), match/switch 1 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::attrs::docs::get_horizontal_trim (cognitive 27) crates/hir-def/src/attrs/docs.rs:507— hir_def::attrs::docs::get_horizontal_trim has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (7 pts), boolean chains 3, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::find_path::find_path_for_module (cognitive 25) crates/hir-def/src/find_path.rs:177— hir_def::find_path::find_path_for_module has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::find_path::find_local_import_locations (cognitive 25) crates/hir-def/src/find_path.rs:577— hir_def::find_path::find_local_import_locations has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::expr_store::pretty::print_where_clauses (cognitive 24) crates/hir-def/src/expr_store/pretty.rs:328— hir_def::expr_store::pretty::print_where_clauses has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 2 (7 pts), match/switch 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::lang_item::crate_lang_items (cognitive 23) crates/hir-def/src/lang_item.rs:38— hir_def::lang_item::crate_lang_items has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 3 (11 pts), loops 4 (8 pts), if/else 4 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_def::expr_store::lower::lower_function (cognitive 22) crates/hir-def/src/expr_store/lower.rs:377— hir_def::expr_store::lower::lower_function has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 3 (11 pts), if/else 5 (8 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_def::attrs::docs::extend_with_attrs (cognitive 18) crates/hir-def/src/attrs/docs.rs:645— hir_def::attrs::docs::extend_with_attrs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_def::find_path::find_in_sysroot (cognitive 16) crates/hir-def/src/find_path.rs:387— hir_def::find_path::find_in_sysroot has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Change coupling: rust_analyzer_span.rs ↔ token_id.rs crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs— `crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs` and `crates/proc-macro-srv/src/server_impl/token_id.rs` change together 84% of the time (21 of the 25 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 21 shared commits counted here, the most recent 3 are `250f6fca` Remove experimental `--env-set` option; `6d2fbc00` Cleanup bidirection proc-macro-srv protocol a bit; `35aec104` reduce the amount of panics in `{TokenStream, Literal}::from_str` calls — run `git show` on any of them.
Change coupling: builtin_fn_macro.rs ↔ fn_macro.rs crates/hir-def/src/macro_expansion_tests/builtin_fn_macro.rs— `crates/hir-def/src/macro_expansion_tests/builtin_fn_macro.rs` and `crates/hir-expand/src/builtin/fn_macro.rs` change together 82% of the time (9 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `1282829c` Add a flag do not parse rest arguments; `5fed4ac8` fix: don't error on tail comma for some macro; `c47f4e03` fix: cfg_select supports non token-tree tokens — run `git show` on any of them.
Change coupling: test_db.rs ↔ lib.rs crates/hir-ty/src/test_db.rs— `crates/hir-ty/src/test_db.rs` and `crates/ide-db/src/lib.rs` change together 75% of the time (9 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `89eaee22` internal: refer to salsa macros using `salsa::`; `57632bea` move `DefDatabase::expand_proc_attr_macros` out of the query group; `273abbb6` internal: Improve panic message when FileSourceRootInput is missing — run `git show` on any of them.
Change coupling: lower.rs ↔ pretty.rs crates/hir-def/src/item_tree/lower.rs— `crates/hir-def/src/item_tree/lower.rs` and `crates/hir-def/src/item_tree/pretty.rs` change together 74% of the time (14 of the 19 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 14 shared commits counted here, the most recent 3 are `0c8f6494` Do not declare the value NS constructor for structs/enum variants if …; `d59f559d` Optimize memory usage of the item tree; `439c0952` Reduce `impl_signature` query dependencies in method resolution — run `git show` on any of them.
Change coupling: mod_path.rs ↔ symbols.rs crates/hir-expand/src/mod_path.rs— `crates/hir-expand/src/mod_path.rs` and `crates/intern/src/symbol/symbols.rs` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `c7662ba9` fix; `75b41dc5` feat: Implement support for `feature(new_range)`; `72a6823f` rust-analyzer: Also use `semiopaque` instead of `semitransparent` — run `git show` on any of them.
Change coupling: expander.rs ↔ collector.rs crates/hir-def/src/expr_store/expander.rs— `crates/hir-def/src/expr_store/expander.rs` and `crates/hir-def/src/nameres/collector.rs` change together 58% of the time (7 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `9fb66968` Stop at eager macro recursion overflow; `ddbe6aca` Store the macro depth inside `MacroCallId`; `20f6d47a` Optimised the depth calculation to be cached instead of calculating O… — run `git show` on any of them.
Change coupling: lower.rs ↔ scope.rs crates/hir-def/src/expr_store/lower.rs— `crates/hir-def/src/expr_store/lower.rs` and `crates/hir-def/src/expr_store/scope.rs` change together 55% of the time (12 of the 22 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 12 shared commits counted here, the most recent 3 are `9d3d1f9e` fix: Don't support const blocks in patterns; `36ac7e21` merge `hir_def::hir::Expr::Unsafe` into `Expr::Block`; `88887b09` Fix handling of params of coroutine fns — run `git show` on any of them.
Change coupling: lower.rs ↔ tests.rs crates/hir-def/src/expr_store/lower.rs— `crates/hir-def/src/expr_store/lower.rs` and `crates/hir-def/src/expr_store/tests.rs` change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `9a5a11fb` fix: Fix `format_args` lowering using wrong integer suffix; `419231c7` Remove fixme and add a missing test attribute; `8956b1e1` Lower ast::Ident to hir::Path when lowering RangePats — run `git show` on any of them.
Change coupling: test_db.rs ↔ lib.rs crates/hir-def/src/test_db.rs— `crates/hir-def/src/test_db.rs` and `crates/ide-db/src/lib.rs` change together 50% of the time (8 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `89eaee22` internal: refer to salsa macros using `salsa::`; `57632bea` move `DefDatabase::expand_proc_attr_macros` out of the query group; `273abbb6` internal: Improve panic message when FileSourceRootInput is missing — run `git show` on any of them.
Change coupling: cast.rs ↔ unify.rs crates/hir-ty/src/infer/cast.rs— `crates/hir-ty/src/infer/cast.rs` and `crates/hir-ty/src/infer/unify.rs` change together 50% of the time (7 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `1286db8b` Remove methods that do not have a correspondence in rustc; `02d8caa3` fix: Sync cast checks to rustc again; `d5ea170a` fix: Remove some deep normalizations from infer — run `git show` on any of them.
Change coupling: diagnostics.rs ↔ expr.rs crates/hir-ty/src/infer/diagnostics.rs— `crates/hir-ty/src/infer/diagnostics.rs` and `crates/hir-ty/src/infer/expr.rs` change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `e7fd8809` Do not relower the signature again in inference, instead fetch it fro…; `dd7b4a47` internal: Pack `ExprOrPatId` when stored; `bc3e7e1d` perf: Shrink `InferenceResult` by ~40 bytes — run `git show` on any of them.
Change coupling: expander.rs ↔ assoc.rs crates/hir-def/src/expr_store/expander.rs— `crates/hir-def/src/expr_store/expander.rs` and `crates/hir-def/src/nameres/assoc.rs` change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `9fb66968` Stop at eager macro recursion overflow; `ddbe6aca` Store the macro depth inside `MacroCallId`; `b361c979` migrate `DefDatabase::macro_def` — run `git show` on any of them.
Change coupling: convert_bool_then.rs ↔ convert_to_guarded_return.rs crates/ide-assists/src/handlers/convert_bool_then.rs— `crates/ide-assists/src/handlers/convert_bool_then.rs` and `crates/ide-assists/src/handlers/convert_to_guarded_return.rs` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `1e885f5b` rename from new_typed to with_ast_node; `bf3643f4` start using typed syntaxEditor constructor; `71035466` update all assist with new constructor semantics — run `git show` on any of them.
Change coupling: discover.rs ↔ test_runner.rs crates/rust-analyzer/src/discover.rs— `crates/rust-analyzer/src/discover.rs` and `crates/rust-analyzer/src/test_runner.rs` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `3bbccf6f` fix: Only parse stdout in discover protocol; `ead5cd93` internal: Make stdout/stderr explicit in JsonLinesParser; `b28aeeb8` fix: Do not panic if rust-analyzer fails to spawn the discover command — run `git show` on any of them.
ide_db::syntax_helpers::format_string::lex_format_specifiers (cyclomatic 40) crates/ide-db/src/syntax_helpers/format_string.rs:45— ide_db::syntax_helpers::format_string::lex_format_specifiers has cyclomatic complexity 40 (threshold 15). Of this number, 35 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_db::syntax_helpers::format_string_exprs::parse_format_exprs (cyclomatic 29) crates/ide-db/src/syntax_helpers/format_string_exprs.rs:44— ide_db::syntax_helpers::format_string_exprs::parse_format_exprs has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_db::prime_caches::parallel_prime_caches (cyclomatic 27) crates/ide-db/src/prime_caches.rs:31— ide_db::prime_caches::parallel_prime_caches has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ide_db::imports::insert_use::guess_granularity_from_scope (cyclomatic 23) crates/ide-db/src/imports/insert_use.rs:340— ide_db::imports::insert_use::guess_granularity_from_scope has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_db::imports::insert_use::insert_use_with_alias_option_with_editor (cyclomatic 19) crates/ide-db/src/imports/insert_use.rs:214— ide_db::imports::insert_use::insert_use_with_alias_option_with_editor has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_db::traits::diff_assoc_items (cyclomatic 19) crates/ide-db/src/traits.rs:56— ide_db::traits::diff_assoc_items has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_db::imports::import_assets::filter_by_definition_kind (cyclomatic 19) crates/ide-db/src/imports/import_assets.rs:553— ide_db::imports::import_assets::filter_by_definition_kind has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_db::imports::import_assets::validate_resolvable (cyclomatic 19) crates/ide-db/src/imports/import_assets.rs:660— ide_db::imports::import_assets::validate_resolvable has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_db::syntax_helpers::node_ext::for_each_tail_expr (cyclomatic 19) crates/ide-db/src/syntax_helpers/node_ext.rs:283— ide_db::syntax_helpers::node_ext::for_each_tail_expr has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_db::imports::merge_imports::recursive_normalize (cyclomatic 17) crates/ide-db/src/imports/merge_imports.rs:292— ide_db::imports::merge_imports::recursive_normalize has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_db::imports::merge_imports::version_sort::version_sort (cyclomatic 17) crates/ide-db/src/imports/merge_imports.rs:978— ide_db::imports::merge_imports::version_sort::version_sort has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_db::syntax_helpers::tree_diff::diff (cyclomatic 17) crates/ide-db/src/syntax_helpers/tree_diff.rs:51— ide_db::syntax_helpers::tree_diff::diff has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (go, syntax_element_eq). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ide_db::imports::merge_imports::use_tree_cmp (cyclomatic 16) crates/ide-db/src/imports/merge_imports.rs:521— ide_db::imports::merge_imports::use_tree_cmp has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
parser::grammar::expressions::atom::parse_asm_expr (cognitive 39) crates/parser/src/grammar/expressions/atom.rs:349— parser::grammar::expressions::atom::parse_asm_expr has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (34 pts), boolean chains 4, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser::grammar::expressions::atom::builtin_expr (cognitive 34) crates/parser/src/grammar/expressions/atom.rs:256— parser::grammar::expressions::atom::builtin_expr has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser::grammar::items::opt_item (cognitive 31) crates/parser/src/grammar/items.rs:109— parser::grammar::items::opt_item has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 13, match/switch 3 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
parser::grammar::expressions::expr_bp (cognitive 24) crates/parser/src/grammar/expressions.rs:243— parser::grammar::expressions::expr_bp has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 5, match/switch 2 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser::grammar::params::param (cognitive 23) crates/parser/src/grammar/params.rs:95— parser::grammar::params::param has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 3, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
parser::grammar::paths::path_segment (cognitive 23) crates/parser/src/grammar/paths.rs:87— parser::grammar::paths::path_segment has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser::grammar::expressions::lhs (cognitive 21) crates/parser/src/grammar/expressions.rs:334— parser::grammar::expressions::lhs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, loops 1 (2 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
parser::grammar::params::list_ (cognitive 20) crates/parser/src/grammar/params.rs:32— parser::grammar::params::list_ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (5 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser::grammar::items::adt::record_field_list (cognitive 18) crates/parser/src/grammar/items/adt.rs:116— parser::grammar::items::adt::record_field_list has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, loops 1 (nesting depth added 5). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to one function item inside it that branches (record_field). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
parser::grammar::expressions::record_expr_field_list (cognitive 17) crates/parser/src/grammar/expressions.rs:703— parser::grammar::expressions::record_expr_field_list has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser::event::process (cognitive 17) crates/parser/src/event.rs:89— parser::event::process has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (7 pts), match/switch 2 (6 pts), if/else 1 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser::grammar::expressions::stmt (cognitive 16) crates/parser/src/grammar/expressions.rs:43— parser::grammar::expressions::stmt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 5, match/switch 2 (3 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser::grammar::patterns::pattern_single_r (cognitive 16) crates/parser/src/grammar/patterns.rs:66— parser::grammar::patterns::pattern_single_r has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Duplicated block (12 lines × 2) crates/hir-def/src/expr_store.rs:374— crates/hir-def/src/expr_store.rs:374-385 | crates/hir-def/src/item_scope.rs:842-853 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12 lines × 2) crates/hir-def/src/lang_item.rs:158— crates/hir-def/src/lang_item.rs:158-169 | crates/hir-def/src/lang_item.rs:183-194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) crates/hir-ty/src/display.rs:1067— crates/hir-ty/src/display.rs:1067-1078 | crates/hir-ty/src/display.rs:1213-1224 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) crates/hir-ty/src/display.rs:1793— crates/hir-ty/src/display.rs:1793-1804 | crates/hir-ty/src/display.rs:1817-1828 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) crates/hir-ty/src/display.rs:2070— crates/hir-ty/src/display.rs:2070-2081 | crates/hir-ty/src/display.rs:2115-2126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) crates/hir-ty/src/infer.rs:2407— crates/hir-ty/src/infer.rs:2407-2418 | crates/hir-ty/src/infer.rs:2469-2480 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) crates/hir-ty/src/lib.rs:267— crates/hir-ty/src/lib.rs:267-278 | crates/hir-ty/src/lib.rs:301-312 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) crates/hir-ty/src/next_solver/ty.rs:1007— crates/hir-ty/src/next_solver/ty.rs:1007-1018 | crates/hir-ty/src/next_solver/ty.rs:1054-1065 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs:291— crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs:291-302 | crates/ide-assists/src/handlers/unwrap_return_type.rs:217-228 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12 lines × 2) crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:196— crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:196-207 | crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:239-250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) crates/ide-db/src/search.rs:329— crates/ide-db/src/search.rs:329-340 | crates/ide-db/src/search.rs:360-371 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) crates/ide-db/src/syntax_helpers/format_string.rs:121— crates/ide-db/src/syntax_helpers/format_string.rs:121-132 | crates/ide-db/src/syntax_helpers/format_string.rs:178-189 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) crates/rust-analyzer/src/lsp/to_proto.rs:1424— crates/rust-analyzer/src/lsp/to_proto.rs:1424-1435 | crates/rust-analyzer/src/lsp/to_proto.rs:1438-1449 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
InferenceContext::infer_expr_inner (cyclomatic 84) crates/hir-ty/src/infer/expr.rs:317— InferenceContext::infer_expr_inner has cyclomatic complexity 84 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
InferenceContext::resolve_variant (cyclomatic 48) crates/hir-ty/src/infer.rs:2225— InferenceContext::resolve_variant has cyclomatic complexity 48 (threshold 15). Of this number, 47 points are the body's own statements and 1 belongs to one function item inside it that branches. This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
InferenceContext::infer_mut_expr_without_adjust (cyclomatic 40) crates/hir-ty/src/infer/mutability.rs:55— InferenceContext::infer_mut_expr_without_adjust has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
InferenceContext::infer_pat_inner (cyclomatic 32) crates/hir-ty/src/infer/pat.rs:377— InferenceContext::infer_pat_inner has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
InferenceContext::try_find_coercion_lub (cyclomatic 29) crates/hir-ty/src/infer/coerce.rs:926— InferenceContext::try_find_coercion_lub has cyclomatic complexity 29 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
InferenceContext::analyze_closure (cyclomatic 26) crates/hir-ty/src/infer/closure/analysis.rs:229— InferenceContext::analyze_closure has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InferenceContext::check_record_expr_fields (cyclomatic 24) crates/hir-ty/src/infer/expr.rs:968— InferenceContext::check_record_expr_fields has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InferenceContext::check_call_arguments (cyclomatic 23) crates/hir-ty/src/infer/expr.rs:1921— InferenceContext::check_call_arguments has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InferenceContext::infer_ref_pat (cyclomatic 20) crates/hir-ty/src/infer/pat.rs:1356— InferenceContext::infer_ref_pat has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InferenceContext::compute_min_captures (cyclomatic 17) crates/hir-ty/src/infer/closure/analysis.rs:724— InferenceContext::compute_min_captures has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
InferenceContext::deduce_closure_signature_from_predicates (cyclomatic 17) crates/hir-ty/src/infer/closure.rs:418— InferenceContext::deduce_closure_signature_from_predicates has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InferenceContext::resolve_all (cyclomatic 17) crates/hir-ty/src/infer.rs:1618— InferenceContext::resolve_all has cyclomatic complexity 17 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
Evaluator::exec_intrinsic (cognitive 215) crates/hir-ty/src/mir/eval/shim.rs:561— Evaluator::exec_intrinsic has cognitive complexity 215 (threshold 15). Drivers by points: if/else 86 (177 pts), match/switch 15 (29 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 108). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Evaluator::eval_rvalue (cognitive 146) crates/hir-ty/src/mir/eval.rs:1177— Evaluator::eval_rvalue has cognitive complexity 146 (threshold 15). Drivers by points: match/switch 25 (68 pts), if/else 24 (66 pts), loops 4 (12 pts) (nesting depth added 93). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Evaluator::exec_simd_intrinsic (cognitive 45) crates/hir-ty/src/mir/eval/shim/simd.rs:51— Evaluator::exec_simd_intrinsic has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (24 pts), match/switch 5 (11 pts), loops 4 (9 pts), boolean chains 1 (nesting depth added 25). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Evaluator::interpret_mir (cognitive 44) crates/hir-ty/src/mir/eval.rs:944— Evaluator::interpret_mir has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 5 (15 pts), loops 4 (9 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Evaluator::place_addr_and_ty_and_metadata (cognitive 39) crates/hir-ty/src/mir/eval.rs:786— Evaluator::place_addr_and_ty_and_metadata has cognitive complexity 39 (threshold 15). Drivers by points: match/switch 8 (27 pts), if/else 5 (11 pts), loops 1 (nesting depth added 25). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Evaluator::create_memory_map::rec (cognitive 35) crates/hir-ty/src/mir/eval.rs:2371— Evaluator::create_memory_map::rec has cognitive complexity 35 (threshold 15). Drivers by points: loops 5 (15 pts), match/switch 6 (13 pts), if/else 3 (7 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Evaluator::exec_extern_c (cognitive 33) crates/hir-ty/src/mir/eval/shim.rs:397— Evaluator::exec_extern_c has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 4 (7 pts), loops 1 (2 pts) (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Evaluator::patch_addresses (cognitive 32) crates/hir-ty/src/mir/eval.rs:2544— Evaluator::patch_addresses has cognitive complexity 32 (threshold 15). Drivers by points: loops 5 (15 pts), match/switch 6 (11 pts), if/else 2 (6 pts) (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Evaluator::exec_atomic_intrinsic (cognitive 20) crates/hir-ty/src/mir/eval/shim.rs:1524— Evaluator::exec_atomic_intrinsic has cognitive complexity 20 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Evaluator::run_drop_glue_deep (cognitive 18) crates/hir-ty/src/mir/eval.rs:3101— Evaluator::run_drop_glue_deep has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), match/switch 3 (6 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Evaluator::unsizing_ptr_from_addr (cognitive 17) crates/hir-ty/src/mir/eval.rs:1767— Evaluator::unsizing_ptr_from_addr has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 5 (11 pts), if/else 2 (6 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
rust_analyzer::config::patch_old_style::patch_json_for_outdated_configs (cyclomatic 95) crates/rust-analyzer/src/config/patch_old_style.rs:10— rust_analyzer::config::patch_old_style::patch_json_for_outdated_configs has cyclomatic complexity 95 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
rust_analyzer::lsp::to_proto::semantic_token_type_and_modifiers (cyclomatic 82) crates/rust-analyzer/src/lsp/to_proto.rs:817— rust_analyzer::lsp::to_proto::semantic_token_type_and_modifiers has cyclomatic complexity 82 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
rust_analyzer::handlers::notification::run_flycheck (cyclomatic 28) crates/rust-analyzer/src/handlers/notification.rs:329— rust_analyzer::handlers::notification::run_flycheck has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rust_analyzer::lsp::to_proto::completion_item (cyclomatic 25) crates/rust-analyzer/src/lsp/to_proto.rs:290— rust_analyzer::lsp::to_proto::completion_item has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: rust_analyzer::lsp::to_proto::completion_item_kind (cyclomatic 37) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
rust_analyzer::diagnostics::flycheck_to_proto::map_rust_diagnostic_to_lsp (cyclomatic 24) crates/rust-analyzer/src/diagnostics/flycheck_to_proto.rs:281— rust_analyzer::diagnostics::flycheck_to_proto::map_rust_diagnostic_to_lsp has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rust_analyzer::handlers::request::handle_runnables (cyclomatic 21) crates/rust-analyzer/src/handlers/request.rs:1016— rust_analyzer::handlers::request::handle_runnables has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rust_analyzer::handlers::request::run_rustfmt (cyclomatic 21) crates/rust-analyzer/src/handlers/request.rs:2405— rust_analyzer::handlers::request::run_rustfmt has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rust_analyzer::lsp::to_proto::code_lens (cyclomatic 17) crates/rust-analyzer/src/lsp/to_proto.rs:1758— rust_analyzer::lsp::to_proto::code_lens has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rust_analyzer::lsp::to_proto::completion_item_kind (cyclomatic 37) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
rust_analyzer::lsp::completion_item_hash (cyclomatic 17) crates/rust-analyzer/src/lsp.rs:37— rust_analyzer::lsp::completion_item_hash has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function item inside it that branches (hash_completion_relevance). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
rust_analyzer::session::run_session (cyclomatic 16) crates/rust-analyzer/src/session.rs:37— rust_analyzer::session::run_session has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Duplicated block (14 lines × 2) crates/hir-expand/src/lib.rs:1211— crates/hir-expand/src/lib.rs:1211-1224 | crates/hir-expand/src/lib.rs:1252-1265 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) crates/hir-ty/src/display.rs:1536— crates/hir-ty/src/display.rs:1536-1549 | crates/hir-ty/src/display.rs:1595-1608 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) crates/hir-ty/src/display.rs:1868— crates/hir-ty/src/display.rs:1868-1881 | crates/hir-ty/src/display.rs:1920-1933 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) crates/hir-ty/src/mir/lower.rs:1287— crates/hir-ty/src/mir/lower.rs:1287-1300 | crates/hir-ty/src/mir/lower.rs:1317-1330 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) crates/ide/src/inlay_hints/lifetime.rs:118— crates/ide/src/inlay_hints/lifetime.rs:118-131 | crates/ide/src/inlay_hints/lifetime.rs:175-188 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) crates/ide-assists/src/handlers/generate_function.rs:585— crates/ide-assists/src/handlers/generate_function.rs:585-598 | crates/ide-assists/src/handlers/generate_function.rs:644-657 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) crates/ide-completion/src/context/analysis.rs:2074— crates/ide-completion/src/context/analysis.rs:2074-2087 | crates/syntax/src/algo.rs:137-150 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (14 lines × 2) crates/ide-completion/src/render/const_.rs:30— crates/ide-completion/src/render/const_.rs:30-43 | crates/ide-completion/src/render/type_alias.rs:52-65 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (14 lines × 2) crates/ide-db/src/imports/import_assets.rs:894— crates/ide-db/src/imports/import_assets.rs:894-907 | crates/ide-db/src/imports/import_assets.rs:919-932 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:1011— crates/rust-analyzer/src/cli/analysis_stats.rs:1011-1024 | crates/rust-analyzer/src/cli/analysis_stats.rs:1115-1128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Evaluator::exec_intrinsic (cyclomatic 198) crates/hir-ty/src/mir/eval/shim.rs:561— Evaluator::exec_intrinsic has cyclomatic complexity 198 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Evaluator::eval_rvalue (cyclomatic 100) crates/hir-ty/src/mir/eval.rs:1177— Evaluator::eval_rvalue has cyclomatic complexity 100 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Evaluator::exec_extern_c (cyclomatic 27) crates/hir-ty/src/mir/eval/shim.rs:397— Evaluator::exec_extern_c has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Evaluator::exec_simd_intrinsic (cyclomatic 26) crates/hir-ty/src/mir/eval/shim/simd.rs:51— Evaluator::exec_simd_intrinsic has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Evaluator::interpret_mir (cyclomatic 24) crates/hir-ty/src/mir/eval.rs:944— Evaluator::interpret_mir has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Evaluator::create_memory_map::rec (cyclomatic 22) crates/hir-ty/src/mir/eval.rs:2371— Evaluator::create_memory_map::rec has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Evaluator::exec_atomic_intrinsic (cyclomatic 19) crates/hir-ty/src/mir/eval/shim.rs:1524— Evaluator::exec_atomic_intrinsic has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Evaluator::patch_addresses (cyclomatic 19) crates/hir-ty/src/mir/eval.rs:2544— Evaluator::patch_addresses has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Evaluator::place_addr_and_ty_and_metadata (cyclomatic 18) crates/hir-ty/src/mir/eval.rs:786— Evaluator::place_addr_and_ty_and_metadata has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mbe::expander::matcher::match_loop_inner (cognitive 133) crates/mbe/src/expander/matcher.rs:366— mbe::expander::matcher::match_loop_inner has cognitive complexity 133 (threshold 15). Drivers by points: if/else 44 (115 pts), match/switch 4 (11 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 79). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
mbe::expander::transcriber::expand_subtree (cognitive 64) crates/mbe/src/expander/transcriber.rs:167— mbe::expander::transcriber::expand_subtree has cognitive complexity 64 (threshold 15). Drivers by points: if/else 8 (29 pts), match/switch 7 (28 pts), loops 3 (7 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mbe::expander::matcher::match_loop (cognitive 53) crates/mbe/src/expander/matcher.rs:624— mbe::expander::matcher::match_loop has cognitive complexity 53 (threshold 15). Drivers by points: if/else 16 (37 pts), match/switch 2 (8 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mbe::parser::parse_metavar_expr (cognitive 22) crates/mbe/src/parser.rs:391— mbe::parser::parse_metavar_expr has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mbe::parser::parse_repeat (cognitive 21) crates/mbe/src/parser.rs:345— mbe::parser::parse_repeat has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 7 (20 pts), loops 1 (nesting depth added 13). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
mbe::expander::transcriber::expand_repeat (cognitive 21) crates/mbe/src/expander/transcriber.rs:463— mbe::expander::transcriber::expand_repeat has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (5 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mbe::parser::next_op (cognitive 19) crates/mbe/src/parser.rs:188— mbe::parser::next_op has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 7 (19 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
mbe::expander::matcher::match_meta_var (cognitive 16) crates/mbe/src/expander/matcher.rs:775— mbe::expander::matcher::match_meta_var has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), match/switch 4 (7 pts), boolean chains 2 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
mbe::expander::expand_rules (cognitive 16) crates/mbe/src/expander.rs:17— mbe::expander::expand_rules has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprCollector::maybe_collect_expr (cognitive 117) crates/hir-def/src/expr_store/lower.rs:1417— ExprCollector::maybe_collect_expr has cognitive complexity 117 (threshold 15). Drivers by points: if/else 50 (91 pts), match/switch 9 (19 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprCollector::lower_inline_asm (cognitive 100) crates/hir-def/src/expr_store/lower/asm.rs:17— ExprCollector::lower_inline_asm has cognitive complexity 100 (threshold 15). Drivers by points: if/else 27 (65 pts), match/switch 10 (28 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 58). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprCollector::collect_format_args_impl (cognitive 71) crates/hir-def/src/expr_store/lower/format_args.rs:110— ExprCollector::collect_format_args_impl has cognitive complexity 71 (threshold 15). Drivers by points: if/else 23 (56 pts), match/switch 3 (8 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprCollector::collect_pat (cognitive 40) crates/hir-def/src/expr_store/lower.rs:2912— ExprCollector::collect_pat has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 4 (10 pts), match/switch 4 (8 pts), boolean chains 1 (nesting depth added 21). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ExprCollector::maybe_collect_expr_as_pat (cognitive 36) crates/hir-def/src/expr_store/lower.rs:2080— ExprCollector::maybe_collect_expr_as_pat has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 7 (11 pts), boolean chains 1 (nesting depth added 16). Of this number, 23 points are the body's own statements and 13 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprCollector::collect_range_expr (cognitive 20) crates/hir-def/src/expr_store/lower.rs:1936— ExprCollector::collect_range_expr has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprCollector::lower_generic_args (cognitive 19) crates/hir-def/src/expr_store/lower.rs:1023— ExprCollector::lower_generic_args has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprCollector::lower_coroutine_body_with_moved_arguments (cognitive 18) crates/hir-def/src/expr_store/lower.rs:1097— ExprCollector::lower_coroutine_body_with_moved_arguments has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprCollector::collect_stmt (cognitive 17) crates/hir-def/src/expr_store/lower.rs:2719— ExprCollector::collect_stmt has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_def::attrs::match_attr_flags (cyclomatic 71) crates/hir-def/src/attrs.rs:131— hir_def::attrs::match_attr_flags has cyclomatic complexity 71 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_def::hir::format_args::parse (cyclomatic 42) crates/hir-def/src/hir/format_args.rs:172— hir_def::hir::format_args::parse has cyclomatic complexity 42 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_def::expr_store::lower::path::lower_path (cyclomatic 38) crates/hir-def/src/expr_store/lower/path.rs:41— hir_def::expr_store::lower::path::lower_path has cyclomatic complexity 38 (threshold 15). Of this number, 37 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_def::attrs::parse_repr_tt (cyclomatic 27) crates/hir-def/src/attrs.rs:1272— hir_def::attrs::parse_repr_tt has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_def::expr_store::lower::lower_body (cyclomatic 22) crates/hir-def/src/expr_store/lower.rs:70— hir_def::expr_store::lower::lower_body has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_def::lang_item::crate_lang_items (cyclomatic 20) crates/hir-def/src/lang_item.rs:38— hir_def::lang_item::crate_lang_items has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_def::find_path::find_path_for_module (cyclomatic 17) crates/hir-def/src/find_path.rs:177— hir_def::find_path::find_path_for_module has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_def::find_path::find_local_import_locations (cyclomatic 16) crates/hir-def/src/find_path.rs:577— hir_def::find_path::find_local_import_locations has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GlobalState::handle_event (cognitive 109) crates/rust-analyzer/src/main_loop.rs:315— GlobalState::handle_event has cognitive complexity 109 (threshold 15). Drivers by points: if/else 31 (60 pts), boolean chains 19, loops 8 (16 pts), match/switch 6 (14 pts) (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GlobalState::switch_workspaces (cognitive 62) crates/rust-analyzer/src/reload.rs:467— GlobalState::switch_workspaces has cognitive complexity 62 (threshold 15). Drivers by points: if/else 20 (41 pts), match/switch 5 (10 pts), loops 2 (6 pts), boolean chains 5 (nesting depth added 30). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
GlobalState::process_changes (cognitive 57) crates/rust-analyzer/src/global_state.rs:340— GlobalState::process_changes has cognitive complexity 57 (threshold 15). Drivers by points: if/else 22 (45 pts), match/switch 2 (7 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
GlobalState::handle_task (cognitive 40) crates/rust-analyzer/src/main_loop.rs:850— GlobalState::handle_task has cognitive complexity 40 (threshold 15). Drivers by points: match/switch 9 (21 pts), if/else 7 (19 pts) (nesting depth added 24). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
GlobalState::current_status (cognitive 37) crates/rust-analyzer/src/reload.rs:128— GlobalState::current_status has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (30 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GlobalState::compute_priming_scope (cognitive 30) crates/rust-analyzer/src/global_state.rs:758— GlobalState::compute_priming_scope has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (19 pts), loops 4 (9 pts), match/switch 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GlobalState::handle_vfs_msg (cognitive 21) crates/rust-analyzer/src/main_loop.rs:980— GlobalState::handle_vfs_msg has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 3 (5 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
GlobalState::handle_deferred_task (cognitive 17) crates/rust-analyzer/src/main_loop.rs:1085— GlobalState::handle_deferred_task has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 2 (3 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_expand::cfg_process::macro_input_callback (cognitive 86) crates/hir-expand/src/cfg_process.rs:47— hir_expand::cfg_process::macro_input_callback has cognitive complexity 86 (threshold 15). Drivers by points: if/else 23 (61 pts), match/switch 4 (11 pts), loops 3 (10 pts), boolean chains 4 (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_expand::fixup::fixup_syntax (cognitive 74) crates/hir-expand/src/fixup.rs:52— hir_expand::fixup::fixup_syntax has cognitive complexity 74 (threshold 15). Drivers by points: if/else 18 (50 pts), match/switch 5 (17 pts), boolean chains 6, loops 1 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_expand::builtin::derive_macro::coerce_pointee_expand (cognitive 64) crates/hir-expand/src/builtin/derive_macro.rs:1128— hir_expand::builtin::derive_macro::coerce_pointee_expand has cognitive complexity 64 (threshold 15). Drivers by points: if/else 31 (46 pts), match/switch 8 (10 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 18). Of this number, 46 points are the body's own statements and 18 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_expand::attrs::expand_cfg_attr_with_doc_comments (cognitive 32) crates/hir-expand/src/attrs.rs:111— hir_expand::attrs::expand_cfg_attr_with_doc_comments has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_expand::eager::eager_macro_recur (cognitive 27) crates/hir-expand/src/eager.rs:151— hir_expand::eager::eager_macro_recur has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 7 (17 pts), if/else 4 (9 pts), loops 1 (nesting depth added 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_expand::builtin::fn_macro::concat_expand (cognitive 24) crates/hir-expand/src/builtin/fn_macro.rs:544— hir_expand::builtin::fn_macro::concat_expand has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 2 (6 pts), boolean chains 5, loops 1 (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_expand::builtin::fn_macro::cfg_select_expand (cognitive 20) crates/hir-expand/src/builtin/fn_macro.rs:342— hir_expand::builtin::fn_macro::cfg_select_expand has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (5 pts), boolean chains 4, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_expand::mod_path::convert_path (cognitive 18) crates/hir-expand/src/mod_path.rs:259— hir_expand::mod_path::convert_path has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (8 pts), if/else 4 (6 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Off the main sequence: edition — edition: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
Off the main sequence: paths — paths: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 8 project(s), so it's rigid to change.
Off the main sequence: profile — profile: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Off the main sequence: stdx — stdx: abstractness 0.19, instability 0.00, distance 0.81 — zone of pain — concrete and depended on by 22 project(s), so it's rigid to change.
Off the main sequence: span — span: abstractness 0.05, instability 0.17, distance 0.79 — zone of pain — concrete and depended on by 15 project(s), so it's rigid to change.
Off the main sequence: cfg — cfg: abstractness 0.00, instability 0.27, distance 0.73 — zone of pain — concrete and depended on by 8 project(s), so it's rigid to change.
Off the main sequence: parser — parser: abstractness 0.13, instability 0.14, distance 0.73 — zone of pain — concrete and depended on by 6 project(s), so it's rigid to change.
Off the main sequence: tt — tt: abstractness 0.05, instability 0.25, distance 0.70 — zone of pain — concrete and depended on by 9 project(s), so it's rigid to change.
hir::display::write_function (cognitive 31) crates/hir/src/display.rs:159— hir::display::write_function has cognitive complexity 31 (threshold 15). Drivers by points: if/else 20 (22 pts), match/switch 3 (7 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
hir::source_analyzer::resolve_hir_path_ (cognitive 29) crates/hir/src/source_analyzer.rs:1872— hir::source_analyzer::resolve_hir_path_ has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (20 pts), match/switch 4 (5 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir::display::write_generic_params_or_args (cognitive 25) crates/hir/src/display.rs:702— hir::display::write_generic_params_or_args has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 3, match/switch 1 (3 pts), loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir::display::write_variants (cognitive 24) crates/hir/src/display.rs:489— hir::display::write_variants has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 1 (3 pts), loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir::term_search::tactics::data_constructor (cognitive 23) crates/hir/src/term_search/tactics.rs:126— hir::term_search::tactics::data_constructor has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 2, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir::display::write_fields (cognitive 19) crates/hir/src/display.rs:454— hir::display::write_fields has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir::term_search::tactics::free_function (cognitive 18) crates/hir/src/term_search/tactics.rs:270— hir::term_search::tactics::free_function has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Duplicated block (15 lines × 2) crates/ide/src/doc_links.rs:601— crates/ide/src/doc_links.rs:601-615 | crates/ide/src/doc_links.rs:617-631 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/ide/src/syntax_highlighting/escape.rs:47— crates/ide/src/syntax_highlighting/escape.rs:47-61 | crates/ide/src/syntax_highlighting/escape.rs:76-90 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/ide-assists/src/utils/gen_trait_fn_body.rs:444— crates/ide-assists/src/utils/gen_trait_fn_body.rs:444-458 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:637-651 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/ide-completion/src/context/analysis.rs:214— crates/ide-completion/src/context/analysis.rs:214-228 | crates/ide-completion/src/context/analysis.rs:335-349 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:958— crates/rust-analyzer/src/cli/analysis_stats.rs:958-972 | crates/rust-analyzer/src/cli/analysis_stats.rs:1063-1077 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/span/src/map.rs:169— crates/span/src/map.rs:169-183 | crates/syntax/src/lib.rs:225-239 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (15 lines × 2) xtask/src/codegen/lints.rs:294— xtask/src/codegen/lints.rs:294-308 | xtask/src/codegen/lints.rs:310-324 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
ExprCollector::maybe_collect_expr (cyclomatic 89) crates/hir-def/src/expr_store/lower.rs:1417— ExprCollector::maybe_collect_expr has cyclomatic complexity 89 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ExprCollector::lower_inline_asm (cyclomatic 49) crates/hir-def/src/expr_store/lower/asm.rs:17— ExprCollector::lower_inline_asm has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ExprCollector::collect_pat (cyclomatic 40) crates/hir-def/src/expr_store/lower.rs:2912— ExprCollector::collect_pat has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ExprCollector::maybe_collect_expr_as_pat (cyclomatic 29) crates/hir-def/src/expr_store/lower.rs:2080— ExprCollector::maybe_collect_expr_as_pat has cyclomatic complexity 29 (threshold 15). Of this number, 20 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ExprCollector::collect_format_args_impl (cyclomatic 27) crates/hir-def/src/expr_store/lower/format_args.rs:110— ExprCollector::collect_format_args_impl has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ExprCollector::lower_type_ref (cyclomatic 20) crates/hir-def/src/expr_store/lower.rs:746— ExprCollector::lower_type_ref has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
DefCollector::resolve_macros (cognitive 75) crates/hir-def/src/nameres/collector.rs:1306— DefCollector::resolve_macros has cognitive complexity 75 (threshold 15). Drivers by points: if/else 18 (56 pts), match/switch 6 (11 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 46). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DefCollector::record_resolved_import (cognitive 53) crates/hir-def/src/nameres/collector.rs:882— DefCollector::record_resolved_import has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (36 pts), match/switch 6 (16 pts), boolean chains 1 (nesting depth added 31). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
DefCollector::seed_with_top_level (cognitive 31) crates/hir-def/src/nameres/collector.rs:277— DefCollector::seed_with_top_level has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 4 (9 pts), boolean chains 3, loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefCollector::push_res_and_update_glob_vis (cognitive 31) crates/hir-def/src/nameres/collector.rs:1202— DefCollector::push_res_and_update_glob_vis has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 9 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefCollector::update_recursive (cognitive 20) crates/hir-def/src/nameres/collector.rs:1111— DefCollector::update_recursive has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (8 pts), loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefCollector::resolution_loop (cognitive 18) crates/hir-def/src/nameres/collector.rs:420— DefCollector::resolution_loop has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Duplicated block (13 lines × 2) crates/hir/src/term_search.rs:120— crates/hir/src/term_search.rs:120-132 | crates/hir/src/term_search.rs:158-170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/hir-ty/src/infer/cast.rs:346— crates/hir-ty/src/infer/cast.rs:346-358 | crates/hir-ty/src/infer/cast.rs:359-371 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/hir-ty/src/next_solver/normalize.rs:252— crates/hir-ty/src/next_solver/normalize.rs:252-264 | crates/hir-ty/src/next_solver/normalize.rs:267-279 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/hir-ty/src/traits.rs:253— crates/hir-ty/src/traits.rs:253-265 | crates/hir-ty/src/traits.rs:276-288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/ide-completion/src/context/analysis.rs:238— crates/ide-completion/src/context/analysis.rs:238-250 | crates/ide-completion/src/context/analysis.rs:359-371 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/syntax/src/ast/syntax_factory/constructors.rs:374— crates/syntax/src/ast/syntax_factory/constructors.rs:374-386 | crates/syntax/src/ast/syntax_factory/constructors.rs:2177-2189 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 3) crates/hir-ty/src/next_solver/util.rs:561— crates/hir-ty/src/next_solver/util.rs:561-568 | crates/hir-ty/src/next_solver/util.rs:589-596 | crates/hir-ty/src/next_solver/util.rs:620-627 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/ide-db/src/search.rs:1247— crates/ide-db/src/search.rs:1247-1254 | crates/ide-db/src/search.rs:1263-1270 | crates/ide-db/src/search.rs:1275-1282 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/syntax/src/ast/syntax_factory/constructors.rs:166— crates/syntax/src/ast/syntax_factory/constructors.rs:166-173 | crates/syntax/src/ast/syntax_factory/constructors.rs:1483-1490 | crates/syntax/src/ast/syntax_factory/constructors.rs:1867-1874 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/syntax/src/ast/syntax_factory/constructors.rs:185— crates/syntax/src/ast/syntax_factory/constructors.rs:185-193 | crates/syntax/src/ast/syntax_factory/constructors.rs:653-660 | crates/syntax/src/ast/syntax_factory/constructors.rs:1776-1785 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/syntax/src/ast/syntax_factory/constructors.rs:969— crates/syntax/src/ast/syntax_factory/constructors.rs:969-976 | crates/syntax/src/ast/syntax_factory/constructors.rs:1465-1473 | crates/syntax/src/ast/syntax_factory/constructors.rs:2348-2355 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/hir/src/lib.rs:2788— crates/hir/src/lib.rs:2788-2795 | crates/hir/src/lib.rs:2809-2816 | crates/ide-db/src/defs.rs:929-936 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (7 lines × 3) crates/hir/src/lib.rs:5716— crates/hir/src/lib.rs:5716-5722 | crates/hir/src/lib.rs:5731-5737 | crates/hir/src/lib.rs:5742-5748 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/hir-def/src/item_scope.rs:391— crates/hir-def/src/item_scope.rs:391-397 | crates/hir-def/src/item_scope.rs:402-408 | crates/hir-def/src/item_scope.rs:413-419 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/hir-ty/src/db.rs:385— crates/hir-ty/src/db.rs:385-391 | crates/hir-ty/src/db.rs:414-420 | crates/hir-ty/src/db.rs:444-450 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/ide/src/hover/render.rs:120— crates/ide/src/hover/render.rs:120-127 | crates/ide/src/hover/render.rs:166-172 | crates/ide/src/hover/render.rs:983-989 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/ide/src/hover/render.rs:166— crates/ide/src/hover/render.rs:166-172 | crates/ide/src/hover/render.rs:280-286 | crates/ide/src/hover/render.rs:983-989 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/rust-analyzer/src/handlers/dispatch.rs:54— crates/rust-analyzer/src/handlers/dispatch.rs:54-60 | crates/rust-analyzer/src/handlers/dispatch.rs:82-88 | crates/rust-analyzer/src/handlers/dispatch.rs:247-253 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Printer::print_expr_in (cyclomatic 79) crates/hir-def/src/expr_store/pretty.rs:531— Printer::print_expr_in has cyclomatic complexity 79 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Printer::print_pat (cyclomatic 40) crates/hir-def/src/expr_store/pretty.rs:896— Printer::print_pat has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Printer::print_path (cyclomatic 27) crates/hir-def/src/expr_store/pretty.rs:1111— Printer::print_path has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Printer::print_type_ref (cyclomatic 26) crates/hir-def/src/expr_store/pretty.rs:1259— Printer::print_type_ref has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Printer::print_mod_item (cyclomatic 21) crates/hir-def/src/item_tree/pretty.rs:155— Printer::print_mod_item has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
GlobalState::handle_event (cyclomatic 74) crates/rust-analyzer/src/main_loop.rs:315— GlobalState::handle_event has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GlobalState::handle_task (cyclomatic 30) crates/rust-analyzer/src/main_loop.rs:850— GlobalState::handle_task has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
GlobalState::switch_workspaces (cyclomatic 29) crates/rust-analyzer/src/reload.rs:467— GlobalState::switch_workspaces has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GlobalState::process_changes (cyclomatic 25) crates/rust-analyzer/src/global_state.rs:340— GlobalState::process_changes has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GlobalState::current_status (cyclomatic 22) crates/rust-analyzer/src/reload.rs:128— GlobalState::current_status has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_expand::builtin::derive_macro::coerce_pointee_expand (cyclomatic 57) crates/hir-expand/src/builtin/derive_macro.rs:1128— hir_expand::builtin::derive_macro::coerce_pointee_expand has cyclomatic complexity 57 (threshold 15). Of this number, 33 points are the body's own statements and 24 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_expand::fixup::fixup_syntax (cyclomatic 41) crates/hir-expand/src/fixup.rs:52— hir_expand::fixup::fixup_syntax has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_expand::cfg_process::macro_input_callback (cyclomatic 35) crates/hir-expand/src/cfg_process.rs:47— hir_expand::cfg_process::macro_input_callback has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_expand::builtin::fn_macro::concat_expand (cyclomatic 21) crates/hir-expand/src/builtin/fn_macro.rs:544— hir_expand::builtin::fn_macro::concat_expand has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: BuiltinFnLikeExpander::find_by_name (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
hir_expand::mod_path::convert_path (cyclomatic 19) crates/hir-expand/src/mod_path.rs:259— hir_expand::mod_path::convert_path has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mbe::expander::matcher::match_loop_inner (cyclomatic 45) crates/mbe/src/expander/matcher.rs:366— mbe::expander::matcher::match_loop_inner has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mbe::expander::transcriber::expand_subtree (cyclomatic 30) crates/mbe/src/expander/transcriber.rs:167— mbe::expander::transcriber::expand_subtree has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mbe::expander::matcher::match_loop (cyclomatic 22) crates/mbe/src/expander/matcher.rs:624— mbe::expander::matcher::match_loop has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mbe::expander::matcher::match_meta_var (cyclomatic 21) crates/mbe/src/expander/matcher.rs:775— mbe::expander::matcher::match_meta_var has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mbe::parser::eat_fragment_kind (cyclomatic 19) crates/mbe/src/parser.rs:296— mbe::parser::eat_fragment_kind has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
parser::grammar::items::opt_item (cyclomatic 38) crates/parser/src/grammar/items.rs:109— parser::grammar::items::opt_item has cyclomatic complexity 38 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
parser::grammar::expressions::atom::atom_expr (cyclomatic 37) crates/parser/src/grammar/expressions/atom.rs:73— parser::grammar::expressions::atom::atom_expr has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
parser::grammar::expressions::atom::parse_asm_expr (cyclomatic 22) crates/parser/src/grammar/expressions/atom.rs:349— parser::grammar::expressions::atom::parse_asm_expr has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
parser::grammar::expressions::atom::builtin_expr (cyclomatic 18) crates/parser/src/grammar/expressions/atom.rs:256— parser::grammar::expressions::atom::builtin_expr has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
parser::grammar::expressions::expr_bp (cyclomatic 16) crates/parser/src/grammar/expressions.rs:243— parser::grammar::expressions::expr_bp has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: parser::grammar::expressions::current_op (cyclomatic 33) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
MirLowerCtx::lower_expr_to_place_without_adjust (cognitive 208) crates/hir-ty/src/mir/lower.rs:469— MirLowerCtx::lower_expr_to_place_without_adjust has cognitive complexity 208 (threshold 15). Drivers by points: if/else 62 (140 pts), match/switch 23 (54 pts), loops 4 (9 pts), boolean chains 5 (nesting depth added 114). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
MirLowerCtx::pattern_match_inner (cognitive 78) crates/hir-ty/src/mir/lower/pattern_matching.rs:117— MirLowerCtx::pattern_match_inner has cognitive complexity 78 (threshold 15). Drivers by points: if/else 26 (60 pts), match/switch 5 (10 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 42). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
MirLowerCtx::lower_expr_as_place_without_adjust (cognitive 37) crates/hir-ty/src/mir/lower/as_place.rs:117— MirLowerCtx::lower_expr_as_place_without_adjust has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (30 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MirLowerCtx::lower_block_to_place (cognitive 34) crates/hir-ty/src/mir/lower.rs:1791— MirLowerCtx::lower_block_to_place has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (27 pts), match/switch 2 (6 pts), loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MirLowerCtx::lower_params_and_bindings (cognitive 20) crates/hir-ty/src/mir/lower.rs:1872— MirLowerCtx::lower_params_and_bindings has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, loops 2, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Printer::print_expr_in (cognitive 88) crates/hir-def/src/expr_store/pretty.rs:531— Printer::print_expr_in has cognitive complexity 88 (threshold 15). Drivers by points: if/else 23 (50 pts), loops 7 (19 pts), match/switch 10 (19 pts) (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Printer::print_pat (cognitive 54) crates/hir-def/src/expr_store/pretty.rs:896— Printer::print_pat has cognitive complexity 54 (threshold 15). Drivers by points: if/else 15 (37 pts), loops 6 (12 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 29). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Printer::print_type_ref (cognitive 28) crates/hir-def/src/expr_store/pretty.rs:1259— Printer::print_type_ref has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 3 (5 pts), loops 2 (4 pts) (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Printer::print_path (cognitive 22) crates/hir-def/src/expr_store/pretty.rs:1111— Printer::print_path has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 3 (5 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Printer::print_type_bounds (cognitive 19) crates/hir-def/src/expr_store/pretty.rs:1364— Printer::print_type_bounds has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 3 (9 pts), if/else 2 (6 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
DeclValidator::validate_struct_fields (cognitive 18) crates/hir-ty/src/diagnostics/decl_check.rs:322— DeclValidator::validate_struct_fields has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DeclValidator::validate_enum_variant_fields) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DeclValidator::validate_enum_variants (cognitive 18) crates/hir-ty/src/diagnostics/decl_check.rs:503— DeclValidator::validate_enum_variants has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeclValidator::validate_enum_variant_fields (cognitive 18) crates/hir-ty/src/diagnostics/decl_check.rs:573— DeclValidator::validate_enum_variant_fields has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DeclValidator::validate_struct_fields) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DeclValidator::validate_union_fields (cognitive 17) crates/hir-ty/src/diagnostics/decl_check.rs:415— DeclValidator::validate_union_fields has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeclValidator::validate_func_body (cognitive 16) crates/hir-ty/src/diagnostics/decl_check.rs:233— DeclValidator::validate_func_body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×5
Members sharing a duplicated core (4 members, 50+ identical tokens) crates/hir-ty/src/diagnostics/expr.rs:624— crates/hir-ty/src/diagnostics/expr.rs:624-660 | crates/hir-ty/src/diagnostics/expr.rs:667-697 | crates/hir/src/source_analyzer.rs:2178-2203 | crates/hir/src/source_analyzer.rs:2210-2235 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) crates/ide/src/hover/render.rs:66— crates/ide/src/hover/render.rs:66-153 | crates/ide/src/hover/render.rs:161-217 | crates/ide/src/hover/render.rs:273-306 | crates/ide/src/hover/render.rs:977-1028 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) crates/ide-assists/src/handlers/generate_default_from_new.rs:50— crates/ide-assists/src/handlers/generate_default_from_new.rs:50-95 | crates/ide-assists/src/handlers/generate_enum_is_method.rs:46-100 | crates/ide-assists/src/handlers/generate_enum_projection_method.rs:123-179 | crates/ide-assists/src/handlers/generate_single_field_struct_from.rs:47-155 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) crates/rust-analyzer/src/cli/analysis_stats.rs:1498— crates/rust-analyzer/src/cli/analysis_stats.rs:1498-1512 | crates/rust-analyzer/src/cli/analysis_stats.rs:1514-1528 | crates/rust-analyzer/src/cli/analysis_stats.rs:1535-1550 | crates/rust-analyzer/src/cli/analysis_stats.rs:1556-1571 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) crates/syntax/src/ast/syntax_factory/constructors.rs:601— crates/syntax/src/ast/syntax_factory/constructors.rs:601-611 | crates/syntax/src/ast/syntax_factory/constructors.rs:1115-1125 | crates/syntax/src/ast/syntax_factory/constructors.rs:1184-1196 | crates/syntax/src/ast/syntax_factory/constructors.rs:1217-1229 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Duplicated block (16 lines × 2) crates/hir-ty/src/infer/callee.rs:137— crates/hir-ty/src/infer/callee.rs:137-152 | crates/hir-ty/src/infer/callee.rs:190-205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) crates/ide/src/runnables.rs:364— crates/ide/src/runnables.rs:364-379 | crates/ide/src/runnables.rs:456-471 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) crates/ide-assists/src/handlers/generate_deref.rs:70— crates/ide-assists/src/handlers/generate_deref.rs:70-85 | crates/ide-assists/src/handlers/generate_deref.rs:113-128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) crates/ide-db/src/imports/merge_imports.rs:879— crates/ide-db/src/imports/merge_imports.rs:879-894 | crates/ide-db/src/imports/merge_imports.rs:918-933 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) crates/rust-analyzer/src/handlers/request.rs:2002— crates/rust-analyzer/src/handlers/request.rs:2002-2017 | crates/rust-analyzer/src/handlers/request.rs:2032-2047 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
AnalysisStats::run_inference (cyclomatic 49) crates/rust-analyzer/src/cli/analysis_stats.rs:774— AnalysisStats::run_inference has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AnalysisStats::run (cyclomatic 48) crates/rust-analyzer/src/cli/analysis_stats.rs:52— AnalysisStats::run has cyclomatic complexity 48 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
AnalysisStats::run_body_lowering (cyclomatic 31) crates/rust-analyzer/src/cli/analysis_stats.rs:1162— AnalysisStats::run_body_lowering has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AnalysisStats::run_term_search (cyclomatic 28) crates/rust-analyzer/src/cli/analysis_stats.rs:494— AnalysisStats::run_term_search has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DefCollector::resolve_macros (cyclomatic 31) crates/hir-def/src/nameres/collector.rs:1306— DefCollector::resolve_macros has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DefCollector::seed_with_top_level (cyclomatic 25) crates/hir-def/src/nameres/collector.rs:277— DefCollector::seed_with_top_level has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
DefCollector::record_resolved_import (cyclomatic 24) crates/hir-def/src/nameres/collector.rs:882— DefCollector::record_resolved_import has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DefCollector::push_res_and_update_glob_vis (cyclomatic 23) crates/hir-def/src/nameres/collector.rs:1202— DefCollector::push_res_and_update_glob_vis has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir::source_analyzer::resolve_hir_path_ (cyclomatic 25) crates/hir/src/source_analyzer.rs:1872— hir::source_analyzer::resolve_hir_path_ has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir::display::write_function (cyclomatic 23) crates/hir/src/display.rs:159— hir::display::write_function has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
hir::attrs::resolve_doc_path_on_ (cyclomatic 23) crates/hir/src/attrs.rs:316— hir::attrs::resolve_doc_path_on_ has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir::attrs::resolve_assoc_or_field (cyclomatic 21) crates/hir/src/attrs.rs:372— hir::attrs::resolve_assoc_or_field has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
AnalysisStats::run_inference (cognitive 134) crates/rust-analyzer/src/cli/analysis_stats.rs:774— AnalysisStats::run_inference has cognitive complexity 134 (threshold 15). Drivers by points: if/else 43 (115 pts), match/switch 4 (8 pts), boolean chains 6, loops 3 (5 pts) (nesting depth added 78). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnalysisStats::run (cognitive 81) crates/rust-analyzer/src/cli/analysis_stats.rs:52— AnalysisStats::run has cognitive complexity 81 (threshold 15). Drivers by points: if/else 25 (35 pts), match/switch 6 (22 pts), loops 8 (21 pts), boolean chains 3 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnalysisStats::run_term_search (cognitive 67) crates/rust-analyzer/src/cli/analysis_stats.rs:494— AnalysisStats::run_term_search has cognitive complexity 67 (threshold 15). Drivers by points: if/else 10 (31 pts), match/switch 9 (26 pts), loops 4 (8 pts), boolean chains 2 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnalysisStats::run_body_lowering (cognitive 50) crates/rust-analyzer/src/cli/analysis_stats.rs:1162— AnalysisStats::run_body_lowering has cognitive complexity 50 (threshold 15). Drivers by points: if/else 20 (37 pts), match/switch 4 (10 pts), loops 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
project_model::workspace::cargo_to_crate_graph (cognitive 72) crates/project-model/src/workspace.rs:1262— project_model::workspace::cargo_to_crate_graph has cognitive complexity 72 (threshold 15). Drivers by points: if/else 22 (55 pts), loops 7 (12 pts), boolean chains 5 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
project_model::workspace::handle_rustc_crates (cognitive 60) crates/project-model/src/workspace.rs:1534— project_model::workspace::handle_rustc_crates has cognitive complexity 60 (threshold 15). Drivers by points: if/else 11 (37 pts), loops 9 (23 pts) (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
project_model::env::cargo_config_env (cognitive 34) crates/project-model/src/env.rs:63— project_model::env::cargo_config_env has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (31 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
project_model::workspace::project_json_to_crate_graph (cognitive 27) crates/project-model/src/workspace.rs:1105— project_model::workspace::project_json_to_crate_graph has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 2 (4 pts), boolean chains 2, match/switch 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Resolver::resolve_path_in_value_ns_with_prefix_info (cognitive 61) crates/hir-def/src/resolver.rs:353— Resolver::resolve_path_in_value_ns_with_prefix_info has cognitive complexity 61 (threshold 15). Drivers by points: if/else 16 (41 pts), match/switch 5 (11 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Resolver::resolve_path_in_type_ns_with_prefix_info (cognitive 34) crates/hir-def/src/resolver.rs:183— Resolver::resolve_path_in_type_ns_with_prefix_info has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (23 pts), match/switch 4 (9 pts), boolean chains 1, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Resolver::rename_will_conflict_with_renamed (cognitive 24) crates/hir-def/src/resolver.rs:846— Resolver::rename_will_conflict_with_renamed has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Resolver::rename_will_conflict_with_another_variable (cognitive 22) crates/hir-def/src/resolver.rs:797— Resolver::rename_will_conflict_with_another_variable has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_diagnostics::handlers::unlinked_file::fixes (cognitive 37) crates/ide-diagnostics/src/handlers/unlinked_file.rs:77— ide_diagnostics::handlers::unlinked_file::fixes has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 4 (11 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_diagnostics::handlers::missing_fields::fixes (cognitive 29) crates/ide-diagnostics/src/handlers/missing_fields.rs:56— ide_diagnostics::handlers::missing_fields::fixes has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 2 (4 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_diagnostics::semantic_diagnostics (cognitive 26) crates/ide-diagnostics/src/lib.rs:375— ide_diagnostics::semantic_diagnostics has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 8 (18 pts), if/else 3 (4 pts), boolean chains 2, loops 2 (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_diagnostics::handlers::type_mismatch::add_missing_ok_or_some (cognitive 22) crates/ide-diagnostics/src/handlers/type_mismatch.rs:176— ide_diagnostics::handlers::type_mismatch::add_missing_ok_or_some has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkspaceBuildScripts::build_command (cognitive 35) crates/project-model/src/build_dependencies.rs:435— WorkspaceBuildScripts::build_command has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (28 pts), match/switch 3 (7 pts) (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
WorkspaceBuildScripts::rustc_crates (cognitive 25) crates/project-model/src/build_dependencies.rs:183— WorkspaceBuildScripts::rustc_crates has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 3 (9 pts), loops 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkspaceBuildScripts::run_command (cognitive 23) crates/project-model/src/build_dependencies.rs:328— WorkspaceBuildScripts::run_command has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 3 (7 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkspaceBuildScripts::run_once (cognitive 17) crates/project-model/src/build_dependencies.rs:100— WorkspaceBuildScripts::run_once has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
syntax::validation::validate_literal (cognitive 26) crates/syntax/src/validation.rs:124— syntax::validation::validate_literal has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 5, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
syntax::validation::validate_path_keywords (cognitive 18) crates/syntax/src/validation.rs:285— syntax::validation::validate_path_keywords has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to one function item inside it that branches (use_prefix). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
syntax::parsing::reparsing::reparse_token (cognitive 16) crates/syntax/src/parsing/reparsing.rs:46— syntax::parsing::reparsing::reparse_token has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 3, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
syntax::ast::prec::precedence (cognitive 16) crates/syntax/src/ast/prec.rs:73— syntax::ast::prec::precedence has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 6 (16 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ExprUseVisitor::cat_pattern (cognitive 23) crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:1496— ExprUseVisitor::cat_pattern has cognitive complexity 23 (threshold 15). Drivers by points: loops 7 (13 pts), match/switch 3 (6 pts), if/else 2 (4 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
ExprUseVisitor::walk_expr (cognitive 22) crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:502— ExprUseVisitor::walk_expr has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (6 pts), match/switch 2 (4 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ExprUseVisitor::walk_captures (cognitive 22) crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:1052— ExprUseVisitor::walk_captures has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (7 pts), match/switch 2 (7 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprUseVisitor::walk_pat (cognitive 19) crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:879— ExprUseVisitor::walk_pat has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
xtask::codegen::lints::generate_descriptor_clippy (cognitive 20) xtask/src/codegen/lints.rs:448— xtask::codegen::lints::generate_descriptor_clippy has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3, match/switch 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
xtask::codegen::lints::generate_lint_descriptor (cognitive 19) xtask/src/codegen/lints.rs:166— xtask::codegen::lints::generate_lint_descriptor has cognitive complexity 19 (threshold 15). Drivers by points: loops 9, if/else 3 (6 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 4). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to one function item inside it that branches (insert_lints). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
xtask::publish::notes::process_inline_macros (cognitive 18) xtask/src/publish/notes.rs:437— xtask::publish::notes::process_inline_macros has cognitive complexity 18 (threshold 15). Drivers by points: loops 7 (15 pts), match/switch 2 (3 pts) (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
xtask::tidy::check_cargo_toml (cognitive 16) xtask/src/tidy.rs:83— xtask::tidy::check_cargo_toml has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Duplicated block (12–13 lines × 2) crates/ide-completion/src/completions/snippet.rs:17— crates/ide-completion/src/completions/snippet.rs:17-29 | crates/ide-completion/src/completions/snippet.rs:57-68 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–13 lines × 2) crates/ide-completion/src/completions/flyimport.rs:263— crates/ide-completion/src/completions/flyimport.rs:263-275 | crates/ide-completion/src/completions/flyimport.rs:316-327 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–13 lines × 2) crates/ide-db/src/syntax_helpers/node_ext.rs:47— crates/ide-db/src/syntax_helpers/node_ext.rs:47-59 | crates/ide-db/src/syntax_helpers/node_ext.rs:146-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–13 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:157— crates/rust-analyzer/src/cli/analysis_stats.rs:157-168 | crates/rust-analyzer/src/cli/analysis_stats.rs:170-182 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) crates/hir/src/lib.rs:4220— crates/hir/src/lib.rs:4220-4229 | crates/hir/src/lib.rs:4254-4264 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) crates/ide/src/inlay_hints.rs:103— crates/ide/src/inlay_hints.rs:103-112 | crates/ide/src/inlay_hints.rs:150-160 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) crates/ide-assists/src/utils/gen_trait_fn_body.rs:662— crates/ide-assists/src/utils/gen_trait_fn_body.rs:662-672 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:682-691 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) crates/syntax/src/ast/edit.rs:91— crates/syntax/src/ast/edit.rs:91-100 | crates/syntax/src/ast/edit.rs:108-118 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 4) crates/hir-ty/src/display.rs:850— crates/hir-ty/src/display.rs:850-857 | crates/hir-ty/src/display.rs:869-876 | crates/hir-ty/src/display.rs:1123-1130 | crates/hir-ty/src/display.rs:1142-1149 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) crates/syntax/src/ast/syntax_factory/constructors.rs:353— crates/syntax/src/ast/syntax_factory/constructors.rs:353-360 | crates/syntax/src/ast/syntax_factory/constructors.rs:401-408 | crates/syntax/src/ast/syntax_factory/constructors.rs:1483-1490 | crates/syntax/src/ast/syntax_factory/constructors.rs:2157-2164 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) crates/syntax/src/ast/syntax_factory/constructors.rs:353— crates/syntax/src/ast/syntax_factory/constructors.rs:353-360 | crates/syntax/src/ast/syntax_factory/constructors.rs:401-408 | crates/syntax/src/ast/syntax_factory/constructors.rs:1799-1806 | crates/syntax/src/ast/syntax_factory/constructors.rs:2157-2164 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) crates/syntax/src/ast/syntax_factory/constructors.rs:420— crates/syntax/src/ast/syntax_factory/constructors.rs:420-427 | crates/syntax/src/ast/syntax_factory/constructors.rs:1820-1828 | crates/syntax/src/ast/syntax_factory/constructors.rs:1950-1957 | crates/syntax/src/ast/syntax_factory/constructors.rs:2213-2220 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
MirLowerCtx::lower_expr_to_place_without_adjust (cyclomatic 131) crates/hir-ty/src/mir/lower.rs:469— MirLowerCtx::lower_expr_to_place_without_adjust has cyclomatic complexity 131 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MirLowerCtx::pattern_match_inner (cyclomatic 46) crates/hir-ty/src/mir/lower/pattern_matching.rs:117— MirLowerCtx::pattern_match_inner has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MirLowerCtx::lower_expr_as_place_without_adjust (cyclomatic 25) crates/hir-ty/src/mir/lower/as_place.rs:117— MirLowerCtx::lower_expr_as_place_without_adjust has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Definition::search_scope (cyclomatic 48) crates/ide-db/src/search.rs:290— Definition::search_scope has cyclomatic complexity 48 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Definition::label (cyclomatic 28) crates/ide-db/src/defs.rs:310— Definition::label has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Definition::range_for_rename (cyclomatic 27) crates/ide-db/src/rename.rs:136— Definition::range_for_rename has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ExprUseVisitor::walk_expr (cyclomatic 40) crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:502— ExprUseVisitor::walk_expr has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ExprUseVisitor::cat_pattern (cyclomatic 20) crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:1496— ExprUseVisitor::cat_pattern has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ExprUseVisitor::walk_pat (cyclomatic 19) crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:879— ExprUseVisitor::walk_pat has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
syntax_bridge::prettify_macro_expansion::prettify_macro_expansion (cyclomatic 40) crates/syntax-bridge/src/prettify_macro_expansion.rs:23— syntax_bridge::prettify_macro_expansion::prettify_macro_expansion has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
syntax_bridge::to_parser_input::to_parser_input (cyclomatic 31) crates/syntax-bridge/src/to_parser_input.rs:8— syntax_bridge::to_parser_input::to_parser_input has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
syntax_bridge::convert_tokens (cyclomatic 31) crates/syntax-bridge/src/lib.rs:208— syntax_bridge::convert_tokens has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
project_model::workspace::cargo_to_crate_graph (cyclomatic 31) crates/project-model/src/workspace.rs:1262— project_model::workspace::cargo_to_crate_graph has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
project_model::workspace::handle_rustc_crates (cyclomatic 20) crates/project-model/src/workspace.rs:1534— project_model::workspace::handle_rustc_crates has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
project_model::workspace::project_json_to_crate_graph (cyclomatic 16) crates/project-model/src/workspace.rs:1105— project_model::workspace::project_json_to_crate_graph has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Expr::gen_source_code (cyclomatic 27) crates/hir/src/term_search/expr.rs:102— Expr::gen_source_code has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Expr::needs_parens_in_expr (cyclomatic 24) crates/syntax/src/ast/prec.rs:199— Expr::needs_parens_in_expr has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Expr::binding_power (cyclomatic 19) crates/syntax/src/ast/prec.rs:334— Expr::binding_power has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Expr::is_ordered_before_parent_in_place_of::order (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
SemanticsImpl::descend_into_macros_impl (cognitive 78) crates/hir/src/semantics.rs:1237— SemanticsImpl::descend_into_macros_impl has cognitive complexity 78 (threshold 15). Drivers by points: if/else 10 (41 pts), match/switch 6 (20 pts), loops 5 (16 pts), boolean chains 1 (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SemanticsImpl::analyze_impl (cognitive 16) crates/hir/src/semantics.rs:2283— SemanticsImpl::analyze_impl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 1 (nesting depth added 5). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SemanticsImpl::locals_used (cognitive 16) crates/hir/src/semantics.rs:2459— SemanticsImpl::locals_used has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 3 (4 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
syntax_bridge::convert_tokens (cognitive 51) crates/syntax-bridge/src/lib.rs:208— syntax_bridge::convert_tokens has cognitive complexity 51 (threshold 15). Drivers by points: match/switch 8 (24 pts), if/else 4 (15 pts), loops 4 (11 pts), boolean chains 1 (nesting depth added 34). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
syntax_bridge::to_parser_input::to_parser_input (cognitive 44) crates/syntax-bridge/src/to_parser_input.rs:8— syntax_bridge::to_parser_input::to_parser_input has cognitive complexity 44 (threshold 15). Drivers by points: match/switch 8 (25 pts), if/else 5 (16 pts), boolean chains 2, loops 1 (nesting depth added 28). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
syntax_bridge::prettify_macro_expansion::prettify_macro_expansion (cognitive 41) crates/syntax-bridge/src/prettify_macro_expansion.rs:23— syntax_bridge::prettify_macro_expansion::prettify_macro_expansion has cognitive complexity 41 (threshold 15). Drivers by points: if/else 7 (19 pts), match/switch 5 (12 pts), boolean chains 7, loops 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModCollector::collect (cognitive 42) crates/hir-def/src/nameres/collector.rs:1898— ModCollector::collect has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (28 pts), match/switch 5 (8 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModCollector::collect_macro_def (cognitive 19) crates/hir-def/src/nameres/collector.rs:2599— ModCollector::collect_macro_def has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModCollector::collect_macro_rules (cognitive 16) crates/hir-def/src/nameres/collector.rs:2517— ModCollector::collect_macro_rules has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 4 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Module::get_usages_and_record_fields (cognitive 41) crates/ide-assists/src/handlers/extract_module.rs:276— Module::get_usages_and_record_fields has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (28 pts), match/switch 3 (12 pts), loops 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Module::process_def_in_sel (cognitive 39) crates/ide-assists/src/handlers/extract_module.rs:541— Module::process_def_in_sel has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 11, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Module::expand_and_group_usages_file_wise (cognitive 18) crates/ide-assists/src/handlers/extract_module.rs:365— Module::expand_and_group_usages_file_wise has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Duplicated block (11–12 lines × 2) crates/hir-def/src/signatures.rs:91— crates/hir-def/src/signatures.rs:91-102 | crates/hir-def/src/signatures.rs:179-189 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–12 lines × 2) crates/hir-def/src/signatures.rs:191— crates/hir-def/src/signatures.rs:191-201 | crates/hir-def/src/signatures.rs:267-278 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–12 lines × 2) crates/rust-analyzer/src/cli/lsif.rs:310— crates/rust-analyzer/src/cli/lsif.rs:310-320 | crates/rust-analyzer/src/cli/scip.rs:64-75 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 3) crates/hir-ty/src/lower.rs:1769— crates/hir-ty/src/lower.rs:1769-1779 | crates/hir-ty/src/lower.rs:2287-2296 | crates/hir-ty/src/lower.rs:2922-2931 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) crates/syntax/src/ast/expr_ext.rs:76— crates/syntax/src/ast/expr_ext.rs:76-85 | crates/syntax/src/ast/node_ext.rs:1138-1147 | crates/syntax/src/ast/node_ext.rs:1160-1169 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (10 lines × 3) crates/hir-ty/src/display.rs:1770— crates/hir-ty/src/display.rs:1770-1779 | crates/hir-ty/src/display.rs:1794-1803 | crates/hir-ty/src/display.rs:1818-1827 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8–10 lines × 2) crates/ide-assists/src/handlers/generate_enum_is_method.rs:47— crates/ide-assists/src/handlers/generate_enum_is_method.rs:47-54 | crates/ide-assists/src/handlers/generate_enum_projection_method.rs:124-133 — before extracting anything, compare `crates/ide-assists/src/handlers/generate_enum_is_method.rs` and `crates/ide-assists/src/handlers/generate_enum_projection_method.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8–10 lines × 2) crates/ide-completion/src/completions/dot.rs:46— crates/ide-completion/src/completions/dot.rs:46-55 | crates/ide-completion/src/completions/dot.rs:108-115 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–10 lines × 2) crates/proc-macro-srv/src/dylib/proc_macros.rs:38— crates/proc-macro-srv/src/dylib/proc_macros.rs:38-47 | crates/proc-macro-srv/src/dylib/proc_macros.rs:49-56 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 4) crates/syntax/src/ast/syntax_factory/constructors.rs:410— crates/syntax/src/ast/syntax_factory/constructors.rs:410-415 | crates/syntax/src/ast/syntax_factory/constructors.rs:649-654 | crates/syntax/src/ast/syntax_factory/constructors.rs:1545-1550 | crates/syntax/src/ast/syntax_factory/constructors.rs:1939-1944 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 4) crates/syntax/src/ast/syntax_factory/constructors.rs:606— crates/syntax/src/ast/syntax_factory/constructors.rs:606-611 | crates/syntax/src/ast/syntax_factory/constructors.rs:1120-1125 | crates/syntax/src/ast/syntax_factory/constructors.rs:1191-1196 | crates/syntax/src/ast/syntax_factory/constructors.rs:1224-1229 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 4) crates/hir-ty/src/next_solver/infer/at.rs:213— crates/hir-ty/src/next_solver/infer/at.rs:213-218 | crates/hir-ty/src/next_solver/infer/at.rs:228-233 | crates/hir-ty/src/next_solver/infer/mod.rs:1327-1332 | crates/hir-ty/src/next_solver/infer/mod.rs:1342-1347 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 3) crates/hir/src/semantics.rs:2308— crates/hir/src/semantics.rs:2308-2313 | crates/hir/src/semantics.rs:2315-2320 | crates/hir/src/semantics.rs:2322-2327 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/hir-def/src/visibility.rs:336— crates/hir-def/src/visibility.rs:336-341 | crates/hir-def/src/visibility.rs:343-348 | crates/hir-def/src/visibility.rs:350-355 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/syntax/src/ast/make.rs:492— crates/syntax/src/ast/make.rs:492-497 | crates/syntax/src/ast/make.rs:1008-1013 | crates/syntax/src/ast/make.rs:1308-1313 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
ide_diagnostics::semantic_diagnostics (cyclomatic 92) crates/ide-diagnostics/src/lib.rs:375— ide_diagnostics::semantic_diagnostics has cyclomatic complexity 92 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_diagnostics::handlers::unlinked_file::fixes (cyclomatic 18) crates/ide-diagnostics/src/handlers/unlinked_file.rs:77— ide_diagnostics::handlers::unlinked_file::fixes has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AnyDiagnostic::inference_diagnostic (cyclomatic 59) crates/hir/src/diagnostics.rs:1549— AnyDiagnostic::inference_diagnostic has cyclomatic complexity 59 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
AnyDiagnostic::body_validation_diagnostic (cyclomatic 20) crates/hir/src/diagnostics.rs:1417— AnyDiagnostic::body_validation_diagnostic has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Converter::extend_token (cyclomatic 50) crates/parser/src/lexed_str.rs:206— Converter::extend_token has cyclomatic complexity 50 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Converter::extend_literal (cyclomatic 25) crates/parser/src/lexed_str.rs:327— Converter::extend_literal has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: parser::lexed_str::err_to_msg (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
Resolver::resolve_path_in_value_ns_with_prefix_info (cyclomatic 41) crates/hir-def/src/resolver.rs:353— Resolver::resolve_path_in_value_ns_with_prefix_info has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Resolver::resolve_path_in_type_ns_with_prefix_info (cyclomatic 22) crates/hir-def/src/resolver.rs:183— Resolver::resolve_path_in_type_ns_with_prefix_info has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FindUsages::search (cyclomatic 39) crates/ide-db/src/search.rs:929— FindUsages::search has cyclomatic complexity 39 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
FindUsages::short_associated_function_fast_search::collect_possible_aliases (cyclomatic 24) crates/ide-db/src/search.rs:654— FindUsages::short_associated_function_fast_search::collect_possible_aliases has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ItemScope::push_res_with_import (cyclomatic 27) crates/hir-def/src/item_scope.rs:585— ItemScope::push_res_with_import has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ItemScope::dump (cyclomatic 20) crates/hir-def/src/item_scope.rs:751— ItemScope::dump has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
TyLoweringContext::lower_dyn_trait (cyclomatic 27) crates/hir-ty/src/lower.rs:1011— TyLoweringContext::lower_dyn_trait has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TyLoweringContext::lower_ty_ext (cyclomatic 22) crates/hir-ty/src/lower.rs:576— TyLoweringContext::lower_ty_ext has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Module::process_def_in_sel (cyclomatic 27) crates/ide-assists/src/handlers/extract_module.rs:541— Module::process_def_in_sel has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Module::get_usages_and_record_fields (cyclomatic 19) crates/ide-assists/src/handlers/extract_module.rs:276— Module::get_usages_and_record_fields has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Reader::read_tokenstream (cyclomatic 26) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:858— Reader::read_tokenstream has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Reader::read_subtree (cyclomatic 22) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:750— Reader::read_subtree has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Config::apply_change_with_sink (cyclomatic 21) crates/rust-analyzer/src/config.rs:1203— Config::apply_change_with_sink has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rust_analyzer::config::field_props (cyclomatic 48) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
Config::inlay_hints (cyclomatic 18) crates/rust-analyzer/src/config.rs:2079— Config::inlay_hints has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: rust_analyzer::config::field_props (cyclomatic 48) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
FlycheckActor::run (cyclomatic 21) crates/rust-analyzer/src/flycheck.rs:579— FlycheckActor::run has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FlycheckActor::check_command (cyclomatic 16) crates/rust-analyzer/src/flycheck.rs:884— FlycheckActor::check_command has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
syntax::validation::validate_literal (cyclomatic 20) crates/syntax/src/validation.rs:124— syntax::validation::validate_literal has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: syntax::validation::rustc_unescape_error_to_string (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
syntax::ast::prec::precedence (cyclomatic 19) crates/syntax/src/ast/prec.rs:73— syntax::ast::prec::precedence has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Expr::is_ordered_before_parent_in_place_of::order (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
Writer::subtree (cyclomatic 19) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:503— Writer::subtree has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Writer::group (cyclomatic 19) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:641— Writer::group has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
PathLoweringContext::substs_from_args_and_bindings (cyclomatic 17) crates/hir-ty/src/lower/path.rs:680— PathLoweringContext::substs_from_args_and_bindings has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
PathLoweringContext::resolve_path_in_value_ns (cyclomatic 16) crates/hir-ty/src/lower/path.rs:384— PathLoweringContext::resolve_path_in_value_ns has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
WorkspaceBuildScripts::run_command (cyclomatic 16) crates/project-model/src/build_dependencies.rs:328— WorkspaceBuildScripts::run_command has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WorkspaceBuildScripts::build_command (cyclomatic 16) crates/project-model/src/build_dependencies.rs:435— WorkspaceBuildScripts::build_command has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
xtask::codegen::lints::generate_lint_descriptor (cyclomatic 16) xtask/src/codegen/lints.rs:166— xtask::codegen::lints::generate_lint_descriptor has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
xtask::publish::notes::get_next_line_component (cyclomatic 16) xtask/src/publish/notes.rs:479— xtask::publish::notes::get_next_line_component has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Repeated repair: crates/hir-ty/src/generics.rs crates/hir-ty/src/generics.rs:388— crates/hir-ty/src/generics.rs changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is hir_ty::generics::parent_generic_def at line 388), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: len method of generics next solver to use `consider_late_bound`”; “fix: consider_late_bound field in Generics for RPITs”; “fix: idx and type of lifetimes captured by opaque”; “fix: early/late bound idx and opaque captured lifetimes”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-ty/src/generics.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/hir-ty/src/next_solver/generics.rs crates/hir-ty/src/next_solver/generics.rs:12— crates/hir-ty/src/next_solver/generics.rs changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is hir_ty::next_solver::generics::generics at line 12), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: Fix `.zip(None)` call”; “fix: Handle enum variants in next-solver `generics`”; “fix: len method of generics next solver to use `consider_late_bound`”; “fix: consider_late_bound field in Generics for RPITs”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-06-29..2026-09-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-29 18:04:31 +00:00' --until='2026-09-27 18:04:31 +00:00' --full-history --no-merges -- crates/hir-ty/src/next_solver/generics.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
SourceAnalyzer::resolve_path (cognitive 99) crates/hir/src/source_analyzer.rs:1157— SourceAnalyzer::resolve_path has cognitive complexity 99 (threshold 15). Drivers by points: if/else 30 (67 pts), match/switch 8 (23 pts), loops 1 (6 pts), boolean chains 3 (nesting depth added 57). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SourceAnalyzer::resolve_offset_of_field (cognitive 16) crates/hir/src/source_analyzer.rs:1083— SourceAnalyzer::resolve_offset_of_field has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 4 (11 pts), if/else 2 (4 pts), loops 1 (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
FindUsages::search (cognitive 98) crates/ide-db/src/search.rs:929— FindUsages::search has cognitive complexity 98 (threshold 15). Drivers by points: if/else 16 (44 pts), loops 12 (36 pts), match/switch 8 (17 pts), boolean chains 1 (nesting depth added 61). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FindUsages::short_associated_function_fast_search::collect_possible_aliases (cognitive 97) crates/ide-db/src/search.rs:654— FindUsages::short_associated_function_fast_search::collect_possible_aliases has cognitive complexity 97 (threshold 15). Drivers by points: if/else 15 (73 pts), loops 6 (20 pts), boolean chains 4 (nesting depth added 72). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NotifyActor::run (cognitive 63) crates/vfs-notify/src/lib.rs:99— NotifyActor::run has cognitive complexity 63 (threshold 15). Drivers by points: if/else 9 (36 pts), loops 4 (13 pts), match/switch 3 (10 pts), boolean chains 4 (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NotifyActor::load_entry (cognitive 24) crates/vfs-notify/src/lib.rs:280— NotifyActor::load_entry has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 5, loops 1 (2 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FlycheckActor::run (cognitive 56) crates/rust-analyzer/src/flycheck.rs:579— FlycheckActor::run has cognitive complexity 56 (threshold 15). Drivers by points: if/else 9 (28 pts), match/switch 6 (19 pts), loops 3 (9 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FlycheckActor::check_command (cognitive 25) crates/rust-analyzer/src/flycheck.rs:884— FlycheckActor::check_command has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 5 (10 pts), boolean chains 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ItemScope::push_res_with_import (cognitive 51) crates/hir-def/src/item_scope.rs:585— ItemScope::push_res_with_import has cognitive complexity 51 (threshold 15). Drivers by points: if/else 12 (32 pts), match/switch 7 (14 pts), boolean chains 5 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ItemScope::dump (cognitive 24) crates/hir-def/src/item_scope.rs:751— ItemScope::dump has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 4 (9 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TyLoweringContext::lower_dyn_trait (cognitive 50) crates/hir-ty/src/lower.rs:1011— TyLoweringContext::lower_dyn_trait has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (31 pts), match/switch 5 (13 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TyLoweringContext::lower_ty_ext (cognitive 20) crates/hir-ty/src/lower.rs:576— TyLoweringContext::lower_ty_ext has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 4 (10 pts), if/else 3 (9 pts), boolean chains 1 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Converter::extend_literal (cognitive 41) crates/parser/src/lexed_str.rs:327— Converter::extend_literal has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20 (40 pts), match/switch 1 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Converter::next_token (cognitive 21) crates/syntax-bridge/src/lib.rs:663— Converter::next_token has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 2 (6 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefMap::resolve_remaining_segments (cognitive 35) crates/hir-def/src/nameres/path_resolution.rs:448— DefMap::resolve_remaining_segments has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 5 (14 pts), loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefMap::resolve_path_fp_with_macro_single (cognitive 22) crates/hir-def/src/nameres/path_resolution.rs:242— DefMap::resolve_path_fp_with_macro_single has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 4 (6 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Definition::search_scope (cognitive 34) crates/ide-db/src/search.rs:290— Definition::search_scope has cognitive complexity 34 (threshold 15). Drivers by points: match/switch 15 (25 pts), if/else 8, boolean chains 1 (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Definition::range_for_rename (cognitive 18) crates/ide-db/src/rename.rs:136— Definition::range_for_rename has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 7 (15 pts), if/else 2 (3 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Reader::read_subtree (cognitive 33) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:750— Reader::read_subtree has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (22 pts), match/switch 2 (8 pts), loops 2 (3 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Reader::read_tokenstream (cognitive 32) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:858— Reader::read_tokenstream has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (23 pts), match/switch 3 (8 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProbeContext::consider_probe (cognitive 30) crates/hir-ty/src/method_resolution/probe.rs:1567— ProbeContext::consider_probe has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 5 (8 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProbeContext::collapse_candidates_to_subtrait_pick (cognitive 16) crates/hir-ty/src/method_resolution/probe.rs:1909— ProbeContext::collapse_candidates_to_subtrait_pick has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SolverContext::compute_goal_fast_path (cognitive 28) crates/hir-ty/src/next_solver/solver.rs:285— SolverContext::compute_goal_fast_path has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SolverContext::fetch_eligible_assoc_item (cognitive 19) crates/hir-ty/src/next_solver/solver.rs:176— SolverContext::fetch_eligible_assoc_item has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Generalizer::tys (cognitive 27) crates/hir-ty/src/next_solver/infer/relate/generalize.rs:434— Generalizer::tys has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 4 (10 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Generalizer::consts (cognitive 17) crates/hir-ty/src/next_solver/infer/relate/generalize.rs:592— Generalizer::consts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Writer::subtree (cognitive 27) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:503— Writer::subtree has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 3 (9 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Writer::group (cognitive 19) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:641— Writer::group has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Coerce::coerce_from_fn_item (cognitive 25) crates/hir-ty/src/infer/coerce.rs:742— Coerce::coerce_from_fn_item has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (22 pts), boolean chains 2, match/switch 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Coerce::coerce_borrowed_pointer (cognitive 22) crates/hir-ty/src/infer/coerce.rs:350— Coerce::coerce_borrowed_pointer has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tt::transform_tt (cognitive 25) crates/tt/src/lib.rs:764— tt::transform_tt has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (6 pts), match/switch 2 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tt::storage::encode (cognitive 25) crates/tt/src/storage.rs:332— tt::storage::encode has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 3 (7 pts), boolean chains 4 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Expr::gen_source_code (cognitive 23) crates/hir/src/term_search/expr.rs:102— Expr::gen_source_code has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 8 (17 pts), if/else 3 (6 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Expr::needs_parens_in_expr (cognitive 20) crates/syntax/src/ast/prec.rs:199— Expr::needs_parens_in_expr has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 7, match/switch 2 (3 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Visibility::max (cognitive 22) crates/hir-def/src/visibility.rs:154— Visibility::max has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (Visibility::min) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Visibility::min (cognitive 22) crates/hir-def/src/visibility.rs:220— Visibility::min has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (Visibility::max) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AnyDiagnostic::body_validation_diagnostic (cognitive 21) crates/hir/src/diagnostics.rs:1417— AnyDiagnostic::body_validation_diagnostic has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 3 (5 pts), boolean chains 4 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
AnyDiagnostic::inference_diagnostic (cognitive 18) crates/hir/src/diagnostics.rs:1549— AnyDiagnostic::inference_diagnostic has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 10 (18 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
FetchMetadata::new (cognitive 18) crates/project-model/src/cargo_workspace.rs:656— FetchMetadata::new has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FetchMetadata::exec (cognitive 16) crates/project-model/src/cargo_workspace.rs:764— FetchMetadata::exec has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Docs::push_doc_lines (cognitive 16) crates/hir-def/src/attrs/docs.rs:259— Docs::push_doc_lines has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (3 pts), boolean chains 2, match/switch 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Docs::remove_indent (cognitive 16) crates/hir-def/src/attrs/docs.rs:342— Docs::remove_indent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities· Medium vulnerability · ×2
REDACTED
REDACTED
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/ide/src/highlight_related.rs:311— crates/ide/src/highlight_related.rs:311-388 | crates/ide/src/highlight_related.rs:394-459 | crates/ide/src/highlight_related.rs:494-584 | crates/ide/src/highlight_related.rs:589-660 | crates/ide/src/highlight_related.rs:790-821 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/syntax/src/syntax_editor/edits.rs:36— crates/syntax/src/syntax_editor/edits.rs:36-44 | crates/syntax/src/syntax_editor/edits.rs:58-66 | crates/syntax/src/syntax_editor/edits.rs:70-78 | crates/syntax/src/syntax_editor/edits.rs:82-96 | crates/syntax/src/syntax_editor/edits.rs:100-108 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Duplicated block (26 lines × 2) crates/ide-assists/src/handlers/convert_for_to_while_let.rs:120— crates/ide-assists/src/handlers/convert_for_to_while_let.rs:120-145 | crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs:162-187 — before extracting anything, compare `crates/ide-assists/src/handlers/convert_for_to_while_let.rs` and `crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (26 lines × 2) crates/ide-diagnostics/src/handlers/field_shorthand.rs:33— crates/ide-diagnostics/src/handlers/field_shorthand.rs:33-58 | crates/ide-diagnostics/src/handlers/field_shorthand.rs:79-104 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) crates/hir-ty/src/mir/eval/shim.rs:592— crates/hir-ty/src/mir/eval/shim.rs:592-615 | crates/hir-ty/src/mir/eval/shim.rs:664-687 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:932— crates/rust-analyzer/src/cli/analysis_stats.rs:932-955 | crates/rust-analyzer/src/cli/analysis_stats.rs:1037-1060 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:213— crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:213-235 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:255-277 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) crates/tt/src/storage.rs:877— crates/tt/src/storage.rs:877-899 | crates/tt/src/storage.rs:901-923 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) crates/ide-completion/src/context/analysis.rs:1567— crates/ide-completion/src/context/analysis.rs:1567-1587 | crates/ide-completion/src/context/analysis.rs:1596-1616 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) crates/proc-macro-srv/src/token_stream.rs:697— crates/proc-macro-srv/src/token_stream.rs:697-717 | crates/tt/src/lib.rs:456-476 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (20 lines × 2) crates/hir-def/src/resolver.rs:823— crates/hir-def/src/resolver.rs:823-842 | crates/hir-def/src/resolver.rs:873-892 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:986— crates/rust-analyzer/src/cli/analysis_stats.rs:986-1005 | crates/rust-analyzer/src/cli/analysis_stats.rs:1090-1109 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) crates/intern/src/intern.rs:51— crates/intern/src/intern.rs:51-69 | crates/intern/src/intern.rs:78-96 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) crates/proc-macro-srv-cli/src/version.rs:40— crates/proc-macro-srv-cli/src/version.rs:40-58 | crates/rust-analyzer/src/version.rs:39-57 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (17 lines × 2) crates/hir-ty/src/infer/expr.rs:76— crates/hir-ty/src/infer/expr.rs:76-92 | crates/hir-ty/src/infer/expr.rs:293-309 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) crates/ide/src/syntax_highlighting/highlight.rs:540— crates/ide/src/syntax_highlighting/highlight.rs:540-556 | crates/ide/src/syntax_highlighting/highlight.rs:563-579 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 3) crates/hir/src/source_analyzer.rs:136— crates/hir/src/source_analyzer.rs:136-150 | crates/hir/src/source_analyzer.rs:189-203 | crates/hir/src/source_analyzer.rs:234-248 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 3) crates/hir-ty/src/infer.rs:1934— crates/hir-ty/src/infer.rs:1934-1948 | crates/hir-ty/src/infer.rs:2235-2249 | crates/hir-ty/src/infer/path.rs:156-170 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (11 lines × 3) crates/hir-ty/src/lower.rs:1683— crates/hir-ty/src/lower.rs:1683-1693 | crates/hir-ty/src/lower.rs:2287-2297 | crates/hir-ty/src/lower.rs:2922-2932 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) crates/ide/src/static_index.rs:120— crates/ide/src/static_index.rs:120-130 | crates/rust-analyzer/src/cli/diagnostics.rs:131-141 | crates/rust-analyzer/src/cli/unresolved_references.rs:98-108 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (9–10 lines × 2) crates/hir-ty/src/infer/expr.rs:1020— crates/hir-ty/src/infer/expr.rs:1020-1028 | crates/hir-ty/src/infer/pat.rs:1199-1208 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9–10 lines × 2) crates/ide/src/rename.rs:682— crates/ide/src/rename.rs:682-690 | crates/ide/src/rename.rs:695-704 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 3) crates/hir-ty/src/infer.rs:2442— crates/hir-ty/src/infer.rs:2442-2450 | crates/hir-ty/src/infer.rs:2483-2491 | crates/hir-ty/src/infer.rs:2546-2554 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) crates/syntax/src/ast/syntax_factory/constructors.rs:351— crates/syntax/src/ast/syntax_factory/constructors.rs:351-359 | crates/syntax/src/ast/syntax_factory/constructors.rs:1797-1805 | crates/syntax/src/ast/syntax_factory/constructors.rs:2155-2163 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8–9 lines × 2) crates/hir-def/src/attrs.rs:1289— crates/hir-def/src/attrs.rs:1289-1297 | crates/hir-def/src/attrs.rs:1310-1317 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) crates/ide-assists/src/handlers/convert_closure_to_fn.rs:428— crates/ide-assists/src/handlers/convert_closure_to_fn.rs:428-436 | crates/ide-assists/src/handlers/convert_closure_to_fn.rs:438-445 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6–7 lines × 2) crates/ide/src/hover/render.rs:529— crates/ide/src/hover/render.rs:529-534 | crates/ide/src/hover/render.rs:562-568 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6–7 lines × 2) crates/span/src/lib.rs:94— crates/span/src/lib.rs:94-99 | crates/span/src/lib.rs:113-119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 3) crates/syntax/src/ast/syntax_factory/constructors.rs:316— crates/syntax/src/ast/syntax_factory/constructors.rs:316-320 | crates/syntax/src/ast/syntax_factory/constructors.rs:1186-1190 | crates/syntax/src/ast/syntax_factory/constructors.rs:1219-1223 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) crates/hir-def/src/expr_store/body.rs:111— crates/hir-def/src/expr_store/body.rs:111-115 | crates/hir-def/src/expr_store/body.rs:117-121 | crates/hir-def/src/expr_store/body.rs:122-126 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 2 locations) editors/code/src/commands.ts:1032— editors/code/src/commands.ts:1032 · editors/code/src/commands.ts:1067 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (12 lines × 2 locations) editors/code/src/commands.ts:1058— editors/code/src/commands.ts:1058 · editors/code/src/commands.ts:1083 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Boundary violation [package:third-party-deep-import] editors/code/src/client.ts:5— editors/code/src/client.ts:5 imports vscode-languageclient/lib/common/utils/is, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] editors/code/src/config.ts:1— editors/code/src/config.ts:1 imports vscode-languageclient/lib/common/utils/is, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Ty::hir_fmt (cyclomatic 117) crates/hir-ty/src/display.rs:1282— Ty::hir_fmt has cyclomatic complexity 117 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TokenStream::from_str (cyclomatic 60) crates/proc-macro-srv/src/token_stream.rs:50— TokenStream::from_str has cyclomatic complexity 60 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
SymbolCollector::collect_from_module (cyclomatic 53) crates/hir/src/symbols.rs:197— SymbolCollector::collect_from_module has cyclomatic complexity 53 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
SourceAnalyzer::resolve_path (cyclomatic 45) crates/hir/src/source_analyzer.rs:1157— SourceAnalyzer::resolve_path has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ErasedFileAstId::kind_typed (cyclomatic 45) crates/span/src/ast_id.rs:198— ErasedFileAstId::kind_typed has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ModCollector::collect (cyclomatic 38) crates/hir-def/src/nameres/collector.rs:1898— ModCollector::collect has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DiagnosticsCollector::collect_impl (cyclomatic 34) crates/hir/src/diagnostics.rs:924— DiagnosticsCollector::collect_impl has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UnsafeVisitor::walk_expr (cyclomatic 33) crates/hir-ty/src/diagnostics/unsafe_check.rs:266— UnsafeVisitor::walk_expr has cyclomatic complexity 33 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
client.createClient (cyclomatic 33) editors/code/src/client.ts:13— client.createClient has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 6 of the 33 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 60, 197, 84, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ExpressionStore::visit_expr_children (cyclomatic 32) crates/hir-def/src/expr_store.rs:671— ExpressionStore::visit_expr_children has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Path::hir_fmt (cyclomatic 29) crates/hir-ty/src/display.rs:2682— Path::hir_fmt has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tt::storage::encode (cyclomatic 28) crates/tt/src/storage.rs:332— tt::storage::encode has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
CompletionRelevance::score (cyclomatic 27) crates/ide-completion/src/item.rs:287— CompletionRelevance::score has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: CompletionItemKind::tag (cyclomatic 37) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
SemanticsImpl::descend_into_macros_impl (cyclomatic 26) crates/hir/src/semantics.rs:1237— SemanticsImpl::descend_into_macros_impl has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scip::run (cyclomatic 26) crates/rust-analyzer/src/cli/scip.rs:24— Scip::run has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NameRefClass::classify (cyclomatic 25) crates/ide-db/src/defs.rs:745— NameRefClass::classify has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Definition::docs_with_rangemap (cyclomatic 26) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
Ctx::transform_path_ (cyclomatic 25) crates/ide-db/src/path_transform.rs:355— Ctx::transform_path_ has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImportMap::collect_import_map (cyclomatic 24) crates/hir-def/src/import_map.rs:136— ImportMap::collect_import_map has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CastCheck::do_check (cyclomatic 24) crates/hir-ty/src/infer/cast.rs:162— CastCheck::do_check has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Pat::hir_fmt (cyclomatic 23) crates/hir-ty/src/diagnostics/match_check.rs:307— Pat::hir_fmt has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FunctionBody::analyze_container (cyclomatic 23) crates/ide-assists/src/handlers/extract_function.rs:844— FunctionBody::analyze_container has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
SourceToDefCtx::container_to_def (cyclomatic 22) crates/hir/src/semantics/source_to_def.rs:616— SourceToDefCtx::container_to_def has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Context::add_constraints_from_ty (cyclomatic 21) crates/hir-ty/src/variance.rs:177— Context::add_constraints_from_ty has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
NotifyActor::run (cyclomatic 21) crates/vfs-notify/src/lib.rs:99— NotifyActor::run has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SolverContext::compute_goal_fast_path (cyclomatic 20) crates/hir-ty/src/next_solver/solver.rs:285— SolverContext::compute_goal_fast_path has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
debug.getDebugConfiguration (cyclomatic 20) editors/code/src/debug.ts:81— debug.getDebugConfiguration has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BuiltinDeriveImplTrait::get_method (cyclomatic 19) crates/hir-def/src/builtin_derive.rs:45— BuiltinDeriveImplTrait::get_method has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ProbeContext::consider_probe (cyclomatic 19) crates/hir-ty/src/method_resolution/probe.rs:1567— ProbeContext::consider_probe has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MirEvalError::pretty_print (cyclomatic 19) crates/hir-ty/src/mir/eval.rs:381— MirEvalError::pretty_print has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ProjectFolders::new (cyclomatic 19) crates/load-cargo/src/lib.rs:215— ProjectFolders::new has cyclomatic complexity 19 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
MacroCallId::expand_speculative (cyclomatic 18) crates/hir-expand/src/lib.rs:788— MacroCallId::expand_speculative has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MirBody::walk_places (cyclomatic 18) crates/hir-ty/src/mir.rs:1074— MirBody::walk_places has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
BestObligation::visit_goal (cyclomatic 18) crates/hir-ty/src/next_solver/infer/errors.rs:535— BestObligation::visit_goal has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
TtTreeSink::token (cyclomatic 18) crates/syntax-bridge/src/lib.rs:933— TtTreeSink::token has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ungrammar::lexer::advance (cyclomatic 18) lib/ungrammar/src/lexer.rs:73— ungrammar::lexer::advance has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
CargoWorkspace::new (cyclomatic 17) crates/project-model/src/cargo_workspace.rs:349— CargoWorkspace::new has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Sysroot::load_workspace (cyclomatic 17) crates/project-model/src/sysroot.rs:249— Sysroot::load_workspace has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UseTree::expand_impl (cyclomatic 16) crates/hir-def/src/item_tree.rs:736— UseTree::expand_impl has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
DefMap::resolve_path_fp_with_macro_single (cyclomatic 16) crates/hir-def/src/nameres/path_resolution.rs:242— DefMap::resolve_path_fp_with_macro_single has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
FunctionSignature::with_source_map (cyclomatic 16) crates/hir-def/src/signatures.rs:631— FunctionSignature::with_source_map has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Filler::fill_body (cyclomatic 16) crates/hir-ty/src/mir/monomorphization.rs:162— Filler::fill_body has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Generalizer::tys (cyclomatic 16) crates/hir-ty/src/next_solver/infer/relate/generalize.rs:434— Generalizer::tys has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CompletionContext::new (cyclomatic 16) crates/ide-completion/src/context.rs:747— CompletionContext::new has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProjectWorkspace::load_cargo (cyclomatic 16) crates/project-model/src/workspace.rs:209— ProjectWorkspace::load_cargo has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
AstIdMap::from_source (cyclomatic 16) crates/span/src/ast_id.rs:633— AstIdMap::from_source has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: ErasedFileAstIdKind::syntax_kind (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
FixmeComment repeated across 16 files crates/hir-def/src/expr_store/lower.rs:444— The identical FixmeComment appears in 16 files (23 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 23 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// FIXME". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
Ty::hir_fmt (cognitive 149) crates/hir-ty/src/display.rs:1282— Ty::hir_fmt has cognitive complexity 149 (threshold 15). Drivers by points: if/else 46 (102 pts), match/switch 21 (42 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 78). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiagnosticsCollector::collect_impl (cognitive 75) crates/hir/src/diagnostics.rs:924— DiagnosticsCollector::collect_impl has cognitive complexity 75 (threshold 15). Drivers by points: if/else 16 (45 pts), match/switch 4 (12 pts), loops 3 (11 pts), boolean chains 7 (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Path::hir_fmt (cognitive 73) crates/hir-ty/src/display.rs:2682— Path::hir_fmt has cognitive complexity 73 (threshold 15). Drivers by points: if/else 14 (42 pts), match/switch 5 (18 pts), loops 4 (11 pts), boolean chains 2 (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scip::run (cognitive 57) crates/rust-analyzer/src/cli/scip.rs:24— Scip::run has cognitive complexity 57 (threshold 15). Drivers by points: if/else 20 (40 pts), match/switch 3 (9 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SymbolCollector::collect_from_module (cognitive 48) crates/hir/src/symbols.rs:197— SymbolCollector::collect_from_module has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (17 pts), match/switch 9 (16 pts), loops 8 (10 pts), boolean chains 5 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImportMap::collect_import_map (cognitive 48) crates/hir-def/src/import_map.rs:136— ImportMap::collect_import_map has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (22 pts), match/switch 4 (20 pts), loops 3 (6 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Ctx::transform_path_ (cognitive 46) crates/ide-db/src/path_transform.rs:355— Ctx::transform_path_ has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (36 pts), boolean chains 5, match/switch 2 (5 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TokenStream::from_str (cognitive 45) crates/proc-macro-srv/src/token_stream.rs:50— TokenStream::from_str has cognitive complexity 45 (threshold 15). Drivers by points: if/else 20 (41 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Config::apply_change_with_sink (cognitive 45) crates/rust-analyzer/src/config.rs:1203— Config::apply_change_with_sink has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (21 pts), match/switch 5 (17 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
client.createClient (cognitive 44) editors/code/src/client.ts:13— client.createClient has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 6, match/switch 1 (5 pts), loops 2, ternaries 2 (nesting depth added 16). Most of this is not in the body itself: 4 of the 44 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 60, 197, 169, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Sysroot::load_workspace (cognitive 40) crates/project-model/src/sysroot.rs:249— Sysroot::load_workspace has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 4 (11 pts), match/switch 1 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TtTreeSink::token (cognitive 37) crates/syntax-bridge/src/lib.rs:933— TtTreeSink::token has cognitive complexity 37 (threshold 15). Drivers by points: match/switch 7 (22 pts), if/else 5 (11 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 22). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Pat::hir_fmt (cognitive 36) crates/hir-ty/src/diagnostics/match_check.rs:307— Pat::hir_fmt has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 5 (11 pts), boolean chains 2 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ExprValidator::check_for_unnecessary_else (cognitive 35) crates/hir-ty/src/diagnostics/expr.rs:499— ExprValidator::check_for_unnecessary_else has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (27 pts), loops 1 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Filler::fill_body (cognitive 35) crates/hir-ty/src/mir/monomorphization.rs:162— Filler::fill_body has cognitive complexity 35 (threshold 15). Drivers by points: match/switch 5 (20 pts), loops 5 (13 pts), if/else 1 (2 pts) (nesting depth added 24). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ProjectFolders::new (cognitive 34) crates/load-cargo/src/lib.rs:215— ProjectFolders::new has cognitive complexity 34 (threshold 15). Drivers by points: loops 10 (18 pts), if/else 5 (10 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 16). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
Matcher::attempt_match_token_tree (cognitive 33) crates/ide-ssr/src/matching.rs:443— Matcher::attempt_match_token_tree has cognitive complexity 33 (threshold 15). Drivers by points: if/else 5 (16 pts), match/switch 4 (12 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SourceToDefCtx::container_to_def (cognitive 32) crates/hir/src/semantics/source_to_def.rs:616— SourceToDefCtx::container_to_def has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (26 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UnsafeVisitor::walk_expr (cognitive 31) crates/hir-ty/src/diagnostics/unsafe_check.rs:266— UnsafeVisitor::walk_expr has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 5 (8 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
MirEvalError::pretty_print (cognitive 31) crates/hir-ty/src/mir/eval.rs:381— MirEvalError::pretty_print has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 9 (28 pts), loops 2 (3 pts) (nesting depth added 20). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
AstIdMap::from_source (cognitive 30) crates/span/src/ast_id.rs:633— AstIdMap::from_source has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 3 (7 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 15). Of this number, 29 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
debug.getDebugConfiguration (cognitive 28) editors/code/src/debug.ts:81— debug.getDebugConfiguration has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 2 (4 pts), boolean chains 3, ternaries 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CompletionRelevance::score (cognitive 27) crates/ide-completion/src/item.rs:287— CompletionRelevance::score has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (21 pts), match/switch 4 (6 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
MirBody::walk_places (cognitive 26) crates/hir-ty/src/mir.rs:1074— MirBody::walk_places has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 6 (18 pts), loops 3 (8 pts) (nesting depth added 17). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
NameRefClass::classify (cognitive 26) crates/ide-db/src/defs.rs:745— NameRefClass::classify has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 6 (11 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImportScope::find_insert_use_container (cognitive 26) crates/ide-db/src/imports/insert_use.rs:74— ImportScope::find_insert_use_container has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (24 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ErasedFileAstId::kind_typed (cognitive 26) crates/span/src/ast_id.rs:198— ErasedFileAstId::kind_typed has cognitive complexity 26 (threshold 15). Drivers by points: if/else 24, match/switch 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SyntaxEditor::add_generic_param (cognitive 26) crates/syntax/src/syntax_editor/edits.rs:113— SyntaxEditor::add_generic_param has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (25 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
TraitImpls::collect_def_map::collect (cognitive 25) crates/hir-ty/src/method_resolution.rs:735— TraitImpls::collect_def_map::collect has cognitive complexity 25 (threshold 15). Drivers by points: loops 5 (10 pts), if/else 3 (9 pts), match/switch 2 (6 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AdtDef::new (cognitive 25) crates/hir-ty/src/next_solver/interner.rs:472— AdtDef::new has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
config.substituteVariablesInEnv (cognitive 24) editors/code/src/config.ts:482— config.substituteVariablesInEnv has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 5 (7 pts), boolean chains 3 (nesting depth added 9). Of this number, 18 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bootstrap.getServer (cognitive 24) REDACTED:36— bootstrap.getServer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (5 pts), boolean chains 1, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Diagnostics::run_ (cognitive 23) crates/rust-analyzer/src/cli/diagnostics.rs:25— Diagnostics::run_ has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts), match/switch 1 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FulfillmentCtxt::try_evaluate_obligations (cognitive 22) crates/hir-ty/src/next_solver/fulfill.rs:156— FulfillmentCtxt::try_evaluate_obligations has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 3 (8 pts), loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Query::search_maps (cognitive 22) crates/ide-db/src/symbol_index.rs:581— Query::search_maps has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 6, loops 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CargoWorkspace::new (cognitive 22) crates/project-model/src/cargo_workspace.rs:349— CargoWorkspace::new has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 6 (8 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 7). Of this number, 16 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Trait::hir_fmt (cognitive 21) crates/hir/src/display.rs:900— Trait::hir_fmt has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 1 (4 pts), loops 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BuiltinDeriveImplTrait::get_method (cognitive 21) crates/hir-def/src/builtin_derive.rs:45— BuiltinDeriveImplTrait::get_method has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 13 (21 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
BindingsBuilder::build_inner (cognitive 21) crates/mbe/src/expander/matcher.rs:220— BindingsBuilder::build_inner has cognitive complexity 21 (threshold 15). Drivers by points: loops 4 (14 pts), if/else 1 (5 pts), match/switch 1 (2 pts) (nesting depth added 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
EditPlan::build (cognitive 21) crates/syntax/src/syntax_editor/edit_algo.rs:71— EditPlan::build has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 5, match/switch 1 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InactiveReason::fmt (cognitive 20) crates/cfg/src/lib.rs:244— InactiveReason::fmt has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 2 (6 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MacroCallId::expand_speculative (cognitive 20) crates/hir-expand/src/lib.rs:788— MacroCallId::expand_speculative has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 3, boolean chains 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
InferCtxt::query_response_instantiation_guess (cognitive 20) crates/hir-ty/src/next_solver/infer/canonical/instantiate.rs:322— InferCtxt::query_response_instantiation_guess has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (4 pts), loops 3, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Anchor::from (cognitive 20) crates/ide-assists/src/handlers/extract_variable.rs:488— Anchor::from has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReplacementRenderer::render_token (cognitive 20) crates/ide-ssr/src/replacing.rs:129— ReplacementRenderer::render_token has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CargoOptions::apply_on_command (cognitive 20) crates/rust-analyzer/src/flycheck.rs:67— CargoOptions::apply_on_command has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 1 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MirPrettyCtx::blocks (cognitive 19) crates/hir-ty/src/mir/pretty.rs:238— MirPrettyCtx::blocks has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (12 pts), loops 3 (7 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Canonicalizer::fold_ty (cognitive 19) crates/hir-ty/src/next_solver/infer/canonical/canonicalizer.rs:328— Canonicalizer::fold_ty has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (3 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
CompletionContext::new (cognitive 19) crates/ide-completion/src/context.rs:747— CompletionContext::new has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 5 (6 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeclarativeMacro::parse_macro2 (cognitive 19) crates/mbe/src/lib.rs:193— DeclarativeMacro::parse_macro2 has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (5 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CfgExpr::parse_from_ast (cognitive 18) crates/cfg/src/cfg_expr.rs:109— CfgExpr::parse_from_ast has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 4 (8 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
UseTree::expand_impl (cognitive 18) crates/hir-def/src/item_tree.rs:736— UseTree::expand_impl has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (9 pts), if/else 3 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). Of this number, 14 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
MatchCheckCtx::ctors_for_ty (cognitive 18) crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs:406— MatchCheckCtx::ctors_for_ty has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 1 (4 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
CastCheck::do_check (cognitive 18) crates/hir-ty/src/infer/cast.rs:162— CastCheck::do_check has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 6 (14 pts), if/else 1 (4 pts) (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ProcMacroServerProcess::run (cognitive 18) crates/proc-macro-api/src/process.rs:125— ProcMacroServerProcess::run has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 3 (8 pts), if/else 5 (7 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
stdx::process::imp::read2 (cognitive 18) crates/stdx/src/process.rs:88— stdx::process::imp::read2 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SyntaxTreeProvider.getElementByRange (cognitive 18) editors/code/src/syntax_tree_provider.ts:138— SyntaxTreeProvider.getElementByRange has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
commands.asWorkspaceSnippetEdit (cognitive 18) editors/code/src/commands.ts:1147— commands.asWorkspaceSnippetEdit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UseTreeLowering::lower_use_tree (cognitive 17) crates/hir-def/src/item_tree/lower.rs:462— UseTreeLowering::lower_use_tree has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 4 (7 pts), boolean chains 1 (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Scope::process_names (cognitive 17) crates/hir-def/src/resolver.rs:1053— Scope::process_names has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 2 (5 pts), loops 2 (4 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
FunctionSignature::with_source_map (cognitive 17) crates/hir-def/src/signatures.rs:631— FunctionSignature::with_source_map has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15 (16 pts), match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CoerceMany::coerce_inner (cognitive 17) crates/hir-ty/src/infer/coerce.rs:1295— CoerceMany::coerce_inner has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 3 (6 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PathLoweringContext::substs_from_args_and_bindings (cognitive 17) crates/hir-ty/src/lower/path.rs:680— PathLoweringContext::substs_from_args_and_bindings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 4, boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceFudger::fold_ty (cognitive 17) crates/hir-ty/src/next_solver/infer/snapshot/fudge.rs:179— InferenceFudger::fold_ty has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GeneratedFunctionTarget::insert_fn_at (cognitive 17) crates/ide-assists/src/handlers/generate_function.rs:618— GeneratedFunctionTarget::insert_fn_at has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (4 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ScriptSource::parse (cognitive 17) crates/parser/src/frontmatter.rs:28— ScriptSource::parse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 4). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
LexedStr::to_input (cognitive 17) crates/parser/src/shortcuts.rs:28— LexedStr::to_input has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Function::hir_fmt (cognitive 16) crates/hir/src/display.rs:90— Function::hir_fmt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 3 (4 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AssocItemCollector::record_item (cognitive 16) crates/hir-def/src/nameres/assoc.rs:261— AssocItemCollector::record_item has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (6 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
HirFormatter::format_bounds_with (cognitive 16) crates/hir-ty/src/display.rs:180— HirFormatter::format_bounds_with has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DbInterner::unsizing_params_for_adt (cognitive 16) crates/hir-ty/src/next_solver/interner.rs:1893— DbInterner::unsizing_params_for_adt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), match/switch 4 (6 pts), loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MatchFinder::output_debug_for_nodes_at_range (cognitive 16) crates/ide-ssr/src/lib.rs:252— MatchFinder::output_debug_for_nodes_at_range has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SourceRootConfig::source_root_parent_map (cognitive 16) crates/load-cargo/src/lib.rs:427— SourceRootConfig::source_root_parent_map has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LsifManager::add_token (cognitive 16) crates/rust-analyzer/src/cli/lsif.rs:155— LsifManager::add_token has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
line_index::analyze_source_file_sse2 (cognitive 16) lib/line-index/src/lib.rs:262— line_index::analyze_source_file_sse2 has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D22 · Internal API Consistency· Duplicate read operation across different types. `SourceDatabase` is the primary database trait, but `Files` exposes an identical `file_text` method. This suggests `Files` is either a redundant wrapper or a legacy alias, creating confusion about which type to use for reading file content. · ×1
Duplicate read operation across different types. `SourceDatabase` is the primary database trait, but `Files` exposes an identical `file_text` method. This suggests `Files` is either a redundant wrapper or a legacy alias, creating confusion about which type to use for reading file content. — Remove `Files.file_text` and rely solely on `SourceDatabase.file_text`. If `Files` is intended for bulk operations, rename it to `FilesBatch` or similar to distinguish it from the single-item query interface. (signatures: SourceDatabase.file_text(file_id: FileId): FileText | Files.file_text(file_id: FileId): FileText)
D22 · Internal API Consistency· Duplicate write operation with inconsistent signatures. `SourceDatabase` has `set_file_text` as a direct method, while `Files` has `set_file_text` that takes the database as an explicit argument. This inconsistency in how the database context is passed (implicit receiver vs explicit parameter) is confusing. · ×1
Duplicate write operation with inconsistent signatures. `SourceDatabase` has `set_file_text` as a direct method, while `Files` has `set_file_text` that takes the database as an explicit argument. This inconsistency in how the database context is passed (implicit receiver vs explicit parameter) is confusing. — Standardize on the `SourceDatabase` trait method. Remove the `Files` wrapper for this operation or rename it to `Files::set_file_text_on` if it must exist, but ideally remove `Files` for single-item mutations. (signatures: SourceDatabase.set_file_text(file_id: FileId, text: str) | Files.set_file_text(db: &mut dyn SourceDatabase, file_id: FileId, text: str))
D22 · Internal API Consistency· Same duplication issue as above for the durability-aware variant. `Files` duplicates the functionality of `SourceDatabase` with an inconsistent signature (explicit db parameter). · ×1
Same duplication issue as above for the durability-aware variant. `Files` duplicates the functionality of `SourceDatabase` with an inconsistent signature (explicit db parameter). — Remove `Files.set_file_text_with_durability` and use `SourceDatabase.set_file_text_with_durability` directly. (signatures: SourceDatabase.set_file_text_with_durability(file_id: FileId, text: str, durability: Durability) | Files.set_file_text_with_durability(db: &mut dyn SourceDatabase, file_id: FileId, text: str, durability: Durability))
D22 · Internal API Consistency· Duplicate read operation. `Files.source_root` duplicates `SourceDatabase.source_root` with inconsistent signature (explicit db parameter in `Files`). · ×1
Duplicate read operation. `Files.source_root` duplicates `SourceDatabase.source_root` with inconsistent signature (explicit db parameter in `Files`). — Remove `Files.source_root` and rely on `SourceDatabase.source_root`. (signatures: SourceDatabase.source_root(id: SourceRootId): SourceRootInput | Files.source_root(source_root_id: SourceRootId): SourceRootInput)
D22 · Internal API Consistency· Duplicate read operation. `Files.file_source_root` duplicates `SourceDatabase.file_source_root` with inconsistent signature. · ×1
Duplicate read operation. `Files.file_source_root` duplicates `SourceDatabase.file_source_root` with inconsistent signature. — Remove `Files.file_source_root` and rely on `SourceDatabase.file_source_root`. (signatures: SourceDatabase.file_source_root(id: FileId): FileSourceRootInput | Files.file_source_root(db: &dyn SourceDatabase, id: FileId): FileSourceRootInput)
D22 · Internal API Consistency· Duplicate write operation. `Files.set_source_root_with_durability` duplicates `SourceDatabase.set_source_root_with_durability` with inconsistent signature. · ×1
TooManyFields: GlobalState crates/rust-analyzer/src/global_state.rs:86— TooManyFields — 49 stored fields beside 51 methods. The bar is 30 stored fields; this is 19 over it, 1.63× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
D30 · Dependency Vulnerabilities· Medium advisory (unmaintained) · ×1
REDACTED
D30 · Dependency Vulnerabilities· Medium advisory (unsound) · ×1
Change-coupling hub: mutability.rs → expr_store.rs, pretty.rs, expr.rs crates/hir-ty/src/infer/mutability.rs— `crates/hir-ty/src/infer/mutability.rs` changes together with 3 other files — `crates/hir-def/src/expr_store.rs`, `crates/hir-def/src/expr_store/pretty.rs`, `crates/hir-ty/src/diagnostics/expr.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
D4 · Code Duplication· Near-duplicate member family (6 members, 7 shared lines) · ×1
Near-duplicate member family (6 members, 7 shared lines) crates/syntax/src/ast/syntax_factory/constructors.rs:1568— crates/syntax/src/ast/syntax_factory/constructors.rs:1568-1597 | crates/syntax/src/ast/syntax_factory/constructors.rs:1724-1743 | crates/syntax/src/ast/syntax_factory/constructors.rs:1767-1785 | crates/syntax/src/ast/syntax_factory/constructors.rs:1795-1839 | crates/syntax/src/ast/syntax_factory/constructors.rs:1865-1902 | crates/syntax/src/ast/syntax_factory/constructors.rs:2198-2229 — These 6 members are variants of one another: a block of 7 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Near-duplicate member family (5 members, 8 shared lines) · ×1
Near-duplicate member family (5 members, 8 shared lines) crates/syntax/src/ast/syntax_factory/constructors.rs:459— crates/syntax/src/ast/syntax_factory/constructors.rs:459-470 | crates/syntax/src/ast/syntax_factory/constructors.rs:863-874 | crates/syntax/src/ast/syntax_factory/constructors.rs:1083-1094 | crates/syntax/src/ast/syntax_factory/constructors.rs:1139-1150 | crates/syntax/src/ast/syntax_factory/constructors.rs:1599-1610 — These 5 members are variants of one another: a block of 8 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Near-duplicate member pair (29 shared lines) crates/syntax/src/ast/syntax_factory/constructors.rs:342— crates/syntax/src/ast/syntax_factory/constructors.rs:342-386 | crates/syntax/src/ast/syntax_factory/constructors.rs:2152-2189 — These two members are variants of one another: 29 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (15 shared lines) crates/hir-ty/src/consteval.rs:157— crates/hir-ty/src/consteval.rs:157-208 | crates/hir-ty/src/next_solver/ty.rs:683-712 — These two members are variants of one another: 15 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×1
Edited copy of a member (29 corresponding lines) crates/proc-macro-srv/src/token_stream.rs:689— crates/proc-macro-srv/src/token_stream.rs:689-723 | crates/tt/src/lib.rs:437-486 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×1
Edited copy of a member (11 corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs:1314— crates/syntax/src/ast/syntax_factory/constructors.rs:1314-1325 | crates/syntax/src/ast/syntax_factory/constructors.rs:1332-1344 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (22 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (22 members, 50+ identical tokens) crates/syntax/src/ast/syntax_factory/constructors.rs:54— crates/syntax/src/ast/syntax_factory/constructors.rs:54-64 | crates/syntax/src/ast/syntax_factory/constructors.rs:195-205 | crates/syntax/src/ast/syntax_factory/constructors.rs:207-217 | crates/syntax/src/ast/syntax_factory/constructors.rs:472-482 | crates/syntax/src/ast/syntax_factory/constructors.rs:500-510 | crates/syntax/src/ast/syntax_factory/constructors.rs:693-703 | crates/syntax/src/ast/syntax_factory/constructors.rs:746-756 | crates/syntax/src/ast/syntax_factory/constructors.rs:758-768 | crates/syntax/src/ast/syntax_factory/constructors.rs:876-886 | crates/syntax/src/ast/syntax_factory/constructors.rs:933-943 | crates/syntax/src/ast/syntax_factory/constructors.rs:949-959 | crates/syntax/src/ast/syntax_factory/constructors.rs:978-988 | crates/syntax/src/ast/syntax_factory/constructors.rs:1058-1068 | crates/syntax/src/ast/syntax_factory/constructors.rs:1127-1137 | crates/syntax/src/ast/syntax_factory/constructors.rs:1359-1369 | crates/syntax/src/ast/syntax_factory/constructors.rs:1423-1433 | crates/syntax/src/ast/syntax_factory/constructors.rs:1506-1516 | crates/syntax/src/ast/syntax_factory/constructors.rs:1518-1528 | crates/syntax/src/ast/syntax_factory/constructors.rs:2021-2031 | crates/syntax/src/ast/syntax_factory/constructors.rs:2033-2043 | crates/syntax/src/ast/syntax_factory/constructors.rs:2231-2240 | crates/syntax/src/ast/syntax_factory/constructors.rs:2280-2290 — These 22 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 22 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 22 times.
Duplicated block (42 lines × 2) crates/hir-def/src/visibility.rs:173— crates/hir-def/src/visibility.rs:173-214 | crates/hir-def/src/visibility.rs:239-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (33 lines × 2) crates/hir/src/term_search/expr.rs:187— crates/hir/src/term_search/expr.rs:187-219 | crates/hir/src/term_search/expr.rs:229-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (30–33 lines × 2) lib/line-index/src/lib.rs:317— lib/line-index/src/lib.rs:317-349 | lib/line-index/src/lib.rs:419-448 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (31 lines × 2) crates/hir-ty/src/next_solver/interner.rs:1521— crates/hir-ty/src/next_solver/interner.rs:1521-1551 | crates/hir-ty/src/next_solver/interner.rs:1583-1613 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21–24 lines × 2) crates/ide-completion/src/completions/expr.rs:120— crates/ide-completion/src/completions/expr.rs:120-140 | crates/ide-completion/src/completions/expr.rs:189-212 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21–23 lines × 2) crates/syntax/src/ast/syntax_factory/constructors.rs:999— crates/syntax/src/ast/syntax_factory/constructors.rs:999-1021 | crates/syntax/src/ast/syntax_factory/constructors.rs:1032-1052 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 3) crates/hir-ty/src/diagnostics/decl_check.rs:327— crates/hir-ty/src/diagnostics/decl_check.rs:327-348 | crates/hir-ty/src/diagnostics/decl_check.rs:417-438 | crates/hir-ty/src/diagnostics/decl_check.rs:578-599 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (22 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:1197— crates/rust-analyzer/src/cli/analysis_stats.rs:1197-1218 | crates/rust-analyzer/src/cli/analysis_stats.rs:1276-1297 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5–20 lines × 3) crates/hir-ty/src/mir/eval.rs:2471— crates/hir-ty/src/mir/eval.rs:2471-2490 | crates/hir-ty/src/mir/eval.rs:2502-2519 | crates/hir-ty/src/mir/eval.rs:3153-3157 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16–20 lines × 2) crates/ide-completion/src/completions/expr.rs:203— crates/ide-completion/src/completions/expr.rs:203-222 | crates/ide-completion/src/completions/type.rs:115-130 — before extracting anything, compare `crates/ide-completion/src/completions/expr.rs` and `crates/ide-completion/src/completions/type.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 3) crates/hir-ty/src/diagnostics/decl_check.rs:357— crates/hir-ty/src/diagnostics/decl_check.rs:357-375 | crates/hir-ty/src/diagnostics/decl_check.rs:445-463 | crates/hir-ty/src/diagnostics/decl_check.rs:608-626 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16–18 lines × 2) crates/ide-completion/src/completions/expr.rs:131— crates/ide-completion/src/completions/expr.rs:131-148 | crates/ide-completion/src/completions/type.rs:72-87 — before extracting anything, compare `crates/ide-completion/src/completions/expr.rs` and `crates/ide-completion/src/completions/type.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17–18 lines × 2) crates/ide-diagnostics/src/handlers/unlinked_file.rs:130— crates/ide-diagnostics/src/handlers/unlinked_file.rs:130-147 | crates/ide-diagnostics/src/handlers/unlinked_file.rs:190-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 3) crates/proc-macro-srv/src/token_stream.rs:115— crates/proc-macro-srv/src/token_stream.rs:115-131 | crates/proc-macro-srv/src/token_stream.rs:143-159 | crates/proc-macro-srv/src/token_stream.rs:171-187 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16 lines × 3) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:152— crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:152-167 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:228-243 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:270-285 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10–15 lines × 2) crates/hir-def/src/nameres/collector.rs:2147— crates/hir-def/src/nameres/collector.rs:2147-2161 | crates/hir-def/src/nameres/collector.rs:2169-2178 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 5) crates/hir-expand/src/fixup.rs:150— crates/hir-expand/src/fixup.rs:150-163 | crates/hir-expand/src/fixup.rs:180-193 | crates/hir-expand/src/fixup.rs:196-209 | crates/hir-expand/src/fixup.rs:226-239 | crates/hir-expand/src/fixup.rs:266-279 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12–14 lines × 4) crates/hir-ty/src/diagnostics/expr.rs:631— crates/hir-ty/src/diagnostics/expr.rs:631-644 | crates/hir-ty/src/diagnostics/expr.rs:674-687 | crates/hir/src/source_analyzer.rs:2185-2196 | crates/hir/src/source_analyzer.rs:2217-2228 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (11–14 lines × 2) xtask/src/codegen/lints.rs:348— xtask/src/codegen/lints.rs:348-358 | xtask/src/codegen/lints.rs:374-387 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 3) crates/syntax/src/validation.rs:328— crates/syntax/src/validation.rs:328-340 | crates/syntax/src/validation.rs:344-356 | crates/syntax/src/validation.rs:360-372 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11–12 lines × 3) crates/hir-def/src/nameres/collector.rs:2146— crates/hir-def/src/nameres/collector.rs:2146-2156 | crates/hir-def/src/nameres/collector.rs:2168-2178 | crates/hir-def/src/nameres/collector.rs:2183-2194 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8–12 lines × 3) crates/syntax/src/ast/syntax_factory/constructors.rs:1820— crates/syntax/src/ast/syntax_factory/constructors.rs:1820-1831 | crates/syntax/src/ast/syntax_factory/constructors.rs:1950-1957 | crates/syntax/src/ast/syntax_factory/constructors.rs:2213-2222 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9–11 lines × 2) crates/hir-def/src/expr_store/lower.rs:2556— crates/hir-def/src/expr_store/lower.rs:2556-2566 | crates/hir-def/src/expr_store/lower.rs:2572-2580 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–11 lines × 2) crates/hir-ty/src/infer/op.rs:211— crates/hir-ty/src/infer/op.rs:211-218 | crates/hir-ty/src/infer/op.rs:222-232 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–11 lines × 2) crates/parser/src/grammar/expressions.rs:705— crates/parser/src/grammar/expressions.rs:705-715 | crates/parser/src/grammar/patterns.rs:407-413 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7–10 lines × 6) crates/syntax/src/ast/syntax_factory/constructors.rs:410— crates/syntax/src/ast/syntax_factory/constructors.rs:410-418 | crates/syntax/src/ast/syntax_factory/constructors.rs:674-680 | crates/syntax/src/ast/syntax_factory/constructors.rs:1816-1825 | crates/syntax/src/ast/syntax_factory/constructors.rs:1884-1893 | crates/syntax/src/ast/syntax_factory/constructors.rs:2173-2181 | crates/syntax/src/ast/syntax_factory/constructors.rs:2209-2217 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 5) crates/syntax/src/ast/syntax_factory/constructors.rs:167— crates/syntax/src/ast/syntax_factory/constructors.rs:167-176 | crates/syntax/src/ast/syntax_factory/constructors.rs:1573-1582 | crates/syntax/src/ast/syntax_factory/constructors.rs:1800-1809 | crates/syntax/src/ast/syntax_factory/constructors.rs:1868-1877 | crates/syntax/src/ast/syntax_factory/constructors.rs:2202-2211 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7–10 lines × 2) crates/ide-completion/src/completions.rs:347— crates/ide-completion/src/completions.rs:347-353 | crates/ide-completion/src/completions.rs:370-379 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 4) crates/ide-assists/src/handlers/generate_default_from_new.rs:87— crates/ide-assists/src/handlers/generate_default_from_new.rs:87-95 | crates/ide-assists/src/handlers/generate_enum_is_method.rs:92-100 | crates/ide-assists/src/handlers/generate_enum_projection_method.rs:171-179 | crates/ide-assists/src/handlers/generate_single_field_struct_from.rs:147-155 — before extracting anything, compare `crates/ide-assists/src/handlers/generate_enum_is_method.rs` and `crates/ide-assists/src/handlers/generate_enum_projection_method.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (4–9 lines × 3) crates/hir-ty/src/display.rs:891— crates/hir-ty/src/display.rs:891-894 | crates/hir-ty/src/display.rs:926-934 | crates/hir-ty/src/display.rs:956-964 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (1–9 lines × 19) crates/syntax/src/ast/syntax_factory/constructors.rs:464— crates/syntax/src/ast/syntax_factory/constructors.rs:464-464 | crates/syntax/src/ast/syntax_factory/constructors.rs:570-570 | crates/syntax/src/ast/syntax_factory/constructors.rs:627-635 | crates/syntax/src/ast/syntax_factory/constructors.rs:831-833 | crates/syntax/src/ast/syntax_factory/constructors.rs:868-868 | crates/syntax/src/ast/syntax_factory/constructors.rs:1088-1088 | crates/syntax/src/ast/syntax_factory/constructors.rs:1103-1103 | crates/syntax/src/ast/syntax_factory/constructors.rs:1144-1144 | crates/syntax/src/ast/syntax_factory/constructors.rs:1162-1162 | crates/syntax/src/ast/syntax_factory/constructors.rs:1284-1286 | crates/syntax/src/ast/syntax_factory/constructors.rs:1319-1319 | crates/syntax/src/ast/syntax_factory/constructors.rs:1337-1337 | crates/syntax/src/ast/syntax_factory/constructors.rs:1377-1385 | crates/syntax/src/ast/syntax_factory/constructors.rs:1393-1394 | crates/syntax/src/ast/syntax_factory/constructors.rs:1551-1551 | crates/syntax/src/ast/syntax_factory/constructors.rs:1587-1587 | crates/syntax/src/ast/syntax_factory/constructors.rs:1604-1604 | crates/syntax/src/ast/syntax_factory/constructors.rs:1641-1643 | crates/syntax/src/ast/syntax_factory/constructors.rs:1736-1736 — all 19 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (4–8 lines × 3) crates/hir-ty/src/next_solver/consts/valtree.rs:137— crates/hir-ty/src/next_solver/consts/valtree.rs:137-140 | crates/hir-ty/src/next_solver/consts/valtree.rs:166-173 | crates/hir-ty/src/next_solver/consts/valtree.rs:191-198 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (4–8 lines × 4) crates/rust-analyzer/src/cli/analysis_stats.rs:1505— crates/rust-analyzer/src/cli/analysis_stats.rs:1505-1508 | crates/rust-analyzer/src/cli/analysis_stats.rs:1521-1524 | crates/rust-analyzer/src/cli/analysis_stats.rs:1543-1550 | crates/rust-analyzer/src/cli/analysis_stats.rs:1564-1571 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7–8 lines × 2) crates/rust-analyzer/src/handlers/dispatch.rs:83— crates/rust-analyzer/src/handlers/dispatch.rs:83-89 | crates/rust-analyzer/src/handlers/dispatch.rs:248-255 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 11) crates/syntax/src/ast/syntax_factory/constructors.rs:90— crates/syntax/src/ast/syntax_factory/constructors.rs:90-96 | crates/syntax/src/ast/syntax_factory/constructors.rs:293-299 | crates/syntax/src/ast/syntax_factory/constructors.rs:538-545 | crates/syntax/src/ast/syntax_factory/constructors.rs:783-789 | crates/syntax/src/ast/syntax_factory/constructors.rs:925-931 | crates/syntax/src/ast/syntax_factory/constructors.rs:1075-1081 | crates/syntax/src/ast/syntax_factory/constructors.rs:1625-1631 | crates/syntax/src/ast/syntax_factory/constructors.rs:1659-1665 | crates/syntax/src/ast/syntax_factory/constructors.rs:1709-1717 | crates/syntax/src/ast/syntax_factory/constructors.rs:1753-1761 | crates/syntax/src/ast/syntax_factory/constructors.rs:1849-1857 — all 11 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 9) crates/syntax/src/ast/syntax_factory/constructors.rs:173— crates/syntax/src/ast/syntax_factory/constructors.rs:173-179 | crates/syntax/src/ast/syntax_factory/constructors.rs:1001-1007 | crates/syntax/src/ast/syntax_factory/constructors.rs:1034-1040 | crates/syntax/src/ast/syntax_factory/constructors.rs:1579-1585 | crates/syntax/src/ast/syntax_factory/constructors.rs:1728-1734 | crates/syntax/src/ast/syntax_factory/constructors.rs:1771-1777 | crates/syntax/src/ast/syntax_factory/constructors.rs:1806-1812 | crates/syntax/src/ast/syntax_factory/constructors.rs:1874-1880 | crates/syntax/src/ast/syntax_factory/constructors.rs:2208-2214 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 5) crates/syntax/src/syntax_editor/edits.rs:38— crates/syntax/src/syntax_editor/edits.rs:38-44 | crates/syntax/src/syntax_editor/edits.rs:60-66 | crates/syntax/src/syntax_editor/edits.rs:72-78 | crates/syntax/src/syntax_editor/edits.rs:90-96 | crates/syntax/src/syntax_editor/edits.rs:102-108 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 13) crates/syntax/src/ast/syntax_factory/constructors.rs:174— crates/syntax/src/ast/syntax_factory/constructors.rs:174-179 | crates/syntax/src/ast/syntax_factory/constructors.rs:181-187 | crates/syntax/src/ast/syntax_factory/constructors.rs:649-654 | crates/syntax/src/ast/syntax_factory/constructors.rs:1545-1550 | crates/syntax/src/ast/syntax_factory/constructors.rs:1580-1585 | crates/syntax/src/ast/syntax_factory/constructors.rs:1729-1734 | crates/syntax/src/ast/syntax_factory/constructors.rs:1772-1777 | crates/syntax/src/ast/syntax_factory/constructors.rs:1807-1812 | crates/syntax/src/ast/syntax_factory/constructors.rs:1823-1831 | crates/syntax/src/ast/syntax_factory/constructors.rs:1875-1880 | crates/syntax/src/ast/syntax_factory/constructors.rs:1939-1944 | crates/syntax/src/ast/syntax_factory/constructors.rs:1952-1957 | crates/syntax/src/ast/syntax_factory/constructors.rs:2215-2222 — all 13 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (1–6 lines × 13) crates/syntax/src/ast/syntax_factory/constructors.rs:465— crates/syntax/src/ast/syntax_factory/constructors.rs:465-470 | crates/syntax/src/ast/syntax_factory/constructors.rs:571-573 | crates/syntax/src/ast/syntax_factory/constructors.rs:869-874 | crates/syntax/src/ast/syntax_factory/constructors.rs:1089-1094 | crates/syntax/src/ast/syntax_factory/constructors.rs:1104-1109 | crates/syntax/src/ast/syntax_factory/constructors.rs:1145-1150 | crates/syntax/src/ast/syntax_factory/constructors.rs:1164-1169 | crates/syntax/src/ast/syntax_factory/constructors.rs:1338-1338 | crates/syntax/src/ast/syntax_factory/constructors.rs:1352-1357 | crates/syntax/src/ast/syntax_factory/constructors.rs:1552-1552 | crates/syntax/src/ast/syntax_factory/constructors.rs:1588-1588 | crates/syntax/src/ast/syntax_factory/constructors.rs:1605-1610 | crates/syntax/src/ast/syntax_factory/constructors.rs:1737-1743 — all 13 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 5) crates/syntax/src/ast/syntax_factory/constructors.rs:181— crates/syntax/src/ast/syntax_factory/constructors.rs:181-186 | crates/syntax/src/ast/syntax_factory/constructors.rs:674-679 | crates/syntax/src/ast/syntax_factory/constructors.rs:1816-1821 | crates/syntax/src/ast/syntax_factory/constructors.rs:1884-1889 | crates/syntax/src/ast/syntax_factory/constructors.rs:2173-2178 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5–6 lines × 2) crates/ide-assists/src/handlers/generate_default_from_new.rs:98— crates/ide-assists/src/handlers/generate_default_from_new.rs:98-103 | crates/ide-assists/src/utils.rs:623-627 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (2–6 lines × 20) crates/syntax/src/ast/syntax_factory/constructors.rs:57— crates/syntax/src/ast/syntax_factory/constructors.rs:57-58 | crates/syntax/src/ast/syntax_factory/constructors.rs:463-464 | crates/syntax/src/ast/syntax_factory/constructors.rs:564-569 | crates/syntax/src/ast/syntax_factory/constructors.rs:604-605 | crates/syntax/src/ast/syntax_factory/constructors.rs:625-626 | crates/syntax/src/ast/syntax_factory/constructors.rs:830-831 | crates/syntax/src/ast/syntax_factory/constructors.rs:867-868 | crates/syntax/src/ast/syntax_factory/constructors.rs:1087-1088 | crates/syntax/src/ast/syntax_factory/constructors.rs:1097-1102 | crates/syntax/src/ast/syntax_factory/constructors.rs:1118-1119 | crates/syntax/src/ast/syntax_factory/constructors.rs:1143-1144 | crates/syntax/src/ast/syntax_factory/constructors.rs:1161-1162 | crates/syntax/src/ast/syntax_factory/constructors.rs:1283-1284 | crates/syntax/src/ast/syntax_factory/constructors.rs:1305-1306 | crates/syntax/src/ast/syntax_factory/constructors.rs:1318-1319 | crates/syntax/src/ast/syntax_factory/constructors.rs:1336-1337 | crates/syntax/src/ast/syntax_factory/constructors.rs:1375-1376 | crates/syntax/src/ast/syntax_factory/constructors.rs:1603-1604 | crates/syntax/src/ast/syntax_factory/constructors.rs:1640-1641 | crates/syntax/src/ast/syntax_factory/constructors.rs:2283-2284 — all 20 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 22) crates/syntax/src/ast/syntax_factory/constructors.rs:59— crates/syntax/src/ast/syntax_factory/constructors.rs:59-64 | crates/syntax/src/ast/syntax_factory/constructors.rs:200-205 | crates/syntax/src/ast/syntax_factory/constructors.rs:212-217 | crates/syntax/src/ast/syntax_factory/constructors.rs:477-482 | crates/syntax/src/ast/syntax_factory/constructors.rs:505-510 | crates/syntax/src/ast/syntax_factory/constructors.rs:698-703 | crates/syntax/src/ast/syntax_factory/constructors.rs:751-756 | crates/syntax/src/ast/syntax_factory/constructors.rs:763-768 | crates/syntax/src/ast/syntax_factory/constructors.rs:881-886 | crates/syntax/src/ast/syntax_factory/constructors.rs:938-943 | crates/syntax/src/ast/syntax_factory/constructors.rs:954-959 | crates/syntax/src/ast/syntax_factory/constructors.rs:983-988 | crates/syntax/src/ast/syntax_factory/constructors.rs:1063-1068 | crates/syntax/src/ast/syntax_factory/constructors.rs:1132-1137 | crates/syntax/src/ast/syntax_factory/constructors.rs:1364-1369 | crates/syntax/src/ast/syntax_factory/constructors.rs:1428-1433 | crates/syntax/src/ast/syntax_factory/constructors.rs:1511-1516 | crates/syntax/src/ast/syntax_factory/constructors.rs:1523-1528 | crates/syntax/src/ast/syntax_factory/constructors.rs:2026-2031 | crates/syntax/src/ast/syntax_factory/constructors.rs:2038-2043 | crates/syntax/src/ast/syntax_factory/constructors.rs:2236-2240 | crates/syntax/src/ast/syntax_factory/constructors.rs:2285-2290 — all 22 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (3–5 lines × 5) crates/ide/src/highlight_related.rs:315— crates/ide/src/highlight_related.rs:315-319 | crates/ide/src/highlight_related.rs:398-402 | crates/ide/src/highlight_related.rs:505-509 | crates/ide/src/highlight_related.rs:598-602 | crates/ide/src/highlight_related.rs:798-800 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (3–5 lines × 3) crates/ide-assists/src/handlers/extract_function.rs:1510— crates/ide-assists/src/handlers/extract_function.rs:1510-1514 | crates/ide-assists/src/handlers/extract_function.rs:1529-1533 | crates/ide-assists/src/handlers/extract_function.rs:1535-1537 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (3–5 lines × 4) crates/rust-analyzer/src/cli/analysis_stats.rs:1500— crates/rust-analyzer/src/cli/analysis_stats.rs:1500-1504 | crates/rust-analyzer/src/cli/analysis_stats.rs:1516-1520 | crates/rust-analyzer/src/cli/analysis_stats.rs:1538-1540 | crates/rust-analyzer/src/cli/analysis_stats.rs:1559-1561 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 4) crates/parser/src/lexed_str.rs:349— crates/parser/src/lexed_str.rs:349-353 | crates/parser/src/lexed_str.rs:361-365 | crates/parser/src/lexed_str.rs:373-377 | crates/parser/src/lexed_str.rs:387-391 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Unstable project test-fixture — test-fixture has instability 0.90 with 1 dependents.
M1 · Documentation (README)· README may be stale · ×1
README may be stale — 741 code files changed in the last 6 months but the README was not touched — it may no longer reflect the system.
P12 · CI test-gate honesty· Coverage collected but not gated · ×1
Coverage collected but not gated — CI collects a coverage report but no step enforces a minimum — coverage could halve and CI stays green. Add a step that fails the build when coverage drops below a floor (your coverage tool's minimum-threshold flag, or a coverage-gate action) so the number guards something. What was searched, so you can tell an absence from a miss: this repository's CI files AND its coverage configuration — the well-known coverage and test-runner config files, read at the repository root and inside workspace package directories two levels down, so a floor declared beside the tests rather than in the pipeline is credited — matched against the threshold settings this check knows by name. A floor set in your coverage service's web UI rather than in a committed file, or under a setting whose name is not one of those, is not seen here.
Sync-over-async blocking editors/code/tests/runTests.ts:6— `main` is async and calls readFileSync — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Duplicated block (36 lines × 2 locations) editors/code/src/commands.ts:210— editors/code/src/commands.ts:210 · editors/code/src/commands.ts:247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34 lines × 2 locations) editors/code/src/commands.ts:722— editors/code/src/commands.ts:722 · editors/code/src/commands.ts:786 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (16 lines × 3 locations) editors/code/src/commands.ts:622— editors/code/src/commands.ts:622 · editors/code/src/commands.ts:727 · editors/code/src/commands.ts:791 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 2 locations) editors/code/src/commands.ts:648— editors/code/src/commands.ts:648 · editors/code/src/commands.ts:817 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (11 lines × 2 locations) editors/code/src/commands.ts:102— editors/code/src/commands.ts:102 · editors/code/src/commands.ts:279 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (10 matched lines × 2 locations) · ×1
Duplicated block with local edits (10 matched lines × 2 locations) REDACTED:203— REDACTED:203 · editors/code/src/ctx.ts:223 — the two spans are one implementation copied and then locally edited — 58 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (10 lines × 4 locations) editors/code/src/commands.ts:55— editors/code/src/commands.ts:55 · editors/code/src/commands.ts:770 · editors/code/src/commands.ts:836 · editors/code/src/commands.ts:966 — all 4 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (8 lines × 2 locations) editors/code/src/commands.ts:767— editors/code/src/commands.ts:767 · editors/code/src/commands.ts:833 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Complex function getDebugConfiguration (cyclomatic 20, cognitive 28) editors/code/src/debug.ts:81— getDebugConfiguration has cyclomatic complexity 20 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function toggleCheckOnSave (cyclomatic 16, cognitive 15) editors/code/src/config.ts:305— toggleCheckOnSave has cyclomatic complexity 16 and cognitive complexity 15; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function getServer (cyclomatic 15, cognitive 25) REDACTED:36— getServer has cyclomatic complexity 15 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 15, cognitive 21) editors/code/src/client.ts:60— (anonymous) has cyclomatic complexity 15 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function substituteVariablesInEnv (cyclomatic 13, cognitive 20) editors/code/src/config.ts:482— substituteVariablesInEnv has cyclomatic complexity 13 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Unused dependency '@hpcc-js/wasm' — Declared in editors/code/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency 'd3' — Declared in editors/code/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency 'd3-graphviz' — Declared in editors/code/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 13 significant file(s) lose their only recent owner: crates/hir-ty/src/next_solver/infer/region_constraints/mod.rs, crates/hir-ty/src/infer/fallback.rs, crates/ide-diagnostics/src/handlers/generic_args_prohibited.rs, crates/hir-ty/src/upvars.rs, crates/ide-diagnostics/src/handlers/inactive_code.rs, crates/hir-ty/src/next_solver/infer/unify_key.rs, crates/ide-diagnostics/src/handlers/field_shorthand.rs, crates/parser/src/grammar/params.rs (+5 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 7 significant file(s) lose their only recent owner: crates/ide/src/inlay_hints/closure_captures.rs, crates/rust-analyzer/src/session.rs, crates/ide/src/inlay_hints/discriminant.rs, crates/stdx/src/macros.rs, crates/ide/src/predicate_eval.rs, crates/vfs/src/file_set/tests.rs, crates/hir-ty/src/solver_errors.rs. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 3 significant file(s) lose their only recent owner: crates/ide-assists/src/handlers/introduce_named_lifetime.rs, crates/ide-assists/src/handlers/move_const_to_impl.rs, crates/proc-macro-api/src/pool.rs. Pair on, review, or document these before any departure.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 10 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (34 single-owned of 747 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo trees and test files identified by path convention, largest first; 747 of the 1426 production source files in this repository met that bar). They are anonymized user #4 (2 file(s)), anonymized user #5 (1 file(s)), anonymized user #6 (1 file(s)), anonymized user #7 (1 file(s)), anonymized user #8 (1 file(s)), anonymized user #9 (1 file(s)) (+4 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above.
No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
Split crates/hir-def — Large at 372k LoC across seventeen namespaces, clearly sprawling. Suggested: split into hir/semantics, hir/expr_store, and hir/ty/lower
Split crates/hir-ty — Large at 70k LoC across seventeen namespaces, sprawling. Suggested: split into hir-ty/infer/closure, hir-ty/infer/region_constraints, and hir-ty/layout
Split crates/rust-analyzer — Large at 25k LoC across nine namespaces; sprawling analyzer. Suggested: split into lsp/handlers, tracing/bin, and diagnostics
D34 · Knowledge Freshness· Further orphaned files (smaller) · ×1
Further orphaned files (smaller) — 15 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: editors/code/src/syntax_tree_provider.ts, crates/ide-assists/src/handlers/remove_unused_param.rs, crates/ide/src/inlay_hints/generic_param.rs, crates/ide-assists/src/handlers/unnecessary_async.rs, crates/ide-assists/src/handlers/generate_constant.rs, crates/hir-ty/src/next_solver/infer/snapshot/undo_log.rs, crates/hir-ty/src/next_solver/infer/opaque_types/table.rs, xtask/src/publish.rs (and 7 more) (17 orphaned of 747 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo trees and test files identified by path convention, largest first; 747 of the 1426 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
Logging is not universal — Only 23/29 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `crates/mbe`, `crates/proc-macro-srv-cli`, `crates/syntax-bridge`, `crates/test-utils`, `lib/ungrammar/ungrammar2json` and 1 more.
R7 · Dead Code· Unused export 'fetchDependencyGraph' · ×1
Unused export 'fetchDependencyGraph' editors/code/src/lsp_ext.ts:160— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'unwrapNullable' · ×1
Unused export 'unwrapNullable' REDACTED:231— Nothing imports this binding — it is safe to review for removal.
Outdated: borsh — `borsh` is locked at 1.6.1 but 1.8.1 is the current stable release on crates.io, and it already satisfies the `"1.4.0"` requirement declared in lib/smol_str/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p borsh` and commit the updated REDACTED.
Outdated: clap — `clap` is locked at 4.6.1 but 4.6.7 is the current stable release on crates.io, and it already satisfies the `"4.5.42"` requirement declared in crates/proc-macro-srv-cli/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap` and commit the updated REDACTED.
Outdated: crossbeam-utils — `crossbeam-utils` is locked at 0.8.21 but 0.8.23 is the current stable release on crates.io, and it already satisfies the `"0.8.21"` requirement declared in crates/stdx/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p crossbeam-utils` and commit the updated REDACTED.
Outdated: flate2 — `flate2` is locked at 1.1.9 but 1.1.10 is the current stable release on crates.io, and it already satisfies the `"1.1.2"` requirement declared in xtask/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p flate2` and commit the updated REDACTED.
Outdated: log — `log` is locked at 0.4.31 but 0.4.34 is the current stable release on crates.io, and it already satisfies the `"0.4.27"` requirement declared in lib/lsp-server/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p log` and commit the updated REDACTED.
Outdated: memchr — `memchr` is locked at 2.8.1 but 2.8.3 is the current stable release on crates.io, and it already satisfies the `"2.7.5"` requirement declared in crates/ide-db/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p memchr` and commit the updated REDACTED.
Outdated: proc-macro2 — `proc-macro2` is locked at 1.0.106 but 1.0.107 is the current stable release on crates.io, and it already satisfies the `"1.0.95"` requirement declared in xtask/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p proc-macro2` and commit the updated REDACTED.
Outdated: quote — `quote` is locked at 1.0.45 but 1.0.47 is the current stable release on crates.io, and it already satisfies the `"1.0.40"` requirement declared in xtask/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p quote` and commit the updated REDACTED.
Outdated: serde — `serde` is locked at 1.0.228 but 1.0.229 is the current stable release on crates.io, and it already satisfies the `"1.0.219"` requirement declared in lib/lsp-server/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde` and commit the updated REDACTED.
Outdated: serde_core — `serde_core` is locked at 1.0.228 but 1.0.229 is the current stable release on crates.io, and it already satisfies the `"1.0.220"` requirement declared in lib/smol_str/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde_core` and commit the updated REDACTED.
Outdated: serde_derive — `serde_derive` is locked at 1.0.228 but 1.0.229 is the current stable release on crates.io, and it already satisfies the `"1.0.219"` requirement declared in lib/lsp-server/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde_derive` and commit the updated REDACTED.
Outdated: serde_json — `serde_json` is locked at 1.0.150 but 1.0.151 is the current stable release on crates.io, and it already satisfies the `"1.0.140"` requirement declared in lib/lsp-server/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde_json` and commit the updated REDACTED.
Outdated: thin-vec — `thin-vec` is locked at 0.2.18 but 0.2.20 is the current stable release on crates.io, and it already satisfies the `"0.2.16"` requirement declared in crates/hir-ty/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p thin-vec` and commit the updated REDACTED.
Outdated: time — `time` is locked at 0.3.47 but 0.3.55 is the current stable release on crates.io, and it already satisfies the `"0.3"` requirement declared in xtask/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p time` and commit the updated REDACTED.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a0ea06-c0e5-77b9-945c-942d5c7886cb · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 71 · Warnings: 2544 · Recommendations: 18 · Info: 14 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 28-09-2026 @ 21:58 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.