Public report — rust, published 29 Jul 2026.
Concrete security findings (CVE IDs, secret matches, dependency versions) are hidden in this version;
ask the repo owner for the full report.
4305findings with an exact file:lineof 4332 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
51/113dimensions across the health lenses2409005 LoC — wide & deep
Executive summary
Read through the Production lens — the standard calibration. *Green* means good enough to run in production. The score is absolute and comparable across repos.
rust-lang/rust carries serious gaps (35%). Several issues below can materially affect correctness, security, or the cost of changing it — and propagate to everything that depends on it.
It is strongest in Domain Modelling (100%) — the domain model is expressive and well-guarded. Event Sourcing (100%) is solid too.
The area that most needs attention is Security (21%) — exposure to security and compliance incidents is elevated. Code Health (32%) is the next concern — changes there are slower and more error-prone.
Leadership focus, highest impact first: Migrate the remaining .js/.jsx files to TypeScript (Type Safety); Break down the listed branch-heavy functions (Cyclomatic Complexity); oversized components into smaller (Large Files).
For scale: Very large (~2,409,005 production lines); rebuilding it from scratch would take roughly ~26.0 person-years (~15–50 engineers). Approximate, ±~30%.
It builds on a genuinely strong Domain Modelling foundation (100%); the priorities above are the highest-leverage way to bring the rest up to that level.
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.
641 finding(s) are new versus the previous scan (2026-07-20) — surfaced by this scheduled scan itself, no pull request required. Showing the first 100; the full set is in the report.
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 — €1,300,000–€6,300,000
0.7× (at 35% quality) — the last 20% of quality is most of the work
Size & shape
Very large · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)
Dead frontend code
~21 LoC unreachable (2 file(s)) — that slice of this estimate buys code with zero runtime value; deleting it is the cheapest win in this report (the R7 card lists every file)
This codebase represents roughly ~26.0 person-years of build effort (about ~€3,800,000 to rebuild). Its weakest lens is Security at 21% — the part of that asset most exposed by the findings below.
How we model this: boilerplate at a scaffolding rate + logic × domain Standard (×1.3) — vertical slice, domain model × a 0.7× 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 Leaked secret finding(s) in Secret Scanning — start with jobs.yml.
Value concentrated against a weak lens · High · Value at risk
This is a Very large asset (~26.0 person-years to rebuild), and its weakest lens is Security at 21%. 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: Migrate the remaining .js/.jsx files to TypeScript. The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Migrate the remaining .js/.jsx files to TypeScript.
A velocity tax on every change · Medium · Economics
The code-quality signals (complexity, duplication, cohesion) average 5.8/10, which acts as a tax on every change in the weaker areas: modifications there plausibly cost on the order of 5–12% more than in clean code, and the tax compounds as the codebase grows. (A modelled estimate, not a measured fact.)
Evidence: D1/D2 complexity, D4 duplication, D6 cohesion: averaging 5.8/10 across the code-quality signals
→ Pay it down where churn is highest — the hotspots — not everywhere; that's where the tax is actually paid.
At a glance — Code Health · 32% · Weak · gated by D1, R1, R2, R3
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
50
High / Critical
A05:2021 — Security Misconfiguration
50
High / Critical
A06:2021 — Vulnerable & Outdated Components
34
High / Critical
A02:2021 — Cryptographic Failures
12
High / Critical
Roadmap
Begin by migrating the remaining JavaScript files to TypeScript to improve type safety. Next, reduce cyclomatic complexity by simplifying branch-heavy functions and splitting oversized components into smaller, focused files. Finally, address the 50 high-priority static analysis findings, prioritizing the CI configuration files, and resolve the 50 high-priority IaC and container security issues, starting with the Dockerfile.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with jobs.yml.
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. 48 of 51 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 3 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.6 — 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 — 51 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, 4305 of 4332 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.
D30 Dependency Vulnerabilities — scanner not present in this environment — The backing tool was not installed where this scan ran, so this dimension was not scored. Install the tool (or run in the hosted environment, where it is always present) for a graded result.
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 (jscpd) — 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.
D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
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.
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.
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.
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").
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.
D33 JS/npm Dependency Vulnerabilities: JS/npm CVE matching reads package manifests and lockfiles — risk from how a dependency is used, and advisories not yet published, fall outside this scan.
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.
AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A clean result is "no unlabelled native control found", not a labelling proof.
AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
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.
DM4 Rich vs anemic domain model: Behaviour is detected as state mutation inside a method body — a method that enforces an invariant by validating-and-throwing without mutating reads as a query, and mutation delegated through an interface the scan can't resolve isn't credited; entities with zero public properties still drop out of the population. It detects that state changes, not whether the rule is correct.
DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of 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".
P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
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 (4): D19, D20, D21, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score (documentation, ADR quality, naming, comment value, onboarding) — D25 sets the ADR-conformance fraction over sampled code, D22 judges API accuracy over a sample. These 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.
1332 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was old_archs::old_archs at 1358. A further 268 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 llvm::intrinsic at 540 — they are counted neither in the figure above nor in this dimension's score.
+ 747 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 50 FnCtxt finding(s) in Cyclomatic Complexity — start with suggest.rs (10), suggestions.rs (7), pat.rs (6). — One of this dimension's main actionable groups (50 warning-level).
Resolve the 31 Parser finding(s) in Cyclomatic Complexity — start with expr.rs (6), item.rs (6), diagnostics.rs (5). — One of this dimension's main actionable groups (31 warning-level).
Resolve the 22 EvalContextExt finding(s) in Cyclomatic Complexity — start with foreign_items.rs (5), fs.rs (3), math.rs (2). — One of this dimension's main actionable groups (22 warning-level).
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.
+ 1113 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 79 FnCtxt finding(s) in Cognitive Complexity — start with suggest.rs (19), suggestions.rs (10), expr.rs (10). — One of this dimension's main actionable groups (79 warning-level).
Resolve the 54 Parser finding(s) in Cognitive Complexity — start with item.rs (15), expr.rs (10), diagnostics.rs (7). — One of this dimension's main actionable groups (54 warning-level).
Resolve the 31 LateResolutionVisitor finding(s) in Cognitive Complexity — start with diagnostics.rs (18), late.rs (13). — One of this dimension's main actionable groups (31 warning-level).
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.9 / 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.
Resolve the 470 FileTooLong finding(s) in God Classes — start with mod.rs (41), lib.rs (26), diagnostics.rs (13). — One of this dimension's main actionable groups (470 warning-level).
Resolve the 100 TooManyMethods finding(s) in God Classes — start with mod.rs (20), lib.rs (8), lower.rs (3). — One of this dimension's main actionable groups (100 warning-level).
Resolve the 58 TooManyFunctions finding(s) in God Classes — start with mod.rs (11), vector.rs (2), lib.rs (2). — One of this dimension's main actionable groups (58 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.
What it measures: Whether the code respects its intended layering / architecture rules.
Method: Enforcement rung (Prevented/Verified/Documented) per checkable ADR via Roslyn, plus dependency cycles via the engine shared with D5/AX3. Deterministic, exact.
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.
Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with jobs.yml. — One of this dimension's main actionable groups (1 issue-level).
Enforce Secret Scanning in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor8.8 / 10Strong✓ 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.
289 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is library/stdarch/crates/core_arch/src/wasm32/simd128.rs.
Off-boarding risk: anonymized user #1 · ×17
Further sole-owners (lower concentration)
What to do
Resolve the 17 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (17 recommendation-level).
Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d16_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 Rust documentation is exemplary: a central README with a prominent website banner and links to Getting Started, Learn, Documentation, and Contributing; a Why Rust section covering performance, reliability, productivity, and the tooling stack (Cargo, rustfmt, Clippy, rust-analyzer); a Quick Start pointing to The Book's Installation chapter; and an exhaustive tests directory that is itself well documented with categories, test purposes, links, and run commands for each subdirectory. It is clear, complete, and well-structured.
The Why Rust section lists Cargo/rustfmt/Clippy/rust-analyzer but does not mention the rustdoc-gui tests that exercise generated HTML output.README.md
What to do
Resolve the 1 The Why Rust section lists Cargo/rustfmt/Clippy/rust-analyzer but does… finding(s) in Documentation Quality — start with README.md. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d19_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D20 · ADR Quality / 10Strong◐ Sampled · advisory
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.
Evaluated 2 ADR(s) individually; mean quality 8.0/10 (consistently complete and clear). 0 flagged with a specific gap.
What to do
Improve ADR Quality — currently 8.0/10. — Evaluated 2 ADR(s) individually; mean quality 8.0/10 (consistently complete and clear). 0 flagged with a specific gap.
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.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: Git-history secret scan via gitleaks detect over full history in an isolated checkout; each match flagged High. Exhaustive; degrades cleanly when tool absent.
18 finding(s): 0 critical, 18 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
Secret: aws-access-token · ×10src/ci/github-actions/jobs.yml:83detected by gitleaks finding
Rotate the exposed credentials — git history can't be un-committed
What to do
Resolve the 10 Secret finding(s) in Secrets (history) — start with ci.yml (8), jobs.yml (2). — One of this dimension's main actionable groups (10 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
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).
High: gha-workflow-env-secret · ×50.github/workflows/ci.yml:42detected by semgrep finding
What to do
Resolve the 50 High finding(s) in Static Analysis (SAST) — start with ci.yml (18), main.yml (13), rustc.yml (4). — One of this dimension's main actionable groups (50 issue-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
High IaC: DS-0002 · ×50library/compiler-builtins/ci/docker/aarch64-unknown-linux-gnu/Dockerfiledetected by trivy finding
What to do
Resolve the 50 High IaC finding(s) in IaC & Container Security — start with Dockerfile (50). — One of this dimension's main actionable groups (50 issue-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 2497 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is library/stdarch/crates/core_arch/src/x86/fma.rs.
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; coupling through a build step, config, or non-source file isn't seen.
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.
Resolve the 1 No build provenance finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 No artifact signing finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 No SBOM finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether dependencies have known published vulnerabilities (CVEs) per the OSV database — read natively from whatever lockfile the repository ships (Cargo, npm, Go, Python, Maven, RubyGems, …). D33 and D30 add ecosystem-specific scanners on top for npm and .NET.
Method: Multi-ecosystem dependency-CVE scan via osv-scanner --recursive (queries the osv.dev database + parses lockfiles natively across ecosystems: npm package-lock/yarn/pnpm/bun, Go go.mod, Rust Cargo.lock, Maven/Gradle pom.xml/gradle.lockfile, PyPI requirements.txt/poetry.lock/Pipfile.lock, Composer composer.lock, RubyGems Gemfile.lock, Hex mix.lock, pub pubspec.lock, Swift Package.resolved); severity tally (Critical/High/Medium/Low) to 0-10 tight normalizer (8.0). NotApplicable only when the repo declares no supported non-.NET dependency lockfile (a NuGet-only repo stays NotApplicable — .NET CVEs are D30's domain); coverage needs a resolved lockfile. Additive to D33 (trivy fs); exhaustive + deterministic, DB kept fresh.
High CVE: [GHSA redacted] · ×8src/tools/rust-analyzer/editors/code/package-lock.jsondetected by osv-scanner finding
High vulnerability: [GHSA redacted]src/ci/citool/Cargo.lockdetected by osv-scanner finding
Medium CVE: [GHSA redacted] · ×10src/tools/rust-analyzer/editors/code/package-lock.jsondetected by osv-scanner finding
Medium advisory (unsound): RUSTSEC-2026-0190 · ×7Cargo.lockdetected by osv-scanner finding
Medium advisory (unmaintained): RUSTSEC-2024-0436 · ×5library/compiler-builtins/Cargo.lockdetected by osv-scanner finding
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 10 Medium CVE finding(s) in OSV Dependency Vulnerabilities — start with package-lock.json (5), Cargo.lock (4), reuse-requirements.txt. — One of this dimension's main actionable groups (10 warning-level).
Resolve the 8 High CVE finding(s) in OSV Dependency Vulnerabilities — start with package-lock.json (8). — One of this dimension's main actionable groups (8 issue-level).
Resolve the 1 High vulnerability finding(s) in OSV Dependency Vulnerabilities — start with Cargo.lock. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d38_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives10.0 / 10Exemplary○ Nothing flagged
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Do you agree with this assessment?
AC2 · Forms & labels10.0 / 10Exemplary○ Nothing flagged
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en"). (×2) — COPYRIGHT-library.html:2, COPYRIGHT.html:2
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×2) — COPYRIGHT-library.html:2, COPYRIGHT.html:2
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.
Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.
`.badge` sets color: #fff on background-color: #777 — 4.5:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — style.css:179
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Do you agree with this assessment?
AC7 · A11y enforcement4.0 / 10Weak✓ Tool-verified
Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an a11y linter (eslint-plugin-jsx-a11y / vuejs-accessibility) configured, and axe/pa11y/Lighthouse wired into tests or CI — on the Documented→Verified→Prevented ladder.
Method: Repo config/CI scan: an a11y linter (eslint-plugin-jsx-a11y / vuejs-accessibility) configured, and axe/pa11y/Lighthouse in tests or CI, graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.
No accessibility enforcement found — no a11y linter (an a11y linter that can read your UI — no component framework was detected, so the JSX/Vue ESLint plugins would have nothing to lint; use an HTML-template a11y linter (html-eslint, htmlhint) or run axe/pa11y over the rendered pages) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time.
What to do
Enforce accessibility in the toolchain: add an a11y linter that can read your UI — no component framework was detected, so the JSX/Vue ESLint plugins would have nothing to lint; use an HTML-template a11y linter (html-eslint, htmlhint) or run axe/pa11y over the rendered pages, assert with your test runner's axe binding (jest-axe, vitest-axe, cypress-axe or @axe-core/playwright) in tests, then gate axe/pa11y/Lighthouse in CI.
Other · Architecture — Whether the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.
Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. 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.
`xous$module.get_env_store` is a read-named query yet it performs a durable write on the read path (a persist to a store/repository). A query must stay side-effect-free so reads are safe to retry, cache, and route to a read replica; move the write into a command. — xous.rs:12
What to do
Keep query handlers read-only — move the writes/event-publishes into a command handler so reads stay safe to retry, cache, and route to a read replica.
Other · Domain Modelling — Whether domain identifiers are strongly typed (a newtype wrapper) rather than raw primitives — consistency once an idiom exists.
Method: Roslyn (DDD-gated): strongly-typed id adoption on domain entities/events; raw Guid/int/string ids counted versus wrapped types. Deterministic, adoption percentage.
Coverage: Population: id-like members by *Id/*Key NAME suffix; strongly-typed-ID shape then checked semantically — non-suffixed identifiers are not seen.
Do you agree with this assessment?
DM4 · Rich vs anemic domain model10.0 / 10Exemplary✓ Tool-verified
Other · Domain Modelling — Whether domain entities own their behaviour (invariant-enforcing commands) rather than being data-only structs driven by a foreign service.
Method: Roslyn (DDD-gated): entity method BODIES classified mutator-vs-query — only methods that mutate the entity's own declared state count as invariant-protecting behaviour, so a getter/passthrough doesn't rescue an anemic class. Deterministic, exhaustive over domain-layer entities.
Coverage: Population: entities by name/base convention; rich-vs-anemic judged by classifying each method body mutator-vs-query — logic-bearing domain types outside the convention are invisible.
Other · Domain Modelling — Whether a domain type's identity-bearing field stays immutable — a `pub` mutable field under a hand-rolled Hash/PartialEq breaks the value-identity invariant.
Method: Roslyn (DDD-gated): public setters on entities detected; score softened when Marten/EF rehydration frameworks present. Deterministic, framework-aware.
Coverage: Population: entities by convention; encapsulation (setter shape) checked exhaustively within the set.
Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies — a domain aggregate fused to a persistence ORM (diesel/sea-orm/sqlx) on its own declaration (active-record) couples the domain to infrastructure. The clean-architecture dependency rule.
Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.
Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.
Other · Event Sourcing — Whether the recovery-replay fold is deterministic — state derived purely from each event's own fields, no clock/random/IO on the replay path.
Method: Roslyn syntax scan (event-sourcing gated): Apply/When folds checked for forbidden tokens (DateTime.Now, Guid.NewGuid, Random, IO), stripped of comments/strings. Deterministic, hard fact per fold.
Other · Event Sourcing — Whether domain events stay immutable (private fields, set once) rather than carrying mutable state.
Method: Roslyn scan (event-sourcing gated): persisted events checked for public setters; immutability verified per property/field. Deterministic, hard fact.
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.
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 206 of 261 project(s) that lack one — worth up to 1.6 pts.
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.
The README describes Cargo, rustfmt, Clippy, and rust-analyzer as part of Rust's ecosystem but the evidence reveals no Cargo or rust-analyzer project in the tree
What to do
Reconcile the README with reality: The README describes Cargo, rustfmt, Clippy, and rust-analyzer as part of Rust's ecosystem but the evidence reveals no Cargo or rust-analyzer project in the tree.
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.
Do you agree with this assessment?
P5 · DR & Backup4.0 / 10Weak✓ Tool-verified
Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.
Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.
What to do
Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).
Enable purge protection / soft-delete (and prevent_destroy on critical resources) so data stores can't be lost to an accidental or malicious delete.
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.
Do you agree with this assessment?
R1 · Type Safety1.4 / 10Critical✓ 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.
25 typed · 156 plain JS
What to do
Migrate the remaining .js/.jsx files to TypeScript.
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.
Branch-heavy code is where defects cluster — extract decisions into smaller functions. (×8) — stringdex.js:3009, search.js:2979, search.js:4256, …
What to do
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Do you agree with this assessment?
R3 · Large Files0.0 / 10Critical✓ Tool-verified
React / JS · Code Health — How many components/modules exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
8 file(s) over 400 lines
What to do
Split the oversized components into smaller, focused ones.
Do you agree with this assessment?
R4 · Test Coverage2.1 / 10Critical✓ 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.
No test imports this module directly or transitively — its behavior is unverified. (×8) — search.js, stringdex.js, main.js, …
What to do
Add tests that import the unreached modules (directly or through their public entry).
React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D33 (JS/npm Dependency Vulnerabilities).
Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D33). 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.
Unreachable from the 11 application, 6 tooling and 152 test entry point(s) detected in this repo. Gate removals on your build/type-check — an undetected custom entry would make these reachable.
no import path from any entry point (11 application, 6 tooling, 152 test roots considered) (×2) — redirect.js, error-index.js
Nothing imports this binding — it is safe to review for removal. — util.ts: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. — config.ts:7
Declared in the root/package.json but never imported anywhere in that package or its workspace members — dead weight and attack surface. Verify against build tooling before removing. (×2)
Declared in src/tools/rust-analyzer/editors/code/package.json but never imported anywhere in that package or its workspace members — dead weight and attack surface. Verify against build tooling before removing.
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?
WCAG coverage — what static analysis assessed
Statically assessed 13 of 55 WCAG 2.2 Level A/AA success criteria (24%; ≈26% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 42 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
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.
Not included — 62 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.
AC4 Keyboard semantics — No interactive element found in the parsed markup — AC4 not applicable here.
AC5 ARIA correctness — No ARIA usage found in the parsed markup — AC5 not applicable here.
AX1 Captive dependencies — no DI registrations detected
AX10 Code composition — not assessed — code composition is computed by ROLE over the .NET document set and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
AX2 Stateful singletons — no singleton implementations detected
AX3 Project dependency cycles — not assessed — project cycles and dependency direction are computed over the .NET project-reference graph and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
AX4 Dependency direction — not applicable to a vertical-slice architecture (the inward-dependency rule is for layered/clean styles)
AX6 Interface segregation — not assessed — interface segregation is computed over the .NET type surface and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — vertical-slice architecture detected, but individual slices could not be resolved from namespaces or project layout
AX8 Test isolation — not assessed — test isolation is computed from the .NET project graph (which projects are test projects, and what they reference) and no such graph was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
AXB2 Runtime readiness — no data
C1 Data Protection — Not assessed: these personal data controls are read from C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom 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 C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom 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.
C3 Audit Trail — Not assessed: these audit controls are read from C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom 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 C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom 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 C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom 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.
D10 Test Quality — ~1149271 lines of test source are present (.rs, .ts) but the test-quality collector reads C# only, so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
D11 Test Reliability — Test reliability not included
D12 Dependency Hygiene — Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
D14 License Compliance — Not scored — this repository's package manifest is not parsed for licence data yet. A gap in the analyzer's language coverage, NOT a finding that the repository's licenses are compliant (a Cargo manifest, package.json), which this pass does not parse yet — so this dimension asserts nothing about this repository's licensing in either direction.
D17 Explicit Debt — explicit-debt markers are read through a C# workspace today, so they were not read for this repository's language — this asserts nothing about how many markers the code carries. Not scored — this is a gap in the analyzer, not a finding about this repository
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.
D22 Internal API Consistency — No exposed public API
D23 Boundary Type-Coupling — Production source is present (.mts, .py, .rs, .ts) but bounded contexts are resolved over the C#/VB project set, which exposed none, so context scope could not be assessed. Not scored — this is a gap in the analyzer, not a verdict about this repository. Declaring the codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed — see the recommendation on this dimension for where. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["Acme.Billing"]`, `Catalog: ["Acme.Catalog"]`.
D24 Comment Value — No inline comments to assess — comment value is not applicable here.
D25 ADR Conformance — none of 2 ADRs are conformance-checkable — unverifiable.
D26 Project Cohesion — Project cohesion is assessed over the .NET project set; this target exposed no projects, so project size and spread could not be assessed. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
D27 Navigability — No calls could be sampled, so navigability was not assessed — tracing effort is measured over resolved call sites and this target exposed none. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
D30 Dependency Vulnerabilities — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Cargo manifest, package.json — not scanned yet) — where an OSV-supported manifest exists, dependency vulnerabilities for this repository are reported under D38 instead.
D32 Data Compliance (PII/GDPR) — No PII/GDPR ruleset is bundled (the public p/gdpr semgrep pack was retired) — data compliance is not assessed in this scan.
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.
D5 Coupling — Inter-project coupling could not be assessed — no analyzable project graph was found for this repository. Not scored: a gap in the analyzer's reach, not a verdict about this repository. (Coupling here is Martin afferent/efferent/instability plus reference cycles across a project-reference graph, read today from .NET project files; other ecosystems' module graphs are not read yet.)
D6 Cohesion (LCOM4) — Cohesion (LCOM4) is measured over a C#/VB class graph, and this repository's production source is .mts, .py, .rs, .ts, which this pass does not read — so no class could be assessed. Not scored — this is a gap in the analyzer, not a finding about this repository.
D8 Code Coverage — Coverage not included — suite not readable by the collector
D9 Test Distribution — Test source is present (.rs, .ts) but the test-pyramid classifier reads C# only, so its unit/integration/BDD/E2E split couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
DM1 Aggregate boundaries — not gated in Rust source-only: aggregate-vs-value-object classification is not 0-FP-separable (every struct-holding-struct reads alike), and a child COLLECTION (legitimate membership) vs a single embedded aggregate is indistinguishable — advisory (the Swift/Dart parity)
DM3 Integration-event coupling — not gated in Rust source-only: a cross-crate domain leak is not 0-FP-separable from a legitimate shared-kernel crate, and the corpus is predominantly single-crate — advisory (candidate-demote, schema §6.1/§13)
DM7 Repository granularity — not gated in Rust source-only: 'a repository per CHILD entity' needs the aggregate-root structure, which is not source-resolvable; the softest gated dim (schema §6.1 sanctions the advisory demote) — advisory
ED2 Event/command shape — not gated in Rust source-only: a command with >1 competing handler needs a dispatch/call graph the source-only frontend cannot resolve (inferred/generic call owners decline) — advisory
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
GD1 Unfinished & placeholder code — no source files
IC1 Incompleteness & stubs — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
P12 CI test-gate honesty — no data
P2 Observability — Observability was not assessed: this check reads .NET source (ILogger/Serilog, OpenTelemetry, health checks) and no such source carries this repository's product — because it is written in another language, or because the solution failed to load. Absence of a .NET logging idiom is NOT evidence that this repo lacks structured logging (it may log through its own ecosystem's logger). This is a gap in the analyzer, not a finding about this repository.
P7 Outbound HTTP resilience — not applicable — this isn't a service/API/worker
P8 Schema migrations — not assessed — schema-migration practice is read from EF Core usage in .NET source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (lcov — `cargo llvm-cov --lcov --output-path lcov.info`) into the repo working tree before the scan — a CI step is the usual place, since the artefact is commonly gitignored, or wire coverage collection into CI, to enable this cross-layer check
PF1 Benchmark discipline — Performance was not assessed: this lens reads .NET source (allocation-aware APIs — Span/Memory, ArrayPool/ObjectPool, stackalloc — and a BenchmarkDotNet suite) and no such source was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
PF2 Allocation hygiene — Performance was not assessed: this lens reads .NET source (allocation-aware APIs — Span/Memory, ArrayPool/ObjectPool, stackalloc — and a BenchmarkDotNet suite) and no such source was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
PF3 Async & latency hygiene — Performance was not assessed: this lens reads .NET source (allocation-aware APIs — Span/Memory, ArrayPool/ObjectPool, stackalloc — and a BenchmarkDotNet suite) and no such source was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
S1 Web-Security Posture — Not assessed: these web-security controls are read from C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom 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 — no data
X1 Async correctness — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
X2 Cancellation propagation — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
X3 Exception handling — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
X4 Structured logging — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution 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 are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
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.
High: gha-workflow-env-secret .github/workflows/ci.yml:42— A secret is exposed in the workflow-level `env:` block, making it available to every job and step in this workflow — including any untrusted code run in pull-request workflows. Scope secrets as narrowly as possible: prefer step-level `env:` so the secret is only available where it is actually needed. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
High: gha-curl-pipe-shell .github/workflows/ci.yml:107— A `run:` step pipes the output of `curl` or `wget` directly into a shell interpreter. This is the "curl | bash" install pattern — if the remote server is compromised or the URL is hijacked, an attacker can execute arbitrary code in your CI runner. Consider downloading the file first, verifying its checksum or signature, and then executing it.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/abi-cafe.yml:46— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/abi-cafe.yml:59— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/cache@<40-character SHA>`. This step references `actions/cache@v5`; resolve the SHA it points at today with `gh api repos/actions/cache/commits/v5 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/cranelift-release-branch.yml:20— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/main.yml:27— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/main.yml:37— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/main.yml:91— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/main.yml:98— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/cache@<40-character SHA>`. This step references `actions/cache@v5`; resolve the SHA it points at today with `gh api repos/actions/cache/commits/v5 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/main.yml:142— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/main.yml:164— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/main.yml:170— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/cache@<40-character SHA>`. This step references `actions/cache@v5`; resolve the SHA it points at today with `gh api repos/actions/cache/commits/v5 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/main.yml:216— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/main.yml:219— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/cache@<40-character SHA>`. This step references `actions/cache@v5`; resolve the SHA it points at today with `gh api repos/actions/cache/commits/v5 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/main.yml:238— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/upload-artifact@<40-character SHA>`. This step references `actions/upload-artifact@v6`; resolve the SHA it points at today with `gh api repos/actions/upload-artifact/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/main.yml:257— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/main.yml:260— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/download-artifact@<40-character SHA>`. This step references `actions/download-artifact@v8`; resolve the SHA it points at today with `gh api repos/actions/download-artifact/commits/v8 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/rustc.yml:14— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/rustc.yml:20— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/cache@<40-character SHA>`. This step references `actions/cache@v5`; resolve the SHA it points at today with `gh api repos/actions/cache/commits/v5 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/rustc.yml:34— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_cranelift/.github/workflows/rustc.yml:40— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/cache@<40-character SHA>`. This step references `actions/cache@v5`; resolve the SHA it points at today with `gh api repos/actions/cache/commits/v5 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_gcc/.github/workflows/ci.yml:42— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v4`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v4 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_gcc/.github/workflows/ci.yml:49— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: Swatinem/rust-cache@<40-character SHA>`. This step references `Swatinem/rust-cache@v2`; resolve the SHA it points at today with `gh api repos/Swatinem/rust-cache/commits/v2 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_gcc/.github/workflows/ci.yml:127— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v4`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v4 --jq .sha`.
High: github-actions-mutable-action-tag compiler/rustc_codegen_gcc/.github/workflows/ci.yml:133— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v4`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v4 --jq .sha`.
D38 · OSV Dependency Vulnerabilities· High CVE · ×8
High CVE: [GHSA redacted] src/tools/rust-analyzer/editors/code/package-lock.json— brace-expansion 1.1.13: [GHSA redacted] — brace-expansion is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin brace-expansion to 1.1.16 with an `overrides` entry (`resolutions` if you use Yarn)). One upgrade of brace-expansion 1.1.13 clears all 2 advisories it raises: [GHSA redacted], [GHSA redacted].
High CVE: [GHSA redacted] src/tools/rust-analyzer/editors/code/package-lock.json— fast-uri 3.0.6: [GHSA redacted] — fast-uri is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin fast-uri to 3.1.3 with an `overrides` entry (`resolutions` if you use Yarn)). This is 1 of 4 advisories this scan raises against fast-uri 3.0.6, and their fixed versions do not agree — anything below 3.1.4 still leaves at least one of them open, so 3.1.4 is the floor for this package, not this row's target alone. One upgrade of fast-uri 3.0.6 clears all 4 advisories it raises: [GHSA redacted], [GHSA redacted], [GHSA redacted], [GHSA redacted].
High CVE: [GHSA redacted] src/tools/rust-analyzer/editors/code/package-lock.json— form-data 4.0.4: [GHSA redacted] — form-data is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin form-data to 4.0.6 with an `overrides` entry (`resolutions` if you use Yarn)).
High CVE: [GHSA redacted] src/tools/rust-analyzer/editors/code/package-lock.json— js-yaml 3.14.2: [GHSA redacted] — js-yaml is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin js-yaml to 3.15.0 with an `overrides` entry (`resolutions` if you use Yarn)). One upgrade of js-yaml 3.14.2 clears all 2 advisories it raises: [GHSA redacted], [GHSA redacted].
High CVE: [GHSA redacted] src/tools/rust-analyzer/editors/code/package-lock.json— linkify-it 5.0.0: [GHSA redacted] — linkify-it is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin linkify-it to 5.0.1 with an `overrides` entry (`resolutions` if you use Yarn)). This is 1 of 2 advisories this scan raises against linkify-it 5.0.0, and their fixed versions do not agree — anything below 5.0.2 still leaves at least one of them open, so 5.0.2 is the floor for this package, not this row's target alone. One upgrade of linkify-it 5.0.0 clears all 2 advisories it raises: [GHSA redacted], [GHSA redacted].
High CVE: [GHSA redacted] src/tools/rust-analyzer/editors/code/package-lock.json— tmp 0.2.4: [GHSA redacted] — tmp is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin tmp to 0.2.6 with an `overrides` entry (`resolutions` if you use Yarn)).
High CVE: [GHSA redacted] src/tools/rust-analyzer/editors/code/package-lock.json— underscore 1.13.7: [GHSA redacted] — underscore is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin underscore to 1.13.8 with an `overrides` entry (`resolutions` if you use Yarn)).
High CVE: [GHSA redacted] src/tools/rust-analyzer/editors/code/package-lock.json— undici 6.24.1: [GHSA redacted] — undici is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin undici to 6.27.0 with an `overrides` entry (`resolutions` if you use Yarn)). One upgrade of undici 6.24.1 clears all 4 advisories it raises: [GHSA redacted], [GHSA redacted], [GHSA redacted], [GHSA redacted].
Orphaned knowledge library/stdarch/crates/core_arch/src/x86/fma.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 src/tools/rust-analyzer/crates/ide/src/inlay_hints/chaining.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 library/stdarch/crates/core_arch/src/x86/avx512vpopcntdq.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 library/stdarch/crates/core_arch/src/x86/kl.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.
D38 · OSV Dependency Vulnerabilities· High vulnerability · ×1
High vulnerability: [GHSA redacted] src/ci/citool/Cargo.lock— rustls-webpki 0.102.8: [GHSA redacted] — rustls-webpki is not declared in this repo's manifests: it is pulled in transitively by rustls 0.23.23, so upgrade the dependency that requires it (or add a `[patch.crates-io]` entry for rustls-webpki — 0.103.13 is not semver-compatible with the resolved 0.102.8, so `cargo update --precise` cannot select it). This is 1 of 4 advisories this scan raises against rustls-webpki 0.102.8, and their fixed versions do not agree — anything below 0.103.13 still leaves at least one of them open, so 0.103.13 is the floor for this package, not this row's target alone. One upgrade of rustls-webpki 0.102.8 clears all 4 advisories it raises: [GHSA redacted], [GHSA redacted], RUSTSEC-2026-0098, RUSTSEC-2026-0099.
FileTooLong: x86/avx512f.rs library/stdarch/crates/core_arch/src/x86/avx512f.rs:0— FileTooLong — 27619 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: x86/avx512fp16.rs library/stdarch/crates/core_arch/src/x86/avx512fp16.rs:0— FileTooLong — 8189 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: x86/avx512bw.rs library/stdarch/crates/core_arch/src/x86/avx512bw.rs:0— FileTooLong — 8031 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: mips/msa.rs library/stdarch/crates/core_arch/src/mips/msa.rs:0— FileTooLong — 4517 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: s390x/vector.rs library/stdarch/crates/core_arch/src/s390x/vector.rs:0— FileTooLong — 4029 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: x86/avx512dq.rs library/stdarch/crates/core_arch/src/x86/avx512dq.rs:0— FileTooLong — 3769 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: src/diagnostics.rs compiler/rustc_parse/src/diagnostics.rs:0— FileTooLong — 3610 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: method/suggest.rs compiler/rustc_hir_typeck/src/method/suggest.rs:0— FileTooLong — 3522 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: src/late.rs compiler/rustc_resolve/src/late.rs:0— FileTooLong — 3469 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: js/search.js src/librustdoc/html/static/js/search.js:0— FileTooLong — 3300 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units).
FileTooLong: powerpc/altivec.rs library/stdarch/crates/core_arch/src/powerpc/altivec.rs:0— FileTooLong — 3160 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: late/diagnostics.rs compiler/rustc_resolve/src/late/diagnostics.rs:0— FileTooLong — 3130 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: src/hir.rs compiler/rustc_hir/src/hir.rs:0— FileTooLong — 2895 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: parser/expr.rs compiler/rustc_parse/src/parser/expr.rs:0— FileTooLong — 2894 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: js/stringdex.js src/librustdoc/html/static/js/stringdex.js:0— FileTooLong — 2776 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units).
FileTooLong: diagnostics/impls.rs compiler/rustc_resolve/src/diagnostics/impls.rs:0— FileTooLong — 2650 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: src/items.rs src/tools/rustfmt/src/items.rs:0— FileTooLong — 2594 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: traits/fulfillment_errors.rs compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:0— FileTooLong — 2591 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: mir/eval.rs src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:0— FileTooLong — 2591 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: src/expr.rs compiler/rustc_hir_typeck/src/expr.rs:0— FileTooLong — 2529 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: expr_store/lower.rs src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:0— FileTooLong — 2520 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: fn_ctxt/suggestions.rs compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:0— FileTooLong — 2518 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: wasm32/simd128.rs library/stdarch/crates/core_arch/src/wasm32/simd128.rs:0— FileTooLong — 2471 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: hir_ty_lowering/mod.rs compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs:0— FileTooLong — 2403 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FileTooLong: parser/item.rs compiler/rustc_parse/src/parser/item.rs:0— FileTooLong — 2387 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
FnCtxt::suggest_traits_to_import (cognitive 178) compiler/rustc_hir_typeck/src/method/suggest.rs:4147— FnCtxt::suggest_traits_to_import has cognitive complexity 178 (threshold 15). Drivers by points: if/else 107, match/switch 33, boolean chains 19, loops 19 (nesting depth added 97). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FnCtxt::suggest_deref_or_ref (cognitive 133) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:2943— FnCtxt::suggest_deref_or_ref has cognitive complexity 133 (threshold 15). Drivers by points: if/else 103, boolean chains 14, match/switch 13, loops 3 (nesting depth added 73). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FnCtxt::label_fn_like (cognitive 124) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:1592— FnCtxt::label_fn_like has cognitive complexity 124 (threshold 15). Drivers by points: if/else 70, loops 28, match/switch 17, boolean chains 9 (nesting depth added 76). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FnCtxt::handle_unsatisfied_predicates (cognitive 124) compiler/rustc_hir_typeck/src/method/suggest.rs:1714— FnCtxt::handle_unsatisfied_predicates has cognitive complexity 124 (threshold 15). Drivers by points: if/else 69, match/switch 27, loops 17, boolean chains 11 (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FnCtxt::check_expr_struct_fields (cognitive 94) compiler/rustc_hir_typeck/src/expr.rs:1847— FnCtxt::check_expr_struct_fields has cognitive complexity 94 (threshold 15). Drivers by points: if/else 74, match/switch 11, boolean chains 6, loops 3 (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.
FnCtxt::note_type_is_not_clone (cognitive 83) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:2032— FnCtxt::note_type_is_not_clone has cognitive complexity 83 (threshold 15). Drivers by points: if/else 52, match/switch 15, loops 10, boolean chains 6 (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FnCtxt::suggest_deref_ref_or_into (cognitive 81) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:351— FnCtxt::suggest_deref_ref_or_into has cognitive complexity 81 (threshold 15). Drivers by points: if/else 48, match/switch 14, loops 12, boolean chains 7 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FnCtxt::suggest_compatible_variants (cognitive 74) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:2611— FnCtxt::suggest_compatible_variants has cognitive complexity 74 (threshold 15). Drivers by points: if/else 49, match/switch 13, boolean chains 7, loops 5 (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.
FnCtxt::instantiate_value_path (cognitive 71) compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:999— FnCtxt::instantiate_value_path has cognitive complexity 71 (threshold 15). Drivers by points: if/else 46, match/switch 17, loops 5, boolean chains 3 (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.
FnCtxt::annotate_loop_expected_due_to_inference (cognitive 67) compiler/rustc_hir_typeck/src/demand.rs:577— FnCtxt::annotate_loop_expected_due_to_inference has cognitive complexity 67 (threshold 15). Drivers by points: if/else 38, match/switch 16, loops 8, boolean chains 5 (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.
FnCtxt::check_expr_field (cognitive 62) compiler/rustc_hir_typeck/src/expr.rs:2741— FnCtxt::check_expr_field has cognitive complexity 62 (threshold 15). Drivers by points: if/else 49, boolean chains 5, loops 4, match/switch 4 (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.
FnCtxt::suggest_cast (cognitive 59) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:3365— FnCtxt::suggest_cast has cognitive complexity 59 (threshold 15). Drivers by points: if/else 43, match/switch 12, boolean chains 4 (nesting depth added 12). 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.
FnCtxt::point_at_expr_if_possible (cognitive 53) compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs:288— FnCtxt::point_at_expr_if_possible has cognitive complexity 53 (threshold 15). Drivers by points: if/else 30, loops 13, boolean chains 5, match/switch 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.
FnCtxt::check_expr_block (cognitive 50) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:1247— FnCtxt::check_expr_block has cognitive complexity 50 (threshold 15). Drivers by points: if/else 46, boolean chains 3, loops 1 (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.
FnCtxt::check_pat_ref (cognitive 50) compiler/rustc_hir_typeck/src/pat.rs:2794— FnCtxt::check_pat_ref has cognitive complexity 50 (threshold 15). Drivers by points: if/else 35, match/switch 8, boolean chains 7 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FnCtxt::check_argument_types (cognitive 49) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:188— FnCtxt::check_argument_types has cognitive complexity 49 (threshold 15). Drivers by points: if/else 37, loops 6, match/switch 4, 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.
FnCtxt::analyze_closure (cognitive 45) compiler/rustc_hir_typeck/src/upvar.rs:165— FnCtxt::analyze_closure has cognitive complexity 45 (threshold 15). Drivers by points: if/else 31, loops 9, match/switch 4, 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.
FnCtxt::report_invalid_callee (cognitive 44) compiler/rustc_hir_typeck/src/callee.rs:877— FnCtxt::report_invalid_callee has cognitive complexity 44 (threshold 15). Drivers by points: if/else 23, match/switch 12, boolean chains 7, 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.
FnCtxt::check_tupled_arguments (cognitive 44) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:563— FnCtxt::check_tupled_arguments has cognitive complexity 44 (threshold 15). Drivers by points: if/else 40, boolean chains 4 (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.
FnCtxt::report_method_error (cognitive 43) compiler/rustc_hir_typeck/src/method/suggest.rs:260— FnCtxt::report_method_error has cognitive complexity 43 (threshold 15). Drivers by points: if/else 33, loops 5, match/switch 4, 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.
FnCtxt::note_source_of_type_mismatch_constraint (cognitive 41) compiler/rustc_hir_typeck/src/demand.rs:290— FnCtxt::note_source_of_type_mismatch_constraint has cognitive complexity 41 (threshold 15). Drivers by points: if/else 30, loops 4, match/switch 4, boolean chains 3 (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.
FnCtxt::report_failed_method_call_on_range_end (cognitive 40) compiler/rustc_hir_typeck/src/method/suggest.rs:2891— FnCtxt::report_failed_method_call_on_range_end has cognitive complexity 40 (threshold 15). Drivers by points: if/else 20, match/switch 18, loops 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.
FnCtxt::suggest_missing_return_type (cognitive 39) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:980— FnCtxt::suggest_missing_return_type has cognitive complexity 39 (threshold 15). Drivers by points: if/else 36, boolean chains 2, match/switch 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.
FnCtxt::report_failed_method_call_on_numerical_infer_var (cognitive 39) compiler/rustc_hir_typeck/src/method/suggest.rs:2984— FnCtxt::report_failed_method_call_on_numerical_infer_var has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14, match/switch 12, loops 10, boolean chains 3 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FnCtxt::check_expr_offset_of (cognitive 37) compiler/rustc_hir_typeck/src/expr.rs:3792— FnCtxt::check_expr_offset_of has cognitive complexity 37 (threshold 15). Drivers by points: if/else 33, match/switch 2, 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.
Parser::expected_one_of_not_found (cognitive 73) compiler/rustc_parse/src/parser/diagnostics.rs:443— Parser::expected_one_of_not_found has cognitive complexity 73 (threshold 15). Drivers by points: if/else 45, boolean chains 27, loops 1 (nesting depth added 8). Of this number, 68 points are the body's own statements and 5 belong to one function item declared inside it. 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.
Parser::parse_fn_front_matter (cognitive 73) compiler/rustc_parse/src/parser/item.rs:3094— Parser::parse_fn_front_matter has cognitive complexity 73 (threshold 15). Drivers by points: if/else 40, match/switch 30, boolean chains 3 (nesting depth added 41). To reduce it, split the body into named stages: move each independent 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::parse_pat_fields (cognitive 68) compiler/rustc_parse/src/parser/pat.rs:1501— Parser::parse_pat_fields has cognitive complexity 68 (threshold 15). Drivers by points: if/else 61, match/switch 4, boolean chains 2, loops 1 (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.
Parser::parse_struct_fields (cognitive 56) compiler/rustc_parse/src/parser/expr.rs:3871— Parser::parse_struct_fields has cognitive complexity 56 (threshold 15). Drivers by points: if/else 42, match/switch 7, boolean chains 6, 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.
Parser::new (cognitive 53) compiler/rustc_parse_format/src/lib.rs:302— Parser::new has cognitive complexity 53 (threshold 15). Drivers by points: if/else 47, match/switch 4, boolean chains 2 (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.
Parser::parse_expr_bottom (cognitive 52) compiler/rustc_parse/src/parser/expr.rs:1471— Parser::parse_expr_bottom has cognitive complexity 52 (threshold 15). Drivers by points: if/else 48, boolean chains 4 (nesting depth added 5). 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.
Parser::parse_pat_with_range_pat (cognitive 51) compiler/rustc_parse/src/parser/pat.rs:720— Parser::parse_pat_with_range_pat has cognitive complexity 51 (threshold 15). Drivers by points: if/else 35, boolean chains 8, match/switch 8 (nesting depth added 9). 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.
Parser::parse_arm (cognitive 50) compiler/rustc_parse/src/parser/expr.rs:3359— Parser::parse_arm has cognitive complexity 50 (threshold 15). Drivers by points: if/else 42, boolean chains 8 (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.
Parser::check_no_chained_comparison (cognitive 49) compiler/rustc_parse/src/parser/diagnostics.rs:1426— Parser::check_no_chained_comparison has cognitive complexity 49 (threshold 15). Drivers by points: if/else 35, match/switch 9, 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.
Parser::parse_ty_common (cognitive 49) compiler/rustc_parse/src/parser/ty.rs:276— Parser::parse_ty_common has cognitive complexity 49 (threshold 15). Drivers by points: if/else 31, boolean chains 9, match/switch 9 (nesting depth added 8). 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.
Parser::parse_item_kind (cognitive 45) compiler/rustc_parse/src/parser/item.rs:253— Parser::parse_item_kind has cognitive complexity 45 (threshold 15). Drivers by points: if/else 35, boolean chains 10 (nesting depth added 5). 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.
Parser::parse_expr_assoc_rest_with (cognitive 39) compiler/rustc_parse/src/parser/expr.rs:145— Parser::parse_expr_assoc_rest_with has cognitive complexity 39 (threshold 15). Drivers by points: if/else 26, boolean chains 6, match/switch 6, 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.
Parser::parse_path_segment (cognitive 39) compiler/rustc_parse/src/parser/path.rs:295— Parser::parse_path_segment has cognitive complexity 39 (threshold 15). Drivers by points: if/else 27, boolean chains 9, match/switch 3 (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::parse_generic_params (cognitive 35) compiler/rustc_parse/src/parser/generics.rs:204— Parser::parse_generic_params has cognitive complexity 35 (threshold 15). Drivers by points: if/else 28, match/switch 5, 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.
Parser::collect_tokens (cognitive 34) compiler/rustc_parse/src/parser/attr_wrapper.rs:156— Parser::collect_tokens has cognitive complexity 34 (threshold 15). Drivers by points: if/else 27, boolean chains 5, loops 2 (nesting depth added 6). 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.
Parser::recover_missing_kw_before_item (cognitive 33) compiler/rustc_parse/src/parser/item.rs:487— Parser::recover_missing_kw_before_item has cognitive complexity 33 (threshold 15). Drivers by points: if/else 28, boolean chains 5 (nesting depth added 6). 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.
Parser::parse_item_impl (cognitive 33) compiler/rustc_parse/src/parser/item.rs:677— Parser::parse_item_impl has cognitive complexity 33 (threshold 15). Drivers by points: if/else 24, boolean chains 6, match/switch 3 (nesting depth added 6). 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.
Parser::format (cognitive 33) compiler/rustc_parse_format/src/lib.rs:618— Parser::format has cognitive complexity 33 (threshold 15). Drivers by points: if/else 33 (nesting depth added 7). 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.
Parser::expected_ident_found (cognitive 30) compiler/rustc_parse/src/parser/diagnostics.rs:277— Parser::expected_ident_found has cognitive complexity 30 (threshold 15). Drivers by points: if/else 22, boolean chains 5, match/switch 3 (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::parse_param_general (cognitive 30) compiler/rustc_parse/src/parser/item.rs:3420— Parser::parse_param_general has cognitive complexity 30 (threshold 15). Drivers by points: if/else 24, boolean chains 4, 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.
Parser::maybe_augment_stashed_expr_in_pats_with_suggestions (cognitive 30) compiler/rustc_parse/src/parser/pat.rs:512— Parser::maybe_augment_stashed_expr_in_pats_with_suggestions has cognitive complexity 30 (threshold 15). Drivers by points: if/else 19, match/switch 10, 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.
Parser::parameter_without_type (cognitive 29) compiler/rustc_parse/src/parser/diagnostics.rs:2237— Parser::parameter_without_type has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14, boolean chains 7, match/switch 5, loops 3 (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::parse_where_clause_common (cognitive 27) compiler/rustc_parse/src/parser/generics.rs:410— Parser::parse_where_clause_common has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18, match/switch 5, loops 3, 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.
Parser::parse_generic_arg (cognitive 27) compiler/rustc_parse/src/parser/path.rs:919— Parser::parse_generic_arg has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16, match/switch 6, boolean chains 5 (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::next (cognitive 27) compiler/rustc_parse_format/src/lib.rs:233— Parser::next has cognitive complexity 27 (threshold 15). Drivers by points: if/else 25, match/switch 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.
FnCtxt::suggest_traits_to_import (cyclomatic 79) compiler/rustc_hir_typeck/src/method/suggest.rs:4147— FnCtxt::suggest_traits_to_import has cyclomatic complexity 79 (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.
FnCtxt::handle_unsatisfied_predicates (cyclomatic 70) compiler/rustc_hir_typeck/src/method/suggest.rs:1714— FnCtxt::handle_unsatisfied_predicates has cyclomatic complexity 70 (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.
FnCtxt::suggest_deref_or_ref (cyclomatic 59) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:2943— FnCtxt::suggest_deref_or_ref 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.
FnCtxt::suggest_cast (cyclomatic 55) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:3365— FnCtxt::suggest_cast has cyclomatic complexity 55 (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.
FnCtxt::label_fn_like (cyclomatic 47) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:1592— FnCtxt::label_fn_like 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.
FnCtxt::instantiate_value_path (cyclomatic 45) compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:999— FnCtxt::instantiate_value_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.
FnCtxt::check_expr_struct_fields (cyclomatic 42) compiler/rustc_hir_typeck/src/expr.rs:1847— FnCtxt::check_expr_struct_fields has cyclomatic complexity 42 (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.
FnCtxt::suggest_deref_ref_or_into (cyclomatic 37) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:351— FnCtxt::suggest_deref_ref_or_into has cyclomatic complexity 37 (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.
FnCtxt::check_pat_inner (cyclomatic 33) compiler/rustc_hir_typeck/src/pat.rs:480— FnCtxt::check_pat_inner 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.
FnCtxt::suggest_compatible_variants (cyclomatic 32) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:2611— FnCtxt::suggest_compatible_variants 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.
FnCtxt::report_invalid_callee (cyclomatic 31) compiler/rustc_hir_typeck/src/callee.rs:877— FnCtxt::report_invalid_callee 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.
FnCtxt::analyze_closure (cyclomatic 31) compiler/rustc_hir_typeck/src/upvar.rs:165— FnCtxt::analyze_closure 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.
FnCtxt::point_at_expr_if_possible (cyclomatic 30) compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs:288— FnCtxt::point_at_expr_if_possible 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.
FnCtxt::check_argument_types (cyclomatic 30) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:188— FnCtxt::check_argument_types 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.
FnCtxt::check_expr_field (cyclomatic 29) compiler/rustc_hir_typeck/src/expr.rs:2741— FnCtxt::check_expr_field 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.
FnCtxt::note_source_of_type_mismatch_constraint (cyclomatic 25) compiler/rustc_hir_typeck/src/demand.rs:290— FnCtxt::note_source_of_type_mismatch_constraint 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.
FnCtxt::report_method_error (cyclomatic 25) compiler/rustc_hir_typeck/src/method/suggest.rs:260— FnCtxt::report_method_error 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.
FnCtxt::check_pat_ref (cyclomatic 25) compiler/rustc_hir_typeck/src/pat.rs:2794— FnCtxt::check_pat_ref 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.
FnCtxt::annotate_loop_expected_due_to_inference (cyclomatic 24) compiler/rustc_hir_typeck/src/demand.rs:577— FnCtxt::annotate_loop_expected_due_to_inference 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.
FnCtxt::note_type_is_not_clone (cyclomatic 24) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:2032— FnCtxt::note_type_is_not_clone 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.
FnCtxt::emit_err_pat_wrong_number_of_fields (cyclomatic 23) compiler/rustc_hir_typeck/src/pat.rs:1881— FnCtxt::emit_err_pat_wrong_number_of_fields 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.
FnCtxt::check_tupled_arguments (cyclomatic 22) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:563— FnCtxt::check_tupled_arguments 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.
FnCtxt::suggest_missing_break_or_return_expr (cyclomatic 22) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:1313— FnCtxt::suggest_missing_break_or_return_expr has cyclomatic complexity 22 (threshold 15). Of this number, 12 points are the body's own statements and 10 belong to one function item declared inside it. 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.
FnCtxt::report_binop_fulfillment_errors (cyclomatic 22) compiler/rustc_hir_typeck/src/op.rs:329— FnCtxt::report_binop_fulfillment_errors 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.
FnCtxt::try_find_coercion_lub (cyclomatic 21) compiler/rustc_hir_typeck/src/coercion.rs:1317— FnCtxt::try_find_coercion_lub has cyclomatic complexity 21 (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::expected_one_of_not_found (cyclomatic 59) compiler/rustc_parse/src/parser/diagnostics.rs:443— Parser::expected_one_of_not_found has cyclomatic complexity 59 (threshold 15). Of this number, 55 points are the body's own statements and 4 belong to one function item declared inside it. 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::parse_expr_bottom (cyclomatic 45) compiler/rustc_parse/src/parser/expr.rs:1471— Parser::parse_expr_bottom 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.
Parser::parse_pat_with_range_pat (cyclomatic 39) compiler/rustc_parse/src/parser/pat.rs:720— Parser::parse_pat_with_range_pat has cyclomatic complexity 39 (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::parse_ty_common (cyclomatic 39) compiler/rustc_parse/src/parser/ty.rs:276— Parser::parse_ty_common has cyclomatic complexity 39 (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::parse_item_kind (cyclomatic 38) compiler/rustc_parse/src/parser/item.rs:253— Parser::parse_item_kind 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.
Parser::parse_fn_front_matter (cyclomatic 35) compiler/rustc_parse/src/parser/item.rs:3094— Parser::parse_fn_front_matter 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.
Parser::nonterminal_may_begin_with (cyclomatic 29) compiler/rustc_parse/src/parser/nonterminal.rs:22— Parser::nonterminal_may_begin_with has cyclomatic complexity 29 (threshold 15). Of this number, 26 points are the body's own statements and 3 belong to one function item declared inside it. 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::parse_expr_assoc_rest_with (cyclomatic 28) compiler/rustc_parse/src/parser/expr.rs:145— Parser::parse_expr_assoc_rest_with 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.
Parser::parse_struct_fields (cyclomatic 27) compiler/rustc_parse/src/parser/expr.rs:3871— Parser::parse_struct_fields 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.
Parser::parse_pat_fields (cyclomatic 26) compiler/rustc_parse/src/parser/pat.rs:1501— Parser::parse_pat_fields 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.
Parser::parse_path_segment (cyclomatic 24) compiler/rustc_parse/src/parser/path.rs:295— Parser::parse_path_segment 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.
Parser::collect_tokens (cyclomatic 23) compiler/rustc_parse/src/parser/attr_wrapper.rs:156— Parser::collect_tokens 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.
Parser::parse_arm (cyclomatic 23) compiler/rustc_parse/src/parser/expr.rs:3359— Parser::parse_arm 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.
Parser::parse_item_impl (cyclomatic 23) compiler/rustc_parse/src/parser/item.rs:677— Parser::parse_item_impl 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.
Parser::format (cyclomatic 22) compiler/rustc_parse_format/src/lib.rs:618— Parser::format 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::parameter_without_type (cyclomatic 21) compiler/rustc_parse/src/parser/diagnostics.rs:2237— Parser::parameter_without_type 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.
Parser::recover_missing_kw_before_item (cyclomatic 20) compiler/rustc_parse/src/parser/item.rs:487— Parser::recover_missing_kw_before_item 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.
Parser::parse_self_param (cyclomatic 20) compiler/rustc_parse/src/parser/item.rs:3535— Parser::parse_self_param 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.
Parser::parse_generic_arg (cyclomatic 20) compiler/rustc_parse/src/parser/path.rs:919— Parser::parse_generic_arg 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.
Parser::check_no_chained_comparison (cyclomatic 19) compiler/rustc_parse/src/parser/diagnostics.rs:1426— Parser::check_no_chained_comparison 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.
Parser::parse_param_general (cyclomatic 19) compiler/rustc_parse/src/parser/item.rs:3420— Parser::parse_param_general 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.
Parser::parse_nonterminal (cyclomatic 19) compiler/rustc_parse/src/parser/nonterminal.rs:121— Parser::parse_nonterminal 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::recover_stmt_ (cyclomatic 18) compiler/rustc_parse/src/parser/diagnostics.rs:2142— Parser::recover_stmt_ 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::parse_pat_no_top_guard_inner (cyclomatic 18) compiler/rustc_parse/src/parser/pat.rs:166— Parser::parse_pat_no_top_guard_inner 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.
Parser::maybe_augment_stashed_expr_in_pats_with_suggestions (cyclomatic 18) compiler/rustc_parse/src/parser/pat.rs:512— Parser::maybe_augment_stashed_expr_in_pats_with_suggestions 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.
LateResolutionVisitor::add_missing_lifetime_specifiers_label (cognitive 180) compiler/rustc_resolve/src/late/diagnostics.rs:4077— LateResolutionVisitor::add_missing_lifetime_specifiers_label has cognitive complexity 180 (threshold 15). Drivers by points: if/else 120, match/switch 35, loops 17, boolean chains 8 (nesting depth added 113). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LateResolutionVisitor::smart_resolve_context_dependent_help (cognitive 97) compiler/rustc_resolve/src/late/diagnostics.rs:2113— LateResolutionVisitor::smart_resolve_context_dependent_help has cognitive complexity 97 (threshold 15). Drivers by points: if/else 66, match/switch 14, boolean chains 13, loops 4 (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.
LateResolutionVisitor::try_lookup_name_relaxed (cognitive 75) compiler/rustc_resolve/src/late/diagnostics.rs:918— LateResolutionVisitor::try_lookup_name_relaxed has cognitive complexity 75 (threshold 15). Drivers by points: if/else 53, match/switch 12, boolean chains 8, loops 2 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LateResolutionVisitor::make_base_error (cognitive 66) compiler/rustc_resolve/src/late/diagnostics.rs:382— LateResolutionVisitor::make_base_error has cognitive complexity 66 (threshold 15). Drivers by points: if/else 39, match/switch 17, boolean chains 10 (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.
LateResolutionVisitor::smart_resolve_path_fragment (cognitive 51) compiler/rustc_resolve/src/late.rs:4549— LateResolutionVisitor::smart_resolve_path_fragment has cognitive complexity 51 (threshold 15). Drivers by points: if/else 39, boolean chains 6, match/switch 6 (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.
LateResolutionVisitor::with_generic_param_rib (cognitive 50) compiler/rustc_resolve/src/late.rs:3085— LateResolutionVisitor::with_generic_param_rib has cognitive complexity 50 (threshold 15). Drivers by points: if/else 24, match/switch 13, loops 11, 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.
LateResolutionVisitor::suggest_introducing_lifetime_filtered (cognitive 48) compiler/rustc_resolve/src/late/diagnostics.rs:3851— LateResolutionVisitor::suggest_introducing_lifetime_filtered has cognitive complexity 48 (threshold 15). Drivers by points: if/else 35, loops 6, boolean chains 5, match/switch 2 (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.
LateResolutionVisitor::resolve_elided_lifetimes_in_path (cognitive 45) compiler/rustc_resolve/src/late.rs:2175— LateResolutionVisitor::resolve_elided_lifetimes_in_path has cognitive complexity 45 (threshold 15). Drivers by points: loops 22, if/else 14, match/switch 7, boolean chains 2 (nesting depth added 25). 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.
LateResolutionVisitor::resolve_lifetime (cognitive 41) compiler/rustc_resolve/src/late.rs:1769— LateResolutionVisitor::resolve_lifetime has cognitive complexity 41 (threshold 15). Drivers by points: if/else 28, match/switch 11, boolean chains 1, 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.
LateResolutionVisitor::resolve_anonymous_lifetime (cognitive 41) compiler/rustc_resolve/src/late.rs:1881— LateResolutionVisitor::resolve_anonymous_lifetime has cognitive complexity 41 (threshold 15). Drivers by points: if/else 36, boolean chains 2, match/switch 2, 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.
LateResolutionVisitor::suggest_using_enum_variant (cognitive 39) compiler/rustc_resolve/src/late/diagnostics.rs:3138— LateResolutionVisitor::suggest_using_enum_variant has cognitive complexity 39 (threshold 15). Drivers by points: if/else 26, match/switch 11, boolean chains 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.
LateResolutionVisitor::resolve_fn_params (cognitive 39) compiler/rustc_resolve/src/late.rs:2488— LateResolutionVisitor::resolve_fn_params has cognitive complexity 39 (threshold 15). Drivers by points: if/else 24, match/switch 11, boolean chains 2, loops 2 (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.
LateResolutionVisitor::suggest_assoc_type_from_bounds (cognitive 35) compiler/rustc_resolve/src/late/diagnostics.rs:207— LateResolutionVisitor::suggest_assoc_type_from_bounds has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16, loops 14, boolean chains 3, match/switch 2 (nesting depth added 11). 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.
LateResolutionVisitor::maybe_report_lifetime_uses (cognitive 34) compiler/rustc_resolve/src/late/diagnostics.rs:3637— LateResolutionVisitor::maybe_report_lifetime_uses has cognitive complexity 34 (threshold 15). Drivers by points: if/else 25, match/switch 8, 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.
LateResolutionVisitor::lookup_typo_candidate (cognitive 33) compiler/rustc_resolve/src/late/diagnostics.rs:2896— LateResolutionVisitor::lookup_typo_candidate has cognitive complexity 33 (threshold 15). Drivers by points: if/else 23, loops 5, match/switch 3, boolean chains 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.
LateResolutionVisitor::lookup_assoc_candidate (cognitive 32) compiler/rustc_resolve/src/late/diagnostics.rs:2786— LateResolutionVisitor::lookup_assoc_candidate has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15, match/switch 12, boolean chains 3, loops 2 (nesting depth added 16). Of this number, 31 points are the body's own statements and 1 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LateResolutionVisitor::suggest_adding_generic_parameter (cognitive 31) compiler/rustc_resolve/src/late/diagnostics.rs:3508— LateResolutionVisitor::suggest_adding_generic_parameter has cognitive complexity 31 (threshold 15). Drivers by points: if/else 23, match/switch 5, boolean chains 3 (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.
LateResolutionVisitor::detect_missing_binding_available_from_pattern (cognitive 28) compiler/rustc_resolve/src/late/diagnostics.rs:1587— LateResolutionVisitor::detect_missing_binding_available_from_pattern has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14, loops 13, 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.
LateResolutionVisitor::err_code_special_cases (cognitive 24) compiler/rustc_resolve/src/late/diagnostics.rs:1388— LateResolutionVisitor::err_code_special_cases has cognitive complexity 24 (threshold 15). Drivers by points: if/else 17, loops 7 (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.
LateResolutionVisitor::visit_generic_params (cognitive 24) compiler/rustc_resolve/src/late.rs:1628— LateResolutionVisitor::visit_generic_params has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12, loops 8, match/switch 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.
LateResolutionVisitor::future_proof_import (cognitive 24) compiler/rustc_resolve/src/late.rs:2781— LateResolutionVisitor::future_proof_import has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14, match/switch 5, loops 4, 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.
LateResolutionVisitor::resolve_item (cognitive 24) compiler/rustc_resolve/src/late.rs:2824— LateResolutionVisitor::resolve_item has cognitive complexity 24 (threshold 15). Drivers by points: if/else 17, boolean chains 4, match/switch 3 (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.
LateResolutionVisitor::resolve_expr (cognitive 24) compiler/rustc_resolve/src/late.rs:5186— LateResolutionVisitor::resolve_expr has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10, loops 9, match/switch 5 (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.
LateResolutionVisitor::resolve_doc_links (cognitive 24) compiler/rustc_resolve/src/late.rs:5447— LateResolutionVisitor::resolve_doc_links has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10, loops 10, boolean chains 3, 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.
LateResolutionVisitor::compute_and_check_or_pat_binding_map (cognitive 23) compiler/rustc_resolve/src/late.rs:4061— LateResolutionVisitor::compute_and_check_or_pat_binding_map has cognitive complexity 23 (threshold 15). Drivers by points: loops 10, if/else 9, match/switch 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.
Resolver::resolve_path_with_ribs (cognitive 142) compiler/rustc_resolve/src/ident.rs:1822— Resolver::resolve_path_with_ribs has cognitive complexity 142 (threshold 15). Drivers by points: if/else 104, boolean chains 18, match/switch 15, loops 5 (nesting depth added 75). Of this number, 140 points are the body's own statements and 2 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent 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::validate_res_from_ribs (cognitive 116) compiler/rustc_resolve/src/ident.rs:1459— Resolver::validate_res_from_ribs has cognitive complexity 116 (threshold 15). Drivers by points: if/else 79, match/switch 28, loops 6, boolean chains 3 (nesting depth added 77). To reduce it, split the body into named stages: move each independent 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::into_struct_error (cognitive 106) compiler/rustc_resolve/src/diagnostics/impls.rs:792— Resolver::into_struct_error has cognitive complexity 106 (threshold 15). Drivers by points: if/else 53, match/switch 26, loops 18, boolean chains 9 (nesting depth added 60). To reduce it, split the body into named stages: move each independent 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::report_privacy_error (cognitive 102) compiler/rustc_resolve/src/diagnostics/impls.rs:2522— Resolver::report_privacy_error has cognitive complexity 102 (threshold 15). Drivers by points: if/else 72, loops 12, match/switch 10, boolean chains 8 (nesting depth added 51). To reduce it, split the body into named stages: move each independent 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::lookup_import_candidates_from_module (cognitive 77) compiler/rustc_resolve/src/diagnostics/impls.rs:1593— Resolver::lookup_import_candidates_from_module has cognitive complexity 77 (threshold 15). Drivers by points: if/else 53, boolean chains 19, match/switch 4, loops 1 (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::report_path_resolution_error (cognitive 66) compiler/rustc_resolve/src/diagnostics/impls.rs:2926— Resolver::report_path_resolution_error has cognitive complexity 66 (threshold 15). Drivers by points: if/else 54, match/switch 10, boolean chains 2 (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.
Resolver::resolve_ident_in_scope (cognitive 64) compiler/rustc_resolve/src/ident.rs:543— Resolver::resolve_ident_in_scope has cognitive complexity 64 (threshold 15). Drivers by points: if/else 36, match/switch 22, boolean chains 4, loops 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.
Resolver::resolve_path_in_value_ns_with_prefix_info (cognitive 61) src/tools/rust-analyzer/crates/hir-def/src/resolver.rs:341— Resolver::resolve_path_in_value_ns_with_prefix_info has cognitive complexity 61 (threshold 15). Drivers by points: if/else 41, match/switch 11, boolean chains 5, loops 4 (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::check_unused (cognitive 55) compiler/rustc_resolve/src/check_unused.rs:413— Resolver::check_unused has cognitive complexity 55 (threshold 15). Drivers by points: if/else 29, boolean chains 11, loops 8, match/switch 7 (nesting depth added 21). Of this number, 51 points are the body's own statements and 4 belong to 2 function items declared inside it. To reduce it, split the body into named stages: move each independent 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::smart_resolve_macro_path (cognitive 54) compiler/rustc_resolve/src/macros.rs:603— Resolver::smart_resolve_macro_path has cognitive complexity 54 (threshold 15). Drivers by points: if/else 37, boolean chains 7, match/switch 6, loops 4 (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.
Resolver::visit_scopes (cognitive 48) compiler/rustc_resolve/src/ident.rs:54— Resolver::visit_scopes has cognitive complexity 48 (threshold 15). Drivers by points: match/switch 24, if/else 14, boolean chains 6, loops 4 (nesting depth added 23). 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.
Resolver::throw_unresolved_import_error (cognitive 46) compiler/rustc_resolve/src/diagnostics/impls.rs:144— Resolver::throw_unresolved_import_error has cognitive complexity 46 (threshold 15). Drivers by points: if/else 31, loops 6, match/switch 6, boolean chains 3 (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::maybe_push_ambiguity (cognitive 38) compiler/rustc_resolve/src/ident.rs:825— Resolver::maybe_push_ambiguity has cognitive complexity 38 (threshold 15). Drivers by points: if/else 21, boolean chains 15, match/switch 2 (nesting depth added 4). 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.
Resolver::finalize_macro_resolutions (cognitive 36) compiler/rustc_resolve/src/macros.rs:929— Resolver::finalize_macro_resolutions has cognitive complexity 36 (threshold 15). Drivers by points: match/switch 15, if/else 14, loops 5, 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.
Resolver::try_resolve_visibility (cognitive 34) compiler/rustc_resolve/src/build_reduced_graph.rs:230— Resolver::try_resolve_visibility has cognitive complexity 34 (threshold 15). Drivers by points: if/else 25, match/switch 9 (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.
Resolver::resolve_path_in_type_ns_with_prefix_info (cognitive 34) src/tools/rust-analyzer/crates/hir-def/src/resolver.rs:181— Resolver::resolve_path_in_type_ns_with_prefix_info has cognitive complexity 34 (threshold 15). Drivers by points: if/else 23, match/switch 9, 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::resolve_ident_in_module (cognitive 31) compiler/rustc_resolve/src/ident.rs:991— Resolver::resolve_ident_in_module has cognitive complexity 31 (threshold 15). Drivers by points: if/else 23, match/switch 5, boolean chains 3 (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.
Resolver::find_cfg_stripped (cognitive 30) compiler/rustc_resolve/src/diagnostics/impls.rs:3564— Resolver::find_cfg_stripped has cognitive complexity 30 (threshold 15). Drivers by points: if/else 22, loops 4, boolean chains 2, match/switch 2 (nesting depth added 15). Most of this is not in the body itself: 13 of the 30 points are its own statements and the rest belongs to one function item declared inside it (comes_from_same_module_for_glob). 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.
Resolver::report_conflict (cognitive 26) compiler/rustc_resolve/src/diagnostics/impls.rs:430— Resolver::report_conflict has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 11, boolean chains 10, if/else 5 (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.
Resolver::unresolved_macro_suggestions (cognitive 26) compiler/rustc_resolve/src/diagnostics/impls.rs:1912— Resolver::unresolved_macro_suggestions has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14, match/switch 6, boolean chains 5, loops 1 (nesting depth added 6). 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.
Resolver::detect_derive_attribute (cognitive 25) compiler/rustc_resolve/src/diagnostics/impls.rs:2078— Resolver::detect_derive_attribute has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14, match/switch 7, loops 3, 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.
Resolver::resolve_ident_in_module_globs_unadjusted (cognitive 25) compiler/rustc_resolve/src/ident.rs:1207— Resolver::resolve_ident_in_module_globs_unadjusted has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17, match/switch 6, 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.
Resolver::rename_will_conflict_with_renamed (cognitive 24) src/tools/rust-analyzer/crates/hir-def/src/resolver.rs:825— Resolver::rename_will_conflict_with_renamed has cognitive complexity 24 (threshold 15). Drivers by points: if/else 17, loops 4, match/switch 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.
Resolver::ambiguity_diagnostic (cognitive 22) compiler/rustc_resolve/src/diagnostics/impls.rs:2294— Resolver::ambiguity_diagnostic has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15, boolean chains 7 (nesting depth added 3). 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.
Resolver::rename_will_conflict_with_another_variable (cognitive 22) src/tools/rust-analyzer/crates/hir-def/src/resolver.rs:776— Resolver::rename_will_conflict_with_another_variable has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, loops 4, match/switch 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.
TypeErrCtxt::report_selection_error (cognitive 170) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:60— TypeErrCtxt::report_selection_error has cognitive complexity 170 (threshold 15). Drivers by points: if/else 130, boolean chains 19, match/switch 17, loops 4 (nesting depth added 91). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TypeErrCtxt::note_and_explain_type_err (cognitive 141) compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs:18— TypeErrCtxt::note_and_explain_type_err has cognitive complexity 141 (threshold 15). Drivers by points: if/else 95, match/switch 20, boolean chains 14, loops 12 (nesting depth added 86). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TypeErrCtxt::note_type_err (cognitive 123) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:1457— TypeErrCtxt::note_type_err has cognitive complexity 123 (threshold 15). Drivers by points: if/else 77, match/switch 21, boolean chains 19, loops 6 (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.
TypeErrCtxt::maybe_report_ambiguity (cognitive 118) compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs:178— TypeErrCtxt::maybe_report_ambiguity has cognitive complexity 118 (threshold 15). Drivers by points: if/else 96, match/switch 15, boolean chains 7 (nesting depth added 60). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TypeErrCtxt::report_similar_impl_candidates (cognitive 116) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:2060— TypeErrCtxt::report_similar_impl_candidates has cognitive complexity 116 (threshold 15). Drivers by points: if/else 92, loops 12, boolean chains 10, match/switch 2 (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.
TypeErrCtxt::note_error_origin (cognitive 85) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:326— TypeErrCtxt::note_error_origin has cognitive complexity 85 (threshold 15). Drivers by points: if/else 61, match/switch 13, boolean chains 7, loops 4 (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.
TypeErrCtxt::compare_generics (cognitive 50) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:979— TypeErrCtxt::compare_generics has cognitive complexity 50 (threshold 15). Drivers by points: if/else 33, loops 7, match/switch 7, boolean chains 3 (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.
TypeErrCtxt::cmp (cognitive 47) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:1128— TypeErrCtxt::cmp has cognitive complexity 47 (threshold 15). Drivers by points: if/else 40, match/switch 3, boolean chains 2, loops 2 (nesting depth added 19). Of this number, 41 points are the body's own statements and 6 belong to 2 function items declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TypeErrCtxt::construct_generic_bound_failure (cognitive 46) compiler/rustc_trait_selection/src/error_reporting/infer/region.rs:716— TypeErrCtxt::construct_generic_bound_failure has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22, match/switch 17, boolean chains 6, 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.
TypeErrCtxt::report_fulfillment_errors (cognitive 46) compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs:141— TypeErrCtxt::report_fulfillment_errors has cognitive complexity 46 (threshold 15). Drivers by points: if/else 31, loops 11, boolean chains 2, match/switch 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.
TypeErrCtxt::expected_found_str_term (cognitive 42) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:2365— TypeErrCtxt::expected_found_str_term has cognitive complexity 42 (threshold 15). Drivers by points: if/else 39, boolean chains 2, match/switch 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.
TypeErrCtxt::report_host_effect_error (cognitive 42) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:864— TypeErrCtxt::report_host_effect_error has cognitive complexity 42 (threshold 15). Drivers by points: if/else 24, loops 9, match/switch 6, boolean chains 3 (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.
TypeErrCtxt::cmp_fn_sig (cognitive 39) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:753— TypeErrCtxt::cmp_fn_sig has cognitive complexity 39 (threshold 15). Drivers by points: if/else 29, loops 6, boolean chains 2, match/switch 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.
TypeErrCtxt::try_conversion_context (cognitive 31) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1137— TypeErrCtxt::try_conversion_context has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18, boolean chains 9, loops 2, match/switch 2 (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.
TypeErrCtxt::consider_returning_binding_diag (cognitive 27) compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs:848— TypeErrCtxt::consider_returning_binding_diag has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15, boolean chains 4, loops 4, match/switch 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.
TypeErrCtxt::report_not_const_evaluatable_error (cognitive 27) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:3810— TypeErrCtxt::report_not_const_evaluatable_error has cognitive complexity 27 (threshold 15). Drivers by points: if/else 21, boolean chains 3, match/switch 3 (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.
TypeErrCtxt::report_concrete_failure (cognitive 26) compiler/rustc_trait_selection/src/error_reporting/infer/region.rs:307— TypeErrCtxt::report_concrete_failure has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14, match/switch 5, boolean chains 4, loops 3 (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.
TypeErrCtxt::should_suggest_as_ref_kind (cognitive 26) compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs:543— TypeErrCtxt::should_suggest_as_ref_kind has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 11, if/else 10, loops 4, 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.
TypeErrCtxt::report_projection_error (cognitive 23) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1602— TypeErrCtxt::report_projection_error has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17, match/switch 5, 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.
TypeErrCtxt::maybe_detailed_projection_msg (cognitive 23) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1819— TypeErrCtxt::maybe_detailed_projection_msg has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11, match/switch 11, 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.
TypeErrCtxt::suggest_function_pointers_impl (cognitive 21) compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs:400— TypeErrCtxt::suggest_function_pointers_impl has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15, boolean chains 3, match/switch 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.
TypeErrCtxt::type_error_additional_suggestions (cognitive 20) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:1981— TypeErrCtxt::type_error_additional_suggestions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, boolean chains 4, match/switch 2 (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.
TypeErrCtxt::check_on_type_error_attribute (cognitive 20) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:2132— TypeErrCtxt::check_on_type_error_attribute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, loops 6 (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.
TypeErrCtxt::report_region_errors (cognitive 20) compiler/rustc_trait_selection/src/error_reporting/infer/region.rs:37— TypeErrCtxt::report_region_errors has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, match/switch 3, 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.
TypeErrCtxt::suggest_for_all_lifetime_closure (cognitive 20) compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs:656— TypeErrCtxt::suggest_for_all_lifetime_closure has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16, boolean chains 2, loops 2 (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.
Builder::cargo (cognitive 155) src/bootstrap/src/core/builder/cargo.rs:640— Builder::cargo has cognitive complexity 155 (threshold 15). Drivers by points: if/else 116, boolean chains 18, match/switch 15, loops 6 (nesting depth added 29). 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.
Builder::codegen_inline_asm (cognitive 117) compiler/rustc_codegen_llvm/src/asm.rs:26— Builder::codegen_inline_asm has cognitive complexity 117 (threshold 15). Drivers by points: if/else 77, match/switch 20, loops 18, boolean chains 2 (nesting depth added 62). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Builder::codegen_inline_asm (cognitive 111) compiler/rustc_codegen_gcc/src/asm.rs:117— Builder::codegen_inline_asm has cognitive complexity 111 (threshold 15). Drivers by points: if/else 66, match/switch 30, loops 11, boolean chains 4 (nesting depth added 59). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Builder::codegen_intrinsic_call (cognitive 107) compiler/rustc_codegen_llvm/src/intrinsic.rs:175— Builder::codegen_intrinsic_call has cognitive complexity 107 (threshold 15). Drivers by points: if/else 79, match/switch 20, boolean chains 6, loops 2 (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.
Builder::expr_into_dest (cognitive 70) compiler/rustc_mir_build/src/builder/expr/into.rs:27— Builder::expr_into_dest has cognitive complexity 70 (threshold 15). Drivers by points: if/else 37, match/switch 30, loops 2, boolean chains 1 (nesting depth added 32). Of this number, 65 points are the body's own statements and 5 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Builder::load_operand (cognitive 38) compiler/rustc_codegen_llvm/src/builder.rs:716— Builder::load_operand has cognitive complexity 38 (threshold 15). Drivers by points: if/else 36, boolean chains 1, match/switch 1 (nesting depth added 16). Of this number, 28 points are the body's own statements and 10 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Builder::codegen_intrinsic_call (cognitive 35) compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:194— Builder::codegen_intrinsic_call has cognitive complexity 35 (threshold 15). Drivers by points: if/else 21, match/switch 14 (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.
Builder::dbg_scope_fn (cognitive 28) compiler/rustc_codegen_llvm/src/debuginfo/mod.rs:129— Builder::dbg_scope_fn has cognitive complexity 28 (threshold 15). Drivers by points: if/else 23, boolean chains 3, match/switch 2 (nesting depth added 5). Most of this is not in the body itself: 8 of the 28 points are its own statements and the rest belongs to 3 function items declared inside it (get_containing_scope, get_function_signature, get_template_parameters). 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.
Builder::as_rvalue (cognitive 26) compiler/rustc_mir_build/src/builder/expr/as_rvalue.rs:43— Builder::as_rvalue has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14, match/switch 8, boolean chains 2, loops 2 (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.
Builder::choose_bucket_for_candidate (cognitive 26) compiler/rustc_mir_build/src/builder/matches/buckets.rs:120— Builder::choose_bucket_for_candidate has cognitive complexity 26 (threshold 15). Drivers by points: if/else 20, match/switch 5, 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.
Builder::count_zeroes_nonzero (cognitive 25) compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:982— Builder::count_zeroes_nonzero has cognitive complexity 25 (threshold 15). Drivers by points: if/else 24, boolean chains 1 (nesting depth added 5). Of this number, 23 points are the body's own statements and 2 belong to one function item declared inside it. 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.
Builder::build_exit_tree (cognitive 23) compiler/rustc_mir_build/src/builder/scope.rs:1973— Builder::build_exit_tree has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11, match/switch 6, loops 4, 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.
Builder::codegen_llvm_intrinsic_call (cognitive 22) compiler/rustc_codegen_llvm/src/intrinsic.rs:910— Builder::codegen_llvm_intrinsic_call has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, loops 3, match/switch 3 (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.
Builder::gcc_icmp (cognitive 21) compiler/rustc_codegen_gcc/src/int.rs:424— Builder::gcc_icmp has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12, match/switch 6, boolean chains 3 (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.
Builder::check_ptr_call (cognitive 20) compiler/rustc_codegen_gcc/src/builder.rs:212— Builder::check_ptr_call has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, boolean chains 4, loops 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.
Builder::ast_block_stmts (cognitive 20) compiler/rustc_mir_build/src/builder/block.rs:34— Builder::ast_block_stmts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, boolean chains 2, loops 2, match/switch 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.
Builder::shuffle_vector (cognitive 19) compiler/rustc_codegen_gcc/src/builder.rs:2019— Builder::shuffle_vector has cognitive complexity 19 (threshold 15). Drivers by points: loops 11, if/else 8 (nesting depth added 5). 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.
Builder::codegen_llvm_intrinsic_call (cognitive 19) compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:587— Builder::codegen_llvm_intrinsic_call has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, match/switch 5, 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.
Builder::args_and_body (cognitive 19) compiler/rustc_mir_build/src/builder/mod.rs:930— Builder::args_and_body has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, match/switch 4, 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.
Builder::load_operand (cognitive 18) compiler/rustc_codegen_gcc/src/builder.rs:1025— Builder::load_operand has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, boolean chains 1, match/switch 1 (nesting depth added 4). Of this number, 14 points are the body's own statements and 4 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Builder::visit_primary_bindings_special (cognitive 18) compiler/rustc_mir_build/src/builder/matches/mod.rs:840— Builder::visit_primary_bindings_special has cognitive complexity 18 (threshold 15). Drivers by points: loops 10, if/else 6, match/switch 2 (nesting depth added 8). 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.
Builder::stmt_expr (cognitive 17) compiler/rustc_mir_build/src/builder/expr/stmt.rs:15— Builder::stmt_expr has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, match/switch 5, 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.
Builder::gcc_lshr (cognitive 16) compiler/rustc_codegen_gcc/src/int.rs:71— Builder::gcc_lshr has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 3, match/switch 3 (nesting depth added 4). 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.
Builder::gcc_shl (cognitive 16) compiler/rustc_codegen_gcc/src/int.rs:634— Builder::gcc_shl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 5, match/switch 3 (nesting depth added 3). 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.
Builder::cfi_type_test (cognitive 16) compiler/rustc_codegen_llvm/src/builder.rs:1939— Builder::cfi_type_test has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, 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.
MirBorrowckCtxt::report_mutability_error (cognitive 148) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:62— MirBorrowckCtxt::report_mutability_error has cognitive complexity 148 (threshold 15). Drivers by points: if/else 107, match/switch 27, loops 10, boolean chains 4 (nesting depth added 86). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MirBorrowckCtxt::explain_captures (cognitive 141) compiler/rustc_borrowck/src/diagnostics/mod.rs:1239— MirBorrowckCtxt::explain_captures has cognitive complexity 141 (threshold 15). Drivers by points: if/else 96, match/switch 22, boolean chains 12, loops 11 (nesting depth added 88). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MirBorrowckCtxt::was_captured_by_trait_object (cognitive 74) compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:821— MirBorrowckCtxt::was_captured_by_trait_object has cognitive complexity 74 (threshold 15). Drivers by points: if/else 50, match/switch 22, boolean chains 1, loops 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.
MirBorrowckCtxt::suggest_make_local_mut (cognitive 62) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:1378— MirBorrowckCtxt::suggest_make_local_mut has cognitive complexity 62 (threshold 15). Drivers by points: if/else 43, boolean chains 10, match/switch 6, loops 3 (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.
MirBorrowckCtxt::add_move_hints (cognitive 50) compiler/rustc_borrowck/src/diagnostics/move_errors.rs:735— MirBorrowckCtxt::add_move_hints has cognitive complexity 50 (threshold 15). Drivers by points: if/else 33, match/switch 13, boolean chains 4 (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.
MirBorrowckCtxt::later_use_kind (cognitive 49) compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:719— MirBorrowckCtxt::later_use_kind has cognitive complexity 49 (threshold 15). Drivers by points: if/else 40, match/switch 8, boolean chains 1 (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.
MirBorrowckCtxt::describe_place_with_options (cognitive 47) compiler/rustc_borrowck/src/diagnostics/mod.rs:340— MirBorrowckCtxt::describe_place_with_options has cognitive complexity 47 (threshold 15). Drivers by points: if/else 39, match/switch 7, loops 1 (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.
MirBorrowckCtxt::suggest_map_index_mut_alternatives (cognitive 39) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:658— MirBorrowckCtxt::suggest_map_index_mut_alternatives has cognitive complexity 39 (threshold 15). Drivers by points: if/else 26, match/switch 5, boolean chains 4, loops 4 (nesting depth added 19). Of this number, 32 points are the body's own statements and 7 belong to 2 function items declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MirBorrowckCtxt::add_move_error_suggestions (cognitive 35) compiler/rustc_borrowck/src/diagnostics/move_errors.rs:1064— MirBorrowckCtxt::add_move_error_suggestions has cognitive complexity 35 (threshold 15). Drivers by points: if/else 31, boolean chains 2, loops 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.
MirBorrowckCtxt::note_due_to_edition_2024_opaque_capture_rules (cognitive 35) compiler/rustc_borrowck/src/diagnostics/opaque_types.rs:92— MirBorrowckCtxt::note_due_to_edition_2024_opaque_capture_rules has cognitive complexity 35 (threshold 15). Drivers by points: if/else 24, loops 8, match/switch 2, 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.
MirBorrowckCtxt::is_mutable (cognitive 33) compiler/rustc_borrowck/src/lib.rs:2561— MirBorrowckCtxt::is_mutable has cognitive complexity 33 (threshold 15). Drivers by points: match/switch 28, if/else 4, boolean chains 1 (nesting depth added 21). 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.
MirBorrowckCtxt::point_at_binding_outside_closure (cognitive 27) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:1149— MirBorrowckCtxt::point_at_binding_outside_closure has cognitive complexity 27 (threshold 15). Drivers by points: if/else 25, 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.
MirBorrowckCtxt::add_static_impl_trait_suggestion (cognitive 26) compiler/rustc_borrowck/src/diagnostics/region_errors.rs:846— MirBorrowckCtxt::add_static_impl_trait_suggestion has cognitive complexity 26 (threshold 15). Drivers by points: if/else 22, loops 2, match/switch 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.
MirBorrowckCtxt::suggest_static_lifetime_for_gat_from_hrtb (cognitive 25) compiler/rustc_borrowck/src/diagnostics/region_errors.rs:197— MirBorrowckCtxt::suggest_static_lifetime_for_gat_from_hrtb has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16, loops 7, 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.
MirBorrowckCtxt::add_moved_or_invoked_closure_note (cognitive 24) compiler/rustc_borrowck/src/diagnostics/mod.rs:238— MirBorrowckCtxt::add_moved_or_invoked_closure_note has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15, match/switch 6, boolean chains 2, loops 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.
MirBorrowckCtxt::append_binding_error (cognitive 24) compiler/rustc_borrowck/src/diagnostics/move_errors.rs:174— MirBorrowckCtxt::append_binding_error has cognitive complexity 24 (threshold 15). Drivers by points: if/else 17, loops 4, boolean chains 2, match/switch 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.
MirBorrowckCtxt::consume_rvalue (cognitive 24) compiler/rustc_borrowck/src/lib.rs:1475— MirBorrowckCtxt::consume_rvalue has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10, match/switch 9, loops 5 (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.
MirBorrowckCtxt::visit_after_early_terminator_effect (cognitive 23) compiler/rustc_borrowck/src/lib.rs:880— MirBorrowckCtxt::visit_after_early_terminator_effect has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13, loops 6, match/switch 4 (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.
MirBorrowckCtxt::check_movable_place (cognitive 23) compiler/rustc_borrowck/src/lib.rs:1899— MirBorrowckCtxt::check_movable_place has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 14, if/else 8, 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.
MirBorrowckCtxt::show_mutating_upvar (cognitive 22) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:994— MirBorrowckCtxt::show_mutating_upvar has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14, match/switch 5, loops 3 (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.
MirBorrowckCtxt::propagate_closure_used_mut_upvar (cognitive 22) compiler/rustc_borrowck/src/lib.rs:1653— MirBorrowckCtxt::propagate_closure_used_mut_upvar has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12, match/switch 9, loops 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.
MirBorrowckCtxt::explain_why_borrow_contains_point (cognitive 19) compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:588— MirBorrowckCtxt::explain_why_borrow_contains_point has cognitive complexity 19 (threshold 15). Drivers by points: if/else 17, boolean chains 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.
MirBorrowckCtxt::add_borrow_suggestions (cognitive 19) compiler/rustc_borrowck/src/diagnostics/move_errors.rs:899— MirBorrowckCtxt::add_borrow_suggestions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, boolean chains 2, 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.
MirBorrowckCtxt::expected_fn_found_fn_mut_call (cognitive 19) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:1193— MirBorrowckCtxt::expected_fn_found_fn_mut_call has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, match/switch 5, 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.
MirBorrowckCtxt::give_name_if_we_can_match_upvar_args (cognitive 17) compiler/rustc_borrowck/src/diagnostics/region_name.rs:393— MirBorrowckCtxt::give_name_if_we_can_match_upvar_args has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, match/switch 4, 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.
EvalContextExt::emulate_foreign_item_inner (cyclomatic 156) src/tools/miri/src/shims/unix/foreign_items.rs:109— EvalContextExt::emulate_foreign_item_inner has cyclomatic complexity 156 (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.
EvalContextExt::emulate_foreign_item_inner (cyclomatic 107) src/tools/miri/src/shims/windows/foreign_items.rs:131— EvalContextExt::emulate_foreign_item_inner has cyclomatic complexity 107 (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.
EvalContextExt::emulate_foreign_item_inner (cyclomatic 44) src/tools/miri/src/shims/math.rs:12— EvalContextExt::emulate_foreign_item_inner has cyclomatic complexity 44 (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.
EvalContextExt::emulate_x86_sse2_intrinsic (cyclomatic 35) src/tools/miri/src/intrinsics/x86/sse2.rs:12— EvalContextExt::emulate_x86_sse2_intrinsic has cyclomatic complexity 35 (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.
EvalContextExt::emulate_foreign_item_inner (cyclomatic 35) src/tools/miri/src/shims/unix/linux/foreign_items.rs:27— EvalContextExt::emulate_foreign_item_inner has cyclomatic complexity 35 (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.
EvalContextExt::CreateFileW (cyclomatic 35) src/tools/miri/src/shims/windows/fs.rs:105— EvalContextExt::CreateFileW 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.
EvalContextExt::emulate_math_intrinsic (cyclomatic 31) src/tools/miri/src/intrinsics/math.rs:96— EvalContextExt::emulate_math_intrinsic 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.
EvalContextExt::emulate_x86_avx_intrinsic (cyclomatic 31) src/tools/miri/src/intrinsics/x86/avx.rs:12— EvalContextExt::emulate_x86_avx_intrinsic 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.
EvalContextExt::emulate_aarch64_intrinsic (cyclomatic 30) src/tools/miri/src/intrinsics/aarch64.rs:9— EvalContextExt::emulate_aarch64_intrinsic has cyclomatic complexity 30 (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.
EvalContextExt::emulate_x86_sse42_intrinsic (cyclomatic 30) src/tools/miri/src/intrinsics/x86/sse42.rs:277— EvalContextExt::emulate_x86_sse42_intrinsic 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.
EvalContextExt::emulate_foreign_item_inner (cyclomatic 26) src/tools/miri/src/shims/unix/solarish/foreign_items.rs:19— EvalContextExt::emulate_foreign_item_inner 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.
EvalContextExt::emulate_x86_avx2_intrinsic (cyclomatic 25) src/tools/miri/src/intrinsics/x86/avx2.rs:12— EvalContextExt::emulate_x86_avx2_intrinsic 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.
EvalContextExt::emulate_x86_sse_intrinsic (cyclomatic 25) src/tools/miri/src/intrinsics/x86/sse.rs:12— EvalContextExt::emulate_x86_sse_intrinsic 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.
EvalContextExt::emulate_x86_intrinsic (cyclomatic 24) src/tools/miri/src/intrinsics/x86/mod.rs:28— EvalContextExt::emulate_x86_intrinsic 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.
EvalContextExt::emulate_foreign_item_inner (cyclomatic 24) src/tools/miri/src/shims/unix/freebsd/foreign_items.rs:16— EvalContextExt::emulate_foreign_item_inner 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.
EvalContextExt::emulate_simd_intrinsic (cyclomatic 21) src/tools/miri/src/intrinsics/simd.rs:13— EvalContextExt::emulate_simd_intrinsic 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.
EvalContextExt::emulate_x86_avx512_intrinsic (cyclomatic 20) src/tools/miri/src/intrinsics/x86/avx512.rs:10— EvalContextExt::emulate_x86_avx512_intrinsic 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.
EvalContextExt::open (cyclomatic 19) src/tools/miri/src/shims/unix/fs.rs:398— EvalContextExt::open 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.
EvalContextExt::emulate_x86_sse41_intrinsic (cyclomatic 18) src/tools/miri/src/intrinsics/x86/sse41.rs:8— EvalContextExt::emulate_x86_sse41_intrinsic 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.
EvalContextExt::linux_statx (cyclomatic 17) src/tools/miri/src/shims/unix/fs.rs:766— EvalContextExt::linux_statx 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.
EvalContextExt::emulate_x86_bmi_intrinsic (cyclomatic 16) src/tools/miri/src/intrinsics/x86/bmi.rs:8— EvalContextExt::emulate_x86_bmi_intrinsic 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.
EvalContextExt::epoll_ctl (cyclomatic 16) src/tools/miri/src/shims/unix/linux_like/epoll.rs:81— EvalContextExt::epoll_ctl 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.
Resolver::into_struct_error (cyclomatic 72) compiler/rustc_resolve/src/diagnostics/impls.rs:792— Resolver::into_struct_error has cyclomatic complexity 72 (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.
Resolver::resolve_path_with_ribs (cyclomatic 63) compiler/rustc_resolve/src/ident.rs:1822— Resolver::resolve_path_with_ribs has cyclomatic complexity 63 (threshold 15). Of this number, 61 points are the body's own statements and 2 belong to one function item declared inside it. 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::visit_scopes (cyclomatic 52) compiler/rustc_resolve/src/ident.rs:54— Resolver::visit_scopes has cyclomatic complexity 52 (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.
Resolver::report_privacy_error (cyclomatic 46) compiler/rustc_resolve/src/diagnostics/impls.rs:2522— Resolver::report_privacy_error 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.
Resolver::validate_res_from_ribs (cyclomatic 45) compiler/rustc_resolve/src/ident.rs:1459— Resolver::validate_res_from_ribs 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.
Resolver::resolve_ident_in_scope (cyclomatic 44) compiler/rustc_resolve/src/ident.rs:543— Resolver::resolve_ident_in_scope has cyclomatic complexity 44 (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.
Resolver::resolve_path_in_value_ns_with_prefix_info (cyclomatic 41) src/tools/rust-analyzer/crates/hir-def/src/resolver.rs:341— 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::lookup_import_candidates_from_module (cyclomatic 40) compiler/rustc_resolve/src/diagnostics/impls.rs:1593— Resolver::lookup_import_candidates_from_module 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.
Resolver::check_unused (cyclomatic 36) compiler/rustc_resolve/src/check_unused.rs:413— Resolver::check_unused has cyclomatic complexity 36 (threshold 15). Of this number, 32 points are the body's own statements and 4 belong to 2 function items declared inside it. 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::smart_resolve_macro_path (cyclomatic 35) compiler/rustc_resolve/src/macros.rs:603— Resolver::smart_resolve_macro_path 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.
Resolver::report_path_resolution_error (cyclomatic 34) compiler/rustc_resolve/src/diagnostics/impls.rs:2926— Resolver::report_path_resolution_error 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.
Resolver::report_conflict (cyclomatic 33) compiler/rustc_resolve/src/diagnostics/impls.rs:430— Resolver::report_conflict 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.
Resolver::maybe_push_ambiguity (cyclomatic 31) compiler/rustc_resolve/src/ident.rs:825— Resolver::maybe_push_ambiguity 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.
Resolver::throw_unresolved_import_error (cyclomatic 30) compiler/rustc_resolve/src/diagnostics/impls.rs:144— Resolver::throw_unresolved_import_error 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.
Resolver::unresolved_macro_suggestions (cyclomatic 26) compiler/rustc_resolve/src/diagnostics/impls.rs:1912— Resolver::unresolved_macro_suggestions has cyclomatic complexity 26 (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.
Resolver::resolve_path_in_type_ns_with_prefix_info (cyclomatic 22) src/tools/rust-analyzer/crates/hir-def/src/resolver.rs:181— 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.
Resolver::finalize_macro_resolutions (cyclomatic 21) compiler/rustc_resolve/src/macros.rs:929— Resolver::finalize_macro_resolutions has cyclomatic complexity 21 (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.
Resolver::resolve_ident_in_module (cyclomatic 19) compiler/rustc_resolve/src/ident.rs:991— Resolver::resolve_ident_in_module 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.
Resolver::add_scope_set_candidates (cyclomatic 18) compiler/rustc_resolve/src/diagnostics/impls.rs:1461— Resolver::add_scope_set_candidates 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.
Resolver::resolve_ident_in_module_globs_unadjusted (cyclomatic 18) compiler/rustc_resolve/src/ident.rs:1207— Resolver::resolve_ident_in_module_globs_unadjusted 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.
Resolver::ambiguity_diagnostic (cyclomatic 17) compiler/rustc_resolve/src/diagnostics/impls.rs:2294— Resolver::ambiguity_diagnostic 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.
Resolver::resolve_ident_in_scope_set_inner (cyclomatic 16) compiler/rustc_resolve/src/ident.rs:411— Resolver::resolve_ident_in_scope_set_inner 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.
InferenceContext::infer_expr_inner (cognitive 116) src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs:310— InferenceContext::infer_expr_inner has cognitive complexity 116 (threshold 15). Drivers by points: match/switch 56, if/else 47, loops 10, boolean chains 3 (nesting depth added 59). 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::resolve_variant (cognitive 68) src/tools/rust-analyzer/crates/hir-ty/src/infer.rs:2290— InferenceContext::resolve_variant has cognitive complexity 68 (threshold 15). Drivers by points: if/else 49, match/switch 13, boolean chains 4, loops 2 (nesting depth added 33). Of this number, 66 points are the body's own statements and 2 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent 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_expr_fields (cognitive 56) src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs:999— InferenceContext::check_record_expr_fields has cognitive complexity 56 (threshold 15). Drivers by points: if/else 40, loops 7, match/switch 7, 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 51) src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs:1944— InferenceContext::check_call_arguments has cognitive complexity 51 (threshold 15). Drivers by points: if/else 31, match/switch 15, loops 4, boolean chains 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.
InferenceContext::infer_ref_pat (cognitive 39) src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs:1360— InferenceContext::infer_ref_pat has cognitive complexity 39 (threshold 15). Drivers by points: if/else 29, boolean chains 5, match/switch 5 (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) src/tools/rust-analyzer/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 26, match/switch 8, loops 4 (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 35) src/tools/rust-analyzer/crates/hir-ty/src/infer/coerce.rs:926— InferenceContext::try_find_coercion_lub has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17, match/switch 12, loops 4, boolean chains 2 (nesting depth added 11). 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.
InferenceContext::infer_block (cognitive 34) src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs:1486— InferenceContext::infer_block has cognitive complexity 34 (threshold 15). Drivers by points: if/else 31, 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.
InferenceContext::deduce_closure_signature_from_predicates (cognitive 30) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure.rs:408— InferenceContext::deduce_closure_signature_from_predicates has cognitive complexity 30 (threshold 15). Drivers by points: if/else 19, match/switch 9, 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::compute_min_captures (cognitive 29) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis.rs:724— InferenceContext::compute_min_captures has cognitive complexity 29 (threshold 15). Drivers by points: match/switch 13, if/else 9, loops 7 (nesting depth added 16). Of this number, 27 points are the body's own statements and 2 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent 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) src/tools/rust-analyzer/crates/hir-ty/src/infer/path.rs:146— InferenceContext::resolve_value_path_inner has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13, match/switch 13 (nesting depth added 14). Of this number, 25 points are the body's own statements and 1 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent 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) src/tools/rust-analyzer/crates/hir-ty/src/infer.rs:1594— InferenceContext::resolve_all has cognitive complexity 26 (threshold 15). Drivers by points: loops 25, if/else 1 (nesting depth added 10). 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.
InferenceContext::infer_pat_inner (cognitive 25) src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs:377— InferenceContext::infer_pat_inner has cognitive complexity 25 (threshold 15). Drivers by points: loops 8, match/switch 7, if/else 6, 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) src/tools/rust-analyzer/crates/hir-ty/src/infer/mutability.rs:21— InferenceContext::infer_mut_expr has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 12, if/else 10, loops 2 (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::analyze_closure (cognitive 22) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis.rs:229— InferenceContext::analyze_closure has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, loops 5, match/switch 3, boolean chains 1 (nesting depth added 6). 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.
InferenceContext::compute_definition_site_hidden_types (cognitive 21) src/tools/rust-analyzer/crates/hir-ty/src/infer/opaques.rs:67— InferenceContext::compute_definition_site_hidden_types has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12, loops 7, match/switch 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.
InferenceContext::calculate_diverging_fallback (cognitive 19) src/tools/rust-analyzer/crates/hir-ty/src/infer/fallback.rs:233— InferenceContext::calculate_diverging_fallback has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9, loops 8, match/switch 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.
InferenceContext::struct_tail_with_normalize (cognitive 19) src/tools/rust-analyzer/crates/hir-ty/src/infer.rs:2102— InferenceContext::struct_tail_with_normalize has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 12, if/else 6, 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.
InferenceContext::check_record_pat_fields (cognitive 18) src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs:1158— InferenceContext::check_record_pat_fields has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, match/switch 4, 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::infer_method_call (cognitive 17) src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs:1802— InferenceContext::infer_method_call has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 9, if/else 5, loops 3 (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 16) src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs:1050— InferenceContext::infer_tuple_struct_pat has cognitive complexity 16 (threshold 15). Drivers by points: loops 7, if/else 4, match/switch 3, 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) src/tools/rust-analyzer/crates/hir-ty/src/infer/place_op.rs:106— InferenceContext::try_index_step has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, 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.
LateResolutionVisitor::add_missing_lifetime_specifiers_label (cyclomatic 66) compiler/rustc_resolve/src/late/diagnostics.rs:4077— LateResolutionVisitor::add_missing_lifetime_specifiers_label has cyclomatic complexity 66 (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.
LateResolutionVisitor::smart_resolve_context_dependent_help (cyclomatic 60) compiler/rustc_resolve/src/late/diagnostics.rs:2113— LateResolutionVisitor::smart_resolve_context_dependent_help has cyclomatic complexity 60 (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.
LateResolutionVisitor::try_lookup_name_relaxed (cyclomatic 36) compiler/rustc_resolve/src/late/diagnostics.rs:918— LateResolutionVisitor::try_lookup_name_relaxed 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.
LateResolutionVisitor::resolve_expr (cyclomatic 35) compiler/rustc_resolve/src/late.rs:5186— LateResolutionVisitor::resolve_expr has cyclomatic complexity 35 (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.
LateResolutionVisitor::make_base_error (cyclomatic 34) compiler/rustc_resolve/src/late/diagnostics.rs:382— LateResolutionVisitor::make_base_error 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.
LateResolutionVisitor::smart_resolve_path_fragment (cyclomatic 31) compiler/rustc_resolve/src/late.rs:4549— LateResolutionVisitor::smart_resolve_path_fragment 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.
LateResolutionVisitor::resolve_item (cyclomatic 29) compiler/rustc_resolve/src/late.rs:2824— LateResolutionVisitor::resolve_item has cyclomatic complexity 29 (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.
LateResolutionVisitor::resolve_elided_lifetimes_in_path (cyclomatic 27) compiler/rustc_resolve/src/late.rs:2175— LateResolutionVisitor::resolve_elided_lifetimes_in_path 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.
LateResolutionVisitor::suggest_using_enum_variant (cyclomatic 26) compiler/rustc_resolve/src/late/diagnostics.rs:3138— LateResolutionVisitor::suggest_using_enum_variant 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.
LateResolutionVisitor::suggest_assoc_type_from_bounds (cyclomatic 24) compiler/rustc_resolve/src/late/diagnostics.rs:207— LateResolutionVisitor::suggest_assoc_type_from_bounds 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.
LateResolutionVisitor::lookup_assoc_candidate (cyclomatic 24) compiler/rustc_resolve/src/late/diagnostics.rs:2786— LateResolutionVisitor::lookup_assoc_candidate has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to one function item declared inside it. 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.
LateResolutionVisitor::with_generic_param_rib (cyclomatic 24) compiler/rustc_resolve/src/late.rs:3085— LateResolutionVisitor::with_generic_param_rib 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.
LateResolutionVisitor::suggest_introducing_lifetime_filtered (cyclomatic 20) compiler/rustc_resolve/src/late/diagnostics.rs:3851— LateResolutionVisitor::suggest_introducing_lifetime_filtered 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.
LateResolutionVisitor::resolve_lifetime (cyclomatic 19) compiler/rustc_resolve/src/late.rs:1769— LateResolutionVisitor::resolve_lifetime 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.
LateResolutionVisitor::resolve_qpath (cyclomatic 19) compiler/rustc_resolve/src/late.rs:4904— LateResolutionVisitor::resolve_qpath 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.
LateResolutionVisitor::resolve_anonymous_lifetime (cyclomatic 18) compiler/rustc_resolve/src/late.rs:1881— LateResolutionVisitor::resolve_anonymous_lifetime 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.
LateResolutionVisitor::resolve_fn_params (cyclomatic 18) compiler/rustc_resolve/src/late.rs:2488— LateResolutionVisitor::resolve_fn_params 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.
LateResolutionVisitor::lookup_typo_candidate (cyclomatic 17) compiler/rustc_resolve/src/late/diagnostics.rs:2896— LateResolutionVisitor::lookup_typo_candidate 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.
LateResolutionVisitor::suggest_adding_generic_parameter (cyclomatic 17) compiler/rustc_resolve/src/late/diagnostics.rs:3508— LateResolutionVisitor::suggest_adding_generic_parameter 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.
LateResolutionVisitor::resolve_doc_links (cyclomatic 17) compiler/rustc_resolve/src/late.rs:5447— LateResolutionVisitor::resolve_doc_links has cyclomatic complexity 17 (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.
EvalContextExt::CreateFileW (cognitive 68) src/tools/miri/src/shims/windows/fs.rs:105— EvalContextExt::CreateFileW has cognitive complexity 68 (threshold 15). Drivers by points: if/else 52, match/switch 9, boolean chains 6, loops 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EvalContextExt::emulate_foreign_item_inner (cognitive 49) src/tools/miri/src/shims/windows/foreign_items.rs:131— EvalContextExt::emulate_foreign_item_inner has cognitive complexity 49 (threshold 15). Drivers by points: if/else 34, match/switch 13, boolean chains 2 (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.
EvalContextExt::emulate_foreign_item_inner (cognitive 45) src/tools/miri/src/shims/unix/foreign_items.rs:109— EvalContextExt::emulate_foreign_item_inner has cognitive complexity 45 (threshold 15). Drivers by points: if/else 36, match/switch 8, 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.
EvalContextExt::emulate_x86_sse42_intrinsic (cognitive 40) src/tools/miri/src/intrinsics/x86/sse42.rs:277— EvalContextExt::emulate_x86_sse42_intrinsic has cognitive complexity 40 (threshold 15). Drivers by points: if/else 31, match/switch 5, loops 3, 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.
EvalContextExt::emulate_aarch64_intrinsic (cognitive 34) src/tools/miri/src/intrinsics/aarch64.rs:9— EvalContextExt::emulate_aarch64_intrinsic has cognitive complexity 34 (threshold 15). Drivers by points: if/else 19, loops 10, match/switch 5 (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.
EvalContextExt::lookup_exported_symbol (cognitive 26) src/tools/miri/src/shims/foreign_items.rs:114— EvalContextExt::lookup_exported_symbol has cognitive complexity 26 (threshold 15). Drivers by points: if/else 19, match/switch 6, 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.
EvalContextExt::epoll_ctl (cognitive 26) src/tools/miri/src/shims/unix/linux_like/epoll.rs:81— EvalContextExt::epoll_ctl has cognitive complexity 26 (threshold 15). Drivers by points: if/else 25, 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.
EvalContextExt::_umtx_op (cognitive 25) src/tools/miri/src/shims/unix/freebsd/sync.rs:37— EvalContextExt::_umtx_op has cognitive complexity 25 (threshold 15). Drivers by points: if/else 22, boolean chains 2, 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.
EvalContextExt::open (cognitive 24) src/tools/miri/src/shims/unix/fs.rs:398— EvalContextExt::open has cognitive complexity 24 (threshold 15). Drivers by points: if/else 23, boolean chains 1 (nesting depth added 4). 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.
EvalContextExt::emulate_x86_bmi_intrinsic (cognitive 23) src/tools/miri/src/intrinsics/x86/bmi.rs:8— EvalContextExt::emulate_x86_bmi_intrinsic has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17, loops 4, boolean chains 1, match/switch 1 (nesting depth added 4). 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.
EvalContextExt::convert_path (cognitive 19) src/tools/miri/src/shims/os_str.rs:263— EvalContextExt::convert_path has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, match/switch 3, boolean chains 2, loops 2 (nesting depth added 3). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 2 function items declared inside it (unix_to_windows, windows_to_unix). 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.
EvalContextExt::emulate_foreign_item_inner (cognitive 19) src/tools/miri/src/shims/unix/freebsd/foreign_items.rs:16— EvalContextExt::emulate_foreign_item_inner has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, match/switch 7, 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.
EvalContextExt::linux_statx (cognitive 19) src/tools/miri/src/shims/unix/fs.rs:766— EvalContextExt::linux_statx has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, boolean chains 5, 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.
EvalContextExt::try_errnum_to_io_error (cognitive 18) src/tools/miri/src/shims/io_error.rs:374— EvalContextExt::try_errnum_to_io_error has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, loops 6 (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.
EvalContextExt::emulate_x86_avx_intrinsic (cognitive 17) src/tools/miri/src/intrinsics/x86/avx.rs:12— EvalContextExt::emulate_x86_avx_intrinsic has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 11, loops 4, boolean chains 2 (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.
EvalContextExt::emulate_x86_sse2_intrinsic (cognitive 17) src/tools/miri/src/intrinsics/x86/sse2.rs:12— EvalContextExt::emulate_x86_sse2_intrinsic has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 15, loops 2 (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.
EvalContextExt::call_llvm_intrinsic (cognitive 16) src/tools/miri/src/intrinsics/mod.rs:164— EvalContextExt::call_llvm_intrinsic has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 4, loops 2, 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.
EvalContextExt::emulate_simd_intrinsic (cognitive 16) src/tools/miri/src/intrinsics/simd.rs:13— EvalContextExt::emulate_simd_intrinsic has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 10, loops 6 (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.
EvalContextExt::emulate_x86_sse41_intrinsic (cognitive 16) src/tools/miri/src/intrinsics/x86/sse41.rs:8— EvalContextExt::emulate_x86_sse41_intrinsic has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, loops 6, boolean chains 1, 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.
TypeErrCtxt::report_selection_error (cyclomatic 87) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:60— TypeErrCtxt::report_selection_error has cyclomatic complexity 87 (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.
TypeErrCtxt::note_type_err (cyclomatic 83) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:1457— TypeErrCtxt::note_type_err has cyclomatic complexity 83 (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.
TypeErrCtxt::note_and_explain_type_err (cyclomatic 78) compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs:18— TypeErrCtxt::note_and_explain_type_err has cyclomatic complexity 78 (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.
TypeErrCtxt::report_similar_impl_candidates (cyclomatic 59) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:2060— TypeErrCtxt::report_similar_impl_candidates 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.
TypeErrCtxt::maybe_report_ambiguity (cyclomatic 58) compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs:178— TypeErrCtxt::maybe_report_ambiguity has cyclomatic complexity 58 (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.
TypeErrCtxt::note_error_origin (cyclomatic 42) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:326— TypeErrCtxt::note_error_origin has cyclomatic complexity 42 (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.
TypeErrCtxt::construct_generic_bound_failure (cyclomatic 35) compiler/rustc_trait_selection/src/error_reporting/infer/region.rs:716— TypeErrCtxt::construct_generic_bound_failure has cyclomatic complexity 35 (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.
TypeErrCtxt::cmp (cyclomatic 29) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:1128— TypeErrCtxt::cmp has cyclomatic complexity 29 (threshold 15). Of this number, 26 points are the body's own statements and 3 belong to 2 function items declared inside it. 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.
TypeErrCtxt::cmp_fn_sig (cyclomatic 25) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:753— TypeErrCtxt::cmp_fn_sig 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.
TypeErrCtxt::report_concrete_failure (cyclomatic 25) compiler/rustc_trait_selection/src/error_reporting/infer/region.rs:307— TypeErrCtxt::report_concrete_failure 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.
TypeErrCtxt::report_fulfillment_errors (cyclomatic 25) compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs:141— TypeErrCtxt::report_fulfillment_errors 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.
TypeErrCtxt::compare_generics (cyclomatic 23) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:979— TypeErrCtxt::compare_generics 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.
TypeErrCtxt::try_conversion_context (cyclomatic 22) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1137— TypeErrCtxt::try_conversion_context 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.
TypeErrCtxt::consider_returning_binding_diag (cyclomatic 19) compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs:848— TypeErrCtxt::consider_returning_binding_diag 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.
TypeErrCtxt::type_error_additional_suggestions (cyclomatic 18) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:1981— TypeErrCtxt::type_error_additional_suggestions 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.
TypeErrCtxt::annotate_source_of_ambiguity (cyclomatic 18) compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs:720— TypeErrCtxt::annotate_source_of_ambiguity 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.
TypeErrCtxt::suggest_function_pointers_impl (cyclomatic 17) compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs:400— TypeErrCtxt::suggest_function_pointers_impl 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.
TypeErrCtxt::report_host_effect_error (cyclomatic 17) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:864— TypeErrCtxt::report_host_effect_error 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.
Builder::cargo (cyclomatic 120) src/bootstrap/src/core/builder/cargo.rs:640— Builder::cargo has cyclomatic complexity 120 (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.
Builder::codegen_intrinsic_call (cyclomatic 95) compiler/rustc_codegen_llvm/src/intrinsic.rs:175— Builder::codegen_intrinsic_call has cyclomatic complexity 95 (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.
Builder::codegen_inline_asm (cyclomatic 69) compiler/rustc_codegen_llvm/src/asm.rs:26— Builder::codegen_inline_asm has cyclomatic complexity 69 (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.
Builder::codegen_inline_asm (cyclomatic 64) compiler/rustc_codegen_gcc/src/asm.rs:117— Builder::codegen_inline_asm 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.
Builder::expr_into_dest (cyclomatic 63) compiler/rustc_mir_build/src/builder/expr/into.rs:27— Builder::expr_into_dest has cyclomatic complexity 63 (threshold 15). Of this number, 60 points are the body's own statements and 3 belong to one function item declared inside it. 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.
Builder::codegen_intrinsic_call (cyclomatic 50) compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:194— Builder::codegen_intrinsic_call 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.
Builder::as_rvalue (cyclomatic 28) compiler/rustc_mir_build/src/builder/expr/as_rvalue.rs:43— Builder::as_rvalue 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.
Builder::choose_bucket_for_candidate (cyclomatic 26) compiler/rustc_mir_build/src/builder/matches/buckets.rs:120— Builder::choose_bucket_for_candidate 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.
Builder::gcc_icmp (cyclomatic 21) compiler/rustc_codegen_gcc/src/int.rs:424— Builder::gcc_icmp 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.
Builder::load_operand (cyclomatic 21) compiler/rustc_codegen_llvm/src/builder.rs:716— Builder::load_operand has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 belong to one function item declared inside it. 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.
Builder::dbg_scope_fn (cyclomatic 19) compiler/rustc_codegen_llvm/src/debuginfo/mod.rs:129— Builder::dbg_scope_fn has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 3 function items declared inside it (get_function_signature, get_containing_scope, get_template_parameters). 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.
Builder::visit_primary_bindings_special (cyclomatic 19) compiler/rustc_mir_build/src/builder/matches/mod.rs:840— Builder::visit_primary_bindings_special 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.
Builder::as_temp_inner (cyclomatic 18) compiler/rustc_mir_build/src/builder/expr/as_temp.rs:30— Builder::as_temp_inner 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.
Builder::static_pattern_match_inner (cyclomatic 18) compiler/rustc_mir_build/src/builder/matches/mod.rs:2929— Builder::static_pattern_match_inner 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.
Builder::gcc_checked_binop (cyclomatic 17) compiler/rustc_codegen_gcc/src/int.rs:269— Builder::gcc_checked_binop 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.
Builder::expr_as_place (cyclomatic 16) compiler/rustc_mir_build/src/builder/expr/as_place.rs:416— Builder::expr_as_place 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.
Builder::stmt_expr (cyclomatic 16) compiler/rustc_mir_build/src/builder/expr/stmt.rs:15— Builder::stmt_expr 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.
MirBorrowckCtxt::report_mutability_error (cyclomatic 65) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:62— MirBorrowckCtxt::report_mutability_error has cyclomatic complexity 65 (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.
MirBorrowckCtxt::explain_captures (cyclomatic 47) compiler/rustc_borrowck/src/diagnostics/mod.rs:1239— MirBorrowckCtxt::explain_captures 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.
MirBorrowckCtxt::suggest_make_local_mut (cyclomatic 44) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:1378— MirBorrowckCtxt::suggest_make_local_mut has cyclomatic complexity 44 (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.
MirBorrowckCtxt::add_move_hints (cyclomatic 24) compiler/rustc_borrowck/src/diagnostics/move_errors.rs:735— MirBorrowckCtxt::add_move_hints 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.
MirBorrowckCtxt::describe_place_with_options (cyclomatic 21) compiler/rustc_borrowck/src/diagnostics/mod.rs:340— MirBorrowckCtxt::describe_place_with_options 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.
MirBorrowckCtxt::consume_rvalue (cyclomatic 21) compiler/rustc_borrowck/src/lib.rs:1475— MirBorrowckCtxt::consume_rvalue 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.
MirBorrowckCtxt::was_captured_by_trait_object (cyclomatic 20) compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:821— MirBorrowckCtxt::was_captured_by_trait_object 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.
MirBorrowckCtxt::later_use_kind (cyclomatic 18) compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:719— MirBorrowckCtxt::later_use_kind 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.
MirBorrowckCtxt::suggest_map_index_mut_alternatives (cyclomatic 18) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:658— MirBorrowckCtxt::suggest_map_index_mut_alternatives has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to 2 function items declared inside it. 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.
MirBorrowckCtxt::give_name_if_anonymous_region_appears_in_output (cyclomatic 18) compiler/rustc_borrowck/src/diagnostics/region_name.rs:793— MirBorrowckCtxt::give_name_if_anonymous_region_appears_in_output 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.
MirBorrowckCtxt::visit_after_early_terminator_effect (cyclomatic 18) compiler/rustc_borrowck/src/lib.rs:880— MirBorrowckCtxt::visit_after_early_terminator_effect 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.
MirBorrowckCtxt::add_move_error_suggestions (cyclomatic 17) compiler/rustc_borrowck/src/diagnostics/move_errors.rs:1064— MirBorrowckCtxt::add_move_error_suggestions 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.
MirBorrowckCtxt::is_mutable (cyclomatic 16) compiler/rustc_borrowck/src/lib.rs:2561— MirBorrowckCtxt::is_mutable 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.
link::link_natively (cyclomatic 57) compiler/rustc_codegen_ssa/src/back/link.rs:1063— link::link_natively 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.
link::link_binary (cyclomatic 32) compiler/rustc_codegen_ssa/src/back/link.rs:140— link::link_binary 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.
link::add_native_libs_from_crate (cyclomatic 27) compiler/rustc_codegen_ssa/src/back/link.rs:3175— link::add_native_libs_from_crate 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.
link::report_linker_output (cyclomatic 23) compiler/rustc_codegen_ssa/src/back/link.rs:908— link::report_linker_output has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to one function item declared inside it. 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.
link::add_order_independent_options (cyclomatic 22) compiler/rustc_codegen_ssa/src/back/link.rs:3018— link::add_order_independent_options 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.
link::get_apple_sdk_root (cyclomatic 22) compiler/rustc_codegen_ssa/src/back/link.rs:3827— link::get_apple_sdk_root 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.
link::link_rlib (cyclomatic 21) compiler/rustc_codegen_ssa/src/back/link.rs:404— link::link_rlib 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.
link::link_staticlib (cyclomatic 19) compiler/rustc_codegen_ssa/src/back/link.rs:613— link::link_staticlib 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.
link::add_apple_link_args (cyclomatic 18) compiler/rustc_codegen_ssa/src/back/link.rs:3614— link::add_apple_link_args 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.
link::linker_and_flavor (cyclomatic 17) compiler/rustc_codegen_ssa/src/back/link.rs:1666— link::linker_and_flavor has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 2 function items declared inside it (infer_from, adjust_flavor_to_features). 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.
link::exec_linker (cyclomatic 17) compiler/rustc_codegen_ssa/src/back/link.rs:1920— link::exec_linker has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function item declared inside it. 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.
link::add_sanitizer_libraries (cyclomatic 16) compiler/rustc_codegen_ssa/src/back/link.rs:1541— link::add_sanitizer_libraries 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.
link::add_linked_symbol_object (cyclomatic 16) compiler/rustc_codegen_ssa/src/back/link.rs:2312— link::add_linked_symbol_object has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function item declared inside it. 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.
TestCx::check_expected_errors (cognitive 105) src/tools/compiletest/src/runtest.rs:658— TestCx::check_expected_errors has cognitive complexity 105 (threshold 15). Drivers by points: if/else 72, loops 21, boolean chains 8, match/switch 4 (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TestCx::make_compile_args (cognitive 69) src/tools/compiletest/src/runtest.rs:1559— TestCx::make_compile_args has cognitive complexity 69 (threshold 15). Drivers by points: if/else 49, boolean chains 10, match/switch 10 (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.
TestCx::run_ui_test (cognitive 65) src/tools/compiletest/src/runtest/ui.rs:16— TestCx::run_ui_test has cognitive complexity 65 (threshold 15). Drivers by points: if/else 56, boolean chains 7, match/switch 2 (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.
TestCx::compare_output (cognitive 32) src/tools/compiletest/src/runtest.rs:2715— TestCx::compare_output has cognitive complexity 32 (threshold 15). Drivers by points: if/else 28, boolean chains 3, 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.
TestCx::load_compare_outputs (cognitive 30) src/tools/compiletest/src/runtest.rs:2328— TestCx::load_compare_outputs has cognitive complexity 30 (threshold 15). Drivers by points: if/else 27, match/switch 3 (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.
TestCx::run_codegen_units_test (cognitive 29) src/tools/compiletest/src/runtest/codegen_units.rs:8— TestCx::run_codegen_units_test has cognitive complexity 29 (threshold 15). Drivers by points: if/else 19, loops 8, boolean chains 2 (nesting depth added 7). Of this number, 20 points are the body's own statements and 9 belong to 3 function items declared inside it. 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.
TestCx::run_rmake_test (cognitive 29) src/tools/compiletest/src/runtest/run_make.rs:13— TestCx::run_rmake_test has cognitive complexity 29 (threshold 15). Drivers by points: if/else 27, boolean chains 1, loops 1 (nesting depth added 4). 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.
TestCx::check_mir_dump (cognitive 24) src/tools/compiletest/src/runtest/mir_opt.rs:28— TestCx::check_mir_dump has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19, loops 5 (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.
TestCx::run_debuginfo_gdb_test (cognitive 23) src/tools/compiletest/src/runtest/debuginfo.rs:108— TestCx::run_debuginfo_gdb_test has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14, loops 6, match/switch 2, 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.
TestCx::show_diff (cognitive 23) src/tools/compiletest/src/runtest.rs:2840— TestCx::show_diff has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13, loops 7, match/switch 2, 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.
TestCx::check_rustdoc_test_option (cognitive 19) src/tools/compiletest/src/runtest.rs:2245— TestCx::check_rustdoc_test_option has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, loops 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.
TestCx::run_pretty_test (cognitive 17) src/tools/compiletest/src/runtest/pretty.rs:6— TestCx::run_pretty_test has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, match/switch 4, loops 1 (nesting depth added 3). 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.
TestCx::run_incremental_test (cognitive 16) src/tools/compiletest/src/runtest/incremental.rs:40— TestCx::run_incremental_test has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, match/switch 4 (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.
link::link_natively (cognitive 102) compiler/rustc_codegen_ssa/src/back/link.rs:1063— link::link_natively has cognitive complexity 102 (threshold 15). Drivers by points: if/else 71, loops 13, boolean chains 9, match/switch 9 (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.
link::link_binary (cognitive 54) compiler/rustc_codegen_ssa/src/back/link.rs:140— link::link_binary has cognitive complexity 54 (threshold 15). Drivers by points: if/else 40, boolean chains 6, loops 5, match/switch 3 (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.
link::add_native_libs_from_crate (cognitive 52) compiler/rustc_codegen_ssa/src/back/link.rs:3175— link::add_native_libs_from_crate has cognitive complexity 52 (threshold 15). Drivers by points: if/else 45, boolean chains 3, match/switch 3, loops 1 (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.
link::link_rlib (cognitive 34) compiler/rustc_codegen_ssa/src/back/link.rs:404— link::link_rlib has cognitive complexity 34 (threshold 15). Drivers by points: if/else 24, loops 5, match/switch 4, 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.
link::report_linker_output (cognitive 31) compiler/rustc_codegen_ssa/src/back/link.rs:908— link::report_linker_output has cognitive complexity 31 (threshold 15). Drivers by points: if/else 21, boolean chains 8, loops 2 (nesting depth added 5). Of this number, 28 points are the body's own statements and 3 belong to one function item declared inside it. 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.
link::link_staticlib (cognitive 28) compiler/rustc_codegen_ssa/src/back/link.rs:613— link::link_staticlib has cognitive complexity 28 (threshold 15). Drivers by points: if/else 21, boolean chains 4, loops 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.
link::exec_linker (cognitive 28) compiler/rustc_codegen_ssa/src/back/link.rs:1920— link::exec_linker has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11, match/switch 8, loops 7, boolean chains 2 (nesting depth added 11). Of this number, 22 points are the body's own statements and 6 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
link::linker_with_args (cognitive 28) compiler/rustc_codegen_ssa/src/back/link.rs:2725— link::linker_with_args has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17, loops 10, 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.
link::add_order_independent_options (cognitive 25) compiler/rustc_codegen_ssa/src/back/link.rs:3018— link::add_order_independent_options has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20, boolean chains 5 (nesting depth added 3). 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.
link::print_native_static_libs (cognitive 23) compiler/rustc_codegen_ssa/src/back/link.rs:1805— link::print_native_static_libs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 19, match/switch 2, 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.
link::add_linked_symbol_object (cognitive 21) compiler/rustc_codegen_ssa/src/back/link.rs:2312— link::add_linked_symbol_object has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15, boolean chains 3, match/switch 2, loops 1 (nesting depth added 4). Of this number, 15 points are the body's own statements and 6 belong to one function item declared inside it. 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.
link::add_c_staticlib_symbols (cognitive 18) compiler/rustc_codegen_ssa/src/back/link.rs:2640— link::add_c_staticlib_symbols has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7, match/switch 6, loops 3, boolean chains 2 (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.
link::linker_and_flavor (cognitive 17) compiler/rustc_codegen_ssa/src/back/link.rs:1666— link::linker_and_flavor has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, match/switch 4 (nesting depth added 5). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 2 function items declared inside it (infer_from, adjust_flavor_to_features). 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.
InferenceContext::infer_expr_inner (cyclomatic 98) src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs:310— InferenceContext::infer_expr_inner has cyclomatic complexity 98 (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 43) src/tools/rust-analyzer/crates/hir-ty/src/infer.rs:2290— InferenceContext::resolve_variant has cyclomatic complexity 43 (threshold 15). Of this number, 42 points are the body's own statements and 1 belong to one function item declared inside it. 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_mut_expr_without_adjust (cyclomatic 41) src/tools/rust-analyzer/crates/hir-ty/src/infer/mutability.rs:55— InferenceContext::infer_mut_expr_without_adjust 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.
InferenceContext::infer_pat_inner (cyclomatic 33) src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs:377— InferenceContext::infer_pat_inner 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.
InferenceContext::try_find_coercion_lub (cyclomatic 25) src/tools/rust-analyzer/crates/hir-ty/src/infer/coerce.rs:926— InferenceContext::try_find_coercion_lub 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.
InferenceContext::check_call_arguments (cyclomatic 24) src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs:1944— InferenceContext::check_call_arguments 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_record_expr_fields (cyclomatic 23) src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs:999— InferenceContext::check_record_expr_fields 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::analyze_closure (cyclomatic 20) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis.rs:229— InferenceContext::analyze_closure 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::infer_ref_pat (cyclomatic 20) src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs:1360— 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::deduce_closure_signature_from_predicates (cyclomatic 17) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure.rs:408— 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) src/tools/rust-analyzer/crates/hir-ty/src/infer.rs:1594— InferenceContext::resolve_all has cyclomatic complexity 17 (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.
InferenceContext::compute_min_captures (cyclomatic 16) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis.rs:724— InferenceContext::compute_min_captures has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function item declared inside it. 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.
TypeChecker::visit_rvalue (cognitive 164) compiler/rustc_mir_transform/src/validate.rs:1002— TypeChecker::visit_rvalue has cognitive complexity 164 (threshold 15). Drivers by points: if/else 120, loops 30, match/switch 9, boolean chains 5 (nesting depth added 105). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TypeChecker::visit_rvalue (cognitive 98) compiler/rustc_borrowck/src/type_check/mod.rs:995— TypeChecker::visit_rvalue has cognitive complexity 98 (threshold 15). Drivers by points: match/switch 49, if/else 44, boolean chains 5 (nesting depth added 60). 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.
TypeChecker::visit_projection_elem (cognitive 58) compiler/rustc_mir_transform/src/validate.rs:647— TypeChecker::visit_projection_elem has cognitive complexity 58 (threshold 15). Drivers by points: if/else 45, match/switch 11, 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.
TypeChecker::visit_terminator (cognitive 36) compiler/rustc_borrowck/src/type_check/mod.rs:742— TypeChecker::visit_terminator has cognitive complexity 36 (threshold 15). Drivers by points: if/else 20, match/switch 13, loops 2, boolean chains 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.
TypeChecker::visit_const_operand (cognitive 31) compiler/rustc_borrowck/src/type_check/mod.rs:1738— TypeChecker::visit_const_operand has cognitive complexity 31 (threshold 15). Drivers by points: if/else 21, match/switch 9, boolean chains 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.
TypeChecker::visit_statement (cognitive 26) compiler/rustc_mir_transform/src/validate.rs:1455— TypeChecker::visit_statement has cognitive complexity 26 (threshold 15). Drivers by points: if/else 24, boolean chains 1, 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.
TypeChecker::check_iscleanup (cognitive 23) compiler/rustc_borrowck/src/type_check/mod.rs:2082— TypeChecker::check_iscleanup has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18, loops 4, 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.
TypeChecker::visit_statement (cognitive 21) compiler/rustc_borrowck/src/type_check/mod.rs:609— TypeChecker::visit_statement has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17, match/switch 3, 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.
TypeChecker::check_call_dest (cognitive 19) compiler/rustc_borrowck/src/type_check/mod.rs:1953— TypeChecker::check_call_dest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 17, match/switch 2 (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.
TypeChecker::check_call_inputs (cognitive 18) compiler/rustc_borrowck/src/type_check/mod.rs:2018— TypeChecker::check_call_inputs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, match/switch 3, 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.
TypeChecker::add_reborrow_constraint (cognitive 18) compiler/rustc_borrowck/src/type_check/mod.rs:2358— TypeChecker::add_reborrow_constraint has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 9, if/else 5, loops 4 (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.
TypeChecker::add_generic_reborrow_constraint (cognitive 16) compiler/rustc_borrowck/src/type_check/mod.rs:2482— TypeChecker::add_generic_reborrow_constraint has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, loops 5 (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.
FunctionCx::codegen_call_terminator (cognitive 102) compiler/rustc_codegen_ssa/src/mir/block.rs:935— FunctionCx::codegen_call_terminator has cognitive complexity 102 (threshold 15). Drivers by points: if/else 60, match/switch 29, loops 7, boolean chains 6 (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.
FunctionCx::codegen_intrinsic_call (cognitive 76) compiler/rustc_codegen_ssa/src/mir/intrinsic.rs:57— FunctionCx::codegen_intrinsic_call has cognitive complexity 76 (threshold 15). Drivers by points: if/else 47, match/switch 20, boolean chains 9 (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.
FunctionCx::codegen_rvalue_operand (cognitive 53) compiler/rustc_codegen_ssa/src/mir/rvalue.rs:495— FunctionCx::codegen_rvalue_operand has cognitive complexity 53 (threshold 15). Drivers by points: if/else 33, match/switch 17, loops 2, boolean chains 1 (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.
FunctionCx::codegen_rvalue (cognitive 47) compiler/rustc_codegen_ssa/src/mir/rvalue.rs:100— FunctionCx::codegen_rvalue has cognitive complexity 47 (threshold 15). Drivers by points: if/else 37, match/switch 5, boolean chains 3, loops 2 (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.
FunctionCx::compute_per_local_var_debug_info (cognitive 44) compiler/rustc_codegen_ssa/src/mir/debuginfo.rs:566— FunctionCx::compute_per_local_var_debug_info has cognitive complexity 44 (threshold 15). Drivers by points: if/else 33, match/switch 8, boolean chains 2, 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.
FunctionCx::codegen_argument (cognitive 40) compiler/rustc_codegen_ssa/src/mir/block.rs:1927— FunctionCx::codegen_argument has cognitive complexity 40 (threshold 15). Drivers by points: if/else 21, match/switch 16, boolean chains 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.
FunctionCx::codegen_scalar_binop (cognitive 40) compiler/rustc_codegen_ssa/src/mir/rvalue.rs:886— FunctionCx::codegen_scalar_binop has cognitive complexity 40 (threshold 15). Drivers by points: if/else 39, match/switch 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.
FunctionCx::debug_introduce_local (cognitive 38) compiler/rustc_codegen_ssa/src/mir/debuginfo.rs:310— FunctionCx::debug_introduce_local has cognitive complexity 38 (threshold 15). Drivers by points: if/else 22, match/switch 9, boolean chains 6, loops 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.
FunctionCx::codegen_switchint_terminator (cognitive 33) compiler/rustc_codegen_ssa/src/mir/block.rs:408— FunctionCx::codegen_switchint_terminator has cognitive complexity 33 (threshold 15). Drivers by points: if/else 20, boolean chains 7, match/switch 6 (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.
FunctionCx::codegen_statement (cognitive 33) compiler/rustc_codegen_ssa/src/mir/statement.rs:11— FunctionCx::codegen_statement has cognitive complexity 33 (threshold 15). Drivers by points: if/else 28, match/switch 4, boolean chains 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.
FunctionCx::clear_variant_dependent_padding (cognitive 22) compiler/rustc_codegen_ssa/src/mir/block.rs:1791— FunctionCx::clear_variant_dependent_padding has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11, loops 9, 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.
FunctionCx::retag_operand (cognitive 22) compiler/rustc_codegen_ssa/src/mir/retag.rs:234— FunctionCx::retag_operand has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14, match/switch 5, loops 2, 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.
render::definition (cognitive 92) src/tools/rust-analyzer/crates/ide/src/hover/render.rs:446— render::definition has cognitive complexity 92 (threshold 15). Drivers by points: if/else 64, match/switch 28 (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.
render::render_impl::doc_impl_item (cognitive 51) src/librustdoc/html/render/mod.rs:1823— render::render_impl::doc_impl_item has cognitive complexity 51 (threshold 15). Drivers by points: if/else 46, boolean chains 3, match/switch 2 (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.
render::render_impl (cognitive 44) src/librustdoc/html/render/mod.rs:1802— render::render_impl has cognitive complexity 44 (threshold 15). Drivers by points: if/else 78, boolean chains 10, loops 8, match/switch 5 (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.
render::literal (cognitive 29) src/tools/rust-analyzer/crates/ide/src/hover/render.rs:832— render::literal has cognitive complexity 29 (threshold 15). Drivers by points: match/switch 16, if/else 13 (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.
render::render_memory_layout (cognitive 27) src/tools/rust-analyzer/crates/ide/src/hover/render.rs:1145— render::render_memory_layout has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14, match/switch 10, boolean chains 3 (nesting depth added 8). 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.
render::repr_attribute (cognitive 22) src/librustdoc/html/render/mod.rs:3023— render::repr_attribute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12, boolean chains 5, match/switch 5 (nesting depth added 4). 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.
render::try_expr (cognitive 20) src/tools/rust-analyzer/crates/ide/src/hover/render.rs:60— render::try_expr has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, boolean chains 2, match/switch 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.
render::definition_owner_name (cognitive 19) src/tools/rust-analyzer/crates/ide/src/hover/render.rs:355— render::definition_owner_name has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 16, if/else 3 (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.
render::render_stability_since_raw_with_extra (cognitive 16) src/librustdoc/html/render/mod.rs:1238— render::render_stability_since_raw_with_extra has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, 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.
render::render_assoc_item (cognitive 16) src/librustdoc/html/render/mod.rs:1313— render::render_assoc_item has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, 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.
render::render_impl_summary (cognitive 16) src/librustdoc/html/render/mod.rs:2330— render::render_impl_summary has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, loops 3, 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.
render::render_resolution_path (cognitive 16) src/tools/rust-analyzer/crates/ide-completion/src/render.rs:408— render::render_resolution_path has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, match/switch 5, 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.
check::check_item_type (cognitive 78) compiler/rustc_hir_analysis/src/check/check.rs:764— check::check_item_type has cognitive complexity 78 (threshold 15). Drivers by points: if/else 48, match/switch 21, loops 7, 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.
check::opaque_type_cycle_error (cognitive 69) compiler/rustc_hir_analysis/src/check/check.rs:2143— check::opaque_type_cycle_error has cognitive complexity 69 (threshold 15). Drivers by points: if/else 32, loops 31, match/switch 4, 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.
check::check_impl_items_against_trait (cognitive 55) compiler/rustc_hir_analysis/src/check/check.rs:1265— check::check_impl_items_against_trait has cognitive complexity 55 (threshold 15). Drivers by points: if/else 38, match/switch 10, boolean chains 4, loops 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.
check::check_opaque_precise_captures (cognitive 53) compiler/rustc_hir_analysis/src/check/check.rs:575— check::check_opaque_precise_captures has cognitive complexity 53 (threshold 15). Drivers by points: if/else 39, match/switch 8, loops 4, boolean chains 2 (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.
check::bounds_from_generic_clauses (cognitive 40) compiler/rustc_hir_analysis/src/check/mod.rs:328— check::bounds_from_generic_clauses has cognitive complexity 40 (threshold 15). Drivers by points: if/else 27, loops 7, boolean chains 3, match/switch 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.
check::check_transparent (cognitive 36) compiler/rustc_hir_analysis/src/check/check.rs:1736— check::check_transparent has cognitive complexity 36 (threshold 15). Drivers by points: if/else 24, match/switch 6, boolean chains 4, loops 2 (nesting depth added 13). Of this number, 23 points are the body's own statements and 13 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check::check_packed (cognitive 29) compiler/rustc_hir_analysis/src/check/check.rs:1633— check::check_packed has cognitive complexity 29 (threshold 15). Drivers by points: if/else 21, loops 7, 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.
check::fn_sig_suggestion (cognitive 22) compiler/rustc_hir_analysis/src/check/mod.rs:441— check::fn_sig_suggestion has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14, match/switch 6, boolean chains 2 (nesting depth added 5). 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.
check::check_scalable_vector (cognitive 20) compiler/rustc_hir_analysis/src/check/check.rs:1531— check::check_scalable_vector has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8, match/switch 8, boolean chains 2, loops 2 (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.
check::detect_discriminant_duplicate (cognitive 20) compiler/rustc_hir_analysis/src/check/check.rs:1958— check::detect_discriminant_duplicate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, loops 3, boolean chains 1, 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.
check::check_fn (cognitive 20) compiler/rustc_hir_typeck/src/check.rs:26— check::check_fn has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, boolean chains 2, loops 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.
check::check_opaque_meets_bounds (cognitive 18) compiler/rustc_hir_analysis/src/check/check.rs:302— check::check_opaque_meets_bounds has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, match/switch 4, loops 3 (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.
State::print_pat (cognitive 76) compiler/rustc_hir_pretty/src/lib.rs:1999— State::print_pat has cognitive complexity 76 (threshold 15). Drivers by points: if/else 72, match/switch 3, boolean chains 1 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
State::print_expr_outer_attr_style (cognitive 62) compiler/rustc_ast_pretty/src/pprust/state/expr.rs:386— State::print_expr_outer_attr_style has cognitive complexity 62 (threshold 15). Drivers by points: if/else 41, boolean chains 7, loops 7, match/switch 7 (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.
State::print_pat (cognitive 53) compiler/rustc_ast_pretty/src/pprust/state.rs:1912— State::print_pat has cognitive complexity 53 (threshold 15). Drivers by points: if/else 49, match/switch 3, boolean chains 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.
State::print_item (cognitive 37) compiler/rustc_ast_pretty/src/pprust/state/item.rs:164— State::print_item has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20, loops 7, boolean chains 5, match/switch 5 (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.
State::print_inline_asm (cognitive 29) compiler/rustc_ast_pretty/src/pprust/state.rs:1757— State::print_inline_asm has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17, match/switch 11, 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.
State::print_item (cognitive 29) compiler/rustc_hir_pretty/src/lib.rs:587— State::print_item has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18, loops 6, match/switch 5 (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.
State::print_use_tree (cognitive 25) compiler/rustc_ast_pretty/src/pprust/state/item.rs:890— State::print_use_tree has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20, loops 3, boolean chains 1, match/switch 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.
State::print_expr (cognitive 24) compiler/rustc_hir_pretty/src/lib.rs:1542— State::print_expr has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16, loops 5, match/switch 3 (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.
State::print_inline_asm (cognitive 22) compiler/rustc_hir_pretty/src/lib.rs:1451— State::print_inline_asm has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, match/switch 9 (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.
State::print_expr_struct (cognitive 19) compiler/rustc_ast_pretty/src/pprust/state/expr.rs:149— State::print_expr_struct has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, boolean chains 2, loops 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.
State::print_type (cognitive 17) compiler/rustc_hir_pretty/src/lib.rs:385— State::print_type has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, match/switch 3, loops 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.
State::print_fn (cognitive 16) compiler/rustc_hir_pretty/src/lib.rs:2258— State::print_fn has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, boolean chains 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.
format::make_format_args (cognitive 147) compiler/rustc_builtin_macros/src/format.rs:161— format::make_format_args has cognitive complexity 147 (threshold 15). Drivers by points: if/else 85, match/switch 48, loops 9, boolean chains 5 (nesting depth added 82). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
format::expand_format_args (cognitive 74) compiler/rustc_ast_lowering/src/format.rs:279— format::expand_format_args has cognitive complexity 74 (threshold 15). Drivers by points: if/else 59, match/switch 8, loops 4, boolean chains 3 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
format::format (cognitive 56) src/bootstrap/src/core/build_steps/format.rs:124— format::format has cognitive complexity 56 (threshold 15). Drivers by points: if/else 28, loops 13, match/switch 12, boolean chains 3 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
format::report_invalid_references (cognitive 36) compiler/rustc_builtin_macros/src/format.rs:952— format::report_invalid_references has cognitive complexity 36 (threshold 15). Drivers by points: if/else 26, loops 4, boolean chains 3, match/switch 3 (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.
format::fmt_type (cognitive 34) src/librustdoc/html/format.rs:880— format::fmt_type has cognitive complexity 34 (threshold 15). Drivers by points: if/else 22, match/switch 10, 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.
format::report_missing_placeholders (cognitive 28) compiler/rustc_builtin_macros/src/format.rs:719— format::report_missing_placeholders has cognitive complexity 28 (threshold 15). Drivers by points: if/else 22, boolean chains 3, match/switch 3 (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.
format::parse_args (cognitive 25) compiler/rustc_builtin_macros/src/format.rs:71— format::parse_args has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18, match/switch 6, 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.
format::primitive_link_fragment (cognitive 23) src/librustdoc/html/format.rs:739— format::primitive_link_fragment has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14, match/switch 5, loops 4 (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.
format::report_redundant_format_arguments (cognitive 22) compiler/rustc_builtin_macros/src/format.rs:880— format::report_redundant_format_arguments has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, loops 6 (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.
format::href_with_root_path (cognitive 22) src/librustdoc/html/format.rs:542— format::href_with_root_path has cognitive complexity 22 (threshold 15). Drivers by points: if/else 19, match/switch 2, 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.
format::flatten_format_args (cognitive 16) compiler/rustc_ast_lowering/src/format.rs:151— format::flatten_format_args has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6, loops 4, match/switch 4, 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.
LoweringContext::lower_inline_asm (cognitive 137) compiler/rustc_ast_lowering/src/asm.rs:25— LoweringContext::lower_inline_asm has cognitive complexity 137 (threshold 15). Drivers by points: if/else 92, match/switch 27, loops 11, boolean chains 7 (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.
LoweringContext::lower_assoc_item_constraint (cognitive 32) compiler/rustc_ast_lowering/src/lib.rs:1263— LoweringContext::lower_assoc_item_constraint has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18, match/switch 12, 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.
LoweringContext::lower_path_segment (cognitive 29) compiler/rustc_ast_lowering/src/path.rs:252— LoweringContext::lower_path_segment has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14, match/switch 12, boolean chains 3 (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.
LoweringContext::lower_qpath (cognitive 27) compiler/rustc_ast_lowering/src/path.rs:25— LoweringContext::lower_qpath has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18, match/switch 6, boolean chains 2, loops 1 (nesting depth added 6). 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.
LoweringContext::lower_expr_mut (cognitive 26) compiler/rustc_ast_lowering/src/expr.rs:163— LoweringContext::lower_expr_mut has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15, match/switch 8, loops 3 (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.
LoweringContext::lower_variant_data (cognitive 26) compiler/rustc_ast_lowering/src/item.rs:816— LoweringContext::lower_variant_data has cognitive complexity 26 (threshold 15). Drivers by points: if/else 20, loops 5, match/switch 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.
LoweringContext::lower_expr_range (cognitive 21) compiler/rustc_ast_lowering/src/expr.rs:1452— LoweringContext::lower_expr_range has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18, match/switch 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.
LoweringContext::lower_use_tree (cognitive 20) compiler/rustc_ast_lowering/src/item.rs:593— LoweringContext::lower_use_tree has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, boolean chains 4, match/switch 3, loops 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.
LoweringContext::lower_generic_arg (cognitive 20) compiler/rustc_ast_lowering/src/lib.rs:1418— LoweringContext::lower_generic_arg has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 10, if/else 9, boolean chains 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.
LoweringContext::lower_legacy_const_generics (cognitive 19) compiler/rustc_ast_lowering/src/expr.rs:550— LoweringContext::lower_legacy_const_generics has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, loops 3 (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.
LoweringContext::lower_ty (cognitive 17) compiler/rustc_ast_lowering/src/lib.rs:1566— LoweringContext::lower_ty has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, match/switch 8 (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.
FunctionCx::codegen_intrinsic_call (cyclomatic 83) compiler/rustc_codegen_ssa/src/mir/intrinsic.rs:57— FunctionCx::codegen_intrinsic_call has cyclomatic complexity 83 (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.
FunctionCx::codegen_call_terminator (cyclomatic 56) compiler/rustc_codegen_ssa/src/mir/block.rs:935— FunctionCx::codegen_call_terminator has cyclomatic complexity 56 (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.
FunctionCx::codegen_rvalue_operand (cyclomatic 41) compiler/rustc_codegen_ssa/src/mir/rvalue.rs:495— FunctionCx::codegen_rvalue_operand 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.
FunctionCx::codegen_scalar_binop (cyclomatic 31) compiler/rustc_codegen_ssa/src/mir/rvalue.rs:886— FunctionCx::codegen_scalar_binop 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.
FunctionCx::debug_introduce_local (cyclomatic 28) compiler/rustc_codegen_ssa/src/mir/debuginfo.rs:310— FunctionCx::debug_introduce_local 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.
FunctionCx::codegen_rvalue (cyclomatic 28) compiler/rustc_codegen_ssa/src/mir/rvalue.rs:100— FunctionCx::codegen_rvalue 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.
FunctionCx::codegen_argument (cyclomatic 26) compiler/rustc_codegen_ssa/src/mir/block.rs:1927— FunctionCx::codegen_argument 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.
FunctionCx::codegen_statement (cyclomatic 22) compiler/rustc_codegen_ssa/src/mir/statement.rs:11— FunctionCx::codegen_statement 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.
FunctionCx::codegen_switchint_terminator (cyclomatic 21) compiler/rustc_codegen_ssa/src/mir/block.rs:408— FunctionCx::codegen_switchint_terminator 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.
FunctionCx::compute_per_local_var_debug_info (cyclomatic 18) compiler/rustc_codegen_ssa/src/mir/debuginfo.rs:566— FunctionCx::compute_per_local_var_debug_info 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.
Hotspot: compiler/rustc_passes/src/check_attr.rs compiler/rustc_passes/src/check_attr.rs— compiler/rustc_passes/src/check_attr.rs changed 45 times in last 90 days, max complexity 193.
Hotspot: compiler/rustc_codegen_llvm/src/intrinsic.rs compiler/rustc_codegen_llvm/src/intrinsic.rs— compiler/rustc_codegen_llvm/src/intrinsic.rs changed 29 times in last 90 days, max complexity 129. 4 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
Hotspot: src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs— src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs changed 40 times in last 90 days, max complexity 86. 7 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
Hotspot: clippy_lints/src/methods/mod.rs clippy_lints/src/methods/mod.rs— clippy_lints/src/methods/mod.rs changed 18 times in last 90 days, max complexity 188.
Hotspot: compiler/rustc_hir/src/attrs/encode_cross_crate.rs compiler/rustc_hir/src/attrs/encode_cross_crate.rs— compiler/rustc_hir/src/attrs/encode_cross_crate.rs changed 17 times in last 90 days, max complexity 193.
Hotspot: src/tools/miri/src/shims/unix/foreign_items.rs src/tools/miri/src/shims/unix/foreign_items.rs— src/tools/miri/src/shims/unix/foreign_items.rs changed 21 times in last 90 days, max complexity 156.
Hotspot: src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs— src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs changed 29 times in last 90 days, max complexity 97.
Hotspot: src/bootstrap/src/core/config/config.rs src/bootstrap/src/core/config/config.rs— src/bootstrap/src/core/config/config.rs changed 21 times in last 90 days, max complexity 120. 4 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
Hotspot: src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs— src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs changed 23 times in last 90 days, max complexity 108. 2 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
Hotspot: compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs— compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs changed 28 times in last 90 days, max complexity 87. 4 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
asm::expand_preparsed_asm (cognitive 107) compiler/rustc_builtin_macros/src/asm.rs:265— asm::expand_preparsed_asm has cognitive complexity 107 (threshold 15). Drivers by points: if/else 71, match/switch 26, loops 9, boolean chains 1 (nesting depth added 65). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
asm::validate_asm_args (cognitive 70) compiler/rustc_builtin_macros/src/asm.rs:39— asm::validate_asm_args has cognitive complexity 70 (threshold 15). Drivers by points: if/else 43, match/switch 13, boolean chains 7, loops 7 (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.
asm::reg_to_llvm (cognitive 40) compiler/rustc_codegen_llvm/src/asm.rs:679— asm::reg_to_llvm has cognitive complexity 40 (threshold 15). Drivers by points: if/else 24, match/switch 15, boolean chains 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.
asm::parse_asm_operand (cognitive 35) compiler/rustc_parse/src/parser/asm.rs:98— asm::parse_asm_operand has cognitive complexity 35 (threshold 15). Drivers by points: if/else 35 (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.
asm::modifier_to_gcc (cognitive 26) compiler/rustc_codegen_gcc/src/asm.rs:1038— asm::modifier_to_gcc has cognitive complexity 26 (threshold 15). Drivers by points: if/else 19, match/switch 7 (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.
asm::parse_asm_args (cognitive 25) compiler/rustc_parse/src/parser/asm.rs:169— asm::parse_asm_args has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20, match/switch 3, 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.
asm::modifier_to_llvm (cognitive 22) compiler/rustc_codegen_llvm/src/asm.rs:837— asm::modifier_to_llvm has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15, match/switch 7 (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.
asm::parse_options (cognitive 17) compiler/rustc_parse/src/parser/asm.rs:289— asm::parse_options has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, loops 3 (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.
asm::llvm_fixup_input (cognitive 16) compiler/rustc_codegen_llvm/src/asm.rs:1086— asm::llvm_fixup_input has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, match/switch 3, 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.
asm::llvm_fixup_output (cognitive 16) compiler/rustc_codegen_llvm/src/asm.rs:1264— asm::llvm_fixup_output has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, match/switch 3, 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.
items::rewrite_fn_base (cognitive 97) src/tools/rustfmt/src/items.rs:2454— items::rewrite_fn_base has cognitive complexity 97 (threshold 15). Drivers by points: if/else 77, boolean chains 13, match/switch 7 (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.
items::format_trait (cognitive 37) src/tools/rustfmt/src/items.rs:1147— items::format_trait has cognitive complexity 37 (threshold 15). Drivers by points: if/else 24, boolean chains 6, match/switch 5, loops 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.
items::opt_item (cognitive 31) src/tools/rust-analyzer/crates/parser/src/grammar/items.rs:109— items::opt_item has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14, boolean chains 13, match/switch 4 (nesting depth added 3). 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.
items::format_impl (cognitive 29) src/tools/rustfmt/src/items.rs:789— items::format_impl has cognitive complexity 29 (threshold 15). Drivers by points: if/else 20, boolean chains 5, match/switch 4 (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.
items::format_struct_struct (cognitive 23) src/tools/rustfmt/src/items.rs:1418— items::format_struct_struct has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18, boolean chains 4, match/switch 1 (nesting depth added 3). 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.
items::rewrite_ty (cognitive 22) src/tools/rustfmt/src/items.rs:1740— items::rewrite_ty has cognitive complexity 22 (threshold 15). Drivers by points: if/else 20, 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.
items::format_impl_ref_and_type (cognitive 21) src/tools/rustfmt/src/items.rs:940— items::format_impl_ref_and_type has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16, match/switch 5 (nesting depth added 5). 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.
items::format_generics (cognitive 21) src/tools/rustfmt/src/items.rs:3342— items::format_generics has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16, boolean chains 5 (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.
items::compute_budgets_for_params (cognitive 20) src/tools/rustfmt/src/items.rs:2904— items::compute_budgets_for_params has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 10, if/else 9, boolean chains 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.
items::rewrite_struct_field (cognitive 16) src/tools/rustfmt/src/items.rs:1911— items::rewrite_struct_field has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 3, loops 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.
DefCollector::resolve_macros (cognitive 75) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:1295— DefCollector::resolve_macros has cognitive complexity 75 (threshold 15). Drivers by points: if/else 56, match/switch 11, loops 6, boolean chains 2 (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.
DefCollector::record_resolved_import (cognitive 46) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:876— DefCollector::record_resolved_import has cognitive complexity 46 (threshold 15). Drivers by points: if/else 29, match/switch 16, boolean chains 1 (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.
DefCollector::build_reduced_graph_for_use_tree (cognitive 43) compiler/rustc_resolve/src/build_reduced_graph.rs:583— DefCollector::build_reduced_graph_for_use_tree has cognitive complexity 43 (threshold 15). Drivers by points: if/else 26, boolean chains 11, match/switch 4, 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) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:1191— DefCollector::push_res_and_update_glob_vis has cognitive complexity 31 (threshold 15). Drivers by points: if/else 22, 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::seed_with_top_level (cognitive 29) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:277— DefCollector::seed_with_top_level has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15, match/switch 9, boolean chains 3, loops 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.
DefCollector::process_macro_use_imports (cognitive 27) compiler/rustc_resolve/src/build_reduced_graph.rs:1147— DefCollector::process_macro_use_imports has cognitive complexity 27 (threshold 15). Drivers by points: if/else 21, boolean chains 2, loops 2, match/switch 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.
DefCollector::build_reduced_graph_for_item (cognitive 20) compiler/rustc_resolve/src/build_reduced_graph.rs:819— DefCollector::build_reduced_graph_for_item has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, loops 3, boolean chains 2, 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.
DefCollector::update_recursive (cognitive 20) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:1100— DefCollector::update_recursive has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10, match/switch 8, 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) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:414— DefCollector::resolution_loop has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, loops 6 (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.
DefCollector::build_reduced_graph_for_extern_crate (cognitive 16) compiler/rustc_resolve/src/build_reduced_graph.rs:997— DefCollector::build_reduced_graph_for_extern_crate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, boolean chains 3, match/switch 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.
Change coupling: gen_c.rs ↔ gen_rust.rs library/stdarch/crates/intrinsic-test/src/common/gen_c.rs— `library/stdarch/crates/intrinsic-test/src/common/gen_c.rs` and `library/stdarch/crates/intrinsic-test/src/common/gen_rust.rs` change together 90% of the time (9 of the 10 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. They already sit in the same directory, so if they share structure, extract the common part into one unit; otherwise break the coupling.
Change coupling: diagnostics.rs ↔ diagnostics.rs compiler/rustc_attr_parsing/src/diagnostics.rs— `compiler/rustc_attr_parsing/src/diagnostics.rs` and `compiler/rustc_lint/src/early/diagnostics.rs` change together 89% of the time (34 of the 38 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. If they belong together, co-locate them; if not, break the coupling.
Change coupling: context.rs ↔ mod.rs compiler/rustc_infer/src/infer/context.rs— `compiler/rustc_infer/src/infer/context.rs` and `compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs` change together 67% of the time (10 of the 15 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. If they belong together, co-locate them; if not, break the coupling.
Change coupling: argument.rs ↔ gen_rust.rs library/stdarch/crates/intrinsic-test/src/common/argument.rs— `library/stdarch/crates/intrinsic-test/src/common/argument.rs` and `library/stdarch/crates/intrinsic-test/src/common/gen_rust.rs` change together 64% of the time (14 of the 22 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. They already sit in the same directory, so if they share structure, extract the common part into one unit; otherwise break the coupling.
Change coupling: on_move.rs ↔ on_unknown.rs compiler/rustc_attr_parsing/src/attributes/diagnostic/on_move.rs— `compiler/rustc_attr_parsing/src/attributes/diagnostic/on_move.rs` and `compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unknown.rs` change together 62% of the time (8 of the 13 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. They already sit in the same directory, so if they share structure, extract the common part into one unit; otherwise break the coupling.
Change coupling: argument.rs ↔ gen_c.rs library/stdarch/crates/intrinsic-test/src/common/argument.rs— `library/stdarch/crates/intrinsic-test/src/common/argument.rs` and `library/stdarch/crates/intrinsic-test/src/common/gen_c.rs` change together 60% of the time (6 of the 10 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. They already sit in the same directory, so if they share structure, extract the common part into one unit; otherwise break the coupling.
Change coupling: on_const.rs ↔ on_move.rs compiler/rustc_attr_parsing/src/attributes/diagnostic/on_const.rs— `compiler/rustc_attr_parsing/src/attributes/diagnostic/on_const.rs` and `compiler/rustc_attr_parsing/src/attributes/diagnostic/on_move.rs` change together 58% of the time (7 of the 12 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. They already sit in the same directory, so if they share structure, extract the common part into one unit; otherwise break the coupling.
Change coupling: on_const.rs ↔ on_unknown.rs compiler/rustc_attr_parsing/src/attributes/diagnostic/on_const.rs— `compiler/rustc_attr_parsing/src/attributes/diagnostic/on_const.rs` and `compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unknown.rs` change together 58% of the time (7 of the 12 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. They already sit in the same directory, so if they share structure, extract the common part into one unit; otherwise break the coupling.
Change coupling: on_move.rs ↔ on_unimplemented.rs compiler/rustc_attr_parsing/src/attributes/diagnostic/on_move.rs— `compiler/rustc_attr_parsing/src/attributes/diagnostic/on_move.rs` and `compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unimplemented.rs` change together 58% of the time (7 of the 12 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. They already sit in the same directory, so if they share structure, extract the common part into one unit; otherwise break the coupling.
Change coupling: on_unimplemented.rs ↔ on_unknown.rs compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unimplemented.rs— `compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unimplemented.rs` and `compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unknown.rs` change together 58% of the time (7 of the 12 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. They already sit in the same directory, so if they share structure, extract the common part into one unit; otherwise break the coupling.
D38 · OSV Dependency Vulnerabilities· Medium CVE · ×10
Medium CVE: [GHSA redacted] src/tools/rust-analyzer/editors/code/package-lock.json— ajv 8.17.1: [GHSA redacted] — ajv is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin ajv to 8.18.0 with an `overrides` entry (`resolutions` if you use Yarn)).
Medium CVE: [GHSA redacted] src/tools/rust-analyzer/editors/code/package-lock.json— brace-expansion 5.0.5: [GHSA redacted] — brace-expansion is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin brace-expansion to 5.0.6 with an `overrides` entry (`resolutions` if you use Yarn)). This is 1 of 3 advisories this scan raises against brace-expansion 5.0.5, and their fixed versions do not agree — anything below 5.0.8 still leaves at least one of them open, so 5.0.8 is the floor for this package, not this row's target alone.
Medium CVE: [GHSA redacted] src/ci/citool/Cargo.lock— bytes 1.10.0: [GHSA redacted] — bytes is not declared in this repo's manifests: it is pulled in transitively by http 1.2.0, so upgrade the dependency that requires it (or force it with `cargo update -p bytes@1.10.0 --precise 1.11.1`, or a `[patch.crates-io]` entry).
Medium CVE: [GHSA redacted] src/ci/docker/host-x86_64/pr-check-1/reuse-requirements.txt— jinja2 3.1.4: [GHSA redacted] — upgrade to 3.1.6. This is 1 of 3 advisories this scan raises against jinja2 3.1.4, and their fixed versions do not agree — anything below 3.1.6 still leaves at least one of them open, so 3.1.6 is the floor for this package, not this row's target alone. One upgrade of jinja2 3.1.4 clears all 3 advisories it raises: [GHSA redacted], [GHSA redacted], [GHSA redacted].
Medium CVE: [GHSA redacted] src/tools/rust-analyzer/editors/code/package-lock.json— markdown-it 14.1.0: [GHSA redacted] — markdown-it is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin markdown-it to 14.1.1 with an `overrides` entry (`resolutions` if you use Yarn)). This is 1 of 2 advisories this scan raises against markdown-it 14.1.0, and their fixed versions do not agree — anything below 14.2.0 still leaves at least one of them open, so 14.2.0 is the floor for this package, not this row's target alone. One upgrade of markdown-it 14.1.0 clears all 2 advisories it raises: [GHSA redacted], [GHSA redacted].
Medium CVE: [GHSA redacted] src/tools/rust-analyzer/editors/code/package-lock.json— qs 6.14.2: [GHSA redacted] — qs is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin qs to 6.15.2 with an `overrides` entry (`resolutions` if you use Yarn)).
Medium CVE: [GHSA redacted] src/ci/citool/Cargo.lock— ring 0.17.11: [GHSA redacted] — ring is not declared in this repo's manifests: it is pulled in transitively by rustls 0.23.23 and rustls-webpki 0.102.8, so upgrade the dependency that requires it (or force it with `cargo update -p ring@0.17.11 --precise 0.17.12`, or a `[patch.crates-io]` entry).
Medium CVE: [GHSA redacted] src/ci/citool/Cargo.lock— time 0.3.38: [GHSA redacted] — upgrade to 0.3.47
Medium CVE: RUSTSEC-2025-0055 src/tools/rustfmt/Cargo.lock— tracing-subscriber 0.3.17: RUSTSEC-2025-0055 — this lockfile is not one cargo resolves against: src/tools/rustfmt is a member of the workspace at the repository root, so cargo locks the whole tree through the repository root's own Cargo.lock and ignores this file. Nothing in it is built, and no version command can move it. Delete it (or take the crate out of the workspace's `members` if it is meant to resolve independently), then check whether the workspace lock still carries tracing-subscriber 0.3.17.
Medium CVE: [GHSA redacted] src/tools/rust-analyzer/editors/code/package-lock.json— uuid 8.3.2: [GHSA redacted] — uuid is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (— 11.1.1 is a MAJOR ahead of the resolved 8.3.2, so an `overrides` pin would force a breaking version under a dependent written against 8.3.2; upgrading the declaring package is the remedy, and where no patched release exists in your major line, record the exposure instead).
State::print_expr_outer_attr_style (cyclomatic 86) compiler/rustc_ast_pretty/src/pprust/state/expr.rs:386— State::print_expr_outer_attr_style has cyclomatic complexity 86 (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.
State::print_pat (cyclomatic 47) compiler/rustc_hir_pretty/src/lib.rs:1999— State::print_pat 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.
State::print_expr (cyclomatic 46) compiler/rustc_hir_pretty/src/lib.rs:1542— State::print_expr has cyclomatic complexity 46 (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.
State::print_pat (cyclomatic 45) compiler/rustc_ast_pretty/src/pprust/state.rs:1912— State::print_pat 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.
State::print_item (cyclomatic 39) compiler/rustc_ast_pretty/src/pprust/state/item.rs:164— State::print_item 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.
State::print_item (cyclomatic 29) compiler/rustc_hir_pretty/src/lib.rs:587— State::print_item has cyclomatic complexity 29 (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.
State::print_type (cyclomatic 24) compiler/rustc_hir_pretty/src/lib.rs:385— State::print_type 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.
State::print_inline_asm (cyclomatic 19) compiler/rustc_ast_pretty/src/pprust/state.rs:1757— State::print_inline_asm 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.
State::print_inline_asm (cyclomatic 16) compiler/rustc_hir_pretty/src/lib.rs:1451— State::print_inline_asm 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.
asm::reg_to_llvm (cyclomatic 85) compiler/rustc_codegen_llvm/src/asm.rs:679— asm::reg_to_llvm has cyclomatic complexity 85 (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.
asm::modifier_to_gcc (cyclomatic 56) compiler/rustc_codegen_gcc/src/asm.rs:1038— asm::modifier_to_gcc has cyclomatic complexity 56 (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.
asm::modifier_to_llvm (cyclomatic 56) compiler/rustc_codegen_llvm/src/asm.rs:837— asm::modifier_to_llvm has cyclomatic complexity 56 (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.
asm::validate_asm_args (cyclomatic 43) compiler/rustc_builtin_macros/src/asm.rs:39— asm::validate_asm_args has cyclomatic complexity 43 (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.
asm::expand_preparsed_asm (cyclomatic 39) compiler/rustc_builtin_macros/src/asm.rs:265— asm::expand_preparsed_asm has cyclomatic complexity 39 (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.
asm::llvm_fixup_output (cyclomatic 27) compiler/rustc_codegen_llvm/src/asm.rs:1264— asm::llvm_fixup_output 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.
asm::llvm_fixup_input (cyclomatic 26) compiler/rustc_codegen_llvm/src/asm.rs:1086— asm::llvm_fixup_input 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.
asm::llvm_fixup_output_type (cyclomatic 25) compiler/rustc_codegen_llvm/src/asm.rs:1421— asm::llvm_fixup_output_type 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.
asm::parse_asm_operand (cyclomatic 18) compiler/rustc_parse/src/parser/asm.rs:98— asm::parse_asm_operand 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.
render::definition (cyclomatic 64) src/tools/rust-analyzer/crates/ide/src/hover/render.rs:446— 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.
render::render_impl::doc_impl_item (cyclomatic 29) src/librustdoc/html/render/mod.rs:1823— render::render_impl::doc_impl_item 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.
render::render_impl (cyclomatic 26) src/librustdoc/html/render/mod.rs:1802— render::render_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.
render::render_memory_layout (cyclomatic 26) src/tools/rust-analyzer/crates/ide/src/hover/render.rs:1145— 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.
render::render_resolution_path (cyclomatic 23) src/tools/rust-analyzer/crates/ide-completion/src/render.rs:408— render::render_resolution_path 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.
render::literal (cyclomatic 20) src/tools/rust-analyzer/crates/ide/src/hover/render.rs:832— render::literal 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.
render::repr_attribute (cyclomatic 18) src/librustdoc/html/render/mod.rs:3023— render::repr_attribute 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.
render::definition_owner_name (cyclomatic 18) src/tools/rust-analyzer/crates/ide/src/hover/render.rs:355— render::definition_owner_name 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.
render::try_expr (cyclomatic 16) src/tools/rust-analyzer/crates/ide/src/hover/render.rs:60— render::try_expr 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.
Evaluator::eval_rvalue (cognitive 134) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:1178— Evaluator::eval_rvalue has cognitive complexity 134 (threshold 15). Drivers by points: match/switch 68, if/else 54, loops 12 (nesting depth added 85). 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_intrinsic (cognitive 78) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs:561— Evaluator::exec_intrinsic has cognitive complexity 78 (threshold 15). Drivers by points: if/else 40, match/switch 29, loops 6, boolean chains 3 (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.
Evaluator::place_addr_and_ty_and_metadata (cognitive 39) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:788— Evaluator::place_addr_and_ty_and_metadata has cognitive complexity 39 (threshold 15). Drivers by points: match/switch 27, if/else 11, 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::interpret_mir (cognitive 39) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:945— Evaluator::interpret_mir has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15, match/switch 15, loops 9 (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.
Evaluator::exec_simd_intrinsic (cognitive 35) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim/simd.rs:51— Evaluator::exec_simd_intrinsic has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14, match/switch 11, loops 9, 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.
Evaluator::create_memory_map::rec (cognitive 35) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:2370— Evaluator::create_memory_map::rec has cognitive complexity 35 (threshold 15). Drivers by points: loops 15, match/switch 13, if/else 7 (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::patch_addresses (cognitive 27) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:2543— Evaluator::patch_addresses has cognitive complexity 27 (threshold 15). Drivers by points: loops 11, match/switch 10, if/else 6 (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.
Evaluator::run_drop_glue_deep (cognitive 17) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:3080— Evaluator::run_drop_glue_deep has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6, match/switch 6, loops 4, 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::exec_atomic_intrinsic (cognitive 16) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs:1487— Evaluator::exec_atomic_intrinsic has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, 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.
diagnostics::suggest_constraining_type_params (cognitive 68) compiler/rustc_middle/src/ty/diagnostics.rs:286— diagnostics::suggest_constraining_type_params has cognitive complexity 68 (threshold 15). Drivers by points: if/else 53, match/switch 12, boolean chains 2, loops 1 (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.
diagnostics::report_result (cognitive 57) src/tools/miri/src/diagnostics.rs:241— diagnostics::report_result has cognitive complexity 57 (threshold 15). Drivers by points: if/else 33, loops 12, match/switch 12 (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.
diagnostics::emit_frag_parse_err (cognitive 41) compiler/rustc_expand/src/mbe/diagnostics.rs:369— diagnostics::emit_frag_parse_err has cognitive complexity 41 (threshold 15). Drivers by points: if/else 27, loops 10, match/switch 3, 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.
diagnostics::failed_to_match_macro (cognitive 29) compiler/rustc_expand/src/mbe/diagnostics.rs:30— diagnostics::failed_to_match_macro has cognitive complexity 29 (threshold 15). Drivers by points: if/else 19, boolean chains 5, loops 3, match/switch 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.
diagnostics::suggest_changing_unsized_bound (cognitive 28) compiler/rustc_middle/src/ty/diagnostics.rs:185— diagnostics::suggest_changing_unsized_bound has cognitive complexity 28 (threshold 15). Drivers by points: if/else 18, loops 9, 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.
diagnostics::report_suspicious_mismatch_block (cognitive 25) compiler/rustc_parse/src/lexer/diagnostics.rs:68— diagnostics::report_suspicious_mismatch_block has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16, loops 7, 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.
diagnostics::report_msg (cognitive 25) src/tools/miri/src/diagnostics.rs:556— diagnostics::report_msg has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17, loops 6, boolean chains 1, 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.
diagnostics::impl_trait_overcapture_suggestion (cognitive 21) compiler/rustc_trait_selection/src/diagnostics.rs:1917— diagnostics::impl_trait_overcapture_suggestion has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15, loops 3, match/switch 3 (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.
diagnostics::create_lit_error (cognitive 16) compiler/rustc_session/src/diagnostics.rs:599— diagnostics::create_lit_error has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, match/switch 6, boolean chains 3 (nesting depth added 4). Of this number, 12 points are the body's own statements and 4 belong to 2 function items declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
clean::clean_generics (cognitive 65) src/librustdoc/clean/mod.rs:735— clean::clean_generics has cognitive complexity 65 (threshold 15). Drivers by points: if/else 31, loops 22, match/switch 11, boolean chains 1 (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.
clean::clean_middle_assoc_item (cognitive 62) src/librustdoc/clean/mod.rs:1366— clean::clean_middle_assoc_item has cognitive complexity 62 (threshold 15). Drivers by points: if/else 33, match/switch 27, boolean chains 2 (nesting depth added 34). Of this number, 57 points are the body's own statements and 5 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
clean::first_non_private (cognitive 44) src/librustdoc/clean/mod.rs:1632— clean::first_non_private has cognitive complexity 44 (threshold 15). Drivers by points: if/else 30, loops 9, boolean chains 4, match/switch 1 (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.
clean::clean_middle_ty (cognitive 33) src/librustdoc/clean/mod.rs:2138— clean::clean_middle_ty has cognitive complexity 33 (threshold 15). Drivers by points: if/else 24, match/switch 9 (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.
clean::maybe_expand_private_type_alias (cognitive 31) src/librustdoc/clean/mod.rs:1809— clean::maybe_expand_private_type_alias has cognitive complexity 31 (threshold 15). Drivers by points: if/else 21, match/switch 8, 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.
clean::clean_ty_generics_inner (cognitive 24) src/librustdoc/clean/mod.rs:861— clean::clean_ty_generics_inner has cognitive complexity 24 (threshold 15). Drivers by points: if/else 17, loops 4, match/switch 2, 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.
clean::clean_qpath (cognitive 21) src/librustdoc/clean/mod.rs:1723— clean::clean_qpath has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17, match/switch 3, 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.
clean::clean_use_statement_inner (cognitive 21) src/librustdoc/clean/mod.rs:3159— clean::clean_use_statement_inner has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14, boolean chains 7 (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.
clean::clean_doc_module (cognitive 17) src/librustdoc/clean/mod.rs:68— clean::clean_doc_module has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, boolean chains 5, loops 1, 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.
InterpCx::eval_simd_intrinsic (cyclomatic 138) compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:21— InterpCx::eval_simd_intrinsic has cyclomatic complexity 138 (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.
InterpCx::eval_intrinsic (cyclomatic 111) compiler/rustc_const_eval/src/interpret/intrinsics.rs:170— InterpCx::eval_intrinsic has cyclomatic complexity 111 (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.
InterpCx::binary_int_op (cyclomatic 60) compiler/rustc_const_eval/src/interpret/operator.rs:84— InterpCx::binary_int_op has cyclomatic complexity 60 (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.
InterpCx::init_stack_frame (cyclomatic 22) compiler/rustc_const_eval/src/interpret/call.rs:334— InterpCx::init_stack_frame 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.
InterpCx::eval_terminator (cyclomatic 22) compiler/rustc_const_eval/src/interpret/step.rs:501— InterpCx::eval_terminator 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.
InterpCx::eval_rvalue_into_place (cyclomatic 21) compiler/rustc_const_eval/src/interpret/step.rs:157— InterpCx::eval_rvalue_into_place 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.
InterpCx::layout_compat (cyclomatic 16) compiler/rustc_const_eval/src/interpret/call.rs:169— InterpCx::layout_compat 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.
InterpCx::cast (cyclomatic 16) compiler/rustc_const_eval/src/interpret/cast.rs:23— InterpCx::cast 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.
Evaluator::exec_intrinsic (cyclomatic 134) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs:561— Evaluator::exec_intrinsic has cyclomatic complexity 134 (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::eval_rvalue (cyclomatic 96) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:1178— Evaluator::eval_rvalue has cyclomatic complexity 96 (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::interpret_mir (cyclomatic 22) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:945— Evaluator::interpret_mir has cyclomatic complexity 22 (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) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:2370— 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_simd_intrinsic (cyclomatic 21) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim/simd.rs:51— Evaluator::exec_simd_intrinsic has cyclomatic complexity 21 (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::exec_extern_c (cyclomatic 18) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs:397— Evaluator::exec_extern_c 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.
Evaluator::place_addr_and_ty_and_metadata (cyclomatic 18) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:788— 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.
Evaluator::patch_addresses (cyclomatic 17) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:2543— Evaluator::patch_addresses 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.
clean::clean_middle_ty (cyclomatic 44) src/librustdoc/clean/mod.rs:2138— clean::clean_middle_ty has cyclomatic complexity 44 (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.
clean::clean_middle_assoc_item (cyclomatic 29) src/librustdoc/clean/mod.rs:1366— clean::clean_middle_assoc_item has cyclomatic complexity 29 (threshold 15). Of this number, 25 points are the body's own statements and 4 belong to one function item declared inside it. 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.
clean::clean_generics (cyclomatic 24) src/librustdoc/clean/mod.rs:735— clean::clean_generics 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.
clean::first_non_private (cyclomatic 21) src/librustdoc/clean/mod.rs:1632— clean::first_non_private 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.
clean::clean_ty (cyclomatic 21) src/librustdoc/clean/mod.rs:1881— clean::clean_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.
clean::clean_ty_generics_inner (cyclomatic 18) src/librustdoc/clean/mod.rs:861— clean::clean_ty_generics_inner 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.
clean::clean_maybe_renamed_item (cyclomatic 18) src/librustdoc/clean/mod.rs:2866— clean::clean_maybe_renamed_item 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.
clean::clean_use_statement_inner (cyclomatic 16) src/librustdoc/clean/mod.rs:3159— clean::clean_use_statement_inner 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.
abi::codegen_terminator_call (cyclomatic 37) compiler/rustc_codegen_cranelift/src/abi/mod.rs:413— abi::codegen_terminator_call has cyclomatic complexity 37 (threshold 15). Of this number, 26 points are the body's own statements and 11 belong to one function item declared inside it. 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.
abi::conv_to_fn_attribute (cyclomatic 24) compiler/rustc_codegen_gcc/src/abi.rs:238— abi::conv_to_fn_attribute 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.
abi::to_llvm_calling_convention (cyclomatic 24) compiler/rustc_codegen_llvm/src/abi.rs:720— abi::to_llvm_calling_convention 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.
abi::arg_attrs_for_rust_scalar (cyclomatic 21) compiler/rustc_ty_utils/src/abi.rs:322— abi::arg_attrs_for_rust_scalar 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.
abi::codegen_fn_prelude (cyclomatic 17) compiler/rustc_codegen_cranelift/src/abi/mod.rs:246— abi::codegen_fn_prelude 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.
abi::get_attrs (cyclomatic 16) compiler/rustc_codegen_llvm/src/abi.rs:59— abi::get_attrs 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.
abi::fn_sig_for_fn_abi (cyclomatic 16) compiler/rustc_ty_utils/src/abi.rs:34— abi::fn_sig_for_fn_abi 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.
abi::fn_abi_sanity_check (cyclomatic 16) compiler/rustc_ty_utils/src/abi.rs:423— abi::fn_abi_sanity_check has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 2 function items declared inside it (fn_arg_sanity_check, fn_arg_attrs_sanity_check). 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.
InterpCx::eval_simd_intrinsic (cognitive 161) compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:21— InterpCx::eval_simd_intrinsic has cognitive complexity 161 (threshold 15). Drivers by points: if/else 72, match/switch 51, loops 36, boolean chains 2 (nesting depth added 88). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InterpCx::binary_int_op (cognitive 61) compiler/rustc_const_eval/src/interpret/operator.rs:84— InterpCx::binary_int_op has cognitive complexity 61 (threshold 15). Drivers by points: if/else 43, match/switch 12, boolean chains 6 (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.
InterpCx::eval_intrinsic (cognitive 45) compiler/rustc_const_eval/src/interpret/intrinsics.rs:170— InterpCx::eval_intrinsic has cognitive complexity 45 (threshold 15). Drivers by points: if/else 29, match/switch 14, boolean chains 2 (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.
InterpCx::init_stack_frame (cognitive 32) compiler/rustc_const_eval/src/interpret/call.rs:334— InterpCx::init_stack_frame has cognitive complexity 32 (threshold 15). Drivers by points: if/else 22, boolean chains 4, loops 4, match/switch 2 (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.
InterpCx::read_discriminant (cognitive 27) compiler/rustc_const_eval/src/interpret/discriminant.rs:52— InterpCx::read_discriminant has cognitive complexity 27 (threshold 15). Drivers by points: if/else 20, match/switch 6, 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.
InterpCx::eval_rvalue_into_place (cognitive 21) compiler/rustc_const_eval/src/interpret/step.rs:157— InterpCx::eval_rvalue_into_place has cognitive complexity 21 (threshold 15). Drivers by points: if/else 19, boolean chains 1, 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.
InterpCx::eval_terminator (cognitive 21) compiler/rustc_const_eval/src/interpret/step.rs:501— InterpCx::eval_terminator has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15, boolean chains 3, loops 2, 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.
InterpCx::mem_copy_repeatedly (cognitive 19) compiler/rustc_const_eval/src/interpret/memory.rs:1486— InterpCx::mem_copy_repeatedly has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, loops 4, boolean chains 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.
SelectionContext::evaluate_predicate_recursively (cognitive 85) compiler/rustc_trait_selection/src/traits/select/mod.rs:601— SelectionContext::evaluate_predicate_recursively has cognitive complexity 85 (threshold 15). Drivers by points: if/else 45, match/switch 28, boolean chains 7, loops 5 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SelectionContext::winnow_candidates (cognitive 79) compiler/rustc_trait_selection/src/traits/select/mod.rs:1869— SelectionContext::winnow_candidates has cognitive complexity 79 (threshold 15). Drivers by points: if/else 61, loops 8, match/switch 7, boolean chains 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.
SelectionContext::candidate_from_obligation_no_cache (cognitive 43) compiler/rustc_trait_selection/src/traits/select/mod.rs:367— SelectionContext::candidate_from_obligation_no_cache has cognitive complexity 43 (threshold 15). Drivers by points: if/else 37, loops 4, boolean chains 1, match/switch 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.
SelectionContext::assemble_candidates_from_auto_impls (cognitive 30) compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:742— SelectionContext::assemble_candidates_from_auto_impls has cognitive complexity 30 (threshold 15). Drivers by points: if/else 23, match/switch 6, 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.
SelectionContext::assemble_candidates_for_unsizing (cognitive 24) compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:987— SelectionContext::assemble_candidates_for_unsizing has cognitive complexity 24 (threshold 15). Drivers by points: if/else 17, boolean chains 3, loops 3, match/switch 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.
SelectionContext::assemble_closure_candidates (cognitive 20) compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:416— SelectionContext::assemble_closure_candidates has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, match/switch 3, 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.
SelectionContext::assemble_builtin_copy_clone_candidate (cognitive 19) compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:1150— SelectionContext::assemble_builtin_copy_clone_candidate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, match/switch 3 (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.
SelectionContext::evaluate_trait_predicate_recursively (cognitive 19) compiler/rustc_trait_selection/src/traits/select/mod.rs:1027— SelectionContext::evaluate_trait_predicate_recursively has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, loops 3, boolean chains 2 (nesting depth added 5). 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.
display::write_bounds_like_dyn_trait (cognitive 74) src/tools/rust-analyzer/crates/hir-ty/src/display.rs:2093— display::write_bounds_like_dyn_trait has cognitive complexity 74 (threshold 15). Drivers by points: if/else 66, boolean chains 5, match/switch 2, loops 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.
display::render_const_scalar_inner (cognitive 44) src/tools/rust-analyzer/crates/hir-ty/src/display.rs:815— display::render_const_scalar_inner has cognitive complexity 44 (threshold 15). Drivers by points: if/else 24, match/switch 13, loops 7 (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.
display::write_function (cognitive 31) src/tools/rust-analyzer/crates/hir/src/display.rs:157— display::write_function has cognitive complexity 31 (threshold 15). Drivers by points: if/else 22, match/switch 7, boolean chains 1, loops 1 (nesting depth added 6). 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.
display::write_generic_params_or_args (cognitive 25) src/tools/rust-analyzer/crates/hir/src/display.rs:700— display::write_generic_params_or_args has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17, boolean chains 3, match/switch 3, 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.
display::render_const_scalar_from_valtree_inner (cognitive 25) src/tools/rust-analyzer/crates/hir-ty/src/display.rs:1090— display::render_const_scalar_from_valtree_inner has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16, match/switch 5, loops 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.
display::write_variants (cognitive 24) src/tools/rust-analyzer/crates/hir/src/display.rs:487— display::write_variants has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19, match/switch 3, loops 2 (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.
display::write_fields (cognitive 19) src/tools/rust-analyzer/crates/hir/src/display.rs:452— display::write_fields has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, loops 3, 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.
display::render_variant_after_name (cognitive 16) src/tools/rust-analyzer/crates/hir-ty/src/display.rs:1224— display::render_variant_after_name has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, loops 6, 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.
pretty::write_scope_tree (cognitive 45) compiler/rustc_middle/src/mir/pretty.rs:397— pretty::write_scope_tree has cognitive complexity 45 (threshold 15). Drivers by points: if/else 36, loops 8, boolean chains 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.
pretty::write_allocation_bytes (cognitive 44) compiler/rustc_middle/src/mir/pretty.rs:1750— pretty::write_allocation_bytes has cognitive complexity 44 (threshold 15). Drivers by points: if/else 28, loops 13, boolean chains 3 (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.
pretty::pretty_print_const_value_tcx (cognitive 32) compiler/rustc_middle/src/mir/pretty.rs:1914— pretty::pretty_print_const_value_tcx has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18, match/switch 8, loops 5, 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.
pretty::print_generic_params (cognitive 29) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:368— pretty::print_generic_params has cognitive complexity 29 (threshold 15). Drivers by points: if/else 21, loops 4, match/switch 4 (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.
pretty::for_each_def (cognitive 25) compiler/rustc_middle/src/ty/print/pretty.rs:3468— pretty::for_each_def has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14, loops 5, match/switch 5, 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.
pretty::print_where_clauses (cognitive 24) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:328— pretty::print_where_clauses has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14, loops 7, match/switch 3 (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.
pretty::write_allocations (cognitive 21) compiler/rustc_middle/src/mir/pretty.rs:1570— pretty::write_allocations has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9, match/switch 8, loops 3, boolean chains 1 (nesting depth added 10). Of this number, 20 points are the body's own statements and 1 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pretty::trimmed_def_paths (cognitive 20) compiler/rustc_middle/src/ty/print/pretty.rs:3548— pretty::trimmed_def_paths has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9, match/switch 6, loops 4, 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.
ExprUseVisitor::walk_captures (cognitive 28) compiler/rustc_hir_typeck/src/expr_use_visitor.rs:999— ExprUseVisitor::walk_captures has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14, loops 7, match/switch 7 (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.
ExprUseVisitor::walk_expr (cognitive 26) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:502— ExprUseVisitor::walk_expr has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16, loops 6, match/switch 4 (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_captures (cognitive 22) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:1062— ExprUseVisitor::walk_captures has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8, loops 7, match/switch 7 (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::cat_pattern (cognitive 21) compiler/rustc_hir_typeck/src/expr_use_visitor.rs:1598— ExprUseVisitor::cat_pattern has cognitive complexity 21 (threshold 15). Drivers by points: loops 13, match/switch 6, if/else 2 (nesting depth added 10). 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::cat_pattern (cognitive 21) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:1506— ExprUseVisitor::cat_pattern has cognitive complexity 21 (threshold 15). Drivers by points: loops 13, match/switch 6, if/else 2 (nesting depth added 10). 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_pat (cognitive 20) compiler/rustc_hir_typeck/src/expr_use_visitor.rs:834— ExprUseVisitor::walk_pat has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, match/switch 5, 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.
ExprUseVisitor::walk_expr (cognitive 19) compiler/rustc_hir_typeck/src/expr_use_visitor.rs:391— ExprUseVisitor::walk_expr has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, loops 4, match/switch 4 (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.
ExprUseVisitor::walk_pat (cognitive 19) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:889— ExprUseVisitor::walk_pat has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, match/switch 4, 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.
format::make_format_args (cyclomatic 79) compiler/rustc_builtin_macros/src/format.rs:161— format::make_format_args has cyclomatic complexity 79 (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.
format::fmt_type (cyclomatic 35) src/librustdoc/html/format.rs:880— format::fmt_type has cyclomatic complexity 35 (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.
format::format (cyclomatic 30) src/bootstrap/src/core/build_steps/format.rs:124— format::format 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.
format::expand_format_args (cyclomatic 28) compiler/rustc_ast_lowering/src/format.rs:279— format::expand_format_args 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.
format::report_invalid_references (cyclomatic 21) compiler/rustc_builtin_macros/src/format.rs:952— format::report_invalid_references 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.
format::report_missing_placeholders (cyclomatic 16) compiler/rustc_builtin_macros/src/format.rs:719— format::report_missing_placeholders 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.
format::href_with_root_path (cyclomatic 16) src/librustdoc/html/format.rs:542— format::href_with_root_path 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.
LoweringContext::lower_expr_mut (cyclomatic 64) compiler/rustc_ast_lowering/src/expr.rs:163— LoweringContext::lower_expr_mut has cyclomatic complexity 64 (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.
LoweringContext::lower_inline_asm (cyclomatic 62) compiler/rustc_ast_lowering/src/asm.rs:25— LoweringContext::lower_inline_asm has cyclomatic complexity 62 (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.
LoweringContext::lower_ty (cyclomatic 33) compiler/rustc_ast_lowering/src/lib.rs:1566— LoweringContext::lower_ty 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.
LoweringContext::lower_qpath (cyclomatic 21) compiler/rustc_ast_lowering/src/path.rs:25— LoweringContext::lower_qpath 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.
LoweringContext::can_lower_expr_to_const_arg_direct (cyclomatic 20) compiler/rustc_ast_lowering/src/lib.rs:2707— LoweringContext::can_lower_expr_to_const_arg_direct 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.
LoweringContext::lower_fn_decl (cyclomatic 17) compiler/rustc_ast_lowering/src/lib.rs:1943— LoweringContext::lower_fn_decl 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.
LoweringContext::lower_path_segment (cyclomatic 16) compiler/rustc_ast_lowering/src/path.rs:252— LoweringContext::lower_path_segment 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 111) src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs:315— GlobalState::handle_event has cognitive complexity 111 (threshold 15). Drivers by points: if/else 62, boolean chains 19, loops 16, match/switch 14 (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.
GlobalState::process_changes (cognitive 57) src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs:335— GlobalState::process_changes has cognitive complexity 57 (threshold 15). Drivers by points: if/else 45, match/switch 7, loops 3, 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.
GlobalState::switch_workspaces (cognitive 57) src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs:467— GlobalState::switch_workspaces has cognitive complexity 57 (threshold 15). Drivers by points: if/else 36, match/switch 10, loops 6, boolean chains 5 (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.
GlobalState::handle_task (cognitive 40) src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs:851— GlobalState::handle_task has cognitive complexity 40 (threshold 15). Drivers by points: match/switch 21, if/else 19 (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) src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs:128— GlobalState::current_status has cognitive complexity 37 (threshold 15). Drivers by points: if/else 30, match/switch 3, boolean chains 2, loops 2 (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 28) src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs:753— GlobalState::compute_priming_scope has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17, loops 9, match/switch 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.
GlobalState::handle_vfs_msg (cognitive 21) src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs:978— GlobalState::handle_vfs_msg has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11, match/switch 5, boolean chains 3, 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.
print_item::item_trait (cognitive 110) src/librustdoc/html/render/print_item.rs:614— print_item::item_trait has cognitive complexity 110 (threshold 15). Drivers by points: if/else 62, loops 36, boolean chains 9, match/switch 3 (nesting depth added 45). Of this number, 103 points are the body's own statements and 7 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
print_item::item_module (cognitive 59) src/librustdoc/html/render/print_item.rs:222— print_item::item_module has cognitive complexity 59 (threshold 15). Drivers by points: match/switch 28, if/else 22, loops 9 (nesting depth added 30). Of this number, 54 points are the body's own statements and 5 belong to 3 function items declared inside it. 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.
print_item::compare_names (cognitive 46) src/librustdoc/html/render/print_item.rs:2193— print_item::compare_names has cognitive complexity 46 (threshold 15). Drivers by points: match/switch 20, if/else 16, loops 9, boolean chains 1 (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.
print_item::render_struct_fields (cognitive 46) src/librustdoc/html/render/print_item.rs:2512— print_item::render_struct_fields has cognitive complexity 46 (threshold 15). Drivers by points: if/else 34, loops 5, match/switch 5, boolean chains 2 (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.
print_item::item_variants (cognitive 28) src/librustdoc/html/render/print_item.rs:1765— print_item::item_variants has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17, match/switch 6, loops 4, 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.
print_item::render_enum_fields (cognitive 25) src/librustdoc/html/render/print_item.rs:1685— print_item::render_enum_fields has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13, match/switch 7, boolean chains 3, loops 2 (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.
print_item::print_item (cognitive 16) src/librustdoc/html/render/print_item.rs:65— print_item::print_item has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, match/switch 4, boolean chains 1 (nesting depth added 3). 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.
ExprCollector::maybe_collect_expr (cognitive 110) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:1330— ExprCollector::maybe_collect_expr has cognitive complexity 110 (threshold 15). Drivers by points: if/else 82, match/switch 21, loops 6, boolean chains 1 (nesting depth added 50). To reduce it, split the body into named stages: move each independent 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 73) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/asm.rs:17— ExprCollector::lower_inline_asm has cognitive complexity 73 (threshold 15). Drivers by points: if/else 38, match/switch 28, loops 5, boolean chains 2 (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.
ExprCollector::collect_format_args_impl (cognitive 71) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/format_args.rs:107— ExprCollector::collect_format_args_impl has cognitive complexity 71 (threshold 15). Drivers by points: if/else 56, match/switch 8, loops 4, 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 37) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:2730— ExprCollector::collect_pat has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16, loops 10, match/switch 10, boolean chains 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.
ExprCollector::maybe_collect_expr_as_pat (cognitive 32) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:1914— ExprCollector::maybe_collect_expr_as_pat has cognitive complexity 32 (threshold 15). Drivers by points: if/else 20, match/switch 11, boolean chains 1 (nesting depth added 14). Of this number, 19 points are the body's own statements and 13 belong to 3 function items declared inside it. To reduce it, split the body into named stages: move each independent 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) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:965— ExprCollector::lower_generic_args has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, match/switch 2, 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) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:1039— ExprCollector::lower_coroutine_body_with_moved_arguments has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, match/switch 2, 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.
write::start_executing_work (cognitive 93) compiler/rustc_codegen_ssa/src/back/write.rs:1228— write::start_executing_work has cognitive complexity 93 (threshold 15). Drivers by points: if/else 64, match/switch 16, loops 8, boolean chains 5 (nesting depth added 45). Of this number, 92 points are the body's own statements and 1 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
write::produce_final_output_artifacts (cognitive 56) compiler/rustc_codegen_ssa/src/back/write.rs:507— write::produce_final_output_artifacts has cognitive complexity 56 (threshold 15). Drivers by points: if/else 41, boolean chains 6, loops 6, match/switch 3 (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.
write::llvm_optimize (cognitive 47) compiler/rustc_codegen_llvm/src/back/write.rs:538— write::llvm_optimize has cognitive complexity 47 (threshold 15). Drivers by points: if/else 34, boolean chains 6, loops 4, match/switch 3 (nesting depth added 11). Of this number, 40 points are the body's own statements and 7 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
write::codegen (cognitive 42) compiler/rustc_codegen_gcc/src/back/write.rs:18— write::codegen has cognitive complexity 42 (threshold 15). Drivers by points: if/else 37, boolean chains 4, match/switch 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.
write::codegen (cognitive 31) compiler/rustc_codegen_llvm/src/back/write.rs:972— write::codegen has cognitive complexity 31 (threshold 15). Drivers by points: if/else 25, boolean chains 3, match/switch 3 (nesting depth added 12). Of this number, 29 points are the body's own statements and 2 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
write::do_thin_lto (cognitive 27) compiler/rustc_codegen_ssa/src/back/write.rs:994— write::do_thin_lto has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12, match/switch 8, loops 5, 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.
write::optimize (cognitive 22) compiler/rustc_codegen_llvm/src/back/write.rs:884— write::optimize has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17, boolean chains 3, match/switch 2 (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.
AstValidator::visit_item (cognitive 64) compiler/rustc_ast_passes/src/ast_validation.rs:1381— AstValidator::visit_item has cognitive complexity 64 (threshold 15). Drivers by points: if/else 48, loops 7, boolean chains 5, match/switch 4 (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.
AstValidator::visit_fn (cognitive 32) compiler/rustc_ast_passes/src/ast_validation.rs:1898— AstValidator::visit_fn has cognitive complexity 32 (threshold 15). Drivers by points: if/else 21, match/switch 7, 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.
AstValidator::visit_assoc_item (cognitive 32) compiler/rustc_ast_passes/src/ast_validation.rs:2019— AstValidator::visit_assoc_item has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17, match/switch 10, boolean chains 5 (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.
AstValidator::visit_generics (cognitive 27) compiler/rustc_ast_passes/src/ast_validation.rs:1786— AstValidator::visit_generics has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12, match/switch 9, loops 6 (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.
AstValidator::visit_ty_common (cognitive 20) compiler/rustc_ast_passes/src/ast_validation.rs:1157— AstValidator::visit_ty_common has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, match/switch 3, loops 2 (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.
AstValidator::visit_param_bound (cognitive 20) compiler/rustc_ast_passes/src/ast_validation.rs:1837— AstValidator::visit_param_bound has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 8, if/else 7, loops 4, 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.
AstValidator::check_extern_fn_signature (cognitive 16) compiler/rustc_ast_passes/src/ast_validation.rs:549— AstValidator::check_extern_fn_signature has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, match/switch 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.
clippy_utils::is_never_expr (cognitive 64) src/tools/clippy/clippy_utils/src/lib.rs:3000— clippy_utils::is_never_expr has cognitive complexity 64 (threshold 15). Drivers by points: if/else 44, loops 11, boolean chains 5, match/switch 4 (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.
clippy_utils::capture_local_usage (cognitive 33) src/tools/clippy/clippy_utils/src/lib.rs:831— clippy_utils::capture_local_usage has cognitive complexity 33 (threshold 15). Drivers by points: match/switch 18, if/else 8, loops 5, boolean chains 2 (nesting depth added 19). Of this number, 32 points are the body's own statements and 1 belong to one function item declared inside it. 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.
clippy_utils::can_move_expr_to_closure (cognitive 21) src/tools/clippy/clippy_utils/src/lib.rs:926— clippy_utils::can_move_expr_to_closure has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 13, if/else 6, loops 2 (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.
clippy_utils::is_body_identity_function (cognitive 21) src/tools/clippy/clippy_utils/src/lib.rs:1807— clippy_utils::is_body_identity_function has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14, boolean chains 3, loops 2, match/switch 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.
clippy_utils::is_default_equivalent_call (cognitive 20) src/tools/clippy/clippy_utils/src/lib.rs:572— clippy_utils::is_default_equivalent_call has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, if/else 8, match/switch 3, loops 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.
clippy_utils::expr_use_sites (cognitive 20) src/tools/clippy/clippy_utils/src/lib.rs:2681— clippy_utils::expr_use_sites has cognitive complexity 20 (threshold 15). Drivers by points: if/else 17, match/switch 3 (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.
clippy_utils::maybe_get_relative_path (cognitive 17) src/tools/clippy/clippy_utils/src/lib.rs:3295— clippy_utils::maybe_get_relative_path has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, match/switch 3, boolean chains 1, loops 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.
wfcheck::check_gat_where_clauses (cognitive 50) compiler/rustc_hir_analysis/src/check/wfcheck.rs:382— wfcheck::check_gat_where_clauses has cognitive complexity 50 (threshold 15). Drivers by points: if/else 37, loops 7, match/switch 6 (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.
wfcheck::check_type_defn (cognitive 29) compiler/rustc_hir_analysis/src/check/wfcheck.rs:975— wfcheck::check_type_defn has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16, boolean chains 5, loops 5, match/switch 3 (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.
wfcheck::check_where_clauses (cognitive 24) compiler/rustc_hir_analysis/src/check/wfcheck.rs:1404— wfcheck::check_where_clauses has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16, match/switch 4, boolean chains 3, 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.
wfcheck::gather_gat_bounds (cognitive 19) compiler/rustc_hir_analysis/src/check/wfcheck.rs:594— wfcheck::gather_gat_bounds has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, loops 5, boolean chains 2 (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.
wfcheck::check_param_wf (cognitive 19) compiler/rustc_hir_analysis/src/check/wfcheck.rs:785— wfcheck::check_param_wf has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 11, if/else 7, boolean chains 1 (nesting depth added 10). Of this number, 15 points are the body's own statements and 4 belong to one function item declared inside it. 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.
wfcheck::lint_redundant_lifetimes (cognitive 18) compiler/rustc_hir_analysis/src/check/wfcheck.rs:2360— wfcheck::lint_redundant_lifetimes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, loops 5, boolean chains 1, 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.
wfcheck::receiver_is_valid (cognitive 16) compiler/rustc_hir_analysis/src/check/wfcheck.rs:1874— wfcheck::receiver_is_valid has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, loops 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.
abi::codegen_fn_prelude (cognitive 40) compiler/rustc_codegen_cranelift/src/abi/mod.rs:246— abi::codegen_fn_prelude has cognitive complexity 40 (threshold 15). Drivers by points: if/else 28, loops 7, match/switch 4, 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.
abi::codegen_terminator_call (cognitive 40) compiler/rustc_codegen_cranelift/src/abi/mod.rs:413— abi::codegen_terminator_call has cognitive complexity 40 (threshold 15). Drivers by points: if/else 47, match/switch 11, loops 3, 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.
abi::arg_attrs_for_rust_scalar (cognitive 38) compiler/rustc_ty_utils/src/abi.rs:322— abi::arg_attrs_for_rust_scalar has cognitive complexity 38 (threshold 15). Drivers by points: if/else 23, match/switch 10, boolean chains 5 (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.
abi::get_attrs (cognitive 26) compiler/rustc_codegen_llvm/src/abi.rs:59— abi::get_attrs has cognitive complexity 26 (threshold 15). Drivers by points: if/else 19, loops 5, boolean chains 1, 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.
abi::fn_sig_for_fn_abi (cognitive 26) compiler/rustc_ty_utils/src/abi.rs:34— abi::fn_sig_for_fn_abi has cognitive complexity 26 (threshold 15). Drivers by points: if/else 21, match/switch 5 (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.
abi::codegen_terminator_call::adjust_call_for_c_variadic (cognitive 22) compiler/rustc_codegen_cranelift/src/abi/mod.rs:630— abi::codegen_terminator_call::adjust_call_for_c_variadic has cognitive complexity 22 (threshold 15). Drivers by points: if/else 19, boolean chains 1, loops 1, 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.
abi::codegen_call_with_unwind_action (cognitive 16) compiler/rustc_codegen_cranelift/src/abi/mod.rs:830— abi::codegen_call_with_unwind_action has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, match/switch 8 (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.
D38 · OSV Dependency Vulnerabilities· Medium advisory (unsound) · ×7
Medium advisory (unsound): RUSTSEC-2026-0190 Cargo.lock— anyhow 1.0.102: RUSTSEC-2026-0190 — upgrade to 1.0.103 (in 8 lockfiles)
Medium advisory (unsound): RUSTSEC-2026-0202 Cargo.lock— cxx 1.0.188: RUSTSEC-2026-0202 — upgrade to 1.0.195
Medium advisory (unsound): RUSTSEC-2026-0008 Cargo.lock— git2 0.20.2: RUSTSEC-2026-0008 — upgrade to 0.20.4. This is 1 of 3 advisories this scan raises against git2 0.20.2, and their fixed versions do not agree — anything below 0.21.0 still leaves at least one of them open, so 0.21.0 is the floor for this package, not this row's target alone.
Medium advisory (unsound): RUSTSEC-2026-0183 Cargo.lock— git2 0.20.2: RUSTSEC-2026-0183 — upgrade to 0.21.0. This is 1 of 3 advisories this scan raises against git2 0.20.2, and their fixed versions do not agree — anything below 0.21.0 still leaves at least one of them open, so 0.21.0 is the floor for this package, not this row's target alone.
Medium advisory (unsound): RUSTSEC-2026-0184 Cargo.lock— git2 0.20.2: RUSTSEC-2026-0184 — upgrade to 0.21.0. This is 1 of 3 advisories this scan raises against git2 0.20.2, and their fixed versions do not agree — anything below 0.21.0 still leaves at least one of them open, so 0.21.0 is the floor for this package, not this row's target alone.
Medium advisory (unsound): RUSTSEC-2026-0186 Cargo.lock— memmap2 0.2.3: RUSTSEC-2026-0186 — upgrade to 0.9.11 (in 3 lockfiles)
Medium advisory (unsound): RUSTSEC-2026-0097 library/Cargo.lock— rand 0.9.2: RUSTSEC-2026-0097 — upgrade to 0.9.3 (in 2 lockfiles)
TypeChecker::visit_rvalue (cyclomatic 87) compiler/rustc_mir_transform/src/validate.rs:1002— TypeChecker::visit_rvalue has cyclomatic complexity 87 (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.
TypeChecker::visit_rvalue (cyclomatic 61) compiler/rustc_borrowck/src/type_check/mod.rs:995— TypeChecker::visit_rvalue 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.
TypeChecker::visit_projection_elem (cyclomatic 39) compiler/rustc_mir_transform/src/validate.rs:647— TypeChecker::visit_projection_elem has cyclomatic complexity 39 (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.
TypeChecker::check_iscleanup (cyclomatic 26) compiler/rustc_borrowck/src/type_check/mod.rs:2082— TypeChecker::check_iscleanup 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.
TypeChecker::visit_terminator (cyclomatic 24) compiler/rustc_borrowck/src/type_check/mod.rs:742— TypeChecker::visit_terminator 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.
TypeChecker::visit_statement (cyclomatic 19) compiler/rustc_mir_transform/src/validate.rs:1455— TypeChecker::visit_statement 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.
ExprCollector::maybe_collect_expr (cyclomatic 86) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:1330— ExprCollector::maybe_collect_expr has cyclomatic complexity 86 (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 42) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/asm.rs:17— ExprCollector::lower_inline_asm has cyclomatic complexity 42 (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 37) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:2730— ExprCollector::collect_pat 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.
ExprCollector::collect_format_args_impl (cyclomatic 27) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/format_args.rs:107— 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::maybe_collect_expr_as_pat (cyclomatic 27) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:1914— ExprCollector::maybe_collect_expr_as_pat has cyclomatic complexity 27 (threshold 15). Of this number, 18 points are the body's own statements and 9 belong to 3 function items declared inside it. 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::lower_type_ref (cyclomatic 20) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:688— 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.
SelectionContext::evaluate_predicate_recursively (cyclomatic 68) compiler/rustc_trait_selection/src/traits/select/mod.rs:601— SelectionContext::evaluate_predicate_recursively has cyclomatic complexity 68 (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.
SelectionContext::winnow_candidates (cyclomatic 47) compiler/rustc_trait_selection/src/traits/select/mod.rs:1869— SelectionContext::winnow_candidates 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.
SelectionContext::assemble_candidates_from_auto_impls (cyclomatic 21) compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:742— SelectionContext::assemble_candidates_from_auto_impls 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.
SelectionContext::assemble_builtin_copy_clone_candidate (cyclomatic 19) compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:1150— SelectionContext::assemble_builtin_copy_clone_candidate 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.
SelectionContext::candidate_from_obligation_no_cache (cyclomatic 18) compiler/rustc_trait_selection/src/traits/select/mod.rs:367— SelectionContext::candidate_from_obligation_no_cache 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.
SelectionContext::assemble_candidates_for_unsizing (cyclomatic 16) compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:987— SelectionContext::assemble_candidates_for_unsizing 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.
TestCx::make_compile_args (cyclomatic 66) src/tools/compiletest/src/runtest.rs:1559— TestCx::make_compile_args has cyclomatic complexity 66 (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.
TestCx::check_expected_errors (cyclomatic 44) src/tools/compiletest/src/runtest.rs:658— TestCx::check_expected_errors has cyclomatic complexity 44 (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.
TestCx::run_ui_test (cyclomatic 39) src/tools/compiletest/src/runtest/ui.rs:16— TestCx::run_ui_test has cyclomatic complexity 39 (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.
TestCx::run_rmake_test (cyclomatic 24) src/tools/compiletest/src/runtest/run_make.rs:13— TestCx::run_rmake_test 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.
TestCx::run_codegen_units_test (cyclomatic 19) src/tools/compiletest/src/runtest/codegen_units.rs:8— TestCx::run_codegen_units_test has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to 3 function items declared inside it. 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.
TestCx::compare_output (cyclomatic 19) src/tools/compiletest/src/runtest.rs:2715— TestCx::compare_output 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.
check::check_item_type (cyclomatic 55) compiler/rustc_hir_analysis/src/check/check.rs:764— check::check_item_type has cyclomatic complexity 55 (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.
check::check_transparent (cyclomatic 28) compiler/rustc_hir_analysis/src/check/check.rs:1736— check::check_transparent has cyclomatic complexity 28 (threshold 15). Of this number, 19 points are the body's own statements and 9 belong to one function item declared inside it. 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.
check::check_impl_items_against_trait (cyclomatic 27) compiler/rustc_hir_analysis/src/check/check.rs:1265— check::check_impl_items_against_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.
check::bounds_from_generic_clauses (cyclomatic 22) compiler/rustc_hir_analysis/src/check/mod.rs:328— check::bounds_from_generic_clauses 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.
check::check_opaque_precise_captures (cyclomatic 21) compiler/rustc_hir_analysis/src/check/check.rs:575— check::check_opaque_precise_captures 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.
check::opaque_type_cycle_error (cyclomatic 20) compiler/rustc_hir_analysis/src/check/check.rs:2143— check::opaque_type_cycle_error 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.
diagnostics::report_result (cyclomatic 47) src/tools/miri/src/diagnostics.rs:241— diagnostics::report_result has cyclomatic complexity 47 (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.
diagnostics::suggest_constraining_type_params (cyclomatic 37) compiler/rustc_middle/src/ty/diagnostics.rs:286— diagnostics::suggest_constraining_type_params has cyclomatic complexity 37 (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.
diagnostics::failed_to_match_macro (cyclomatic 21) compiler/rustc_expand/src/mbe/diagnostics.rs:30— diagnostics::failed_to_match_macro 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.
diagnostics::emit_frag_parse_err (cyclomatic 21) compiler/rustc_expand/src/mbe/diagnostics.rs:369— diagnostics::emit_frag_parse_err 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.
diagnostics::create_lit_error (cyclomatic 20) compiler/rustc_session/src/diagnostics.rs:599— diagnostics::create_lit_error has cyclomatic complexity 20 (threshold 15). Of this number, 14 points are the body's own statements and 6 belong to 2 function items declared inside it. 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.
diagnostics::report_msg (cyclomatic 16) src/tools/miri/src/diagnostics.rs:556— diagnostics::report_msg 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.
ExprUseVisitor::walk_expr (cyclomatic 43) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:502— ExprUseVisitor::walk_expr has cyclomatic complexity 43 (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 41) compiler/rustc_hir_typeck/src/expr_use_visitor.rs:391— ExprUseVisitor::walk_expr 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.
ExprUseVisitor::cat_pattern (cyclomatic 21) compiler/rustc_hir_typeck/src/expr_use_visitor.rs:1598— ExprUseVisitor::cat_pattern 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.
ExprUseVisitor::walk_pat (cyclomatic 19) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:889— 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.
ExprUseVisitor::cat_pattern (cyclomatic 19) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:1506— ExprUseVisitor::cat_pattern 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.
ExprUseVisitor::walk_pat (cyclomatic 17) compiler/rustc_hir_typeck/src/expr_use_visitor.rs:834— ExprUseVisitor::walk_pat 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.
VnState::eval_to_const_inner (cyclomatic 37) compiler/rustc_mir_transform/src/gvn.rs:576— VnState::eval_to_const_inner has cyclomatic complexity 37 (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.
VnState::simplify_cast (cyclomatic 22) compiler/rustc_mir_transform/src/gvn.rs:1554— VnState::simplify_cast 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.
VnState::project (cyclomatic 21) compiler/rustc_mir_transform/src/gvn.rs:824— VnState::project 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.
VnState::simplify_aggregate (cyclomatic 19) compiler/rustc_mir_transform/src/gvn.rs:1203— VnState::simplify_aggregate 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.
VnState::simplify_binary_inner (cyclomatic 18) compiler/rustc_mir_transform/src/gvn.rs:1431— VnState::simplify_binary_inner 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.
VnState::simplify_unary (cyclomatic 16) compiler/rustc_mir_transform/src/gvn.rs:1299— VnState::simplify_unary 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.
DefCollector::build_reduced_graph_for_use_tree (cyclomatic 31) compiler/rustc_resolve/src/build_reduced_graph.rs:583— DefCollector::build_reduced_graph_for_use_tree 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::resolve_macros (cyclomatic 31) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:1295— 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 23) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:277— DefCollector::seed_with_top_level 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.
DefCollector::push_res_and_update_glob_vis (cyclomatic 23) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:1191— 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.
DefCollector::record_resolved_import (cyclomatic 22) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:876— DefCollector::record_resolved_import 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.
DefCollector::build_reduced_graph_for_item (cyclomatic 19) compiler/rustc_resolve/src/build_reduced_graph.rs:819— DefCollector::build_reduced_graph_for_item 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.
pretty::pretty_print_const_value_tcx (cyclomatic 22) compiler/rustc_middle/src/mir/pretty.rs:1914— pretty::pretty_print_const_value_tcx 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.
pretty::write_scope_tree (cyclomatic 20) compiler/rustc_middle/src/mir/pretty.rs:397— pretty::write_scope_tree 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.
pretty::write_allocation_bytes (cyclomatic 19) compiler/rustc_middle/src/mir/pretty.rs:1750— pretty::write_allocation_bytes 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.
pretty::print (cyclomatic 18) compiler/rustc_driver_impl/src/pretty.rs:229— pretty::print 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.
pretty::write_allocations (cyclomatic 18) compiler/rustc_middle/src/mir/pretty.rs:1570— pretty::write_allocations has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function item declared inside it. 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.
pretty::for_each_def (cyclomatic 16) compiler/rustc_middle/src/ty/print/pretty.rs:3468— pretty::for_each_def 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.
analysis::classify_name_ref (cognitive 172) src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:950— analysis::classify_name_ref has cognitive complexity 172 (threshold 15). Drivers by points: if/else 80, match/switch 68, boolean chains 15, loops 9 (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.
analysis::expected_type_and_name (cognitive 59) src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:589— analysis::expected_type_and_name has cognitive complexity 59 (threshold 15). Drivers by points: if/else 25, match/switch 23, boolean chains 6, loops 5 (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.
analysis::expand (cognitive 58) src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:172— analysis::expand has cognitive complexity 58 (threshold 15). Drivers by points: if/else 45, match/switch 6, loops 5, boolean chains 2 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
analysis::analyze (cognitive 28) src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:442— analysis::analyze has cognitive complexity 28 (threshold 15). Drivers by points: if/else 20, boolean chains 7, 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.
analysis::report_test_diffs (cognitive 20) src/ci/citool/src/analysis.rs:458— analysis::report_test_diffs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7, loops 7, match/switch 6 (nesting depth added 5). Of this number, 16 points are the body's own statements and 4 belong to 2 function items declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
analysis::report_debuginfo_statistics (cognitive 16) src/ci/citool/src/analysis.rs:148— analysis::report_debuginfo_statistics has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6, loops 5, match/switch 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.
Printer::print_expr_in (cognitive 94) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:531— Printer::print_expr_in has cognitive complexity 94 (threshold 15). Drivers by points: if/else 54, match/switch 21, loops 19 (nesting depth added 51). To reduce it, split the body into named stages: move each independent 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) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:907— Printer::print_pat has cognitive complexity 54 (threshold 15). Drivers by points: if/else 37, loops 12, match/switch 3, 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.
Printer::print_type_ref (cognitive 28) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:1274— Printer::print_type_ref has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19, match/switch 5, loops 4 (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.
Printer::default_print_def_path (cognitive 23) compiler/rustc_middle/src/ty/print/mod.rs:148— Printer::default_print_def_path has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15, boolean chains 4, match/switch 4 (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_path (cognitive 22) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:1126— Printer::print_path has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12, match/switch 5, loops 4, 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) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:1379— Printer::print_type_bounds has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 9, if/else 6, loops 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.
hvx::parse_header (cognitive 92) library/stdarch/crates/stdarch-gen-hexagon/src/hvx.rs:361— hvx::parse_header has cognitive complexity 92 (threshold 15). Drivers by points: if/else 68, loops 12, match/switch 9, boolean chains 3 (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.
hvx::generate_functions (cognitive 30) library/stdarch/crates/stdarch-gen-hexagon/src/hvx.rs:1438— hvx::generate_functions has cognitive complexity 30 (threshold 15). Drivers by points: if/else 27, 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.
hvx::generate_extern_block (cognitive 26) library/stdarch/crates/stdarch-gen-hexagon/src/hvx.rs:1201— hvx::generate_extern_block has cognitive complexity 26 (threshold 15). Drivers by points: if/else 19, loops 6, 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.
hvx::parse_compound_expr (cognitive 25) library/stdarch/crates/stdarch-gen-hexagon/src/hvx.rs:173— hvx::parse_compound_expr has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20, boolean chains 5 (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.
hvx::parse_prototype (cognitive 17) library/stdarch/crates/stdarch-gen-hexagon/src/hvx.rs:326— hvx::parse_prototype has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, loops 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.
hvx::get_compound_primary_instr (cognitive 17) library/stdarch/crates/stdarch-gen-hexagon/src/hvx.rs:1370— hvx::get_compound_primary_instr has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, boolean chains 6, 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.
FmtVisitor::close_block (cognitive 48) src/tools/rustfmt/src/visitor.rs:263— FmtVisitor::close_block has cognitive complexity 48 (threshold 15). Drivers by points: if/else 24, match/switch 17, boolean chains 6, 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.
FmtVisitor::visit_item (cognitive 25) src/tools/rustfmt/src/visitor.rs:442— FmtVisitor::visit_item has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18, match/switch 7 (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.
FmtVisitor::visit_stmt (cognitive 20) src/tools/rustfmt/src/visitor.rs:118— FmtVisitor::visit_stmt has cognitive complexity 20 (threshold 15). Drivers by points: if/else 19, 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.
FmtVisitor::visit_impl_items (cognitive 19) src/tools/rustfmt/src/items.rs:718— FmtVisitor::visit_impl_items has cognitive complexity 19 (threshold 15). Drivers by points: loops 6, if/else 5, boolean chains 4, match/switch 4 (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.
FmtVisitor::process_comment (cognitive 17) src/tools/rustfmt/src/missed_spans.rs:235— FmtVisitor::process_comment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, match/switch 4, 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.
FmtVisitor::process_missing_code (cognitive 16) src/tools/rustfmt/src/missed_spans.rs:330— FmtVisitor::process_missing_code has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, boolean chains 1, loops 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.
inline::build_impl (cognitive 47) src/librustdoc/clean/inline.rs:457— inline::build_impl has cognitive complexity 47 (threshold 15). Drivers by points: if/else 28, boolean chains 9, match/switch 8, loops 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.
inline::resolve_callsite (cognitive 27) compiler/rustc_mir_transform/src/inline.rs:541— inline::resolve_callsite has cognitive complexity 27 (threshold 15). Drivers by points: if/else 26, 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.
inline::inline_call (cognitive 26) compiler/rustc_mir_transform/src/inline.rs:868— inline::inline_call has cognitive complexity 26 (threshold 15). Drivers by points: if/else 18, loops 6, match/switch 2 (nesting depth added 7). Of this number, 23 points are the body's own statements and 3 belong to one function item declared inside it. 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.
inline::try_inlining (cognitive 22) compiler/rustc_mir_transform/src/inline.rs:613— inline::try_inlining has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15, loops 5, match/switch 2 (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.
inline::build_module_items (cognitive 21) src/librustdoc/clean/inline.rs:708— inline::build_module_items has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16, boolean chains 4, 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.
inline::check_mir_is_available (cognitive 17) compiler/rustc_mir_transform/src/inline.rs:713— inline::check_mir_is_available has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, boolean chains 2, 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.
compare_impl_item::check_number_of_early_bound_regions (cognitive 42) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1147— compare_impl_item::check_number_of_early_bound_regions has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19, loops 14, match/switch 7, boolean chains 2 (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.
compare_impl_item::compare_number_of_generics (cognitive 40) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1588— compare_impl_item::compare_number_of_generics has cognitive complexity 40 (threshold 15). Drivers by points: if/else 24, loops 8, match/switch 8 (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.
compare_impl_item::compare_number_of_method_arguments (cognitive 38) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1728— compare_impl_item::compare_number_of_method_arguments has cognitive complexity 38 (threshold 15). Drivers by points: if/else 35, match/switch 3 (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.
compare_impl_item::check_region_late_boundedness (cognitive 20) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1243— compare_impl_item::check_region_late_boundedness has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13, loops 3, boolean chains 2, match/switch 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.
compare_impl_item::collect_return_position_impl_trait_in_trait_tys (cognitive 18) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:457— compare_impl_item::collect_return_position_impl_trait_in_trait_tys has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 7, if/else 6, loops 4, boolean chains 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.
compare_impl_item::compare_synthetic_generics (cognitive 17) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1908— compare_impl_item::compare_synthetic_generics has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, match/switch 2, boolean chains 1, loops 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.
Command::fmt (cognitive 38) library/std/src/sys/process/unix/common.rs:495— Command::fmt has cognitive complexity 38 (threshold 15). Drivers by points: if/else 31, loops 7 (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.
Command::posix_spawn (cognitive 37) library/std/src/sys/process/unix/unix.rs:456— Command::posix_spawn has cognitive complexity 37 (threshold 15). Drivers by points: if/else 25, match/switch 7, boolean chains 4, loops 1 (nesting depth added 10). Of this number, 29 points are the body's own statements and 8 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Command::fmt (cognitive 34) library/std/src/sys/process/unsupported.rs:139— Command::fmt has cognitive complexity 34 (threshold 15). Drivers by points: if/else 27, loops 7 (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.
Command::do_exec (cognitive 26) library/std/src/sys/process/unix/unix.rs:283— Command::do_exec has cognitive complexity 26 (threshold 15). Drivers by points: if/else 25, 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.
Command::spawn_with_attributes (cognitive 18) library/std/src/sys/process/windows.rs:279— Command::spawn_with_attributes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, boolean chains 2, match/switch 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.
Command::bench (cognitive 18) src/tools/miri/miri-script/src/commands.rs:255— Command::bench has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, loops 4, boolean chains 2 (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.
request::handle_runnables (cognitive 38) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs:1018— request::handle_runnables has cognitive complexity 38 (threshold 15). Drivers by points: if/else 28, boolean chains 6, loops 3, 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.
request::run_rustfmt (cognitive 30) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs:2407— request::run_rustfmt has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18, boolean chains 6, match/switch 6 (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.
request::handle_run_test (cognitive 19) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs:250— request::handle_run_test has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8, match/switch 7, loops 4 (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.
request::handle_workspace_symbol (cognitive 19) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs:675— request::handle_workspace_symbol has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 10, 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 declared inside it (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.
request::handle_code_action (cognitive 19) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs:1501— request::handle_code_action has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, loops 5 (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.
request::handle_parent_module (cognitive 18) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs:933— request::handle_parent_module has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 13, if/else 5 (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.
analysis::classify_name_ref (cyclomatic 152) src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:950— 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.
analysis::expected_type_and_name (cyclomatic 48) src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:589— analysis::expected_type_and_name 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.
analysis::expand (cyclomatic 27) src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:172— 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.
analysis::analyze (cyclomatic 20) src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:442— analysis::analyze 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.
analysis::report_test_diffs (cyclomatic 17) src/ci/citool/src/analysis.rs:458— analysis::report_test_diffs has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 2 function items declared inside it. 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.
Printer::print_expr_in (cyclomatic 84) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:531— Printer::print_expr_in 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.
Printer::print_pat (cyclomatic 41) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:907— Printer::print_pat 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.
Printer::print_path (cyclomatic 27) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:1126— 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) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:1274— 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 22) src/tools/rust-analyzer/crates/hir-def/src/item_tree/pretty.rs:173— Printer::print_mod_item 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.
GlobalState::handle_event (cyclomatic 74) src/tools/rust-analyzer/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) src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs:851— 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 28) src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs:467— GlobalState::switch_workspaces 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.
GlobalState::process_changes (cyclomatic 25) src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs:335— 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) src/tools/rust-analyzer/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.
expr::complete_expr_path (cyclomatic 73) src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs:47— 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.
expr::format_expr (cyclomatic 57) src/tools/rustfmt/src/expr.rs:86— expr::format_expr has cyclomatic complexity 57 (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::reconstruct_format_args_template_string (cyclomatic 29) compiler/rustc_ast_pretty/src/pprust/state/expr.rs:975— expr::reconstruct_format_args_template_string has cyclomatic complexity 29 (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::can_be_overflowed_expr (cyclomatic 18) src/tools/rustfmt/src/expr.rs:1477— expr::can_be_overflowed_expr 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.
expr::rewrite_struct_lit (cyclomatic 16) src/tools/rustfmt/src/expr.rs:1704— expr::rewrite_struct_lit 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.
HirEqInterExpr::eq_expr (cyclomatic 69) src/tools/clippy/clippy_utils/src/hir_utils.rs:497— HirEqInterExpr::eq_expr has cyclomatic complexity 69 (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.
HirEqInterExpr::eq_block (cyclomatic 19) src/tools/clippy/clippy_utils/src/hir_utils.rs:387— HirEqInterExpr::eq_block 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.
HirEqInterExpr::eq_pat (cyclomatic 19) src/tools/clippy/clippy_utils/src/hir_utils.rs:789— HirEqInterExpr::eq_pat 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.
HirEqInterExpr::check_ctxt (cyclomatic 17) src/tools/clippy/clippy_utils/src/hir_utils.rs:924— HirEqInterExpr::check_ctxt 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.
HirEqInterExpr::eq_item (cyclomatic 16) src/tools/clippy/clippy_utils/src/hir_utils.rs:207— HirEqInterExpr::eq_item 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.
print_item::item_trait (cyclomatic 60) src/librustdoc/html/render/print_item.rs:614— print_item::item_trait has cyclomatic complexity 60 (threshold 15). Of this number, 56 points are the body's own statements and 4 belong to one function item declared inside it. 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.
print_item::item_module (cyclomatic 42) src/librustdoc/html/render/print_item.rs:222— print_item::item_module has cyclomatic complexity 42 (threshold 15). Of this number, 24 points are the body's own statements and 18 belong to 3 function items declared inside it. 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.
print_item::print_item (cyclomatic 41) src/librustdoc/html/render/print_item.rs:65— print_item::print_item 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.
print_item::compare_names (cyclomatic 27) src/librustdoc/html/render/print_item.rs:2193— print_item::compare_names 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.
print_item::render_struct_fields (cyclomatic 23) src/librustdoc/html/render/print_item.rs:2512— print_item::render_struct_fields 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.
PrettyPrinter::pretty_print_type (cyclomatic 57) compiler/rustc_middle/src/ty/print/pretty.rs:751— PrettyPrinter::pretty_print_type 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.
PrettyPrinter::pretty_print_opaque_impl_type (cyclomatic 43) compiler/rustc_middle/src/ty/print/pretty.rs:1033— PrettyPrinter::pretty_print_opaque_impl_type has cyclomatic complexity 43 (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.
PrettyPrinter::pretty_print_const_valtree (cyclomatic 23) compiler/rustc_middle/src/ty/print/pretty.rs:1871— PrettyPrinter::pretty_print_const_valtree 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.
PrettyPrinter::pretty_print_const_expr (cyclomatic 22) compiler/rustc_middle/src/ty/print/pretty.rs:1593— PrettyPrinter::pretty_print_const_expr 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.
PrettyPrinter::try_print_visible_def_path_recur (cyclomatic 17) compiler/rustc_middle/src/ty/print/pretty.rs:482— PrettyPrinter::try_print_visible_def_path_recur 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.
write::start_executing_work (cyclomatic 47) compiler/rustc_codegen_ssa/src/back/write.rs:1228— write::start_executing_work has cyclomatic complexity 47 (threshold 15). Of this number, 46 points are the body's own statements and 1 belong to one function item declared inside it. 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.
write::produce_final_output_artifacts (cyclomatic 34) compiler/rustc_codegen_ssa/src/back/write.rs:507— write::produce_final_output_artifacts 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.
write::llvm_optimize (cyclomatic 31) compiler/rustc_codegen_llvm/src/back/write.rs:538— write::llvm_optimize has cyclomatic complexity 31 (threshold 15). Of this number, 25 points are the body's own statements and 6 belong to one function item declared inside it. 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.
write::codegen (cyclomatic 23) compiler/rustc_codegen_gcc/src/back/write.rs:18— write::codegen 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.
write::codegen (cyclomatic 22) compiler/rustc_codegen_llvm/src/back/write.rs:972— write::codegen has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belong to one function item declared inside it. 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.
FnAbi::adjust_for_foreign_abi (cyclomatic 36) compiler/rustc_target/src/callconv/mod.rs:639— FnAbi::adjust_for_foreign_abi 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.
FnAbi::apply_attrs_llfn (cyclomatic 27) compiler/rustc_codegen_llvm/src/abi.rs:436— FnAbi::apply_attrs_llfn 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.
FnAbi::adjust_for_rust_abi (cyclomatic 22) compiler/rustc_target/src/callconv/mod.rs:726— FnAbi::adjust_for_rust_abi 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.
FnAbi::gcc_type (cyclomatic 17) compiler/rustc_codegen_gcc/src/abi.rs:118— FnAbi::gcc_type 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.
FnAbi::apply_attrs_callsite (cyclomatic 16) compiler/rustc_codegen_llvm/src/abi.rs:604— FnAbi::apply_attrs_callsite 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.
base::codegen_fn_body (cognitive 92) compiler/rustc_codegen_cranelift/src/base.rs:282— base::codegen_fn_body has cognitive complexity 92 (threshold 15). Drivers by points: if/else 69, loops 11, match/switch 9, boolean chains 3 (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.
base::codegen_stmt (cognitive 69) compiler/rustc_codegen_cranelift/src/base.rs:606— base::codegen_stmt has cognitive complexity 69 (threshold 15). Drivers by points: if/else 36, match/switch 30, loops 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.
base::compile_codegen_unit::module_codegen (cognitive 24) compiler/rustc_codegen_llvm/src/base.rs:83— base::compile_codegen_unit::module_codegen has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16, loops 6, boolean chains 2 (nesting depth added 5). 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.
base::compile_codegen_unit::module_codegen (cognitive 22) compiler/rustc_codegen_gcc/src/base.rs:96— base::compile_codegen_unit::module_codegen has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, loops 3, match/switch 2, boolean chains 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.
base::codegen_crate (cognitive 20) compiler/rustc_codegen_ssa/src/base.rs:714— base::codegen_crate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12, loops 4, boolean chains 2, match/switch 2 (nesting depth added 4). 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.
PrettyPrinter::pretty_print_opaque_impl_type (cognitive 82) compiler/rustc_middle/src/ty/print/pretty.rs:1033— PrettyPrinter::pretty_print_opaque_impl_type has cognitive complexity 82 (threshold 15). Drivers by points: if/else 46, loops 14, match/switch 13, boolean chains 9 (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.
PrettyPrinter::pretty_print_type (cognitive 72) compiler/rustc_middle/src/ty/print/pretty.rs:751— PrettyPrinter::pretty_print_type has cognitive complexity 72 (threshold 15). Drivers by points: if/else 57, match/switch 14, boolean chains 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PrettyPrinter::pretty_print_const_valtree (cognitive 29) compiler/rustc_middle/src/ty/print/pretty.rs:1871— PrettyPrinter::pretty_print_const_valtree has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15, match/switch 8, loops 4, 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.
PrettyPrinter::pretty_print_dyn_existential (cognitive 25) compiler/rustc_middle/src/ty/print/pretty.rs:1373— PrettyPrinter::pretty_print_dyn_existential has cognitive complexity 25 (threshold 15). Drivers by points: if/else 21, 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.
PrettyPrinter::try_print_visible_def_path_recur (cognitive 23) compiler/rustc_middle/src/ty/print/pretty.rs:482— PrettyPrinter::try_print_visible_def_path_recur has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14, match/switch 7, 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.
markdown::markdown_links (cognitive 73) src/librustdoc/html/markdown.rs:1792— markdown::markdown_links has cognitive complexity 73 (threshold 15). Drivers by points: if/else 40, loops 15, match/switch 12, boolean chains 6 (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.
markdown::rust_code_blocks (cognitive 30) src/librustdoc/html/markdown.rs:2023— markdown::rust_code_blocks has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17, match/switch 7, loops 5, 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.
markdown::find_codes (cognitive 22) src/librustdoc/html/markdown.rs:737— markdown::find_codes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11, match/switch 5, loops 4, 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.
markdown::check (cognitive 22) src/tools/clippy/clippy_lints/src/doc/markdown.rs:12— markdown::check has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10, boolean chains 7, loops 5 (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.
markdown::check_word (cognitive 16) src/tools/clippy/clippy_lints/src/doc/markdown.rs:85— markdown::check_word has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 7. Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 3 function items declared inside it (is_camel_case, has_underscore, has_hyphen). 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.
rustc_driver_impl::print_crate_info (cognitive 68) compiler/rustc_driver_impl/src/lib.rs:617— rustc_driver_impl::print_crate_info has cognitive complexity 68 (threshold 15). Drivers by points: if/else 31, loops 25, match/switch 8, boolean chains 4 (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.
rustc_driver_impl::run_compiler (cognitive 24) compiler/rustc_driver_impl/src/lib.rs:171— rustc_driver_impl::run_compiler has cognitive complexity 24 (threshold 15). Drivers by points: if/else 22, boolean chains 1, match/switch 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.
rustc_driver_impl::install_ice_hook (cognitive 20) compiler/rustc_driver_impl/src/lib.rs:1444— rustc_driver_impl::install_ice_hook has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10, match/switch 7, boolean chains 3 (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.
rustc_driver_impl::report_ice (cognitive 19) compiler/rustc_driver_impl/src/lib.rs:1523— rustc_driver_impl::report_ice has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, match/switch 2, boolean chains 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.
rustc_driver_impl::handle_explain (cognitive 18) compiler/rustc_driver_impl/src/lib.rs:414— rustc_driver_impl::handle_explain has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, 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.
Checker::visit_item (cognitive 63) compiler/rustc_passes/src/stability.rs:568— Checker::visit_item has cognitive complexity 63 (threshold 15). Drivers by points: if/else 47, loops 6, boolean chains 5, match/switch 5 (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.
Checker::visit_terminator (cognitive 52) compiler/rustc_const_eval/src/check_consts/check.rs:743— Checker::visit_terminator has cognitive complexity 52 (threshold 15). Drivers by points: if/else 35, match/switch 11, boolean chains 6 (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.
Checker::visit_path (cognitive 48) compiler/rustc_passes/src/stability.rs:774— Checker::visit_path has cognitive complexity 48 (threshold 15). Drivers by points: if/else 37, match/switch 8, loops 3 (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.
Checker::visit_rvalue (cognitive 24) compiler/rustc_const_eval/src/check_consts/check.rs:565— Checker::visit_rvalue has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16, boolean chains 5, match/switch 3 (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.
Checker::check_url (cognitive 24) src/tools/linkchecker/main.rs:312— Checker::check_url has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13, match/switch 7, boolean chains 2, loops 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.
Lexer::next_token_from_cursor (cognitive 61) compiler/rustc_parse/src/lexer/mod.rs:160— Lexer::next_token_from_cursor has cognitive complexity 61 (threshold 15). Drivers by points: if/else 54, match/switch 5, boolean chains 1, loops 1 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Lexer::cook_lexer_literal (cognitive 40) compiler/rustc_parse/src/lexer/mod.rs:759— Lexer::cook_lexer_literal has cognitive complexity 40 (threshold 15). Drivers by points: if/else 33, loops 3, match/switch 3, boolean chains 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.
Lexer::lex_token_tree_open_delim (cognitive 38) compiler/rustc_parse/src/lexer/tokentrees.rs:54— Lexer::lex_token_tree_open_delim has cognitive complexity 38 (threshold 15). Drivers by points: if/else 32, loops 4, boolean chains 2 (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.
Lexer::maybe_report_guarded_str (cognitive 19) compiler/rustc_parse/src/lexer/mod.rs:1107— Lexer::maybe_report_guarded_str has cognitive complexity 19 (threshold 15). Drivers by points: if/else 18, 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.
Lexer::lex_token_trees (cognitive 17) compiler/rustc_parse/src/lexer/tokentrees.rs:14— Lexer::lex_token_trees has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, match/switch 3, 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.
rustdoc::source_span_for_markdown_range_inner (cognitive 56) compiler/rustc_resolve/src/rustdoc.rs:555— rustdoc::source_span_for_markdown_range_inner has cognitive complexity 56 (threshold 15). Drivers by points: if/else 44, boolean chains 7, loops 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.
rustdoc::strip_generics_from_path (cognitive 24) compiler/rustc_resolve/src/rustdoc.rs:291— rustdoc::strip_generics_from_path has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14, loops 5, match/switch 5 (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.
rustdoc::main_args (cognitive 22) src/librustdoc/lib.rs:798— rustdoc::main_args has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11, loops 5, match/switch 5, boolean chains 1 (nesting depth added 4). 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.
rustdoc::parse_links (cognitive 16) compiler/rustc_resolve/src/rustdoc.rs:429— rustdoc::parse_links has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, loops 2, match/switch 2 (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.
rustdoc::main (cognitive 16) src/bootstrap/src/bin/rustdoc.rs:20— rustdoc::main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, 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.
lower::generic_predicates (cognitive 42) src/tools/rust-analyzer/crates/hir-ty/src/lower.rs:2533— lower::generic_predicates has cognitive complexity 42 (threshold 15). Drivers by points: if/else 31, loops 6, match/switch 4, boolean chains 1 (nesting depth added 22). Of this number, 40 points are the body's own statements and 2 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
lower::resolve_type_param_assoc_type_shorthand (cognitive 36) src/tools/rust-analyzer/crates/hir-ty/src/lower.rs:2114— lower::resolve_type_param_assoc_type_shorthand has cognitive complexity 36 (threshold 15). Drivers by points: if/else 24, match/switch 7, loops 3, 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.
lower::lower_body (cognitive 26) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:70— lower::lower_body has cognitive complexity 26 (threshold 15). Drivers by points: if/else 19, match/switch 3, boolean chains 2, loops 2 (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.
lower::mir_body_for_closure_query (cognitive 23) src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs:2112— lower::mir_body_for_closure_query has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13, match/switch 7, loops 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.
lower::lower_function (cognitive 22) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:319— lower::lower_function has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 11, if/else 8, loops 2, 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.
builtin::infringing_fields_error (cognitive 40) compiler/rustc_hir_analysis/src/coherence/builtin.rs:1019— builtin::infringing_fields_error has cognitive complexity 40 (threshold 15). Drivers by points: if/else 25, loops 8, match/switch 6, boolean chains 1 (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.
builtin::visit_implementation_of_dispatch_from_dyn (cognitive 31) compiler/rustc_hir_analysis/src/coherence/builtin.rs:280— builtin::visit_implementation_of_dispatch_from_dyn has cognitive complexity 31 (threshold 15). Drivers by points: if/else 26, boolean chains 4, match/switch 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.
builtin::coerce_shared_info (cognitive 23) compiler/rustc_hir_analysis/src/coherence/builtin.rs:561— builtin::coerce_shared_info has cognitive complexity 23 (threshold 15). Drivers by points: if/else 19, boolean chains 3, 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.
builtin::coerce_unsized_info (cognitive 22) compiler/rustc_hir_analysis/src/coherence/builtin.rs:784— builtin::coerce_unsized_info has cognitive complexity 22 (threshold 15). Drivers by points: if/else 20, boolean chains 1, 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.
builtin::visit_implementation_of_const_param_ty (cognitive 18) compiler/rustc_hir_analysis/src/coherence/builtin.rs:163— builtin::visit_implementation_of_const_param_ty has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, loops 7, match/switch 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.
rename::source_edit_from_def (cognitive 39) src/tools/rust-analyzer/crates/ide-db/src/rename.rs:673— rename::source_edit_from_def has cognitive complexity 39 (threshold 15). Drivers by points: if/else 25, match/switch 8, loops 4, boolean chains 2 (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.
rename::transform_method_call_into_assoc_fn (cognitive 30) src/tools/rust-analyzer/crates/ide/src/rename.rs:627— rename::transform_method_call_into_assoc_fn has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 14, if/else 9, loops 6, boolean chains 1 (nesting depth added 19). 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.
rename::source_edit_from_name_ref (cognitive 24) src/tools/rust-analyzer/crates/ide-db/src/rename.rs:578— rename::source_edit_from_name_ref has cognitive complexity 24 (threshold 15). Drivers by points: if/else 18, match/switch 4, 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.
rename::transform_assoc_fn_into_method_call (cognitive 23) src/tools/rust-analyzer/crates/ide/src/rename.rs:411— rename::transform_assoc_fn_into_method_call has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 11, if/else 6, loops 6 (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.
rename::find_definitions (cognitive 20) src/tools/rust-analyzer/crates/ide/src/rename.rs:277— rename::find_definitions has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 10, if/else 9, boolean chains 1 (nesting depth added 5). 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.
compile::run_cargo (cognitive 38) src/bootstrap/src/core/build_steps/compile.rs:2624— compile::run_cargo has cognitive complexity 38 (threshold 15). Drivers by points: if/else 23, match/switch 8, boolean chains 4, loops 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.
compile::copy_self_contained_objects (cognitive 27) src/bootstrap/src/core/build_steps/compile.rs:375— compile::copy_self_contained_objects has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13, loops 13, 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.
compile::std_cargo (cognitive 24) src/bootstrap/src/core/build_steps/compile.rs:527— compile::std_cargo has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19, boolean chains 3, 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.
compile::rustc_cargo_env (cognitive 19) src/bootstrap/src/core/build_steps/compile.rs:1315— compile::rustc_cargo_env has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, boolean chains 2, match/switch 2 (nesting depth added 3). 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.
compile::rustc_llvm_env (cognitive 17) src/bootstrap/src/core/build_steps/compile.rs:1415— compile::rustc_llvm_env has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15, boolean chains 2 (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.
types::join_bounds_inner (cognitive 37) src/tools/rustfmt/src/types.rs:1170— types::join_bounds_inner has cognitive complexity 37 (threshold 15). Drivers by points: if/else 23, match/switch 8, boolean chains 6 (nesting depth added 4). 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.
types::repr_nullable_ptr (cognitive 24) compiler/rustc_lint/src/types.rs:860— types::repr_nullable_ptr has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14, match/switch 9, 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.
types::lint_wide_pointer (cognitive 19) compiler/rustc_lint/src/types.rs:296— types::lint_wide_pointer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, boolean chains 1, 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.
types::format_function_type (cognitive 19) src/tools/rustfmt/src/types.rs:316— types::format_function_type has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, boolean chains 3, match/switch 2 (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.
types::create_disallowed_map (cognitive 18) src/tools/clippy/clippy_config/src/types.rs:135— types::create_disallowed_map has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, boolean chains 3, loops 3 (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.
EvalCtxt::term_is_fully_unconstrained (cognitive 32) compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1095— EvalCtxt::term_is_fully_unconstrained has cognitive complexity 32 (threshold 15). Drivers by points: if/else 22, boolean chains 7, match/switch 3 (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.
EvalCtxt::merge_trait_candidates (cognitive 28) compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:1495— EvalCtxt::merge_trait_candidates has cognitive complexity 28 (threshold 15). Drivers by points: if/else 22, loops 3, match/switch 2, 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.
EvalCtxt::evaluate_goal_raw (cognitive 23) compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:664— EvalCtxt::evaluate_goal_raw has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11, match/switch 10, 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.
EvalCtxt::try_assemble_bounds_via_registered_opaques (cognitive 20) compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs:1080— EvalCtxt::try_assemble_bounds_via_registered_opaques has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13, loops 3, match/switch 3, 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.
EvalCtxt::normalize_opaque_type (cognitive 17) compiler/rustc_next_trait_solver/src/solve/project_goals/opaque_types.rs:17— EvalCtxt::normalize_opaque_type has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 11, if/else 6 (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.
partitioning::internalize_symbols (cognitive 30) compiler/rustc_monomorphize/src/partitioning.rs:529— partitioning::internalize_symbols has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18, loops 8, match/switch 4 (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.
partitioning::merge_codegen_units (cognitive 25) compiler/rustc_monomorphize/src/partitioning.rs:318— partitioning::merge_codegen_units has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16, loops 8, 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.
partitioning::debug_dump (cognitive 25) compiler/rustc_monomorphize/src/partitioning.rs:986— partitioning::debug_dump has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18, loops 7 (nesting depth added 10). Of this number, 18 points are the body's own statements and 7 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
partitioning::mono_item_visibility (cognitive 23) compiler/rustc_monomorphize/src/partitioning.rs:803— partitioning::mono_item_visibility has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16, boolean chains 5, match/switch 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.
partitioning::collect_and_partition_mono_items (cognitive 21) compiler/rustc_monomorphize/src/partitioning.rs:1158— partitioning::collect_and_partition_mono_items has cognitive complexity 21 (threshold 15). Drivers by points: loops 11, if/else 5, match/switch 4, boolean chains 1 (nesting depth added 8). 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.
CodegenCx::codegen_global_asm (cognitive 27) compiler/rustc_codegen_gcc/src/asm.rs:919— CodegenCx::codegen_global_asm has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 14, if/else 8, loops 4, boolean chains 1 (nesting depth added 16). 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.
CodegenCx::get_static_inner (cognitive 24) compiler/rustc_codegen_llvm/src/consts.rs:365— CodegenCx::get_static_inner has cognitive complexity 24 (threshold 15). Drivers by points: if/else 20, boolean chains 4 (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.
CodegenCx::declare_fn (cognitive 22) compiler/rustc_codegen_llvm/src/declare.rs:173— CodegenCx::declare_fn has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, loops 6 (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.
CodegenCx::codegen_global_asm (cognitive 21) compiler/rustc_codegen_llvm/src/asm.rs:410— CodegenCx::codegen_global_asm has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10, match/switch 9, boolean chains 1, loops 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.
CodegenCx::scalar_to_backend_with_pac (cognitive 16) compiler/rustc_codegen_gcc/src/common.rs:321— CodegenCx::scalar_to_backend_with_pac has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, match/switch 3, boolean chains 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.
windows::enable (cognitive 26) library/std/src/sys/thread_local/guard/windows.rs:110— windows::enable has cognitive complexity 26 (threshold 15). Drivers by points: if/else 23, match/switch 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.
windows::parse_lp_cmd_line (cognitive 22) library/std/src/sys/args/windows.rs:54— windows::parse_lp_cmd_line has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10, match/switch 7, boolean chains 3, loops 2 (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.
windows::append_bat_arg (cognitive 22) library/std/src/sys/args/windows.rs:219— windows::append_bat_arg has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15, boolean chains 5, 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.
windows::append_arg (cognitive 20) library/std/src/sys/args/windows.rs:173— windows::append_arg has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, boolean chains 2, match/switch 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.
windows::search_paths (cognitive 17) library/std/src/sys/process/windows.rs:530— windows::search_paths has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, loops 4 (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.
D38 · OSV Dependency Vulnerabilities· Medium advisory (unmaintained) · ×5
Medium advisory (unmaintained): RUSTSEC-2024-0436 library/compiler-builtins/Cargo.lock— paste 1.0.15: RUSTSEC-2024-0436 — no fixed version exists: the advisory reports the package as unmaintained. Replace paste with a maintained alternative, or vendor and maintain a fork. (in 2 lockfiles)
Medium advisory (unmaintained): RUSTSEC-2026-0173 library/compiler-builtins/Cargo.lock— proc-macro-error2 2.0.1: RUSTSEC-2026-0173 — no fixed version exists: the advisory reports the package as unmaintained. proc-macro-error2 is not declared in this repo's manifests: it is pulled in transitively by gungraun-macros 0.9.0, so the action is on the dependency that requires it — upgrade or replace that dependent.
Medium advisory (unmaintained): RUSTSEC-2024-0320 library/stdarch/Cargo.lock— yaml-rust 0.4.5: RUSTSEC-2024-0320 — no fixed version exists: the advisory reports the package as unmaintained. yaml-rust is not declared in this repo's manifests: it is pulled in transitively by serde_yaml 0.8.26, so the action is on the dependency that requires it — upgrade or replace that dependent.
Medium advisory (unmaintained): RUSTSEC-2025-0134 src/ci/citool/Cargo.lock— rustls-pemfile 2.2.0: RUSTSEC-2025-0134 — no fixed version exists: the advisory reports the package as unmaintained. rustls-pemfile is not declared in this repo's manifests: it is pulled in transitively by ureq 3.0.8, so the action is on the dependency that requires it — upgrade or replace that dependent.
Medium advisory (unmaintained): RUSTSEC-2025-0141 src/tools/rustbook/Cargo.lock— bincode 1.3.3: RUSTSEC-2025-0141 — no fixed version exists: the advisory reports the package as unmaintained. bincode is not declared in this repo's manifests: it is pulled in transitively by syntect 5.3.0, so the action is on the dependency that requires it — upgrade or replace that dependent.
Ty::hir_fmt (cyclomatic 117) src/tools/rust-analyzer/crates/hir-ty/src/display.rs:1277— 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.
Ty::rewrite_result (cyclomatic 44) src/tools/rustfmt/src/types.rs:807— Ty::rewrite_result has cyclomatic complexity 44 (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.
Ty::ty_and_layout_field::field_ty_or_layout (cyclomatic 25) compiler/rustc_middle/src/ty/layout.rs:835— Ty::ty_and_layout_field::field_ty_or_layout 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.
Ty::ty_and_layout_pointee_info_at (cyclomatic 22) compiler/rustc_middle/src/ty/layout.rs:1031— Ty::ty_and_layout_pointee_info_at 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.
attrs::match_attr_flags (cyclomatic 66) src/tools/rust-analyzer/crates/hir-def/src/attrs.rs:130— attrs::match_attr_flags has cyclomatic complexity 66 (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.
attrs::parse_repr_tt (cyclomatic 26) src/tools/rust-analyzer/crates/hir-def/src/attrs.rs:1236— attrs::parse_repr_tt 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.
attrs::resolve_doc_path_on_ (cyclomatic 23) src/tools/rust-analyzer/crates/hir/src/attrs.rs:314— 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.
attrs::resolve_assoc_or_field (cyclomatic 21) src/tools/rust-analyzer/crates/hir/src/attrs.rs:370— 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.
highlight::highlight_def (cyclomatic 61) src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/highlight.rs:457— 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.
highlight::punctuation (cyclomatic 40) src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/highlight.rs:99— 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.
highlight::highlight_name_ref (cyclomatic 30) src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/highlight.rs:264— 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.
highlight::highlight_name_ref_by_syntax (cyclomatic 18) src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/highlight.rs:798— highlight::highlight_name_ref_by_syntax 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.
base::codegen_stmt (cyclomatic 49) compiler/rustc_codegen_cranelift/src/base.rs:606— base::codegen_stmt 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.
base::codegen_fn_body (cyclomatic 45) compiler/rustc_codegen_cranelift/src/base.rs:282— base::codegen_fn_body 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.
base::compile_codegen_unit::module_codegen (cyclomatic 25) compiler/rustc_codegen_gcc/src/base.rs:96— base::compile_codegen_unit::module_codegen 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.
base::compile_codegen_unit::module_codegen (cyclomatic 20) compiler/rustc_codegen_llvm/src/base.rs:83— base::compile_codegen_unit::module_codegen 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.
AnalysisStats::run_inference (cyclomatic 48) src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs:773— AnalysisStats::run_inference has cyclomatic complexity 48 (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 47) src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs:55— AnalysisStats::run has cyclomatic complexity 47 (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 29) src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs:1161— AnalysisStats::run_body_lowering 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.
AnalysisStats::run_term_search (cyclomatic 28) src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs:490— 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.
items::rewrite_fn_base (cyclomatic 47) src/tools/rustfmt/src/items.rs:2454— items::rewrite_fn_base 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.
items::opt_item (cyclomatic 38) src/tools/rust-analyzer/crates/parser/src/grammar/items.rs:109— 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.
items::format_trait (cyclomatic 24) src/tools/rustfmt/src/items.rs:1147— items::format_trait 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.
items::format_impl (cyclomatic 21) src/tools/rustfmt/src/items.rs:789— items::format_impl 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.
clippy_utils::is_never_expr (cyclomatic 42) src/tools/clippy/clippy_utils/src/lib.rs:3000— clippy_utils::is_never_expr has cyclomatic complexity 42 (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.
clippy_utils::capture_local_usage (cyclomatic 22) src/tools/clippy/clippy_utils/src/lib.rs:831— clippy_utils::capture_local_usage has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to one function item declared inside it. 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.
clippy_utils::is_default_equivalent_call (cyclomatic 18) src/tools/clippy/clippy_utils/src/lib.rs:572— clippy_utils::is_default_equivalent_call 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.
clippy_utils::expr_use_sites (cyclomatic 18) src/tools/clippy/clippy_utils/src/lib.rs:2681— clippy_utils::expr_use_sites 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.
display::render_const_scalar_inner (cyclomatic 41) src/tools/rust-analyzer/crates/hir-ty/src/display.rs:815— display::render_const_scalar_inner 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.
display::write_bounds_like_dyn_trait (cyclomatic 35) src/tools/rust-analyzer/crates/hir-ty/src/display.rs:2093— display::write_bounds_like_dyn_trait 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.
display::render_const_scalar_from_valtree_inner (cyclomatic 32) src/tools/rust-analyzer/crates/hir-ty/src/display.rs:1090— display::render_const_scalar_from_valtree_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.
display::write_function (cyclomatic 23) src/tools/rust-analyzer/crates/hir/src/display.rs:157— display::write_function 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.
ValidityVisitor::visit_value (cyclomatic 34) compiler/rustc_const_eval/src/interpret/validity.rs:1323— ValidityVisitor::visit_value 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.
ValidityVisitor::check_safe_pointer (cyclomatic 27) compiler/rustc_const_eval/src/interpret/validity.rs:562— ValidityVisitor::check_safe_pointer has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each ...
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.