Public report of rust-lang/rust-analyzer, published 14 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 14 November 2026, 15:14 UTC · Survey ID cd_94f4fa034228486db8b941e673930f50
rust-lang/rust-analyzer
Measured 14 November 2026, 15:09 UTC, at code version 114dcb8
Test reliability is not measured: The suite could not be re-run, but the repository declares tests of its own unreliable.
CAI scoreAt riskUp 3 since the last survey
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A large codebase: 449,914 lines of product code in 46 projects, tests not counted · Estimated rebuild effort: about 4.0 person-years · Weakest lens: Code Health, 62
Findings by how serious they are
23 critical2979 serious130 minor
15 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
14 November 2026, 15:09 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
62of 62 dimensions measured by tools.
3069of 3132 findings point to an exact file and line, so you can open each one in the code. The other 63 concern the repository as a whole, such as missing documentation.
62dimensions across 6 lenses, read from 449,914 lines of product code in 46 projects.
rust-lang/rust-analyzer is rated At risk because critical security findings are open, most of them in the build pipeline. It scores 64 out of 100, which the At risk rating leaves unchanged.
Code Health, at 62, is the weakest lens, level with Security and Compliance, and counts most in the score. The best first step is recording design decisions, worth about 2 points. Writing log messages as searchable templates would lift Code Health itself, also worth about 2.
Six pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Three known security holes in the packages the code depends on can be used by attackers, and two pipeline steps install packages that can change without warning. Pinning each tool to an exact version, updating the vulnerable packages and pinning what the pipeline installs would close these risks. Limiting each secret to its own step would fix the two secrets exposed to more of the pipeline than needed, and the two places where the code runs text as code or as a command need a direct call instead. The three parts of the code nobody has worked on for a long time need someone to learn and document them before anyone changes them.
The product code is 449,914 lines, about €580,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
The weakest lenses score close to each other, so improving any of them moves the score.
Code composition: what the lines of code are
Product code 88%Tests 12%
New since the last survey: 610 findings
These 610 critical or serious findings weren't in the previous survey, on 27 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
God Classes · FunctionTooLong: commands.viewMemoryLayout.<returned closure> editors/code/src/commands.ts
God Classes · FileTooLong: src/thin_map.rs crates/stdx/src/thin_map.rs
Code Duplication · Near-duplicate member pair (41 shared lines) crates/hir/src/term_search/tactics.rs
Code Duplication · Near-duplicate member pair (19 shared lines) crates/hir-ty/src/consteval.rs
Code Duplication · Edited copy of a member (29 corresponding lines) crates/proc-macro-srv/src/token_stream.rs
Code Duplication · Edited copy of a member (12 corresponding lines) crates/ide/src/interpret.rs
Code Duplication · Edited copy of a member (13 corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs
Code Duplication · Members sharing a duplicated core (19 members, 50+ identical tokens) crates/syntax/src/ast/syntax_factory/constructors.rs
Code Duplication · Members sharing a duplicated core (10 members, 50+ identical tokens) crates/syntax/src/ast/syntax_factory/constructors.rs
Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) crates/ide-assists/src/handlers/generate_blanket_trait_impl.rs
Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) crates/syntax/src/ast/syntax_factory/constructors.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/hir-ide/src/diagnostics/decl_check.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/syntax/src/syntax_editor/edits.rs
Code Duplication · Edited copy of a member (74 corresponding lines) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs
Code Duplication · Edited copy of a member (44 corresponding lines) crates/hir-ty/src/next_solver/ty.rs
Code Duplication · Edited copy of a member (53 corresponding lines) crates/hir-expand/src/builtin/derive_macro.rs
Code Duplication · Edited copy of a member (56 corresponding lines) crates/hir-def/src/visibility.rs
Code Duplication · Edited copy of a member (45 corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs
Code Duplication · Edited copy of a member (58 corresponding lines) crates/hir/src/lib.rs
Code Duplication · Edited copy of a member (50 corresponding lines) crates/ide/src/inlay_hints/lifetime.rs
Code Duplication · Edited copy of a member (41 corresponding lines) crates/ide-assists/src/handlers/generate_deref.rs
Code Duplication · Edited copy of a member (40 corresponding lines) crates/ide-assists/src/handlers/expand_rest_pattern.rs
Code Duplication · Edited copies of one member (3 members, 32+ corresponding lines) crates/syntax/src/ast/token_ext.rs
Code Duplication · Edited copy of a member (73 corresponding lines) lib/line-index/src/lib.rs
Code Duplication · Edited copy of a member (39 corresponding lines) crates/hir/src/lib.rs
Code Duplication · Edited copy of a member (39 corresponding lines) crates/proc-macro-api/src/bidirectional_protocol.rs
Code Duplication · Edited copy of a member (40 corresponding lines) crates/ide-diagnostics/src/handlers/field_shorthand.rs
Code Duplication · Edited copy of a member (29 corresponding lines) crates/hir/src/lib.rs
Code Duplication · Edited copy of a member (36 corresponding lines) crates/ide-assists/src/handlers/expand_glob_import.rs
Code Duplication · Edited copy of a member (45 corresponding lines) crates/hir/src/symbols.rs
Code Duplication · Edited copy of a member (30 corresponding lines) crates/ide-completion/src/render/const_.rs
Code Duplication · Edited copy of a member (33 corresponding lines) crates/hir-ty/src/consteval.rs
Code Duplication · Edited copy of a member (46 corresponding lines) crates/ide-assists/src/handlers/convert_comment_from_or_to_doc.rs
Code Duplication · Edited copy of a member (32 corresponding lines) crates/ide/src/inlay_hints.rs
Code Duplication · Edited copy of a member (24 corresponding lines) crates/hir/src/semantics/child_by_source.rs
Code Duplication · Edited copy of a member (46 corresponding lines) crates/ide-assists/src/handlers/convert_bool_to_enum.rs
Code Duplication · Edited copies of one member (5 members, 22+ corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs
Code Duplication · Edited copy of a member (35 corresponding lines) crates/ide/src/runnables.rs
Code Duplication · Edited copy of a member (37 corresponding lines) crates/hir/src/source_analyzer.rs
Code Duplication · Edited copy of a member (31 corresponding lines) crates/hir-def/src/import_map.rs
Code Duplication · Edited copies of one member (3 members, 29+ corresponding lines) crates/hir-ty/src/consteval.rs
Code Duplication · Edited copies of one member (3 members, 37+ corresponding lines) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs
Code Duplication · Edited copy of a member (31 corresponding lines) crates/ide-completion/src/completions/attribute/diagnostic.rs
Code Duplication · Edited copy of a member (33 corresponding lines) crates/rust-analyzer/src/handlers/request.rs
Code Duplication · Edited copy of a member (28 corresponding lines) crates/ide-assists/src/handlers/move_from_mod_rs.rs
Code Duplication · Edited copy of a member (30 corresponding lines) crates/ide-assists/src/handlers/generate_impl.rs
Code Duplication · Edited copy of a member (30 corresponding lines) crates/ide-assists/src/handlers/convert_for_to_while_let.rs
Code Duplication · Edited copy of a member (27 corresponding lines) xtask/src/codegen/diagnostics_docs.rs
Code Duplication · Edited copy of a member (25 corresponding lines) crates/proc-macro-srv/src/token_stream.rs
Code Duplication · Edited copy of a member (25 corresponding lines) crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs
Code Duplication · Edited copy of a member (30 corresponding lines) crates/proc-macro-srv-cli/src/main_loop.rs
Code Duplication · Edited copy of a member (22 corresponding lines) crates/syntax/src/syntax_editor/edits.rs
Code Duplication · Edited copy of a member (25 corresponding lines) crates/hir-def/src/item_tree/lower.rs
Code Duplication · Edited copy of a member (20 corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs
Code Duplication · Edited copy of a member (35 corresponding lines) crates/cfg/src/lib.rs
Code Duplication · Edited copy of a member (20 corresponding lines) crates/ide-db/src/helpers.rs
Code Duplication · Edited copy of a member (38 corresponding lines) crates/hir-def/src/resolver.rs
Code Duplication · Edited copy of a member (34 corresponding lines) crates/hir-def/src/signatures.rs
Code Duplication · Edited copy of a member (17 corresponding lines) crates/ide-assists/src/handlers/flip_or_pattern.rs
Code Duplication · Edited copy of a member (13 corresponding lines) crates/hir-def/src/item_scope.rs
Code Duplication · Edited copy of a member (24 corresponding lines) crates/hir-ty/src/infer/expr.rs
Code Duplication · Edited copy of a member (28 corresponding lines) crates/hir-ty/src/next_solver/util.rs
Code Duplication · Edited copy of a member (20 corresponding lines) crates/hir-ty/src/next_solver/def_id.rs
Code Duplication · Edited copies of one member (4 members, 18+ corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs
Code Duplication · Edited copy of a member (33 corresponding lines) crates/hir-ty/src/layout/adt.rs
Code Duplication · Edited copy of a member (25 corresponding lines) crates/hir-ty/src/next_solver/normalize.rs
Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs
Code Duplication · Edited copy of a member (22 corresponding lines) crates/rust-analyzer/src/handlers/request.rs
Code Duplication · Edited copy of a member (29 corresponding lines) crates/span/src/map.rs
Code Duplication · Edited copy of a member (16 corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs
Code Duplication · Edited copy of a member (20 corresponding lines) crates/ide-assists/src/handlers/apply_demorgan.rs
Code Duplication · Edited copy of a member (36 corresponding lines) crates/ide-assists/src/handlers/generate_getter_or_setter.rs
Code Duplication · Edited copy of a member (27 corresponding lines) crates/ide-diagnostics/src/handlers/unresolved_field.rs
Code Duplication · Edited copy of a member (34 corresponding lines) crates/ide-completion/src/completions/snippet.rs
Code Duplication · Edited copy of a member (18 corresponding lines) crates/ide-diagnostics/src/handlers/type_mismatch.rs
Code Duplication · Edited copies of one member (3 members, 23+ corresponding lines) crates/hir-ty/src/lower.rs
Code Duplication · Edited copy of a member (20 corresponding lines) crates/hir/src/semantics.rs
Code Duplication · Edited copy of a member (16 corresponding lines) crates/syntax/src/ast/edit.rs
Code Duplication · Edited copy of a member (16 corresponding lines) crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs
Code Duplication · Edited copy of a member (20 corresponding lines) crates/ide-completion/src/completions/postfix.rs
Code Duplication · Edited copy of a member (24 corresponding lines) crates/ide/src/syntax_highlighting/escape.rs
Code Duplication · Edited copy of a member (14 corresponding lines) crates/hir/src/display.rs
Code Duplication · Edited copy of a member (25 corresponding lines) crates/ide-db/src/syntax_helpers/node_ext.rs
Code Duplication · Edited copies of one member (3 members, 25+ corresponding lines) crates/intern/src/intern.rs
Code Duplication · Edited copies of one member (3 members, 25+ corresponding lines) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs
Code Duplication · Edited copy of a member (24 corresponding lines) crates/ide-db/src/use_trivial_constructor.rs
Code Duplication · Edited copy of a member (22 corresponding lines) crates/rust-analyzer/src/config.rs
Code Duplication · Edited copy of a member (14 corresponding lines) crates/hir-ty/src/next_solver/consts.rs
Code Duplication · Edited copy of a member (23 corresponding lines) crates/hir-expand/src/builtin/derive_macro.rs
Code Duplication · Edited copy of a member (20 corresponding lines) crates/ide-assists/src/handlers/raw_string.rs
Code Duplication · Edited copy of a member (12 corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs
Code Duplication · Edited copy of a member (22 corresponding lines) xtask/src/publish/notes.rs
Code Duplication · Edited copy of a member (21 corresponding lines) crates/hir-ty/src/mir/eval.rs
Code Duplication · Edited copy of a member (30 corresponding lines) crates/ide-db/src/imports/merge_imports.rs
Code Duplication · Edited copy of a member (15 corresponding lines) crates/hir-expand/src/lib.rs
Code Duplication · Edited copy of a member (18 corresponding lines) crates/hir-ty/src/lower.rs
Code Duplication · Edited copy of a member (16 corresponding lines) crates/hir/src/lib.rs
Code Duplication · Edited copy of a member (15 corresponding lines) crates/ide/src/doc_links/intra_doc_links.rs
We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 178 findings
These 178 critical or serious findings were in the previous survey, on 27 October 2026, and are gone from this one. The first 100 are listed here.
God Classes · FileTooLong: semantics/source_to_def.rs crates/hir/src/semantics/source_to_def.rs
God Classes · ClassTooLong: Completions crates/ide-completion/src/completions.rs
Code Duplication · Near-duplicate member family (6 members, 7 shared lines) crates/syntax/src/ast/syntax_factory/constructors.rs
Code Duplication · Near-duplicate member family (5 members, 8 shared lines) crates/syntax/src/ast/syntax_factory/constructors.rs
Code Duplication · Near-duplicate member pair (29 shared lines) crates/syntax/src/ast/syntax_factory/constructors.rs
Code Duplication · Near-duplicate member pair (15 shared lines) crates/hir-ty/src/consteval.rs
Code Duplication · Edited copy of a member (29 corresponding lines) crates/proc-macro-srv/src/token_stream.rs
Code Duplication · Edited copy of a member (11 corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs
Code Duplication · Members sharing a duplicated core (22 members, 50+ identical tokens) crates/syntax/src/ast/syntax_factory/constructors.rs
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) crates/syntax/src/syntax_editor/edits.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/ide-assists/src/handlers/generate_default_from_new.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/syntax/src/ast/syntax_factory/constructors.rs
€190,000 to €970,000, for 3,230 to 10,248 hours of work, about 4.0 person-years for 2 to 8 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.9 at a score of 64. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Large: 449,914 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with main.rs.
Raises the score by about 2 points · Low effort · ADR Quality
2
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4).
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Files that change often carry extra risk · Combined risk
2 files are changed often and are hard to read, which makes them the likeliest places for a mistake. They also have under half their code tested, or were written almost entirely by one person, so a mistake there is less likely to be caught, or only one person knows the code well enough to avoid it. A change to these files therefore carries more risk than the overall score suggests.
Based on: Churn × Complexity Hotspots (31 files) · Code Coverage (95 files under half tested) · Bus Factor (0 files written almost entirely by one person) · The files: diagnostics.rs and lib.rs
What to do: Add tests to these files and have a second person review every change to them, starting with diagnostics.rs and lib.rs.
Where the investment is most exposed · Value at risk
This code would cost about €580,000 to build again, about 4.0 person-years of work. Its weakest lens is Code Health, at 62 (Adequate). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
Resolve the 1 No ADRs found finding(s) in ADR Quality. Of all the actions in this report, it raises the score most for the work it takes: about 2 points for low effort, because it clears the 1 ADR Quality findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.8 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 3% to 6% on every change. The history of the code shows how much it changes: about 22,864 lines over the last 90 days, which is about 92,726 lines a year. At that pace, the extra work comes to an estimated 6.7 to 40.1 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
836 modules, with 3884 dependencies between them. 22 loops run through 156 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 796 more are left out to keep it readable.
Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
hir_ty.next_solver.predicate uses hir_ty.next_solver.interner, so a change to hir_ty.next_solver.interner can break hir_ty.next_solver.predicate, while a change to hir_ty.next_solver.predicate can't break hir_ty.next_solver.interner.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
4→26 hir_ty.next_solver.predicate uses hir_typart of a loop✕
Connections
2 pairs of types, where a type in hir_ty.next_solver.predicate uses a type in hir_ty.
hir_ty.next_solver.predicate uses hir_ty, so a change to hir_ty can break hir_ty.next_solver.predicate, while a change to hir_ty.next_solver.predicate can't break hir_ty.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
parser.syntax_kind.generated uses edition, so a change to edition can break parser.syntax_kind.generated, while a change to parser.syntax_kind.generated can't break edition.
Position
Below the diagonal: parser.syntax_kind.generated uses a module listed above it, which is the healthy direction.
text_size.range uses text_size.size, so a change to text_size.size can break text_size.range, while a change to text_size.range can't break text_size.size.
Position
Below the diagonal: text_size.range uses a module listed above it, which is the healthy direction.
syntax.ast.syntax_factory uses edition, so a change to edition can break syntax.ast.syntax_factory, while a change to syntax.ast.syntax_factory can't break edition.
Position
Below the diagonal: syntax.ast.syntax_factory uses a module listed above it, which is the healthy direction.
syntax.ast.syntax_factory uses parser.syntax_kind.generated, so a change to parser.syntax_kind.generated can break syntax.ast.syntax_factory, while a change to syntax.ast.syntax_factory can't break parser.syntax_kind.generated.
Position
Below the diagonal: syntax.ast.syntax_factory uses a module listed above it, which is the healthy direction.
8→11 syntax.ast.syntax_factory uses syntax.ast.generated.nodespart of a loop✕
Connections
103 pairs of types, where a type in syntax.ast.syntax_factory uses a type in syntax.ast.generated.nodes. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
syntax.ast.syntax_factory uses syntax.ast.generated.nodes, so a change to syntax.ast.generated.nodes can break syntax.ast.syntax_factory, while a change to syntax.ast.syntax_factory can't break syntax.ast.generated.nodes.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
hir_expand.name uses hir_expand.mod_path, so a change to hir_expand.mod_path can break hir_expand.name, while a change to hir_expand.name can't break hir_expand.mod_path.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
syntax.syntax_editor uses syntax.ast.syntax_factory, so a change to syntax.ast.syntax_factory can break syntax.syntax_editor, while a change to syntax.syntax_editor can't break syntax.ast.syntax_factory.
Position
Below the diagonal: syntax.syntax_editor uses a module listed above it, which is the healthy direction.
10→11 syntax.syntax_editor uses syntax.ast.generated.nodespart of a loop✕
Connections
1 pair of types, where a type in syntax.syntax_editor uses a type in syntax.ast.generated.nodes.
syntax.syntax_editor uses syntax.ast.generated.nodes, so a change to syntax.ast.generated.nodes can break syntax.syntax_editor, while a change to syntax.syntax_editor can't break syntax.ast.generated.nodes.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
syntax.ast.generated.nodes uses edition, so a change to edition can break syntax.ast.generated.nodes, while a change to syntax.ast.generated.nodes can't break edition.
Position
Below the diagonal: syntax.ast.generated.nodes uses a module listed above it, which is the healthy direction.
199 pairs of types, where a type in syntax.ast.generated.nodes uses a type in parser.syntax_kind.generated. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
syntax.ast.generated.nodes uses parser.syntax_kind.generated, so a change to parser.syntax_kind.generated can break syntax.ast.generated.nodes, while a change to syntax.ast.generated.nodes can't break parser.syntax_kind.generated.
Position
Below the diagonal: syntax.ast.generated.nodes uses a module listed above it, which is the healthy direction.
syntax.ast.generated.nodes uses syntax.ast.syntax_factory, so a change to syntax.ast.syntax_factory can break syntax.ast.generated.nodes, while a change to syntax.ast.generated.nodes can't break syntax.ast.syntax_factory.
Position
Below the diagonal: syntax.ast.generated.nodes uses a module listed above it, which is the healthy direction.
syntax.ast.generated.nodes uses syntax.syntax_editor, so a change to syntax.syntax_editor can break syntax.ast.generated.nodes, while a change to syntax.ast.generated.nodes can't break syntax.syntax_editor.
Position
Below the diagonal: syntax.ast.generated.nodes uses a module listed above it, which is the healthy direction.
11→12 syntax.ast.generated.nodes uses syntax.ast.generated.tokenspart of a loop✕
Connections
1 pair of types, where a type in syntax.ast.generated.nodes uses a type in syntax.ast.generated.tokens.
syntax.ast.generated.nodes uses syntax.ast.generated.tokens, so a change to syntax.ast.generated.tokens can break syntax.ast.generated.nodes, while a change to syntax.ast.generated.nodes can't break syntax.ast.generated.tokens.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
syntax.ast.generated.tokens uses parser.syntax_kind.generated, so a change to parser.syntax_kind.generated can break syntax.ast.generated.tokens, while a change to syntax.ast.generated.tokens can't break parser.syntax_kind.generated.
Position
Below the diagonal: syntax.ast.generated.tokens uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in syntax.ast.generated.tokens uses a type in span.
The types involved
syntax.ast.generated.tokens.Ident → span.Span
syntax.ast.generated.tokens.String → span.Span
Direction
syntax.ast.generated.tokens uses span, so a change to span can break syntax.ast.generated.tokens, while a change to syntax.ast.generated.tokens can't break span.
Position
Below the diagonal: syntax.ast.generated.tokens uses a module listed above it, which is the healthy direction.
syntax.ast.generated.tokens uses syntax.ast.generated.nodes, so a change to syntax.ast.generated.nodes can break syntax.ast.generated.tokens, while a change to syntax.ast.generated.tokens can't break syntax.ast.generated.nodes.
Position
Below the diagonal: syntax.ast.generated.tokens uses a module listed above it, which is the healthy direction.
base_db.input uses syntax.ast.generated.tokens, so a change to syntax.ast.generated.tokens can break base_db.input, while a change to base_db.input can't break syntax.ast.generated.tokens.
Position
Below the diagonal: base_db.input uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in ide_db.assists uses a type in text_size.range.
The types involved
ide_db.assists.Assist → text_size.range.TextRange
Direction
ide_db.assists uses text_size.range, so a change to text_size.range can break ide_db.assists, while a change to ide_db.assists can't break text_size.range.
Position
Below the diagonal: ide_db.assists uses a module listed above it, which is the healthy direction.
ide_db.assists uses syntax.ast.generated.tokens, so a change to syntax.ast.generated.tokens can break ide_db.assists, while a change to ide_db.assists can't break syntax.ast.generated.tokens.
Position
Below the diagonal: ide_db.assists uses a module listed above it, which is the healthy direction.
hir_expand.mod_path uses hir_expand.name, so a change to hir_expand.name can break hir_expand.mod_path, while a change to hir_expand.mod_path can't break hir_expand.name.
Position
Below the diagonal: hir_expand.mod_path uses a module listed above it, which is the healthy direction.
hir_expand.mod_path uses syntax.ast.generated.nodes, so a change to syntax.ast.generated.nodes can break hir_expand.mod_path, while a change to hir_expand.mod_path can't break syntax.ast.generated.nodes.
Position
Below the diagonal: hir_expand.mod_path uses a module listed above it, which is the healthy direction.
hir_expand.mod_path uses base_db.input, so a change to base_db.input can break hir_expand.mod_path, while a change to hir_expand.mod_path can't break base_db.input.
Position
Below the diagonal: hir_expand.mod_path uses a module listed above it, which is the healthy direction.
hir_def.hir uses hir_expand.mod_path, so a change to hir_expand.mod_path can break hir_def.hir, while a change to hir_def.hir can't break hir_expand.mod_path.
Position
Below the diagonal: hir_def.hir uses a module listed above it, which is the healthy direction.
hir_expand uses syntax.ast.generated.nodes, so a change to syntax.ast.generated.nodes can break hir_expand, while a change to hir_expand can't break syntax.ast.generated.nodes.
Position
Below the diagonal: hir_expand uses a module listed above it, which is the healthy direction.
hir_expand uses syntax.ast.generated.tokens, so a change to syntax.ast.generated.tokens can break hir_expand, while a change to hir_expand can't break syntax.ast.generated.tokens.
Position
Below the diagonal: hir_expand uses a module listed above it, which is the healthy direction.
hir_expand uses hir_expand.mod_path, so a change to hir_expand.mod_path can break hir_expand, while a change to hir_expand can't break hir_expand.mod_path.
Position
Below the diagonal: hir_expand uses a module listed above it, which is the healthy direction.
hir_def.item_tree uses hir_expand.name, so a change to hir_expand.name can break hir_def.item_tree, while a change to hir_def.item_tree can't break hir_expand.name.
Position
Below the diagonal: hir_def.item_tree uses a module listed above it, which is the healthy direction.
hir_def.item_tree uses syntax.ast.generated.nodes, so a change to syntax.ast.generated.nodes can break hir_def.item_tree, while a change to hir_def.item_tree can't break syntax.ast.generated.nodes.
Position
Below the diagonal: hir_def.item_tree uses a module listed above it, which is the healthy direction.
hir_def.item_tree uses syntax.ast.generated.tokens, so a change to syntax.ast.generated.tokens can break hir_def.item_tree, while a change to hir_def.item_tree can't break syntax.ast.generated.tokens.
Position
Below the diagonal: hir_def.item_tree uses a module listed above it, which is the healthy direction.
hir_def.item_tree uses base_db.input, so a change to base_db.input can break hir_def.item_tree, while a change to hir_def.item_tree can't break base_db.input.
Position
Below the diagonal: hir_def.item_tree uses a module listed above it, which is the healthy direction.
hir_def.item_tree uses hir_expand.mod_path, so a change to hir_expand.mod_path can break hir_def.item_tree, while a change to hir_def.item_tree can't break hir_expand.mod_path.
Position
Below the diagonal: hir_def.item_tree uses a module listed above it, which is the healthy direction.
ide_db uses parser.syntax_kind.generated, so a change to parser.syntax_kind.generated can break ide_db, while a change to ide_db can't break parser.syntax_kind.generated.
Position
Below the diagonal: ide_db uses a module listed above it, which is the healthy direction.
hir_def uses syntax.ast.generated.nodes, so a change to syntax.ast.generated.nodes can break hir_def, while a change to hir_def can't break syntax.ast.generated.nodes.
Position
Below the diagonal: hir_def uses a module listed above it, which is the healthy direction.
30 pairs of types, where a type in hir_def uses a type in hir_expand. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
The types involved
hir_def.AstIdWithPath → hir_expand.HirFileId
hir_def.AttrDefId → hir_expand.HirFileId
hir_def.ConstId → hir_expand.Lookup
hir_def.DefWithBodyId → hir_expand.HirFileId
hir_def.EnumId → hir_expand.HirFileId
hir_def.EnumId → hir_expand.Lookup
hir_def.EnumVariantId → hir_expand.Lookup
hir_def.EnumVariantLoc → hir_expand.Intern
hir_def.ExternBlockId → hir_expand.Lookup
hir_def.ExternCrateId → hir_expand.Lookup
hir_def.FunctionId → hir_expand.Lookup
hir_def.GenericDefId → hir_expand.HirFileId
hir_def.ImplId → hir_expand.HirFileId
hir_def.ImplId → hir_expand.Lookup
hir_def.Macro2Id → hir_expand.Lookup
hir_def.Macro2Loc → hir_expand.Intern
hir_def.MacroId → hir_expand.MacroDefId
hir_def.MacroRulesId → hir_expand.Lookup
hir_def.MacroRulesLoc → hir_expand.Intern
hir_def.ProcMacroId → hir_expand.Lookup
hir_def.ProcMacroLoc → hir_expand.Intern
hir_def.StaticId → hir_expand.Lookup
hir_def.StructId → hir_expand.Lookup
hir_def.TraitId → hir_expand.HirFileId
hir_def.TraitId → hir_expand.Lookup
Direction
hir_def uses hir_expand, so a change to hir_expand can break hir_def, while a change to hir_def can't break hir_expand.
Position
Below the diagonal: hir_def uses a module listed above it, which is the healthy direction.
hir_def.expr_store.path uses hir_expand.name, so a change to hir_expand.name can break hir_def.expr_store.path, while a change to hir_def.expr_store.path can't break hir_expand.name.
Position
Below the diagonal: hir_def.expr_store.path uses a module listed above it, which is the healthy direction.
hir_def.expr_store.path uses hir_expand.mod_path, so a change to hir_expand.mod_path can break hir_def.expr_store.path, while a change to hir_def.expr_store.path can't break hir_expand.mod_path.
Position
Below the diagonal: hir_def.expr_store.path uses a module listed above it, which is the healthy direction.
hir_def.expr_store.path uses hir_def.item_tree, so a change to hir_def.item_tree can break hir_def.expr_store.path, while a change to hir_def.expr_store.path can't break hir_def.item_tree.
Position
Below the diagonal: hir_def.expr_store.path uses a module listed above it, which is the healthy direction.
hir_def.expr_store.path uses hir_def, so a change to hir_def can break hir_def.expr_store.path, while a change to hir_def.expr_store.path can't break hir_def.
Position
Below the diagonal: hir_def.expr_store.path uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.ty uses hir_ty.next_solver.predicate, so a change to hir_ty.next_solver.predicate can break hir_ty.next_solver.ty, while a change to hir_ty.next_solver.ty can't break hir_ty.next_solver.predicate.
Position
Below the diagonal: hir_ty.next_solver.ty uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.ty uses hir_def.hir, so a change to hir_def.hir can break hir_ty.next_solver.ty, while a change to hir_ty.next_solver.ty can't break hir_def.hir.
Position
Below the diagonal: hir_ty.next_solver.ty uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.ty uses hir_def, so a change to hir_def can break hir_ty.next_solver.ty, while a change to hir_ty.next_solver.ty can't break hir_def.
Position
Below the diagonal: hir_ty.next_solver.ty uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.ty uses hir_def.expr_store.path, so a change to hir_def.expr_store.path can break hir_ty.next_solver.ty, while a change to hir_ty.next_solver.ty can't break hir_def.expr_store.path.
Position
Below the diagonal: hir_ty.next_solver.ty uses a module listed above it, which is the healthy direction.
22→23 hir_ty.next_solver.ty uses hir_ty.next_solver.internerpart of a loop✕
Connections
3 pairs of types, where a type in hir_ty.next_solver.ty uses a type in hir_ty.next_solver.interner.
hir_ty.next_solver.ty uses hir_ty.next_solver.interner, so a change to hir_ty.next_solver.interner can break hir_ty.next_solver.ty, while a change to hir_ty.next_solver.ty can't break hir_ty.next_solver.interner.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
22→24 hir_ty.next_solver.ty uses hir_ty.next_solver.inferpart of a loop✕
Connections
1 pair of types, where a type in hir_ty.next_solver.ty uses a type in hir_ty.next_solver.infer.
hir_ty.next_solver.ty uses hir_ty.next_solver.infer, so a change to hir_ty.next_solver.infer can break hir_ty.next_solver.ty, while a change to hir_ty.next_solver.ty can't break hir_ty.next_solver.infer.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
22→25 hir_ty.next_solver.ty uses hir_ty.next_solver.constspart of a loop✕
Connections
2 pairs of types, where a type in hir_ty.next_solver.ty uses a type in hir_ty.next_solver.consts.
hir_ty.next_solver.ty uses hir_ty.next_solver.consts, so a change to hir_ty.next_solver.consts can break hir_ty.next_solver.ty, while a change to hir_ty.next_solver.ty can't break hir_ty.next_solver.consts.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
hir_ty.next_solver.interner uses hir_ty.next_solver.predicate, so a change to hir_ty.next_solver.predicate can break hir_ty.next_solver.interner, while a change to hir_ty.next_solver.interner can't break hir_ty.next_solver.predicate.
Position
Below the diagonal: hir_ty.next_solver.interner uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.interner uses base_db.input, so a change to base_db.input can break hir_ty.next_solver.interner, while a change to hir_ty.next_solver.interner can't break base_db.input.
Position
Below the diagonal: hir_ty.next_solver.interner uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.interner uses hir_def.hir, so a change to hir_def.hir can break hir_ty.next_solver.interner, while a change to hir_ty.next_solver.interner can't break hir_def.hir.
Position
Below the diagonal: hir_ty.next_solver.interner uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.interner uses hir_def, so a change to hir_def can break hir_ty.next_solver.interner, while a change to hir_ty.next_solver.interner can't break hir_def.
Position
Below the diagonal: hir_ty.next_solver.interner uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.interner uses hir_def.expr_store.path, so a change to hir_def.expr_store.path can break hir_ty.next_solver.interner, while a change to hir_ty.next_solver.interner can't break hir_def.expr_store.path.
Position
Below the diagonal: hir_ty.next_solver.interner uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.interner uses hir_ty.next_solver.ty, so a change to hir_ty.next_solver.ty can break hir_ty.next_solver.interner, while a change to hir_ty.next_solver.interner can't break hir_ty.next_solver.ty.
Position
Below the diagonal: hir_ty.next_solver.interner uses a module listed above it, which is the healthy direction.
23→24 hir_ty.next_solver.interner uses hir_ty.next_solver.inferpart of a loop✕
Connections
2 pairs of types, where a type in hir_ty.next_solver.interner uses a type in hir_ty.next_solver.infer.
hir_ty.next_solver.interner uses hir_ty.next_solver.infer, so a change to hir_ty.next_solver.infer can break hir_ty.next_solver.interner, while a change to hir_ty.next_solver.interner can't break hir_ty.next_solver.infer.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
hir_ty.next_solver.infer uses hir_ty.next_solver.predicate, so a change to hir_ty.next_solver.predicate can break hir_ty.next_solver.infer, while a change to hir_ty.next_solver.infer can't break hir_ty.next_solver.predicate.
Position
Below the diagonal: hir_ty.next_solver.infer uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.infer uses hir_def.hir, so a change to hir_def.hir can break hir_ty.next_solver.infer, while a change to hir_ty.next_solver.infer can't break hir_def.hir.
Position
Below the diagonal: hir_ty.next_solver.infer uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.infer uses hir_def, so a change to hir_def can break hir_ty.next_solver.infer, while a change to hir_ty.next_solver.infer can't break hir_def.
Position
Below the diagonal: hir_ty.next_solver.infer uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.infer uses hir_def.expr_store.path, so a change to hir_def.expr_store.path can break hir_ty.next_solver.infer, while a change to hir_ty.next_solver.infer can't break hir_def.expr_store.path.
Position
Below the diagonal: hir_ty.next_solver.infer uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.infer uses hir_ty.next_solver.ty, so a change to hir_ty.next_solver.ty can break hir_ty.next_solver.infer, while a change to hir_ty.next_solver.infer can't break hir_ty.next_solver.ty.
Position
Below the diagonal: hir_ty.next_solver.infer uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.infer uses hir_ty.next_solver.interner, so a change to hir_ty.next_solver.interner can break hir_ty.next_solver.infer, while a change to hir_ty.next_solver.infer can't break hir_ty.next_solver.interner.
Position
Below the diagonal: hir_ty.next_solver.infer uses a module listed above it, which is the healthy direction.
24→25 hir_ty.next_solver.infer uses hir_ty.next_solver.constspart of a loop✕
Connections
3 pairs of types, where a type in hir_ty.next_solver.infer uses a type in hir_ty.next_solver.consts.
hir_ty.next_solver.infer uses hir_ty.next_solver.consts, so a change to hir_ty.next_solver.consts can break hir_ty.next_solver.infer, while a change to hir_ty.next_solver.infer can't break hir_ty.next_solver.consts.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
24→26 hir_ty.next_solver.infer uses hir_typart of a loop✕
Connections
2 pairs of types, where a type in hir_ty.next_solver.infer uses a type in hir_ty.
hir_ty.next_solver.infer uses hir_ty, so a change to hir_ty can break hir_ty.next_solver.infer, while a change to hir_ty.next_solver.infer can't break hir_ty.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
hir_ty.next_solver.consts uses hir_ty.next_solver.predicate, so a change to hir_ty.next_solver.predicate can break hir_ty.next_solver.consts, while a change to hir_ty.next_solver.consts can't break hir_ty.next_solver.predicate.
Position
Below the diagonal: hir_ty.next_solver.consts uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.consts uses hir_def, so a change to hir_def can break hir_ty.next_solver.consts, while a change to hir_ty.next_solver.consts can't break hir_def.
Position
Below the diagonal: hir_ty.next_solver.consts uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.consts uses hir_def.expr_store.path, so a change to hir_def.expr_store.path can break hir_ty.next_solver.consts, while a change to hir_ty.next_solver.consts can't break hir_def.expr_store.path.
Position
Below the diagonal: hir_ty.next_solver.consts uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.consts uses hir_ty.next_solver.ty, so a change to hir_ty.next_solver.ty can break hir_ty.next_solver.consts, while a change to hir_ty.next_solver.consts can't break hir_ty.next_solver.ty.
Position
Below the diagonal: hir_ty.next_solver.consts uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.consts uses hir_ty.next_solver.interner, so a change to hir_ty.next_solver.interner can break hir_ty.next_solver.consts, while a change to hir_ty.next_solver.consts can't break hir_ty.next_solver.interner.
Position
Below the diagonal: hir_ty.next_solver.consts uses a module listed above it, which is the healthy direction.
hir_ty.next_solver.consts uses hir_ty.next_solver.infer, so a change to hir_ty.next_solver.infer can break hir_ty.next_solver.consts, while a change to hir_ty.next_solver.consts can't break hir_ty.next_solver.infer.
Position
Below the diagonal: hir_ty.next_solver.consts uses a module listed above it, which is the healthy direction.
hir_ty uses hir_ty.next_solver.interner, so a change to hir_ty.next_solver.interner can break hir_ty, while a change to hir_ty can't break hir_ty.next_solver.interner.
Position
Below the diagonal: hir_ty uses a module listed above it, which is the healthy direction.
hir_ty uses hir_ty.next_solver.consts, so a change to hir_ty.next_solver.consts can break hir_ty, while a change to hir_ty can't break hir_ty.next_solver.consts.
Position
Below the diagonal: hir_ty uses a module listed above it, which is the healthy direction.
hir_ide.display uses hir_ty.next_solver.predicate, so a change to hir_ty.next_solver.predicate can break hir_ide.display, while a change to hir_ide.display can't break hir_ty.next_solver.predicate.
Position
Below the diagonal: hir_ide.display uses a module listed above it, which is the healthy direction.
hir_ide.display uses syntax.ast.generated.tokens, so a change to syntax.ast.generated.tokens can break hir_ide.display, while a change to hir_ide.display can't break syntax.ast.generated.tokens.
Position
Below the diagonal: hir_ide.display uses a module listed above it, which is the healthy direction.
hir_ide.display uses base_db.input, so a change to base_db.input can break hir_ide.display, while a change to hir_ide.display can't break base_db.input.
Position
Below the diagonal: hir_ide.display uses a module listed above it, which is the healthy direction.
hir_ide.display uses hir_expand.mod_path, so a change to hir_expand.mod_path can break hir_ide.display, while a change to hir_ide.display can't break hir_expand.mod_path.
Position
Below the diagonal: hir_ide.display uses a module listed above it, which is the healthy direction.
hir_ide.display uses hir_def.expr_store.path, so a change to hir_def.expr_store.path can break hir_ide.display, while a change to hir_ide.display can't break hir_def.expr_store.path.
Position
Below the diagonal: hir_ide.display uses a module listed above it, which is the healthy direction.
hir_ide.display uses hir_ty.next_solver.ty, so a change to hir_ty.next_solver.ty can break hir_ide.display, while a change to hir_ide.display can't break hir_ty.next_solver.ty.
Position
Below the diagonal: hir_ide.display uses a module listed above it, which is the healthy direction.
hir_ide.display uses hir_ty.next_solver.interner, so a change to hir_ty.next_solver.interner can break hir_ide.display, while a change to hir_ide.display can't break hir_ty.next_solver.interner.
Position
Below the diagonal: hir_ide.display uses a module listed above it, which is the healthy direction.
hir_ty.infer uses hir_expand.mod_path, so a change to hir_expand.mod_path can break hir_ty.infer, while a change to hir_ty.infer can't break hir_expand.mod_path.
Position
Below the diagonal: hir_ty.infer uses a module listed above it, which is the healthy direction.
hir_ty.infer uses hir_def.expr_store.path, so a change to hir_def.expr_store.path can break hir_ty.infer, while a change to hir_ty.infer can't break hir_def.expr_store.path.
Position
Below the diagonal: hir_ty.infer uses a module listed above it, which is the healthy direction.
hir_ty.infer uses hir_ty.next_solver.ty, so a change to hir_ty.next_solver.ty can break hir_ty.infer, while a change to hir_ty.infer can't break hir_ty.next_solver.ty.
Position
Below the diagonal: hir_ty.infer uses a module listed above it, which is the healthy direction.
hir_ty.infer uses hir_ty.next_solver.interner, so a change to hir_ty.next_solver.interner can break hir_ty.infer, while a change to hir_ty.infer can't break hir_ty.next_solver.interner.
Position
Below the diagonal: hir_ty.infer uses a module listed above it, which is the healthy direction.
hir_ty.infer uses hir_ty.next_solver.infer, so a change to hir_ty.next_solver.infer can break hir_ty.infer, while a change to hir_ty.infer can't break hir_ty.next_solver.infer.
Position
Below the diagonal: hir_ty.infer uses a module listed above it, which is the healthy direction.
hir_ty.infer uses hir_ty.next_solver.consts, so a change to hir_ty.next_solver.consts can break hir_ty.infer, while a change to hir_ty.infer can't break hir_ty.next_solver.consts.
Position
Below the diagonal: hir_ty.infer uses a module listed above it, which is the healthy direction.
hir.diagnostics uses parser.syntax_kind.generated, so a change to parser.syntax_kind.generated can break hir.diagnostics, while a change to hir.diagnostics can't break parser.syntax_kind.generated.
Position
Below the diagonal: hir.diagnostics uses a module listed above it, which is the healthy direction.
hir.diagnostics uses text_size.range, so a change to text_size.range can break hir.diagnostics, while a change to hir.diagnostics can't break text_size.range.
Position
Below the diagonal: hir.diagnostics uses a module listed above it, which is the healthy direction.
hir.diagnostics uses hir_expand.name, so a change to hir_expand.name can break hir.diagnostics, while a change to hir.diagnostics can't break hir_expand.name.
Position
Below the diagonal: hir.diagnostics uses a module listed above it, which is the healthy direction.
hir.diagnostics uses syntax.ast.generated.tokens, so a change to syntax.ast.generated.tokens can break hir.diagnostics, while a change to hir.diagnostics can't break syntax.ast.generated.tokens.
Position
Below the diagonal: hir.diagnostics uses a module listed above it, which is the healthy direction.
hir.diagnostics uses hir_expand.mod_path, so a change to hir_expand.mod_path can break hir.diagnostics, while a change to hir.diagnostics can't break hir_expand.mod_path.
Position
Below the diagonal: hir.diagnostics uses a module listed above it, which is the healthy direction.
hir.diagnostics uses hir_def.expr_store.path, so a change to hir_def.expr_store.path can break hir.diagnostics, while a change to hir.diagnostics can't break hir_def.expr_store.path.
Position
Below the diagonal: hir.diagnostics uses a module listed above it, which is the healthy direction.
hir.diagnostics uses hir_ty.next_solver.infer, so a change to hir_ty.next_solver.infer can break hir.diagnostics, while a change to hir.diagnostics can't break hir_ty.next_solver.infer.
Position
Below the diagonal: hir.diagnostics uses a module listed above it, which is the healthy direction.
28 pairs of types, where a type in hir.diagnostics uses a type in hir. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
hir.term_search.expr uses hir_expand.mod_path, so a change to hir_expand.mod_path can break hir.term_search.expr, while a change to hir.term_search.expr can't break hir_expand.mod_path.
Position
Below the diagonal: hir.term_search.expr uses a module listed above it, which is the healthy direction.
hir.term_search.expr uses hir_ide.display, so a change to hir_ide.display can break hir.term_search.expr, while a change to hir.term_search.expr can't break hir_ide.display.
Position
Below the diagonal: hir.term_search.expr uses a module listed above it, which is the healthy direction.
30→31 hir.term_search.expr uses hir.semanticspart of a loop✕
Connections
2 pairs of types, where a type in hir.term_search.expr uses a type in hir.semantics.
hir.term_search.expr uses hir.semantics, so a change to hir.semantics can break hir.term_search.expr, while a change to hir.term_search.expr can't break hir.semantics.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
30→32 hir.term_search.expr uses hirpart of a loop✕
Connections
4 pairs of types, where a type in hir.term_search.expr uses a type in hir.
hir.semantics uses text_size.range, so a change to text_size.range can break hir.semantics, while a change to hir.semantics can't break text_size.range.
Position
Below the diagonal: hir.semantics uses a module listed above it, which is the healthy direction.
hir.semantics uses hir_expand.name, so a change to hir_expand.name can break hir.semantics, while a change to hir.semantics can't break hir_expand.name.
Position
Below the diagonal: hir.semantics uses a module listed above it, which is the healthy direction.
32 pairs of types, where a type in hir.semantics uses a type in syntax.ast.generated.nodes. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
hir.semantics uses syntax.ast.generated.nodes, so a change to syntax.ast.generated.nodes can break hir.semantics, while a change to hir.semantics can't break syntax.ast.generated.nodes.
Position
Below the diagonal: hir.semantics uses a module listed above it, which is the healthy direction.
hir.semantics uses syntax.ast.generated.tokens, so a change to syntax.ast.generated.tokens can break hir.semantics, while a change to hir.semantics can't break syntax.ast.generated.tokens.
Position
Below the diagonal: hir.semantics uses a module listed above it, which is the healthy direction.
hir.semantics uses hir_expand.mod_path, so a change to hir_expand.mod_path can break hir.semantics, while a change to hir.semantics can't break hir_expand.mod_path.
Position
Below the diagonal: hir.semantics uses a module listed above it, which is the healthy direction.
hir.semantics uses hir_def.item_tree, so a change to hir_def.item_tree can break hir.semantics, while a change to hir.semantics can't break hir_def.item_tree.
Position
Below the diagonal: hir.semantics uses a module listed above it, which is the healthy direction.
hir.semantics uses hir_def.expr_store.path, so a change to hir_def.expr_store.path can break hir.semantics, while a change to hir.semantics can't break hir_def.expr_store.path.
Position
Below the diagonal: hir.semantics uses a module listed above it, which is the healthy direction.
hir.semantics uses hir.term_search.expr, so a change to hir.term_search.expr can break hir.semantics, while a change to hir.semantics can't break hir.term_search.expr.
Position
Below the diagonal: hir.semantics uses a module listed above it, which is the healthy direction.
hir uses parser.syntax_kind.generated, so a change to parser.syntax_kind.generated can break hir, while a change to hir can't break parser.syntax_kind.generated.
Position
Below the diagonal: hir uses a module listed above it, which is the healthy direction.
39 pairs of types, where a type in hir uses a type in hir_expand.name. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
The types involved
hir.Adt → hir_expand.name.Name
hir.AssocItem → hir_expand.name.Name
hir.BuiltinAttr → hir_expand.name.Name
hir.BuiltinType → hir_expand.name.Name
hir.Const → hir_expand.name.Name
hir.ConstParam → hir_expand.name.Name
hir.CrateDependency → hir_expand.name.Name
hir.DefWithBody → hir_expand.name.Name
hir.DeriveHelper → hir_expand.name.Name
hir.Enum → hir_expand.name.Name
hir.EnumVariant → hir_expand.name.Name
hir.ExternAssocItem → hir_expand.name.Name
hir.ExternCrateDecl → hir_expand.name.Name
hir.Field → hir_expand.name.Name
hir.Function → hir_expand.name.Name
hir.GenericDef → hir_expand.name.Name
hir.GenericParam → hir_expand.name.Name
hir.HasName → hir_expand.name.Name
hir.InlineAsmOperand → hir_expand.name.Name
hir.Label → hir_expand.name.Name
hir.LifetimeParam → hir_expand.name.Name
hir.Local → hir_expand.name.Name
hir.Macro → hir_expand.name.Name
hir.Module → hir_expand.name.Name
hir.ModuleDef → hir_expand.name.Name
Direction
hir uses hir_expand.name, so a change to hir_expand.name can break hir, while a change to hir can't break hir_expand.name.
Position
Below the diagonal: hir uses a module listed above it, which is the healthy direction.
hir uses syntax.ast.generated.nodes, so a change to syntax.ast.generated.nodes can break hir, while a change to hir can't break syntax.ast.generated.nodes.
Position
Below the diagonal: hir uses a module listed above it, which is the healthy direction.
hir uses syntax.ast.generated.tokens, so a change to syntax.ast.generated.tokens can break hir, while a change to hir can't break syntax.ast.generated.tokens.
Position
Below the diagonal: hir uses a module listed above it, which is the healthy direction.
hir uses hir_ty.next_solver.interner, so a change to hir_ty.next_solver.interner can break hir, while a change to hir can't break hir_ty.next_solver.interner.
Position
Below the diagonal: hir uses a module listed above it, which is the healthy direction.
55 pairs of types, where a type in hir uses a type in hir_ide.display. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
ide_assists.assist_context uses edition, so a change to edition can break ide_assists.assist_context, while a change to ide_assists.assist_context can't break edition.
Position
Below the diagonal: ide_assists.assist_context uses a module listed above it, which is the healthy direction.
ide_assists.assist_context uses text_size.size, so a change to text_size.size can break ide_assists.assist_context, while a change to ide_assists.assist_context can't break text_size.size.
Position
Below the diagonal: ide_assists.assist_context uses a module listed above it, which is the healthy direction.
ide_assists.assist_context uses vfs, so a change to vfs can break ide_assists.assist_context, while a change to ide_assists.assist_context can't break vfs.
Position
Below the diagonal: ide_assists.assist_context uses a module listed above it, which is the healthy direction.
ide_assists.assist_context uses parser.syntax_kind.generated, so a change to parser.syntax_kind.generated can break ide_assists.assist_context, while a change to ide_assists.assist_context can't break parser.syntax_kind.generated.
Position
Below the diagonal: ide_assists.assist_context uses a module listed above it, which is the healthy direction.
ide_assists.assist_context uses text_size.range, so a change to text_size.range can break ide_assists.assist_context, while a change to ide_assists.assist_context can't break text_size.range.
Position
Below the diagonal: ide_assists.assist_context uses a module listed above it, which is the healthy direction.
ide_assists.assist_context uses syntax.ast.generated.nodes, so a change to syntax.ast.generated.nodes can break ide_assists.assist_context, while a change to ide_assists.assist_context can't break syntax.ast.generated.nodes.
Position
Below the diagonal: ide_assists.assist_context uses a module listed above it, which is the healthy direction.
ide_assists.assist_context uses syntax.ast.generated.tokens, so a change to syntax.ast.generated.tokens can break ide_assists.assist_context, while a change to ide_assists.assist_context can't break syntax.ast.generated.tokens.
Position
Below the diagonal: ide_assists.assist_context uses a module listed above it, which is the healthy direction.
ide_assists.assist_context uses ide_db.assists, so a change to ide_db.assists can break ide_assists.assist_context, while a change to ide_assists.assist_context can't break ide_db.assists.
Position
Below the diagonal: ide_assists.assist_context uses a module listed above it, which is the healthy direction.
ide_assists.assist_context uses ide_db, so a change to ide_db can break ide_assists.assist_context, while a change to ide_assists.assist_context can't break ide_db.
Position
Below the diagonal: ide_assists.assist_context uses a module listed above it, which is the healthy direction.
ide_assists.assist_context uses hir.semantics, so a change to hir.semantics can break ide_assists.assist_context, while a change to ide_assists.assist_context can't break hir.semantics.
Position
Below the diagonal: ide_assists.assist_context uses a module listed above it, which is the healthy direction.
ide.inlay_hints uses text_size.size, so a change to text_size.size can break ide.inlay_hints, while a change to ide.inlay_hints can't break text_size.size.
Position
Below the diagonal: ide.inlay_hints uses a module listed above it, which is the healthy direction.
ide.inlay_hints uses text_size.range, so a change to text_size.range can break ide.inlay_hints, while a change to ide.inlay_hints can't break text_size.range.
Position
Below the diagonal: ide.inlay_hints uses a module listed above it, which is the healthy direction.
ide.inlay_hints uses syntax.ast.generated.nodes, so a change to syntax.ast.generated.nodes can break ide.inlay_hints, while a change to ide.inlay_hints can't break syntax.ast.generated.nodes.
Position
Below the diagonal: ide.inlay_hints uses a module listed above it, which is the healthy direction.
ide.inlay_hints uses syntax.ast.generated.tokens, so a change to syntax.ast.generated.tokens can break ide.inlay_hints, while a change to ide.inlay_hints can't break syntax.ast.generated.tokens.
Position
Below the diagonal: ide.inlay_hints uses a module listed above it, which is the healthy direction.
ide.inlay_hints uses hir_expand.mod_path, so a change to hir_expand.mod_path can break ide.inlay_hints, while a change to ide.inlay_hints can't break hir_expand.mod_path.
Position
Below the diagonal: ide.inlay_hints uses a module listed above it, which is the healthy direction.
ide.inlay_hints uses hir_ide.display, so a change to hir_ide.display can break ide.inlay_hints, while a change to ide.inlay_hints can't break hir_ide.display.
Position
Below the diagonal: ide.inlay_hints uses a module listed above it, which is the healthy direction.
ide.inlay_hints uses hir.semantics, so a change to hir.semantics can break ide.inlay_hints, while a change to ide.inlay_hints can't break hir.semantics.
Position
Below the diagonal: ide.inlay_hints uses a module listed above it, which is the healthy direction.
ide_completion.context uses edition, so a change to edition can break ide_completion.context, while a change to ide_completion.context can't break edition.
Position
Below the diagonal: ide_completion.context uses a module listed above it, which is the healthy direction.
ide_completion.context uses parser.syntax_kind.generated, so a change to parser.syntax_kind.generated can break ide_completion.context, while a change to ide_completion.context can't break parser.syntax_kind.generated.
Position
Below the diagonal: ide_completion.context uses a module listed above it, which is the healthy direction.
ide_completion.context uses text_size.range, so a change to text_size.range can break ide_completion.context, while a change to ide_completion.context can't break text_size.range.
Position
Below the diagonal: ide_completion.context uses a module listed above it, which is the healthy direction.
ide_completion.context uses hir_expand.name, so a change to hir_expand.name can break ide_completion.context, while a change to ide_completion.context can't break hir_expand.name.
Position
Below the diagonal: ide_completion.context uses a module listed above it, which is the healthy direction.
ide_completion.context uses syntax.ast.generated.nodes, so a change to syntax.ast.generated.nodes can break ide_completion.context, while a change to ide_completion.context can't break syntax.ast.generated.nodes.
Position
Below the diagonal: ide_completion.context uses a module listed above it, which is the healthy direction.
ide_completion.context uses base_db.input, so a change to base_db.input can break ide_completion.context, while a change to ide_completion.context can't break base_db.input.
Position
Below the diagonal: ide_completion.context uses a module listed above it, which is the healthy direction.
ide_completion.context uses hir_def.hir, so a change to hir_def.hir can break ide_completion.context, while a change to ide_completion.context can't break hir_def.hir.
Position
Below the diagonal: ide_completion.context uses a module listed above it, which is the healthy direction.
ide_completion.context uses ide_db, so a change to ide_db can break ide_completion.context, while a change to ide_completion.context can't break ide_db.
Position
Below the diagonal: ide_completion.context uses a module listed above it, which is the healthy direction.
ide_completion.context uses hir_def.expr_store.path, so a change to hir_def.expr_store.path can break ide_completion.context, while a change to ide_completion.context can't break hir_def.expr_store.path.
Position
Below the diagonal: ide_completion.context uses a module listed above it, which is the healthy direction.
ide_completion.context uses hir_ty.next_solver.interner, so a change to hir_ty.next_solver.interner can break ide_completion.context, while a change to ide_completion.context can't break hir_ty.next_solver.interner.
Position
Below the diagonal: ide_completion.context uses a module listed above it, which is the healthy direction.
ide_completion.context uses hir_ide.display, so a change to hir_ide.display can break ide_completion.context, while a change to ide_completion.context can't break hir_ide.display.
Position
Below the diagonal: ide_completion.context uses a module listed above it, which is the healthy direction.
ide_completion.context uses hir.term_search.expr, so a change to hir.term_search.expr can break ide_completion.context, while a change to ide_completion.context can't break hir.term_search.expr.
Position
Below the diagonal: ide_completion.context uses a module listed above it, which is the healthy direction.
ide_completion.context uses hir.semantics, so a change to hir.semantics can break ide_completion.context, while a change to ide_completion.context can't break hir.semantics.
Position
Below the diagonal: ide_completion.context uses a module listed above it, which is the healthy direction.
ide_db.defs uses syntax.ast.generated.nodes, so a change to syntax.ast.generated.nodes can break ide_db.defs, while a change to ide_db.defs can't break syntax.ast.generated.nodes.
Position
Below the diagonal: ide_db.defs uses a module listed above it, which is the healthy direction.
ide_db.defs uses syntax.ast.generated.tokens, so a change to syntax.ast.generated.tokens can break ide_db.defs, while a change to ide_db.defs can't break syntax.ast.generated.tokens.
Position
Below the diagonal: ide_db.defs uses a module listed above it, which is the healthy direction.
ide_diagnostics uses text_size.range, so a change to text_size.range can break ide_diagnostics, while a change to ide_diagnostics can't break text_size.range.
Position
Below the diagonal: ide_diagnostics uses a module listed above it, which is the healthy direction.
ide_diagnostics uses syntax.ast.generated.nodes, so a change to syntax.ast.generated.nodes can break ide_diagnostics, while a change to ide_diagnostics can't break syntax.ast.generated.nodes.
Position
Below the diagonal: ide_diagnostics uses a module listed above it, which is the healthy direction.
ide_diagnostics uses syntax.ast.generated.tokens, so a change to syntax.ast.generated.tokens can break ide_diagnostics, while a change to ide_diagnostics can't break syntax.ast.generated.tokens.
Position
Below the diagonal: ide_diagnostics uses a module listed above it, which is the healthy direction.
ide_diagnostics uses ide_db.assists, so a change to ide_db.assists can break ide_diagnostics, while a change to ide_diagnostics can't break ide_db.assists.
Position
Below the diagonal: ide_diagnostics uses a module listed above it, which is the healthy direction.
ide_diagnostics uses hir_ide.display, so a change to hir_ide.display can break ide_diagnostics, while a change to ide_diagnostics can't break hir_ide.display.
Position
Below the diagonal: ide_diagnostics uses a module listed above it, which is the healthy direction.
ide_diagnostics uses hir.semantics, so a change to hir.semantics can break ide_diagnostics, while a change to ide_diagnostics can't break hir.semantics.
Position
Below the diagonal: ide_diagnostics uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in ide uses a type in syntax.ast.generated.tokens.
The types involved
ide.Analysis → syntax.ast.generated.tokens.String
Direction
ide uses syntax.ast.generated.tokens, so a change to syntax.ast.generated.tokens can break ide, while a change to ide can't break syntax.ast.generated.tokens.
Position
Below the diagonal: ide uses a module listed above it, which is the healthy direction.
ide_completion.completions uses hir_expand.name, so a change to hir_expand.name can break ide_completion.completions, while a change to ide_completion.completions can't break hir_expand.name.
Position
Below the diagonal: ide_completion.completions uses a module listed above it, which is the healthy direction.
ide_completion.completions uses hir_expand.mod_path, so a change to hir_expand.mod_path can break ide_completion.completions, while a change to ide_completion.completions can't break hir_expand.mod_path.
Position
Below the diagonal: ide_completion.completions uses a module listed above it, which is the healthy direction.
ide_completion.completions uses hir.term_search.expr, so a change to hir.term_search.expr can break ide_completion.completions, while a change to ide_completion.completions can't break hir.term_search.expr.
Position
Below the diagonal: ide_completion.completions uses a module listed above it, which is the healthy direction.
ide_completion.completions uses hir, so a change to hir can break ide_completion.completions, while a change to ide_completion.completions can't break hir.
Position
Below the diagonal: ide_completion.completions uses a module listed above it, which is the healthy direction.
ide_completion.completions uses ide_completion.context, so a change to ide_completion.context can break ide_completion.completions, while a change to ide_completion.completions can't break ide_completion.context.
Position
Below the diagonal: ide_completion.completions uses a module listed above it, which is the healthy direction.
rust_analyzer.global_state uses vfs, so a change to vfs can break rust_analyzer.global_state, while a change to rust_analyzer.global_state can't break vfs.
Position
Below the diagonal: rust_analyzer.global_state uses a module listed above it, which is the healthy direction.
rust_analyzer.global_state uses syntax.ast.generated.tokens, so a change to syntax.ast.generated.tokens can break rust_analyzer.global_state, while a change to rust_analyzer.global_state can't break syntax.ast.generated.tokens.
Position
Below the diagonal: rust_analyzer.global_state uses a module listed above it, which is the healthy direction.
rust_analyzer.global_state uses base_db.input, so a change to base_db.input can break rust_analyzer.global_state, while a change to rust_analyzer.global_state can't break base_db.input.
Position
Below the diagonal: rust_analyzer.global_state uses a module listed above it, which is the healthy direction.
rust_analyzer.global_state uses ide_db, so a change to ide_db can break rust_analyzer.global_state, while a change to rust_analyzer.global_state can't break ide_db.
Position
Below the diagonal: rust_analyzer.global_state uses a module listed above it, which is the healthy direction.
rust_analyzer.global_state uses ide_diagnostics, so a change to ide_diagnostics can break rust_analyzer.global_state, while a change to rust_analyzer.global_state can't break ide_diagnostics.
Position
Below the diagonal: rust_analyzer.global_state uses a module listed above it, which is the healthy direction.
rust_analyzer.global_state uses ide, so a change to ide can break rust_analyzer.global_state, while a change to rust_analyzer.global_state can't break ide.
Position
Below the diagonal: rust_analyzer.global_state uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 62% · Adequate · gated by D2, X4 ·
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:2025 — Software Supply Chain Failures
24
High / Critical
A05:2025 — Injection
14
High / Critical
A02:2025 — Security Misconfiguration
2
High / Critical
Roadmap
Top priorities: Resolve the 1 No ADRs found finding(s) in ADR Quality — start with main.rs; Interpolated log message defeats structured logging; Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with main.rs.
Code Duplication: Edited copy of a member (12 corresponding lines)
xtask/src/codegen/diagnostics_docs.rs
5.9
Mixed
Code Duplication: Edited copy of a member (27 corresponding lines)
crates/intern/src/gc.rs
5.9
Mixed
Code Duplication: Edited copy of a member (9 corresponding lines)
crates/hir-ty/src/mir/eval/shim.rs
6.0
Mixed
Explicit Debt: FixmeComment
How the grades work
Every finding carries one of four grades. Three say how serious it is. The fourth says this
survey could not settle it — and it is a grade, not a gap.
Critical — 23
A definite problem that already costs you something and drags the score down: a
missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here
tends to cause failures elsewhere.
Serious — 2979
Likely wrong, but not failing yet. It degrades
the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to
carry for two years either.
Minor — 130
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 15
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey 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. All 62 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.
Every figure here is one of two 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. 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.
What we checked — 62 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, 3069 of 3132 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 or a scanner, 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.
D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This repository declares 1 of its own test(s) unreliable. The built-in reliability runner does not support this repository's ecosystem (.rs, .ts), so the suite was not re-run and no reliability score is given — these are the repository's own declarations, not our measurement.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
D27 Navigability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
AX6 Interface segregation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via REDACTED (REDACTED). the image ran but published no HTTP port — nothing to crawl (EXPOSE the web port to unlock runtime evidence).
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Python, Rust is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python, Rust is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X13 Undrained process stream — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X17 Uncapped recursion over a caller-supplied document — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X18 Disposal-pattern correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X23 Unguarded diagnostic materialisation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X24 Document value interpolated into markup unescaped — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X3 Exception handling — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X4 Structured logging — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 197 further occurrence(s) are not listed individually; the score already reflects all 237.
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
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D8 Code Coverage: Coverage is measured by building and running the test suite inside our isolated image — the target repo is never modified, and nothing on your systems runs. So coverage exists only when the suite builds and runs within the inline time budget; one that needs external services, can't build, or exceeds the budget yields no coverage (D8 then degrades to not-measured, not a low score). Line coverage also says nothing about assertion quality.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D23 Boundary Type-Coupling: Boundary leakage is detected from type references across detected contexts — leaks that flow through primitives, serialization or shared infrastructure may not surface as a typed reference.
D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
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.
287 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was Evaluator::exec_intrinsic at 197. A further 60 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being HlTag::as_str at 60 — they are counted neither in the figure above nor in this dimension's score. 20 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: crates/ide/src/syntax_highlighting/tags.rs (HlTag::as_str at 60), crates/rust-analyzer/src/lsp/semantic_tokens.rs (SupportedType::fmt at 58), xtask/src/codegen/grammar.rs (Field::method_name at 33), crates/syntax/src/ast/expr_ext.rs (BinExpr::op_details at 30), crates/hir-ty/src/lang_items.rs (hir_ty::lang_items::lang_items_for_bin_op at 28), and 15 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.
+ 81 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 3 bodies over 120 down to 120 or less in Cyclomatic Complexity — start with Evaluator::exec_intrinsic (cyclomatic 197), ide_completion::context::analysis::classify_name_ref (cyclomatic 153), MirLowerCtx::lower_expr_to_place_without_adjust (cyclomatic 131). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 3 together lifts Cyclomatic Complexity from 5.3 to about 5.8/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
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.
+ 123 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 9 bodies over 120 down to 120 or less in Cognitive Complexity — start with Evaluator::exec_intrinsic (cognitive 213), MirLowerCtx::lower_expr_to_place_without_adjust (cognitive 208), ide_completion::context::analysis::classify_name_ref (cognitive 172). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 9 together lifts Cognitive Complexity from 3.7 to about 4.7/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.5 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 99 FileTooLong finding(s) in God Classes — start with lib.rs (7), lower.rs (3), display.rs (2). — One of this dimension's main actionable groups (99 warning-level).
Resolve the 71 MethodTooLong finding(s) in God Classes — start with lower.rs (7), eval.rs (5), analysis_stats.rs (5). — One of this dimension's main actionable groups (71 warning-level).
Resolve the 60 FunctionTooLong finding(s) in God Classes — start with analysis.rs (4), display.rs (3), highlight.rs (3). — One of this dimension's main actionable groups (60 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
445 duplicated block group(s) detected. 3.6 % of the production lines (16,283 of 449,914) are in a reported copy. A further 284 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 3 of the 729 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
+ 184 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 50 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with shim.rs (5), gen_trait_fn_body.rs (4), lib.rs (3). — One of this dimension's main actionable groups (50 warning-level).
Resolve the 43 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with lower.rs (3), display.rs (2), convert_named_struct_to_tuple_struct.rs (2). — One of this dimension's main actionable groups (43 warning-level).
Resolve the 36 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with item_scope.rs (2), source_analyzer.rs (2), signature_help.rs (2). — One of this dimension's main actionable groups (36 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling7.3 / 10Strong✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
46 production modules (Cargo+npm), 0 dependency cycle(s), 6 unstable depended-on module(s). Read from the build's own module declarations; 8 module(s) off the main sequence, with abstractness counted on 43 of the 46 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).
Off the main sequence: edition · ×8
Unstable project hir-ide
Unstable project ide
Unstable project ide-diagnostics
Unstable project load-cargo
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 8 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (8 warning-level).
Resolve the 1 Unstable project hir-ide finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Unstable project ide finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 8 Low cohesion finding(s) in Cohesion (LCOM4) — start with lib.rs (3), completions.rs, config.rs. — One of this dimension's main actionable groups (8 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the code is actually exercised by tests.
Method: Coverage from the analyzer's own run of the suite, computed per-file with structured exclusions for generated, trivial, and glue code. A coverage report found in the repository is never read. When the suite can't be built/run in-image, coverage is reported NOT-MEASURED (excluded from the score) with the precondition to make it measurable — never a LoC-ratio proxy folded in as if measured. Deterministic.
Line coverage 79.2% — 116 file(s) below 50%. Measured from the Rust suite (repository root: `cargo test --workspace` instrumented over 827 production file(s), 57 test binaries and 9 doc-test binaries).
Resolve the 116 Low coverage finding(s) in Code Coverage — start with lib.rs (10), msg.rs (3), main.rs (3). — One of this dimension's main actionable groups (116 warning-level).
Detailed fixes: d8_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
30 outdated, 0 yanked direct Cargo dependencies. 93 of 99 direct crates were graded against crates.io (0 not published there, 6 not resolved by a committed REDACTED). Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.
Outdated: anyhow · ×30
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 266 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's REDACTED closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. This repository publishes itself under MIT OR Apache-2.0, which is its own choice and is not judged here.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Top hotspots: crates/ide-completion/src/context/analysis.rs (14×153=2142); crates/hir-ty/src/mir/lower.rs (10×131=1310); crates/hir-ty/src/mir/eval.rs (13×100=1300) Repeated repair below the complexity floor: crates/stdx/src/tempfile.rs (4 of 6 changes were fixes); crates/ide-diagnostics/src/handlers/type_mismatch.rs (3 of 5 changes were fixes); crates/ide-completion/src/completions/mod_.rs (3 of 4 changes were fixes)
Resolve the 33 Hotspot finding(s) in Churn × Complexity Hotspots — start with lower.rs (3), lib.rs (3), expr.rs (2). — One of this dimension's main actionable groups (33 warning-level).
Resolve the 3 Repeated repair finding(s) in Churn × Complexity Hotspots — start with tempfile.rs, type_mismatch.rs, mod_.rs. — One of this dimension's main actionable groups (3 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor9.5 / 10Exemplary✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
37 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is crates/hir-ty/src/next_solver/infer/region_constraints/mod.rs. Counted over 751 of the 1439 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Off-boarding risk: anonymized user #1 · ×4
Further sole-owners (lower concentration)
✓ On the Gold path — maintain.
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
1027 deducted task-comment markers across 449914 LoC (0.2/KLoC) → score 9.5. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
FixmeComment repeated across 16 filescrates/syntax/src/fuzz.rs:70
What to do
Resolve the 926 FixmeComment finding(s) in Explicit Debt — start with lib.rs (67), lower.rs (37), infer.rs (23). — One of this dimension's main actionable groups (926 warning-level).
Resolve the 32 XxxComment finding(s) in Explicit Debt — start with decl_check.rs (5), config.rs (2), flat.rs (2). — One of this dimension's main actionable groups (32 warning-level).
Resolve the 26 HackComment finding(s) in Explicit Debt — start with source_analyzer.rs (5), matcher.rs (3), range.rs (2). — One of this dimension's main actionable groups (26 warning-level).
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
0 of 1 documentation facets pass in full; short on: F2 example. 37 document(s) read across 3 unit(s).
Documentation: no build, run or usage exampleREADME.md:1
What to do
Resolve the 1 Documentation 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 Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
What it measures: Whether domain types (IDs, enums, value objects) leak across bounded-context boundaries.
Method: Cross-context domain-type leakage via Roslyn structural classification (strongly-typed IDs / value objects) over every public surface. Exhaustive, deterministic, type-level aggregate-boundary check.
Coverage: Bounded contexts derived from NAMESPACE prefix (or graph-inferred where available); cross-boundary domain-type leakage then checked exhaustively over every public member of every type.
What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).
Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.
Resolve the 1 redundant comment finding(s) in Comment Value — start with commands.ts. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d24_recommendation.md · top locations in Appendix A, every location in findings.md.
8 of 43 build units (Cargo, npm) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
14 finding(s): 0 critical, 14 high, 0 medium, 0 low. 2 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 7 file(s) — `crates/hir-ty/src/next_solver/infer/mod.rs` (line 528), `crates/hir/src/lib.rs` (line 4541, line 4555, line 4638, …), `crates/rust-analyzer/src/handlers/dispatch.rs` (line 111, line 112, line 140, …), `crates/stdx/src/thin_map.rs` (lines 56–60, lines 61–65, lines 92–93, …), `crates/syntax-bridge/src/lib.rs` (line 221), … (+2 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 2 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 3 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4). — One of this dimension's main actionable groups (4 issue-level).
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 2 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
Resolve the 1 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 2 Medium advisory (unsound) finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 warning-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 1 High IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Medium IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
26 of 751 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is crates/ide/src/file_structure.rs. Counted over 751 of the 1439 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Resolve the 3 Orphaned knowledge finding(s) in Knowledge Freshness — start with file_structure.rs, view_syntax_tree.rs, notes.rs. — One of this dimension's main actionable groups (3 issue-level).
Resolve the 23 Orphaned file finding(s) in Knowledge Freshness — start with convert_comment_from_or_to_doc.rs, toggle_async_sugar.rs, syntax_tree_provider.ts. — One of this dimension's main actionable groups (23 recommendation-level).
Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 9 Change coupling finding(s) in Change Coupling — start with lower.rs (3), expander.rs (2), rust_analyzer_span.rs. — One of this dimension's main actionable groups (9 warning-level).
Resolve the 1 Change-coupling hub finding(s) in Change Coupling — start with mutability.rs. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
+ 5 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 3 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (3 warning-level).
Resolve the 2 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).
Resolve the 2 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 0 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Do you agree with this assessment?
AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified
Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.
Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.
Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.
Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.
Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
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
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary✓ Tool-verified
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
1 public type in `hir.diagnostics` is marked as implementation by its own namespace, folder or name: `IncoherentImpl` (crates/hir/src/diagnostics.rs:523, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — crates/hir/src/diagnostics.rs:523
1 public type in `hir.semantics` is marked as implementation by its own namespace, folder or name: `SemanticsImpl` (crates/hir/src/semantics.rs:171, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — crates/hir/src/semantics.rs:171
What to do
Hide `hir.diagnostics` (`IncoherentImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `hir.semantics` (`SemanticsImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Do you agree with this assessment?
P2 · Observability6.3 / 10Adequate✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Only 24/31 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `crates/mbe`, `crates/proc-macro-srv-cli`, `crates/syntax-bridge`, `crates/test-utils`, `lib/expect-test/xtask` and 2 more.
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
Add a health-check endpoint (a /health route on your axum/actix router) so orchestrators and load balancers can probe liveness/readiness.
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.
`.github/actions/github-release/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — .github/actions/github-release/package.json:5
What to do
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
What to do
Make sure a person approves each release. The release job names an environment, but its approval rules live in the code host's settings, where we can't see them. Check that a reviewer must approve each release, or publish releases as drafts first, so a bad build can be stopped before anyone downloads it.
Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.
Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Do you agree with this assessment?
R1 · Type Safety10.0 / 10Exemplary✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.
editors/code/src/commands.ts:210 · editors/code/src/commands.ts:247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — editors/code/src/commands.ts:210
editors/code/src/commands.ts:722 · editors/code/src/commands.ts:786 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — editors/code/src/commands.ts:722
editors/code/src/commands.ts:622 · editors/code/src/commands.ts:727 · editors/code/src/commands.ts:791 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. — editors/code/src/commands.ts:622
editors/code/src/commands.ts:648 · editors/code/src/commands.ts:817 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — editors/code/src/commands.ts:648
editors/code/src/commands.ts:1015 · editors/code/src/commands.ts:1050 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — editors/code/src/commands.ts:1015
editors/code/src/commands.ts:1041 · editors/code/src/commands.ts:1066 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — editors/code/src/commands.ts:1041
editors/code/src/commands.ts:102 · editors/code/src/commands.ts:279 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — editors/code/src/commands.ts:102
REDACTED:203 · editors/code/src/ctx.ts:223 — the two spans are one implementation copied and then locally edited — 58 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — REDACTED:203
editors/code/src/commands.ts:55 · editors/code/src/commands.ts:770 · editors/code/src/commands.ts:836 · editors/code/src/commands.ts:949 — all 4 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — editors/code/src/commands.ts:55
editors/code/src/commands.ts:767 · editors/code/src/commands.ts:833 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — editors/code/src/commands.ts:767
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Architecture — Conformance to the detected frontend architecture layout (feature-sliced / layered src) plus cross-package deep-import rules (D-386).
Method: Conformance to the detected frontend layout (feature-sliced / layered src) plus cross-package deep-import rules, over the module graph. Deterministic.
editors/code/src/client.ts:5 imports vscode-languageclient/lib/common/utils/is, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — editors/code/src/client.ts:5
editors/code/src/config.ts:1 imports vscode-languageclient/lib/common/utils/is, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — editors/code/src/config.ts:1
What to do
Fix the listed violations: import through public entries (package exports / slice index), never reach into another layer or package's internals.
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
getDebugConfiguration has cyclomatic complexity 20 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — editors/code/src/debug.ts:81
toggleCheckOnSave has cyclomatic complexity 16 and cognitive complexity 15; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — editors/code/src/config.ts:305
getServer has cyclomatic complexity 15 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:36
(anonymous) has cyclomatic complexity 15 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — editors/code/src/client.ts:60
substituteVariablesInEnv has cyclomatic complexity 13 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — editors/code/src/config.ts:482
Do you agree with this assessment?
R3 · Large Files4.3 / 10Weak✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
editors/code/src/commands.ts has 1400 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — editors/code/src/commands.ts:1
editors/code/src/ctx.ts has 572 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — editors/code/src/ctx.ts:1
editors/code/src/config.ts has 546 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — editors/code/src/config.ts:1
What to do
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Do you agree with this assessment?
R4 · Test Coverage10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.
Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.
React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).
Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.
Do you agree with this assessment?
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.
Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.
Do you agree with this assessment?
R7 · Dead Code9.9 / 10Exemplary✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
Nothing imports this binding — it is safe to review for removal. (×2) — editors/code/src/lsp_ext.ts:160, REDACTED:236
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.
Declared in editors/code/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
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.
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.
`warn!` at line 372 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/vfs-notify/src/lib.rs:372
`info!` at line 43 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/stdx/src/tempfile.rs:43
`info!` at line 67 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/stdx/src/tempfile.rs:67
`info!` at line 1216 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/config.rs:1216
`info!` at line 1240 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/config.rs:1240
`info!` at line 1318 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/config.rs:1318
`info!` at line 1360 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/config.rs:1360
`info!` at line 1807 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/config.rs:1807
`error!` at line 1809 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/config.rs:1809
`error!` at line 2302 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/config.rs:2302
`warn!` at line 3665 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/config.rs:3665
`warn!` at line 3694 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/config.rs:3694
`error!` at line 692 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/flycheck.rs:692
`error!` at line 511 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/global_state.rs:511
`info!` at line 42 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. (×2) — crates/rust-analyzer/src/main_loop.rs:42, crates/rust-analyzer/src/session.rs:42
`warn!` at line 633 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/main_loop.rs:633
`trace!` at line 691 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `trace!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/main_loop.rs:691
`trace!` at line 787 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `trace!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/main_loop.rs:787
`error!` at line 885 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/main_loop.rs:885
`error!` at line 941 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/main_loop.rs:941
`error!` at line 1238 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/main_loop.rs:1238
`info!` at line 712 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/reload.rs:712
`error!` at line 721 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/reload.rs:721
`info!` at line 54 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/session.rs:54
`info!` at line 79 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/session.rs:79
`error!` at line 78 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/lsp/utils.rs:78
`error!` at line 86 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/lsp/utils.rs:86
`debug!` at line 131 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/lsp/utils.rs:131
`error!` at line 226 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/handlers/dispatch.rs:226
`error!` at line 440 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/handlers/dispatch.rs:440
`error!` at line 77 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/handlers/notification.rs:77
`trace!` at line 83 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `trace!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/handlers/notification.rs:83
`error!` at line 145 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/handlers/notification.rs:145
`debug!` at line 242 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/handlers/notification.rs:242
`error!` at line 247 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/handlers/notification.rs:247
`error!` at line 527 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/handlers/notification.rs:527
`error!` at line 274 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/handlers/request.rs:274
`error!` at line 248 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rust-analyzer/src/cli/scip.rs:248
`error!` at line 148 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/project-model/src/build_dependencies.rs:148
Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
~1.7 `!` null assertions per 1k TypeScript source lines — 12 assertion(s) across the 7054 source line(s) of the 20 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: editors/code/src/dependencies_provider.ts (3), editors/code/src/client.ts (2), editors/code/src/commands.ts (2). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
What to do
The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).
Do you agree with this assessment?
Reference — by lens
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 5 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
D11 Test Reliability — 1 observation(s) recorded · This repository declares 1 of its own test(s) unreliable. The built-in reliability runner does not support this repository's ecosystem (.rs, .ts), so the suite was not re-run and no reliability score is given — these are the repository's own declarations, not our measurement.
P12 CI test-gate honesty — 1 observation(s) recorded · Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
SC1 Supply-chain hygiene — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X10 Duplicated predicate — 3 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 11 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 61 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — Frontend below the scale floor (15 DOM element(s) < 25) — too little surface to assess accessibility.
AC2 Forms & labels — Frontend below the scale floor (15 DOM element(s) < 25) — too little surface to assess accessibility.
AC3 Page structure — Frontend below the scale floor (15 DOM element(s) < 25) — too little surface to assess accessibility.
AC4 Keyboard semantics — Frontend below the scale floor (15 DOM element(s) < 25) — too little surface to assess accessibility.
AC5 ARIA correctness — Frontend below the scale floor (15 DOM element(s) < 25) — too little surface to assess accessibility.
AC6 Visual & motion safety — Frontend below the scale floor (15 DOM element(s) < 25) — too little surface to assess accessibility.
AX1 Captive dependencies — Not applicable: this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one; this repository's TypeScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX6 Interface segregation — AX6 reached only 1% of this repository's production lines — rust (443,396 lines), python (118 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — the image ran but published no HTTP port — nothing to crawl (EXPOSE the web port to unlock runtime evidence) This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
C1 Data Protection — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no data at rest for these controls to protect.
C2 Access Controls — No access-control surface detected in the analyzed source — this repository starts no server another machine can reach (no actix-web HttpServer, axum::serve, Rocket launch, warp::serve, poem or salvo Server, tonic Server::builder, hyper or tiny_http server outside examples and tests, none bound beyond loopback). Access control is therefore N/A here — a crate is authorized by the application that serves it, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data whose lifetime a retention limit would bound.
C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data for a data subject to erase, export or consent over.
D10 Test Quality — ~59194 lines of test source are present (.rs, .ts) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
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.
D21 Naming Consistency — D21 withholds its case and prefix conventions rows: 3 candidate(s) found and not reported.
D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust surface was not measured.
D25 ADR Conformance — no ADRs to check
D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.rs), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
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.
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
DM1 Domain Modelling — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 2 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit); 279 value object(s)
ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows only 1 of the 3 signals this lens looks for (2 aggregate(s) with Apply/When folds)
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JavaScript/TypeScript, Python, Rust source, so there is no service whose uptime a failing dependency could take down
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — coverage data present for 827 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
S1 Web-Security Posture — No web surface: 816 Rust file(s) were read for weak hashes and ciphers, key material fixed in the source, disabled TLS certificate validation and obsolete TLS versions, and none was found. This repository serves no HTTP of its own — no HTTP-server crate (actix-web, axum, Rocket, warp, poem, tide, salvo, tonic, a hyper server, …) among its Cargo manifests' run-time dependencies, and no server started in its production source — so HTTPS enforcement, HSTS, cookie flags and input validation are N/A here, as they are for a C# library or worker. If this codebase starts serving HTTP, the dimension reactivates automatically.
X12 Unreachable branch — X12 reached only 1% of this repository's production lines — rust (443,396 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X13 Undrained process stream — X13 reached only 1% of this repository's production lines — rust (443,396 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X16 Unfloored truncation loop — X16 reached only 1% of this repository's production lines — rust (443,396 lines), python (118 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X17 Uncapped recursion over a caller-supplied document — X17 reached only 1% of this repository's production lines — rust (443,396 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X18 Disposal-pattern correctness — X18 reached only 1% of this repository's production lines — rust (443,396 lines), python (118 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X2 Cancellation propagation — no C# was loaded; this repository's Python and Rust were read, and no request in it can be cancelled by a caller — a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation; a Rust request takes no token: a future is cancelled by dropping it, from outside the call (select!, a timeout, an aborted task), and reqwest, hyper and tonic take none
X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X23 Unguarded diagnostic materialisation — X23 reached only 1% of this repository's production lines — rust (443,396 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X24 Document value interpolated into markup unescaped — X24 reached only 1% of this repository's production lines — rust (443,396 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X25 Inert configuration knob — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X27 Collection changed while being enumerated — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X3 Exception handling — X3 reached only 1% of this repository's production lines — rust (443,396 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
Orphaned knowledge crates/ide/src/file_structure.rs:1— 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 crates/ide/src/view_syntax_tree.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge xtask/src/publish/notes.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
D11 · Test Reliability· Test declared unreliable · ×1
Test declared unreliable: ratoml_inherit_config_from_ws_root crates/rust-analyzer/tests/slow-tests/ratoml.rs:453— This test is disabled or skipped with a reason naming unreliability — the repository's own words: "flaky test that tends to hang". A test that is skipped for flakiness is neither passing nor protecting the code it covers; either stabilise it or delete it, but do not leave it disabled indefinitely. (Found by reading the repository's own test source — the suite itself was not re-run, since the reliability runner does not support this ecosystem.)
FixmeComment xtask/src/dist.rs:258— // FIXME: find a way to bring this back — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment xtask/src/pgo.rs:86— // FIXME: switch to `--revision` here around 2035 or so — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment lib/expect-test/src/lib.rs:143— // FIXME: fix the lints — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment editors/code/src/client.ts:66— // FIXME: We currently emit this diagnostic way too early, before we have — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment editors/code/src/commands.ts:1120— // FIXME: this is a workaround until vscode-languageclient supports doing the SnippeTextEdit conversion itself — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment editors/code/src/config.ts:481— // FIXME: Merge this with `substituteVSCodeVariables` above — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment editors/code/src/ctx.ts:421— // FIXME: We should re-use the client, that is ctx.deactivate() if none of the configs have changed — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment editors/code/src/main.ts:163— // FIXME: We should re-use the client, that is ctx.deactivate() if none of the configs have changed — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment editors/code/src/debug.ts:198— // FIXME: Neither crates\rust-analyzer\src\main_loop\handlers.rs — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment editors/code/src/main.ts:14— // FIXME: this should be non-optional — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment editors/code/src/tasks.ts:54— // FIXME: The server should provide this — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment editors/code/src/toolchain.ts:158— // FIXME: The server should provide this — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment editors/code/src/tasks.ts:128— // FIXME: The server should provide cargo — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment editors/code/src/test_explorer.ts:126— // FIXME(hack_recover_crate_name): We eagerly resolve every test if we got a lazy top level response (detected — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/test-fixture/src/lib.rs:295— // FIXME: This is less than ideal — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/hir-def/src/nameres/tests/incremental.rs:82— // FIXME: This is less than ideal — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/syntax-bridge/src/lib.rs:26— // FIXME: we probably should re-think `token_tree_to_syntax_node` interfaces — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/syntax-bridge/src/lib.rs:272— // FIXME: record an error somewhere if we're closing more than one tree here? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/syntax-bridge/src/lib.rs:298— // FIXME: this might still be an unmatched closing delimiter? Maybe we should assert here — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/syntax-bridge/src/lib.rs:355— // FIXME: record an error somewhere? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/syntax-bridge/src/lib.rs:885— // FIXME: Span splitting — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/syntax-bridge/src/lib.rs:1017— // FIXME: Emitting whitespace for this is really just a hack, we should get rid of it. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/syntax-bridge/src/prettify_macro_expansion.rs:116— // FIXME: this branch is for `=>` in macro_rules!, which is currently parsed as — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/syntax/src/lib.rs:164— // FIXME: validation errors are not handled here — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/syntax/src/validation.rs:23— // FIXME: — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FileTooLong: expr_store/lower.rs crates/hir-def/src/expr_store/lower.rs— FileTooLong — 2645 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 81% of them inside a single declaration: ExprCollector (3 blocks, 508-3766). The bar is 500 significant lines; this is 2145 over it, 5.29× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: mir/eval.rs crates/hir-ty/src/mir/eval.rs— FileTooLong — 2498 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 82% of them inside a single declaration: Evaluator (2 blocks, 166-3070). The bar is 500 significant lines; this is 1998 over it, 5.00× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: src/config.rs crates/rust-analyzer/src/config.rs— FileTooLong — 2416 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1916 over it, 4.83× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/lower.rs crates/hir-ty/src/lower.rs— FileTooLong — 2096 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 46 free functions. The bar is 500 significant lines; this is 1596 over it, 4.19× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/display.rs crates/hir-ide/src/display.rs— FileTooLong — 2039 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1539 over it, 4.08× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: handlers/request.rs crates/rust-analyzer/src/handlers/request.rs— FileTooLong — 1948 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 80 free functions. The bar is 500 significant lines; this is 1448 over it, 3.90× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/semantics.rs crates/hir/src/semantics.rs— FileTooLong — 1903 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1403 over it, 3.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: nameres/collector.rs crates/hir-def/src/nameres/collector.rs— FileTooLong — 1813 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1313 over it, 3.63× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: mir/lower.rs crates/hir-ty/src/mir/lower.rs— FileTooLong — 1698 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 79% of them inside a single declaration: MirLowerCtx (2 blocks, 78-1941). The bar is 500 significant lines; this is 1198 over it, 3.40× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: src/infer.rs crates/hir-ty/src/infer.rs— FileTooLong — 1695 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1195 over it, 3.39× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: next_solver/interner.rs crates/hir-ty/src/next_solver/interner.rs— FileTooLong — 1640 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1140 over it, 3.28× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/source_analyzer.rs crates/hir/src/source_analyzer.rs— FileTooLong — 1616 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 74% of them inside a single declaration: SourceAnalyzer (2 blocks, 77-1752). The bar is 500 significant lines; this is 1116 over it, 3.23× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: syntax_factory/constructors.rs crates/syntax/src/ast/syntax_factory/constructors.rs— FileTooLong — 1578 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 99% of them inside a single declaration: SyntaxFactory (2 blocks, 15-2414). The bar is 500 significant lines; this is 1078 over it, 3.16× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: src/diagnostics.rs crates/hir/src/diagnostics.rs— FileTooLong — 1551 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1051 over it, 3.10× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: lsp/to_proto.rs crates/rust-analyzer/src/lsp/to_proto.rs— FileTooLong — 1541 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 52 free functions. The bar is 500 significant lines; this is 1041 over it, 3.08× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: context/analysis.rs crates/ide-completion/src/context/analysis.rs— FileTooLong — 1511 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1011 over it, 3.02× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: handlers/extract_function.rs crates/ide-assists/src/handlers/extract_function.rs— FileTooLong — 1452 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 36 free functions. The bar is 500 significant lines; this is 952 over it, 2.90× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/workspace.rs crates/project-model/src/workspace.rs— FileTooLong — 1398 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 898 over it, 2.80× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: infer/expr.rs crates/hir-ty/src/infer/expr.rs— FileTooLong — 1372 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 97% of them inside a single declaration: InferenceContext (55-2170). The bar is 500 significant lines; this is 872 over it, 2.74× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: method_resolution/probe.rs crates/hir-ty/src/method_resolution/probe.rs— FileTooLong — 1220 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 720 over it, 2.44× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: cli/analysis_stats.rs crates/rust-analyzer/src/cli/analysis_stats.rs— FileTooLong — 1213 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 86% of them inside a single declaration: AnalysisStats (51-1481). The bar is 500 significant lines; this is 713 over it, 2.43× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: eval/shim.rs crates/hir-ty/src/mir/eval/shim.rs— FileTooLong — 1196 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 98% of them inside a single declaration: Evaluator (30-1627). The bar is 500 significant lines; this is 696 over it, 2.39× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: builtin/derive_macro.rs crates/hir-expand/src/builtin/derive_macro.rs— FileTooLong — 1111 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 611 over it, 2.22× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/lib.rs crates/hir-expand/src/lib.rs— FileTooLong — 1072 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 572 over it, 2.14× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: hover/render.rs crates/ide/src/hover/render.rs— FileTooLong — 1035 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 535 over it, 2.07× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
MethodTooLong: MirLowerCtx.lower_expr_to_place_without_adjust crates/hir-ty/src/mir/lower.rs:370— MethodTooLong — lower_expr_to_place_without_adjust runs 681 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 581 over it, 6.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Evaluator.exec_intrinsic crates/hir-ty/src/mir/eval/shim.rs:560— MethodTooLong — exec_intrinsic runs 654 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 554 over it, 6.54× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Ty.hir_fmt crates/hir-ide/src/display.rs:1281— MethodTooLong — hir_fmt runs 439 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 339 over it, 4.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: InferenceContext.infer_expr_inner crates/hir-ty/src/infer/expr.rs:317— MethodTooLong — infer_expr_inner runs 393 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 293 over it, 3.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Evaluator.eval_rvalue crates/hir-ty/src/mir/eval.rs:1029— MethodTooLong — eval_rvalue runs 390 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 290 over it, 3.90× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ExprCollector.maybe_collect_expr crates/hir-def/src/expr_store/lower.rs:1417— MethodTooLong — maybe_collect_expr runs 382 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 282 over it, 3.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MirLowerCtx.pattern_match_inner crates/hir-ty/src/mir/lower/pattern_matching.rs:117— MethodTooLong — pattern_match_inner runs 313 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 213 over it, 3.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AnyDiagnostic.inference_diagnostic crates/hir/src/diagnostics.rs:1578— MethodTooLong — inference_diagnostic runs 306 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 206 over it, 3.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: TokenStream.from_str crates/proc-macro-srv/src/token_stream.rs:50— MethodTooLong — from_str runs 302 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 202 over it, 3.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AnalysisStats.run_inference crates/rust-analyzer/src/cli/analysis_stats.rs:774— MethodTooLong — run_inference runs 288 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 188 over it, 2.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DefCollector.resolve_macros crates/hir-def/src/nameres/collector.rs:1306— MethodTooLong — resolve_macros runs 280 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 180 over it, 2.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ModCollector.collect crates/hir-def/src/nameres/collector.rs:1898— MethodTooLong — collect runs 271 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 171 over it, 2.71× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Printer.print_expr_in crates/hir-def/src/expr_store/pretty.rs:531— MethodTooLong — print_expr_in runs 248 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 148 over it, 2.48× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AnalysisStats.run crates/rust-analyzer/src/cli/analysis_stats.rs:52— MethodTooLong — run runs 237 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 137 over it, 2.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: FindUsages.short_associated_function_fast_search crates/ide-db/src/search.rs:601— MethodTooLong — short_associated_function_fast_search runs 219 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 119 over it, 2.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: GlobalState.handle_event crates/rust-analyzer/src/main_loop.rs:315— MethodTooLong — handle_event runs 219 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 119 over it, 2.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: SourceAnalyzer.resolve_path crates/hir/src/source_analyzer.rs:1158— MethodTooLong — resolve_path runs 217 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 117 over it, 2.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: InferenceContext.resolve_variant crates/hir-ty/src/infer.rs:2256— MethodTooLong — resolve_variant runs 207 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 107 over it, 2.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ProjectWorkspace.load_cargo crates/project-model/src/workspace.rs:211— MethodTooLong — load_cargo runs 202 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 102 over it, 2.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ExprCollector.lower_inline_asm crates/hir-def/src/expr_store/lower/asm.rs:17— MethodTooLong — lower_inline_asm runs 197 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 97 over it, 1.97× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: GlobalState.switch_workspaces crates/rust-analyzer/src/reload.rs:467— MethodTooLong — switch_workspaces runs 180 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 80 over it, 1.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Scip.run crates/rust-analyzer/src/cli/scip.rs:24— MethodTooLong — run runs 179 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 79 over it, 1.79× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ExprCollector.collect_pat crates/hir-def/src/expr_store/lower.rs:2918— MethodTooLong — collect_pat runs 166 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 66 over it, 1.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: InferenceContext.infer_closure crates/hir-ty/src/infer/closure.rs:68— MethodTooLong — infer_closure runs 161 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 61 over it, 1.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Expr.gen_source_code crates/hir/src/term_search/expr.rs:102— MethodTooLong — gen_source_code runs 159 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 59 over it, 1.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_completion::context::analysis::classify_name_ref crates/ide-completion/src/context/analysis.rs:967— FunctionTooLong — ide_completion::context::analysis::classify_name_ref runs 567 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 467 over it, 5.67× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: hir_expand::builtin::derive_macro::coerce_pointee_expand crates/hir-expand/src/builtin/derive_macro.rs:1128— FunctionTooLong — hir_expand::builtin::derive_macro::coerce_pointee_expand runs 328 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 228 over it, 3.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide::hover::render::definition crates/ide/src/hover/render.rs:446— FunctionTooLong — ide::hover::render::definition runs 288 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 188 over it, 2.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_completion::context::analysis::expected_type_and_name crates/ide-completion/src/context/analysis.rs:590— FunctionTooLong — ide_completion::context::analysis::expected_type_and_name runs 239 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 139 over it, 2.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_completion::completions::postfix::complete_postfix crates/ide-completion/src/completions/postfix.rs:33— FunctionTooLong — ide_completion::completions::postfix::complete_postfix runs 228 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 128 over it, 2.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: hir_ty::layout::layout_of_ty_query crates/hir-ty/src/layout.rs:162— FunctionTooLong — hir_ty::layout::layout_of_ty_query runs 225 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 125 over it, 2.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_assists::handlers::convert_closure_to_fn::convert_closure_to_fn crates/ide-assists/src/handlers/convert_closure_to_fn.rs:54— FunctionTooLong — ide_assists::handlers::convert_closure_to_fn::convert_closure_to_fn runs 216 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 116 over it, 2.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: hir_ide::display::render_const_scalar_inner crates/hir-ide/src/display.rs:819— FunctionTooLong — hir_ide::display::render_const_scalar_inner runs 201 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 101 over it, 2.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: client.createClient editors/code/src/client.ts:13— FunctionTooLong — createClient runs 200 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 100 over it, 2.00× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: commands.viewMemoryLayout editors/code/src/commands.ts:1325— FunctionTooLong — viewMemoryLayout runs 193 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 93 over it, 1.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: hir_def::hir::format_args::parse crates/hir-def/src/hir/format_args.rs:172— FunctionTooLong — hir_def::hir::format_args::parse runs 192 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 92 over it, 1.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: commands.viewMemoryLayout.<returned closure> editors/code/src/commands.ts:1326— FunctionTooLong — viewMemoryLayout.<returned closure> runs 192 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 92 over it, 1.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: hir_expand::fixup::fixup_syntax crates/hir-expand/src/fixup.rs:52— FunctionTooLong — hir_expand::fixup::fixup_syntax runs 189 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 89 over it, 1.89× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_db::prime_caches::parallel_prime_caches crates/ide-db/src/prime_caches.rs:31— FunctionTooLong — ide_db::prime_caches::parallel_prime_caches runs 184 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 84 over it, 1.84× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_assists::handlers::add_missing_match_arms::add_missing_match_arms crates/ide-assists/src/handlers/add_missing_match_arms.rs:41— FunctionTooLong — ide_assists::handlers::add_missing_match_arms::add_missing_match_arms runs 182 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 82 over it, 1.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_completion::context::analysis::expand crates/ide-completion/src/context/analysis.rs:172— FunctionTooLong — ide_completion::context::analysis::expand runs 180 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 80 over it, 1.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide::inlay_hints::adjustment::hints crates/ide/src/inlay_hints/adjustment.rs:23— FunctionTooLong — ide::inlay_hints::adjustment::hints runs 180 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 80 over it, 1.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mbe::expander::matcher::match_loop_inner crates/mbe/src/expander/matcher.rs:366— FunctionTooLong — mbe::expander::matcher::match_loop_inner runs 175 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 75 over it, 1.75× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_assists::handlers::extract_variable::extract_variable crates/ide-assists/src/handlers/extract_variable.rs:74— FunctionTooLong — ide_assists::handlers::extract_variable::extract_variable runs 169 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 69 over it, 1.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide_diagnostics::semantic_diagnostics crates/ide-diagnostics/src/lib.rs:377— FunctionTooLong — ide_diagnostics::semantic_diagnostics runs 169 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 69 over it, 1.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: hir_expand::cfg_process::macro_input_callback crates/hir-expand/src/cfg_process.rs:47— FunctionTooLong — hir_expand::cfg_process::macro_input_callback runs 160 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 60 over it, 1.60× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: hir_def::expr_store::lower::path::lower_path crates/hir-def/src/expr_store/lower/path.rs:41— FunctionTooLong — hir_def::expr_store::lower::path::lower_path runs 158 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 58 over it, 1.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: rust_analyzer::lsp::to_proto::completion_item crates/rust-analyzer/src/lsp/to_proto.rs:291— FunctionTooLong — rust_analyzer::lsp::to_proto::completion_item runs 156 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 56 over it, 1.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide::inlay_hints::lifetime::hints_ crates/ide/src/inlay_hints/lifetime.rs:194— FunctionTooLong — ide::inlay_hints::lifetime::hints_ runs 149 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 49 over it, 1.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ide::syntax_highlighting::highlight::highlight_def crates/ide/src/syntax_highlighting/highlight.rs:451— FunctionTooLong — ide::syntax_highlighting::highlight::highlight_def runs 149 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 49 over it, 1.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
ide_assists::handlers::inline_call::inline (cognitive 80) crates/ide-assists/src/handlers/inline_call.rs:349— ide_assists::handlers::inline_call::inline has cognitive complexity 80 (threshold 15). Drivers by points: if/else 25 (46 pts), match/switch 8 (15 pts), boolean chains 10, loops 6 (9 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::convert_closure_to_fn::convert_closure_to_fn (cognitive 59) crates/ide-assists/src/handlers/convert_closure_to_fn.rs:54— ide_assists::handlers::convert_closure_to_fn::convert_closure_to_fn has cognitive complexity 59 (threshold 15). Drivers by points: if/else 23 (43 pts), match/switch 5 (8 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::extract_variable::extract_variable (cognitive 56) crates/ide-assists/src/handlers/extract_variable.rs:74— ide_assists::handlers::extract_variable::extract_variable has cognitive complexity 56 (threshold 15). Drivers by points: if/else 20 (36 pts), match/switch 10 (16 pts), boolean chains 3, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::unwrap_return_type::unwrap_return_type (cognitive 54) crates/ide-assists/src/handlers/unwrap_return_type.rs:40— ide_assists::handlers::unwrap_return_type::unwrap_return_type has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (37 pts), match/switch 5 (12 pts), boolean chains 4, loops 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::inline_type_alias::create_replacement (cognitive 52) crates/ide-assists/src/handlers/inline_type_alias.rs:320— ide_assists::handlers::inline_type_alias::create_replacement has cognitive complexity 52 (threshold 15). Drivers by points: if/else 16 (44 pts), loops 4, boolean chains 2, match/switch 1 (2 pts) (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ide_assists::handlers::add_missing_match_arms::add_missing_match_arms (cognitive 44) crates/ide-assists/src/handlers/add_missing_match_arms.rs:41— ide_assists::handlers::add_missing_match_arms::add_missing_match_arms has cognitive complexity 44 (threshold 15). Drivers by points: if/else 23 (32 pts), boolean chains 6, match/switch 3 (4 pts), loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::utils::gen_trait_fn_body::gen_partial_eq (cognitive 44) crates/ide-assists/src/utils/gen_trait_fn_body.rs:414— ide_assists::utils::gen_trait_fn_body::gen_partial_eq has cognitive complexity 44 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 5 (16 pts), match/switch 5 (9 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::add_turbo_fish::add_turbo_fish (cognitive 39) crates/ide-assists/src/handlers/add_turbo_fish.rs:31— ide_assists::handlers::add_turbo_fish::add_turbo_fish has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (30 pts), match/switch 7, loops 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::apply_demorgan::apply_demorgan (cognitive 36) crates/ide-assists/src/handlers/apply_demorgan.rs:40— ide_assists::handlers::apply_demorgan::apply_demorgan has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (30 pts), match/switch 2 (3 pts), loops 2, boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::extract_function::update_external_control_flow (cognitive 35) crates/ide-assists/src/handlers/extract_function.rs:2128— ide_assists::handlers::extract_function::update_external_control_flow has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (24 pts), match/switch 3 (9 pts), boolean chains 1, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::generate_new::generate_new (cognitive 35) crates/ide-assists/src/handlers/generate_new.rs:36— ide_assists::handlers::generate_new::generate_new has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (24 pts), match/switch 4 (6 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::convert_bool_to_enum::replace_usages (cognitive 30) crates/ide-assists/src/handlers/convert_bool_to_enum.rs:212— ide_assists::handlers::convert_bool_to_enum::replace_usages has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (26 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::convert_closure_to_fn::compute_closure_type_params (cognitive 30) crates/ide-assists/src/handlers/convert_closure_to_fn.rs:351— ide_assists::handlers::convert_closure_to_fn::compute_closure_type_params has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 5 (11 pts), match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::extract_module::extract_module (cognitive 29) crates/ide-assists/src/handlers/extract_module.rs:56— ide_assists::handlers::extract_module::extract_module has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 5 (8 pts), boolean chains 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::generate_delegate_methods::generate_delegate_methods (cognitive 29) crates/ide-assists/src/handlers/generate_delegate_methods.rs:51— ide_assists::handlers::generate_delegate_methods::generate_delegate_methods has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 4 (8 pts), boolean chains 2, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::extract_expressions_from_format_string::extract_expressions_from_format_string (cognitive 28) crates/ide-assists/src/handlers/extract_expressions_from_format_string.rs:31— ide_assists::handlers::extract_expressions_from_format_string::extract_expressions_from_format_string has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 4 (9 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::wrap_return_type::wrap_return_type (cognitive 28) crates/ide-assists/src/handlers/wrap_return_type.rs:43— ide_assists::handlers::wrap_return_type::wrap_return_type has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 4 (8 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::extract_function::extract_function (cognitive 27) crates/ide-assists/src/handlers/extract_function.rs:67— ide_assists::handlers::extract_function::extract_function has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 4, boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::generate_documentation_template::introduction_builder (cognitive 27) crates/ide-assists/src/handlers/generate_documentation_template.rs:187— ide_assists::handlers::generate_documentation_template::introduction_builder has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::extract_type_alias::collect_used_generics (cognitive 25) crates/ide-assists/src/handlers/extract_type_alias.rs:110— ide_assists::handlers::extract_type_alias::collect_used_generics has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 5 (9 pts), boolean chains 2 (nesting depth added 11). Of this number, 24 points are the body's own statements and 1 belongs to one function item inside it that branches. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_assists::handlers::remove_dbg::compute_dbg_replacement (cognitive 25) crates/ide-assists/src/handlers/remove_dbg.rs:72— ide_assists::handlers::remove_dbg::compute_dbg_replacement has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 4 (8 pts), boolean chains 5 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::wrap_unwrap_cfg_attr::attempt_get_derive (cognitive 24) crates/ide-assists/src/handlers/wrap_unwrap_cfg_attr.rs:38— ide_assists::handlers::wrap_unwrap_cfg_attr::attempt_get_derive has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, loops 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_assists::handlers::extract_function::make_body (cognitive 23) crates/ide-assists/src/handlers/extract_function.rs:1800— ide_assists::handlers::extract_function::make_body has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 11 (23 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_assists::handlers::merge_match_arms::get_arm_types::recurse (cognitive 23) crates/ide-assists/src/handlers/merge_match_arms.rs:130— ide_assists::handlers::merge_match_arms::get_arm_types::recurse has cognitive complexity 23 (threshold 15). Drivers by points: loops 4 (13 pts), if/else 3 (7 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
ide_assists::handlers::remove_unused_imports::remove_unused_imports (cognitive 23) crates/ide-assists/src/handlers/remove_unused_imports.rs:36— ide_assists::handlers::remove_unused_imports::remove_unused_imports has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (10 pts), match/switch 6 (9 pts), loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Duplicated block (6 lines × 2) crates/hir-def/src/expr_store/lower.rs:1179— crates/hir-def/src/expr_store/lower.rs:1179-1184 | crates/hir-def/src/expr_store/lower.rs:1208-1213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/hir-def/src/item_scope.rs:244— crates/hir-def/src/item_scope.rs:244-249 | crates/hir-def/src/item_scope.rs:259-264 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/item_scope.rs:244` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/hir-ty/src/infer/coerce.rs:1000— crates/hir-ty/src/infer/coerce.rs:1000-1005 | crates/hir-ty/src/infer/coerce.rs:1007-1012 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (6 lines × 2) crates/hir-ty/src/mir/eval/shim.rs:234— crates/hir-ty/src/mir/eval/shim.rs:234-239 | crates/hir-ty/src/mir/eval/shim.rs:246-251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/mir/eval/shim.rs:234` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (6 lines × 2) crates/hir-ty/src/mir/eval/shim.rs:1136— crates/hir-ty/src/mir/eval/shim.rs:1136-1141 | crates/hir-ty/src/mir/eval/shim.rs:1168-1173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/mir/eval/shim.rs:1136` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/hir-ty/src/next_solver/consts/valtree.rs:162— crates/hir-ty/src/next_solver/consts/valtree.rs:162-167 | crates/hir-ty/src/next_solver/consts/valtree.rs:235-240 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/next_solver/consts/valtree.rs:162` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (6 lines × 2) crates/hir-ty/src/next_solver/infer/errors.rs:161— crates/hir-ty/src/next_solver/infer/errors.rs:161-166 | crates/hir-ty/src/next_solver/infer/errors.rs:168-173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (6 lines × 2) crates/hir-ty/src/next_solver/interner.rs:1186— crates/hir-ty/src/next_solver/interner.rs:1186-1191 | crates/hir-ty/src/next_solver/interner.rs:1200-1205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/next_solver/interner.rs:1186` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `def_id` to `Self::ImplOrTraitAssocTermId` in one and `Self::InherentAssocTermId` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (6 lines × 2) crates/hir/src/diagnostics.rs:2002— crates/hir/src/diagnostics.rs:2002-2007 | crates/hir/src/diagnostics.rs:2018-2023 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) crates/hir/src/term_search/expr.rs:130— crates/hir/src/term_search/expr.rs:130-135 | crates/hir/src/term_search/expr.rs:159-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/hir/src/term_search/expr.rs:130— crates/hir/src/term_search/expr.rs:130-135 | crates/hir/src/term_search/expr.rs:271-276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/ide-assists/src/handlers/convert_bool_then.rs:86— crates/ide-assists/src/handlers/convert_bool_then.rs:86-91 | crates/ide-assists/src/handlers/convert_bool_then.rs:271-276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/ide-assists/src/handlers/convert_from_to_tryfrom.rs:45— crates/ide-assists/src/handlers/convert_from_to_tryfrom.rs:45-50 | crates/ide-assists/src/handlers/convert_into_to_from.rs:60-65 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) crates/ide-assists/src/handlers/generate_new.rs:82— crates/ide-assists/src/handlers/generate_new.rs:82-89 | crates/ide-assists/src/handlers/qualify_method_call.rs:48-53 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) crates/ide-assists/src/handlers/unwrap_return_type.rs:41— crates/ide-assists/src/handlers/unwrap_return_type.rs:41-46 | crates/ide-assists/src/handlers/wrap_return_type.rs:44-49 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/unwrap_return_type.rs:41` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/ide-assists/src/utils/gen_trait_fn_body.rs:56— crates/ide-assists/src/utils/gen_trait_fn_body.rs:56-61 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:166-171 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/utils/gen_trait_fn_body.rs:56` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/ide-assists/src/utils/gen_trait_fn_body.rs:172` calls `expr_path`, `ident_path` and `crates/ide-assists/src/utils/gen_trait_fn_body.rs:63` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 2) crates/ide-assists/src/utils/gen_trait_fn_body.rs:197— crates/ide-assists/src/utils/gen_trait_fn_body.rs:197-202 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:231-236 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/utils/gen_trait_fn_body.rs:197` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/ide-assists/src/utils/gen_trait_fn_body.rs:391— crates/ide-assists/src/utils/gen_trait_fn_body.rs:391-397 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:671-676 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/utils/gen_trait_fn_body.rs:391` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (6 lines × 2) crates/ide-assists/src/utils/gen_trait_fn_body.rs:503— crates/ide-assists/src/utils/gen_trait_fn_body.rs:503-508 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:536-541 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/utils/gen_trait_fn_body.rs:503` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/load-cargo/src/lib.rs:596— crates/load-cargo/src/lib.rs:596-601 | crates/load-cargo/src/lib.rs:633-638 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/macros/src/lib.rs:101— crates/macros/src/lib.rs:101-106 | crates/macros/src/lib.rs:212-217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/macros/src/lib.rs:101` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/proc-macro-srv-cli/src/main_loop.rs:137— crates/proc-macro-srv-cli/src/main_loop.rs:137-143 | crates/proc-macro-srv-cli/src/main_loop.rs:520-525 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:456— crates/rust-analyzer/src/cli/analysis_stats.rs:456-461 | crates/rust-analyzer/src/cli/analysis_stats.rs:1339-1344 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/cli/analysis_stats.rs:456` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (6 lines × 2) crates/rust-analyzer/src/handlers/request.rs:1074— crates/rust-analyzer/src/handlers/request.rs:1074-1079 | crates/rust-analyzer/src/handlers/request.rs:1108-1113 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/handlers/request.rs:1074` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/rust-analyzer/src/main_loop.rs:678— crates/rust-analyzer/src/main_loop.rs:678-688 | crates/rust-analyzer/src/main_loop.rs:780-785 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/main_loop.rs:678` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
ide::syntax_highlighting::traverse (cognitive 103) crates/ide/src/syntax_highlighting.rs:226— ide::syntax_highlighting::traverse has cognitive complexity 103 (threshold 15). Drivers by points: if/else 17 (50 pts), match/switch 16 (49 pts), boolean chains 3, loops 1 (nesting depth added 66). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::hover::render::definition (cognitive 92) crates/ide/src/hover/render.rs:446— ide::hover::render::definition has cognitive complexity 92 (threshold 15). Drivers by points: if/else 34 (64 pts), match/switch 16 (28 pts) (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::folding_ranges::folding_ranges (cognitive 76) crates/ide/src/folding_ranges.rs:61— ide::folding_ranges::folding_ranges has cognitive complexity 76 (threshold 15). Drivers by points: if/else 18 (65 pts), match/switch 3 (8 pts), boolean chains 2, loops 1 (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ide::syntax_highlighting::highlight::highlight_def (cognitive 69) crates/ide/src/syntax_highlighting/highlight.rs:451— ide::syntax_highlighting::highlight::highlight_def has cognitive complexity 69 (threshold 15). Drivers by points: if/else 22 (42 pts), match/switch 9 (22 pts), boolean chains 5 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::rename::transform_method_call_into_assoc_fn (cognitive 62) crates/ide/src/rename.rs:627— ide::rename::transform_method_call_into_assoc_fn has cognitive complexity 62 (threshold 15). Drivers by points: if/else 12 (41 pts), match/switch 4 (14 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::highlight_related::highlight_references (cognitive 60) crates/ide/src/highlight_related.rs:152— ide::highlight_related::highlight_references has cognitive complexity 60 (threshold 15). Drivers by points: if/else 17 (40 pts), match/switch 5 (14 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::inlay_hints::adjustment::hints (cognitive 56) crates/ide/src/inlay_hints/adjustment.rs:23— ide::inlay_hints::adjustment::hints has cognitive complexity 56 (threshold 15). Drivers by points: if/else 26 (36 pts), boolean chains 10, match/switch 3 (7 pts), loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::inlay_hints::implicit_drop::hints (cognitive 47) crates/ide/src/inlay_hints/implicit_drop.rs:27— ide::inlay_hints::implicit_drop::hints has cognitive complexity 47 (threshold 15). Drivers by points: match/switch 6 (24 pts), if/else 8 (22 pts), loops 1 (nesting depth added 32). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide::rename::transform_assoc_fn_into_method_call (cognitive 44) crates/ide/src/rename.rs:411— ide::rename::transform_assoc_fn_into_method_call has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (27 pts), match/switch 3 (11 pts), loops 3 (6 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::inlay_hints::closing_brace::hints (cognitive 39) crates/ide/src/inlay_hints/closing_brace.rs:21— ide::inlay_hints::closing_brace::hints has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (27 pts), match/switch 4 (9 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::inlay_hints::lifetime::hints_ (cognitive 38) crates/ide/src/inlay_hints/lifetime.rs:194— ide::inlay_hints::lifetime::hints_ has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (18 pts), match/switch 9 (13 pts), boolean chains 6, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::syntax_highlighting::highlight::highlight_name_ref (cognitive 38) crates/ide/src/syntax_highlighting/highlight.rs:258— ide::syntax_highlighting::highlight::highlight_name_ref has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (28 pts), match/switch 5 (8 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::annotations::annotations (cognitive 35) crates/ide/src/annotations.rs:58— ide::annotations::annotations has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 5, match/switch 4 (5 pts), loops 1 (2 pts) (nesting depth added 11). Of this number, 29 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::signature_help::signature_help_for_call (cognitive 35) crates/ide/src/signature_help.rs:159— ide::signature_help::signature_help_for_call has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 8 (17 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::view_syntax_tree::syntax_node_to_json (cognitive 35) crates/ide/src/view_syntax_tree.rs:31— ide::view_syntax_tree::syntax_node_to_json has cognitive complexity 35 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 5 (15 pts), loops 2 (5 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::hover::hover_offset (cognitive 33) crates/ide/src/hover.rs:159— ide::hover::hover_offset has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 7, match/switch 3 (5 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::join_lines::remove_newline (cognitive 33) crates/ide/src/join_lines.rs:82— ide::join_lines::remove_newline has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (21 pts), match/switch 4 (8 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::syntax_highlighting::highlight::punctuation (cognitive 32) crates/ide/src/syntax_highlighting/highlight.rs:93— ide::syntax_highlighting::highlight::punctuation has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 4 (7 pts), boolean chains 3 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide::moniker::def_to_non_local_moniker (cognitive 31) crates/ide/src/moniker.rs:283— ide::moniker::def_to_non_local_moniker has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (19 pts), match/switch 5 (10 pts), boolean chains 1, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::inlay_hints::param_name::hints (cognitive 28) crates/ide/src/inlay_hints/param_name.rs:19— ide::inlay_hints::param_name::hints has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 5 (9 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::hover::render::render_memory_layout (cognitive 27) crates/ide/src/hover/render.rs:1165— ide::hover::render::render_memory_layout has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (14 pts), match/switch 5 (10 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ide::inlay_hints::bind_pat::hints (cognitive 27) crates/ide/src/inlay_hints/bind_pat.rs:22— ide::inlay_hints::bind_pat::hints has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 5, match/switch 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::signature_help::signature_help (cognitive 27) crates/ide/src/signature_help.rs:73— ide::signature_help::signature_help has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (23 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::goto_definition::goto_definition (cognitive 26) crates/ide/src/goto_definition.rs:58— ide::goto_definition::goto_definition has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide::highlight_related::highlight_branch_exit_points (cognitive 26) crates/ide/src/highlight_related.rs:308— ide::highlight_related::highlight_branch_exit_points has cognitive complexity 26 (threshold 15). Drivers by points: loops 5 (12 pts), if/else 4 (9 pts), match/switch 2 (5 pts) (nesting depth added 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
Duplicated block (9 lines × 2) crates/hir-def/src/attrs.rs:661— crates/hir-def/src/attrs.rs:661-669 | crates/hir-def/src/attrs.rs:673-681 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-def/src/expr_store/lower.rs:1142— crates/hir-def/src/expr_store/lower.rs:1142-1150 | crates/hir-def/src/expr_store/lower.rs:1186-1194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-def/src/expr_store/lower.rs:2753— crates/hir-def/src/expr_store/lower.rs:2753-2761 | crates/hir-def/src/expr_store/lower.rs:2766-2774 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-def/src/import_map.rs:250— crates/hir-def/src/import_map.rs:250-258 | crates/hir-def/src/import_map.rs:296-304 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/hir-def/src/import_map.rs:295` calls `for_trait_item` and `crates/hir-def/src/import_map.rs:249` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 2) crates/hir-def/src/nameres/path_resolution.rs:269— crates/hir-def/src/nameres/path_resolution.rs:269-277 | crates/hir-def/src/nameres/path_resolution.rs:384-392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/nameres/path_resolution.rs:269` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/hir-def/src/src.rs:155— crates/hir-def/src/src.rs:155-163 | crates/hir-def/src/src.rs:170-178 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/src.rs:155` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/hir-expand/src/builtin/fn_macro.rs:880— crates/hir-expand/src/builtin/fn_macro.rs:880-888 | crates/hir-expand/src/builtin/fn_macro.rs:956-964 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir-ide/src/display.rs:849— crates/hir-ide/src/display.rs:849-857 | crates/hir-ide/src/display.rs:1122-1130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ide/src/display.rs:849` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) crates/hir-ide/src/display.rs:868— crates/hir-ide/src/display.rs:868-876 | crates/hir-ide/src/display.rs:1141-1149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ide/src/display.rs:868` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/hir-ty/src/consteval.rs:210— crates/hir-ty/src/consteval.rs:210-218 | crates/hir-ty/src/consteval.rs:248-256 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/consteval.rs:210` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/hir-ty/src/infer.rs:1540— crates/hir-ty/src/infer.rs:1540-1548 | crates/hir-ty/src/infer.rs:1554-1562 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/infer.rs:1540` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/hir-ty/src/infer/closure/analysis.rs:1228— crates/hir-ty/src/infer/closure/analysis.rs:1228-1236 | crates/hir-ty/src/infer/closure/analysis.rs:1243-1251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/infer/closure/analysis.rs:1228` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/hir-ty/src/lower.rs:1506— crates/hir-ty/src/lower.rs:1506-1514 | crates/hir-ty/src/lower.rs:2285-2293 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/lower.rs:1506` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/hir-ty/src/next_solver/def_id.rs:252— crates/hir-ty/src/next_solver/def_id.rs:252-260 | crates/hir-ty/src/next_solver/def_id.rs:279-287 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir/src/semantics.rs:2617— crates/hir/src/semantics.rs:2617-2625 | crates/hir/src/semantics.rs:2629-2637 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/hir/src/semantics/source_to_def.rs:675— crates/hir/src/semantics/source_to_def.rs:675-683 | crates/hir/src/semantics/source_to_def.rs:686-694 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/semantics/source_to_def.rs:675` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/hir/src/symbols.rs:290— crates/hir/src/symbols.rs:290-298 | crates/hir/src/symbols.rs:331-339 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/symbols.rs:290` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) crates/hir/src/term_search/tactics.rs:170— crates/hir/src/term_search/tactics.rs:170-178 | crates/hir/src/term_search/tactics.rs:216-224 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/term_search/tactics.rs:170` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/ide-assists/src/handlers/generate_delegate_trait.rs:285— crates/ide-assists/src/handlers/generate_delegate_trait.rs:285-294 | crates/ide-assists/src/handlers/generate_delegate_trait.rs:395-403 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/generate_delegate_trait.rs:285` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) crates/ide-assists/src/handlers/generate_impl.rs:49— crates/ide-assists/src/handlers/generate_impl.rs:49-57 | crates/ide-assists/src/handlers/generate_impl.rs:97-105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/generate_impl.rs:49` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/ide-assists/src/handlers/introduce_named_lifetime.rs:138— crates/ide-assists/src/handlers/introduce_named_lifetime.rs:138-146 | crates/ide-assists/src/handlers/introduce_named_lifetime.rs:197-205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/introduce_named_lifetime.rs:138` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/ide-assists/src/handlers/move_from_mod_rs.rs:31— crates/ide-assists/src/handlers/move_from_mod_rs.rs:31-39 | crates/ide-assists/src/handlers/move_to_mod_rs.rs:31-39 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/move_from_mod_rs.rs:31` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/ide-assists/src/handlers/replace_method_eager_lazy.rs:32— crates/ide-assists/src/handlers/replace_method_eager_lazy.rs:32-40 | crates/ide-assists/src/handlers/replace_method_eager_lazy.rs:142-150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/ide-assists/src/utils/gen_trait_fn_body.rs:601— crates/ide-assists/src/utils/gen_trait_fn_body.rs:601-609 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:694-702 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/utils/gen_trait_fn_body.rs:601` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/ide-db/src/imports/import_assets.rs:377— crates/ide-db/src/imports/import_assets.rs:377-385 | crates/ide-db/src/imports/import_assets.rs:392-400 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-db/src/imports/import_assets.rs:377` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
ide::hover::render::definition (cyclomatic 64) crates/ide/src/hover/render.rs:446— ide::hover::render::definition has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::syntax_highlighting::highlight::highlight_def (cyclomatic 61) crates/ide/src/syntax_highlighting/highlight.rs:451— ide::syntax_highlighting::highlight::highlight_def has cyclomatic complexity 61 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::inlay_hints::adjustment::hints (cyclomatic 53) crates/ide/src/inlay_hints/adjustment.rs:23— ide::inlay_hints::adjustment::hints has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::syntax_highlighting::traverse (cyclomatic 47) crates/ide/src/syntax_highlighting.rs:226— ide::syntax_highlighting::traverse has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::syntax_highlighting::highlight::punctuation (cyclomatic 40) crates/ide/src/syntax_highlighting/highlight.rs:93— ide::syntax_highlighting::highlight::punctuation has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::inlay_hints::lifetime::hints_ (cyclomatic 34) crates/ide/src/inlay_hints/lifetime.rs:194— ide::inlay_hints::lifetime::hints_ has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::folding_ranges::folding_ranges (cyclomatic 31) crates/ide/src/folding_ranges.rs:61— ide::folding_ranges::folding_ranges has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::inlay_hints::closing_brace::hints (cyclomatic 31) crates/ide/src/inlay_hints/closing_brace.rs:21— ide::inlay_hints::closing_brace::hints has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::hover::hover_offset (cyclomatic 30) crates/ide/src/hover.rs:159— ide::hover::hover_offset has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::moniker::def_to_kind (cyclomatic 30) crates/ide/src/moniker.rs:183— ide::moniker::def_to_kind has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::syntax_highlighting::highlight::highlight_name_ref (cyclomatic 30) crates/ide/src/syntax_highlighting/highlight.rs:258— ide::syntax_highlighting::highlight::highlight_name_ref has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::file_structure::structure_node (cyclomatic 26) crates/ide/src/file_structure.rs:82— ide::file_structure::structure_node has cyclomatic complexity 26 (threshold 15). Of this number, 23 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::hover::render::render_memory_layout (cyclomatic 26) crates/ide/src/hover/render.rs:1165— ide::hover::render::render_memory_layout has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::inlay_hints::hints (cyclomatic 26) crates/ide/src/inlay_hints.rs:207— ide::inlay_hints::hints has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::goto_type_definition::goto_type_definition (cyclomatic 25) crates/ide/src/goto_type_definition.rs:16— ide::goto_type_definition::goto_type_definition has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::signature_help::signature_help_for_call (cyclomatic 25) crates/ide/src/signature_help.rs:159— ide::signature_help::signature_help_for_call has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::annotations::annotations (cyclomatic 24) crates/ide/src/annotations.rs:58— ide::annotations::annotations has cyclomatic complexity 24 (threshold 15). Of this number, 20 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::doc_links::filename_and_frag_for_def (cyclomatic 24) crates/ide/src/doc_links.rs:647— ide::doc_links::filename_and_frag_for_def has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::rename::transform_method_call_into_assoc_fn (cyclomatic 24) crates/ide/src/rename.rs:627— ide::rename::transform_method_call_into_assoc_fn has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::highlight_related::highlight_references (cyclomatic 23) crates/ide/src/highlight_related.rs:152— ide::highlight_related::highlight_references has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::goto_definition::goto_definition (cyclomatic 22) crates/ide/src/goto_definition.rs:58— ide::goto_definition::goto_definition has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::inlay_hints::bind_pat::hints (cyclomatic 22) crates/ide/src/inlay_hints/bind_pat.rs:22— ide::inlay_hints::bind_pat::hints has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::join_lines::remove_newline (cyclomatic 22) crates/ide/src/join_lines.rs:82— ide::join_lines::remove_newline has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide::hover::render::literal (cyclomatic 21) crates/ide/src/hover/render.rs:849— ide::hover::render::literal has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide::typing::on_eq_typed (cyclomatic 20) crates/ide/src/typing.rs:219— ide::typing::on_eq_typed has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 3 function items inside it that branch (assign_expr, let_stmt, assign_to_eq). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
Duplicated block (7 lines × 2) crates/hir-def/src/expr_store/lower.rs:1472— crates/hir-def/src/expr_store/lower.rs:1472-1478 | crates/hir-def/src/expr_store/lower.rs:1512-1518 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/expr_store/lower.rs:1472` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/hir-def/src/item_scope.rs:259— crates/hir-def/src/item_scope.rs:259-265 | crates/hir-def/src/item_scope.rs:274-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/item_scope.rs:259` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/hir-def/src/item_scope.rs:774— crates/hir-def/src/item_scope.rs:774-780 | crates/hir-def/src/item_scope.rs:792-798 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/item_scope.rs:774` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/hir-def/src/resolver.rs:230— crates/hir-def/src/resolver.rs:230-236 | crates/hir-def/src/resolver.rs:459-465 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/resolver.rs:230` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/hir-ide/src/display.rs:995— crates/hir-ide/src/display.rs:995-1001 | crates/hir-ide/src/display.rs:1021-1027 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ide/src/display.rs:995` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/hir/src/source_analyzer.rs:1318— crates/hir/src/source_analyzer.rs:1318-1324 | crates/hir/src/source_analyzer.rs:1409-1415 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/source_analyzer.rs:1318` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/ide-assists/src/handlers/introduce_named_lifetime.rs:102— crates/ide-assists/src/handlers/introduce_named_lifetime.rs:102-108 | crates/ide-assists/src/handlers/introduce_named_lifetime.rs:171-177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/introduce_named_lifetime.rs:102` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/ide-assists/src/handlers/remove_dbg.rs:102— crates/ide-assists/src/handlers/remove_dbg.rs:102-108 | crates/ide-assists/src/handlers/remove_dbg.rs:110-116 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (7 lines × 2) crates/ide-db/src/active_parameter.rs:183— crates/ide-db/src/active_parameter.rs:183-189 | crates/syntax/src/ast/node_ext.rs:59-65 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (7 lines × 2) crates/ide-db/src/syntax_helpers/node_ext.rs:179— crates/ide-db/src/syntax_helpers/node_ext.rs:179-185 | crates/ide-db/src/syntax_helpers/node_ext.rs:207-213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-db/src/syntax_helpers/node_ext.rs:179` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs:62— crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs:62-68 | crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs:70-76 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (7 lines × 2) crates/ide-diagnostics/src/handlers/type_mismatch.rs:392— crates/ide-diagnostics/src/handlers/type_mismatch.rs:392-398 | crates/ide-diagnostics/src/handlers/type_mismatch.rs:416-422 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/ide/src/inlay_hints/lifetime.rs:79— crates/ide/src/inlay_hints/lifetime.rs:79-85 | crates/ide/src/inlay_hints/lifetime.rs:146-152 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/ide/src/inlay_hints/lifetime.rs:145` calls `path`, `as_ref`, `and_then` and `crates/ide/src/inlay_hints/lifetime.rs:77` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) crates/ide/src/inlay_hints/param_name.rs:67— crates/ide/src/inlay_hints/param_name.rs:67-73 | crates/ide/src/inlay_hints/param_name.rs:117-123 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/ide/src/signature_help.rs:595— crates/ide/src/signature_help.rs:595-601 | crates/ide/src/signature_help.rs:729-735 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/ide/src/typing.rs:259— crates/ide/src/typing.rs:259-265 | crates/ide/src/typing.rs:295-301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/ide/src/typing.rs:303` calls `syntax`, `descendants`, `any` and `crates/ide/src/typing.rs:266` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:371— crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:371-377 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:390-396 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/proc-macro-srv/src/token_stream.rs:302— crates/proc-macro-srv/src/token_stream.rs:302-308 | crates/proc-macro-srv/src/token_stream.rs:318-324 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/proc-macro-srv/src/token_stream.rs:302` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:1197— crates/rust-analyzer/src/cli/analysis_stats.rs:1197-1203 | crates/rust-analyzer/src/cli/analysis_stats.rs:1235-1241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/cli/analysis_stats.rs:1197` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/syntax/src/ast/syntax_factory/constructors.rs:538— crates/syntax/src/ast/syntax_factory/constructors.rs:538-545 | crates/syntax/src/ast/syntax_factory/constructors.rs:1626-1632 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:538` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/hir/src/source_analyzer.rs:1546— crates/hir/src/source_analyzer.rs:1546-1552 | crates/hir/src/source_analyzer.rs:1563-1569 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/ide-assists/src/handlers/remove_unused_param.rs:165— crates/ide-assists/src/handlers/remove_unused_param.rs:165-171 | crates/ide-assists/src/handlers/remove_unused_param.rs:190-196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/remove_unused_param.rs:165` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/hir-ty/src/consteval.rs:154— crates/hir-ty/src/consteval.rs:154-160 | crates/hir-ty/src/next_solver/ty.rs:697-703 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (7 lines × 2) crates/hir-ty/src/consteval.rs:165— crates/hir-ty/src/consteval.rs:165-171 | crates/hir-ty/src/next_solver/ty.rs:705-711 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (7 lines × 2) crates/hir-ty/src/mir/eval.rs:1844— crates/hir-ty/src/mir/eval.rs:1844-1850 | crates/hir-ty/src/mir/eval.rs:1853-1859 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/mir/eval.rs:1844` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/hir-def/src/expr_store/lower.rs:1185— crates/hir-def/src/expr_store/lower.rs:1185-1189 | crates/hir-def/src/expr_store/lower.rs:1196-1200 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/expr_store/lower.rs:1185` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/hir-ty/src/consteval.rs:176— crates/hir-ty/src/consteval.rs:176-180 | crates/hir-ty/src/next_solver/ty.rs:713-717 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/hir-ty/src/consteval.rs:181` calls `default_float` and `crates/hir-ty/src/next_solver/ty.rs:718` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 2) crates/hir-ty/src/infer/cast.rs:460— crates/hir-ty/src/infer/cast.rs:460-464 | crates/hir-ty/src/infer/cast.rs:490-494 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/infer/cast.rs:460` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/hir-ty/src/mir/eval.rs:1828— crates/hir-ty/src/mir/eval.rs:1828-1832 | crates/hir-ty/src/mir/eval.rs:1840-1844 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/hir-ty/src/mir/eval/shim.rs:236— crates/hir-ty/src/mir/eval/shim.rs:236-240 | crates/hir-ty/src/mir/eval/shim.rs:1381-1385 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/mir/eval/shim.rs:236` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/hir/src/lib.rs:3909— crates/hir/src/lib.rs:3909-3913 | crates/hir/src/lib.rs:3927-3931 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/lib.rs:3909` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) crates/hir/src/source_analyzer.rs:865— crates/hir/src/source_analyzer.rs:865-869 | crates/hir/src/source_analyzer.rs:899-903 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/source_analyzer.rs:865` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:76— crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:76-80 | crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:78-82 — before extracting anything, compare `crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs` and `crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:76` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:83` calls `as_ref`, `either`, `syntax` and `crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:82` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 2) crates/ide-assists/src/utils/gen_trait_fn_body.rs:179— crates/ide-assists/src/utils/gen_trait_fn_body.rs:179-183 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:213-217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/ide-completion/src/completions/record.rs:32— crates/ide-completion/src/completions/record.rs:32-36 | crates/ide-completion/src/completions/record.rs:60-64 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/completions/record.rs:32` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/ide-db/src/imports/merge_imports.rs:505— crates/ide-db/src/imports/merge_imports.rs:505-509 | crates/ide-db/src/imports/merge_imports.rs:530-534 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-db/src/imports/merge_imports.rs:505` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/ide-db/src/syntax_helpers/format_string.rs:254— crates/ide-db/src/syntax_helpers/format_string.rs:254-258 | crates/ide-db/src/syntax_helpers/format_string.rs:272-276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-db/src/syntax_helpers/format_string.rs:254` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/ide-db/src/syntax_helpers/node_ext.rs:98— crates/ide-db/src/syntax_helpers/node_ext.rs:98-102 | crates/ide-db/src/syntax_helpers/node_ext.rs:139-143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-db/src/syntax_helpers/node_ext.rs:98` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/ide-ssr/src/fragments.rs:29— crates/ide-ssr/src/fragments.rs:29-33 | crates/ide-ssr/src/fragments.rs:52-56 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) crates/ide/src/goto_type_definition.rs:44— crates/ide/src/goto_type_definition.rs:44-48 | crates/ide/src/hover.rs:700-704 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide/src/goto_type_definition.rs:44` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/ide/src/navigation_target.rs:713— crates/ide/src/navigation_target.rs:713-717 | crates/ide/src/navigation_target.rs:785-789 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide/src/navigation_target.rs:713` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/parser/src/grammar/expressions/atom.rs:326— crates/parser/src/grammar/expressions/atom.rs:326-330 | crates/parser/src/grammar/patterns.rs:225-231 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/parser/src/grammar/expressions/atom.rs:326` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/parser/src/grammar/items.rs:377— crates/parser/src/grammar/items.rs:377-381 | crates/parser/src/grammar/items.rs:386-390 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/rust-analyzer/src/handlers/request.rs:2224— crates/rust-analyzer/src/handlers/request.rs:2224-2228 | crates/rust-analyzer/src/handlers/request.rs:2264-2269 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/handlers/request.rs:2224` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/hir-ide/src/diagnostics/match_check/pat_util.rs:19— crates/hir-ide/src/diagnostics/match_check/pat_util.rs:19-23 | crates/hir-ty/src/utils.rs:181-185 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) crates/hir-ty/src/lower.rs:2699— crates/hir-ty/src/lower.rs:2699-2703 | crates/hir-ty/src/next_solver/util.rs:502-506 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) crates/hir-ty/src/infer/coerce.rs:357— crates/hir-ty/src/infer/coerce.rs:357-367 | crates/hir-ty/src/infer/coerce.rs:828-832 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/infer/coerce.rs:357` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/hir-ty/src/mir/eval/shim.rs:1203— crates/hir-ty/src/mir/eval/shim.rs:1203-1207 | crates/hir-ty/src/mir/eval/shim.rs:1280-1284 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/mir/eval/shim.rs:1203` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/hir-ty/src/mir/eval/shim.rs:1277` calls `get` and `crates/hir-ty/src/mir/eval/shim.rs:1201` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 2) crates/rust-analyzer/src/handlers/request.rs:1923— crates/rust-analyzer/src/handlers/request.rs:1923-1927 | crates/rust-analyzer/src/handlers/request.rs:1962-1966 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `params` to `CallHierarchyIncomingCallsParams` in one and `CallHierarchyOutgoingCallsParams` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (5 lines × 2) crates/hir-ty/src/mir/eval.rs:1491— crates/hir-ty/src/mir/eval.rs:1491-1495 | crates/hir-ty/src/mir/eval.rs:1507-1511 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/mir/eval.rs:1491` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/hir-def/src/expr_store/scope.rs:163— crates/hir-def/src/expr_store/scope.rs:163-170 | crates/hir-def/src/expr_store/scope.rs:182-189 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/hir-def/src/find_path.rs:406— crates/hir-def/src/find_path.rs:406-413 | crates/hir-def/src/find_path.rs:423-430 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) crates/hir-def/src/item_scope.rs:657— crates/hir-def/src/item_scope.rs:657-664 | crates/hir-def/src/item_scope.rs:674-681 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/item_scope.rs:657` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/hir-def/src/nameres/collector.rs:2569— crates/hir-def/src/nameres/collector.rs:2569-2576 | crates/hir-def/src/nameres/collector.rs:2645-2652 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/nameres/collector.rs:2569` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/hir-def/src/nameres/collector.rs:2578` calls `empty`, `set` and `crates/hir-def/src/nameres/collector.rs:2654` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) crates/hir-def/src/nameres/collector.rs:2583— crates/hir-def/src/nameres/collector.rs:2583-2590 | crates/hir-def/src/nameres/collector.rs:2655-2662 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/nameres/collector.rs:2583` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 2) crates/hir-expand/src/attrs.rs:325— crates/hir-expand/src/attrs.rs:325-332 | crates/syntax/src/ast/token_ext.rs:278-285 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) crates/hir-ty/src/infer.rs:2352— crates/hir-ty/src/infer.rs:2352-2359 | crates/hir-ty/src/infer.rs:2401-2408 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/hir-ty/src/mir/eval.rs:1351— crates/hir-ty/src/mir/eval.rs:1351-1358 | crates/hir-ty/src/mir/eval.rs:1381-1388 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8 lines × 2) crates/hir/src/lib.rs:2515— crates/hir/src/lib.rs:2515-2522 | crates/hir/src/lib.rs:2524-2531 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8 lines × 2) crates/hir/src/semantics/child_by_source.rs:75— crates/hir/src/semantics/child_by_source.rs:75-82 | crates/hir/src/semantics/child_by_source.rs:102-109 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/semantics/child_by_source.rs:75` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/hir/src/semantics/source_to_def.rs:627— crates/hir/src/semantics/source_to_def.rs:627-634 | crates/hir/src/semantics/source_to_def.rs:638-645 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/semantics/source_to_def.rs:627` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/hir/src/source_analyzer.rs:1891— crates/hir/src/source_analyzer.rs:1891-1898 | crates/hir/src/source_analyzer.rs:2096-2103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/source_analyzer.rs:1891` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 2) crates/ide-assists/src/handlers/bind_unused_param.rs:27— crates/ide-assists/src/handlers/bind_unused_param.rs:27-34 | crates/ide-assists/src/handlers/remove_unused_param.rs:69-76 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) crates/ide-assists/src/handlers/convert_closure_to_fn.rs:115— crates/ide-assists/src/handlers/convert_closure_to_fn.rs:115-122 | crates/ide-assists/src/handlers/convert_closure_to_fn.rs:126-133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/convert_closure_to_fn.rs:115` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/ide-assists/src/handlers/convert_to_guarded_return.rs:125— crates/ide-assists/src/handlers/convert_to_guarded_return.rs:125-132 | crates/ide-assists/src/handlers/convert_to_guarded_return.rs:204-211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/convert_to_guarded_return.rs:125` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/ide-assists/src/handlers/extract_type_alias.rs:96— crates/ide-assists/src/handlers/extract_type_alias.rs:96-103 | crates/ide-assists/src/handlers/generate_fn_type_alias.rs:105-112 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) crates/ide-assists/src/handlers/extract_type_alias.rs:156— crates/ide-assists/src/handlers/extract_type_alias.rs:156-163 | crates/ide-assists/src/handlers/extract_type_alias.rs:165-172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8 lines × 2) crates/ide-completion/src/completions/attribute.rs:101— crates/ide-completion/src/completions/attribute.rs:101-108 | crates/ide-completion/src/completions/item_list.rs:47-54 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/completions/attribute.rs:101` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/ide-completion/src/completions/expr.rs:172— crates/ide-completion/src/completions/expr.rs:172-179 | crates/ide-completion/src/completions/type.rs:95-102 — before extracting anything, compare `crates/ide-completion/src/completions/expr.rs` and `crates/ide-completion/src/completions/type.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/completions/expr.rs:172` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/ide/src/hover/render.rs:122— crates/ide/src/hover/render.rs:122-129 | crates/ide/src/hover/render.rs:167-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/intern/src/gc.rs:137— crates/intern/src/gc.rs:137-144 | crates/intern/src/gc.rs:150-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8 lines × 2) lib/smol_str/src/serde.rs:45— lib/smol_str/src/serde.rs:45-52 | lib/smol_str/src/serde.rs:55-62 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/syntax/src/ast/syntax_factory/constructors.rs:783— crates/syntax/src/ast/syntax_factory/constructors.rs:783-790 | crates/syntax/src/ast/syntax_factory/constructors.rs:925-932 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:783` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/syntax/src/ast/syntax_factory/constructors.rs:475— crates/syntax/src/ast/syntax_factory/constructors.rs:475-482 | crates/syntax/src/ast/syntax_factory/constructors.rs:1522-1529 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:475` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/syntax/src/ast/syntax_factory/constructors.rs:2025— crates/syntax/src/ast/syntax_factory/constructors.rs:2025-2032 | crates/syntax/src/ast/syntax_factory/constructors.rs:2037-2044 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:2025` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Hotspot: crates/ide-completion/src/context/analysis.rs crates/ide-completion/src/context/analysis.rs:967— crates/ide-completion/src/context/analysis.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 153 in ide_completion::context::analysis::classify_name_ref at line 967. 8 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/ide-completion/src/context/analysis.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ty/src/mir/lower.rs crates/hir-ty/src/mir/lower.rs:370— crates/hir-ty/src/mir/lower.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 131 in MirLowerCtx::lower_expr_to_place_without_adjust at line 370. 3 of those changes were fix/bug commits, and the other 7 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/hir-ty/src/mir/lower.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ty/src/mir/eval.rs crates/hir-ty/src/mir/eval.rs:1029— crates/hir-ty/src/mir/eval.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 100 in Evaluator::eval_rvalue at line 1029. 5 of those changes were fix/bug commits, and the other 8 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/hir-ty/src/mir/eval.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ide/src/display.rs crates/hir-ide/src/display.rs:1281— crates/hir-ide/src/display.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 117 in Ty::hir_fmt at line 1281. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/hir-ide/src/display.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-def/src/expr_store/lower.rs crates/hir-def/src/expr_store/lower.rs:1417— crates/hir-def/src/expr_store/lower.rs changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 90 in ExprCollector::maybe_collect_expr at line 1417. 3 of those changes were fix/bug commits, and the other 5 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/hir-def/src/expr_store/lower.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir/src/diagnostics.rs crates/hir/src/diagnostics.rs:1578— crates/hir/src/diagnostics.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 66 in AnyDiagnostic::inference_diagnostic at line 1578. 4 of those changes were fix/bug commits, and the other 5 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/hir/src/diagnostics.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ty/src/infer/expr.rs crates/hir-ty/src/infer/expr.rs:317— crates/hir-ty/src/infer/expr.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 84 in InferenceContext::infer_expr_inner at line 317. 4 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/hir-ty/src/infer/expr.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/ide-diagnostics/src/lib.rs crates/ide-diagnostics/src/lib.rs:377— crates/ide-diagnostics/src/lib.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 95 in ide_diagnostics::semantic_diagnostics at line 377. 3 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/ide-diagnostics/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/ide-completion/src/render.rs crates/ide-completion/src/render.rs:408— crates/ide-completion/src/render.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in ide_completion::render::render_resolution_path at line 408. 8 of those changes were fix/bug commits, and the other 9 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/ide-completion/src/render.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ty/src/mir/eval/shim.rs crates/hir-ty/src/mir/eval/shim.rs:560— crates/hir-ty/src/mir/eval/shim.rs changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 197 in Evaluator::exec_intrinsic at line 560. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/hir-ty/src/mir/eval/shim.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/ide-completion/src/completions/expr.rs crates/ide-completion/src/completions/expr.rs:47— crates/ide-completion/src/completions/expr.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 75 in ide_completion::completions::expr::complete_expr_path at line 47. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/ide-completion/src/completions/expr.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/parser/src/lexed_str.rs crates/parser/src/lexed_str.rs:206— crates/parser/src/lexed_str.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 53 in Converter::extend_token at line 206. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/parser/src/lexed_str.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ty/src/mir/lower/pattern_matching.rs crates/hir-ty/src/mir/lower/pattern_matching.rs:117— crates/hir-ty/src/mir/lower/pattern_matching.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in MirLowerCtx::pattern_match_inner at line 117. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/hir-ty/src/mir/lower/pattern_matching.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ty/src/lower.rs crates/hir-ty/src/lower.rs:593— crates/hir-ty/src/lower.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in TyLoweringContext::lower_ty_ext at line 593. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/hir-ty/src/lower.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/ide-completion/src/completions/type.rs crates/ide-completion/src/completions/type.rs:12— crates/ide-completion/src/completions/type.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in ide_completion::completions::type::complete_type_path at line 12. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/ide-completion/src/completions/type.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/ide-completion/src/render/function.rs crates/ide-completion/src/render/function.rs:50— crates/ide-completion/src/render/function.rs changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in ide_completion::render::function::render at line 50. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/ide-completion/src/render/function.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/ide-assists/src/handlers/extract_variable.rs crates/ide-assists/src/handlers/extract_variable.rs:74— crates/ide-assists/src/handlers/extract_variable.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in ide_assists::handlers::extract_variable::extract_variable at line 74. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/ide-assists/src/handlers/extract_variable.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ty/src/infer/coerce.rs crates/hir-ty/src/infer/coerce.rs:926— crates/hir-ty/src/infer/coerce.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in InferenceContext::try_find_coercion_lub at line 926. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/hir-ty/src/infer/coerce.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ide/src/diagnostics/unsafe_check.rs crates/hir-ide/src/diagnostics/unsafe_check.rs:266— crates/hir-ide/src/diagnostics/unsafe_check.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in UnsafeVisitor::walk_expr at line 266. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/hir-ide/src/diagnostics/unsafe_check.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/ide-completion/src/completions.rs crates/ide-completion/src/completions.rs:723— crates/ide-completion/src/completions.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in ide_completion::completions::complete_name_ref at line 723. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/ide-completion/src/completions.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir/src/source_analyzer.rs crates/hir/src/source_analyzer.rs:1873— crates/hir/src/source_analyzer.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in hir::source_analyzer::resolve_hir_path_ at line 1873. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/hir/src/source_analyzer.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/hir-ty/src/infer/pat.rs crates/hir-ty/src/infer/pat.rs:1356— crates/hir-ty/src/infer/pat.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in InferenceContext::infer_ref_pat at line 1356. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/hir-ty/src/infer/pat.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/ide-completion/src/completions/attribute/cfg.rs crates/ide-completion/src/completions/attribute/cfg.rs:12— crates/ide-completion/src/completions/attribute/cfg.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in ide_completion::completions::attribute::cfg::complete_cfg at line 12. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/ide-completion/src/completions/attribute/cfg.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/proc-macro-api/src/legacy_protocol/msg/flat.rs crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:871— crates/proc-macro-api/src/legacy_protocol/msg/flat.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in Reader::read_tokenstream at line 871. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/proc-macro-api/src/legacy_protocol/msg/flat.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/ide-assists/src/handlers/inline_call.rs crates/ide-assists/src/handlers/inline_call.rs:349— crates/ide-assists/src/handlers/inline_call.rs changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 51 in ide_assists::handlers::inline_call::inline at line 349. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/ide-assists/src/handlers/inline_call.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
XxxComment crates/test-fixture/src/lib.rs:1056— // XXX Currently replaces any literals with an empty string, but supporting — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/syntax-bridge/src/prettify_macro_expansion.rs:142— // XXX: Why input included WHITESPACE? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/rust-analyzer/tests/slow-tests/support.rs:299— /// XXX: remove the tempdir last — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/rust-analyzer/src/config.rs:3651— // XXX: check alias first, to work around the VS Code where it pre-fills the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/rust-analyzer/src/config.rs:3679— // XXX: check alias first, to work around the VS Code where it pre-fills the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/rust-analyzer/src/flycheck.rs:211— // XXX: drop order is significant — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:776— // XXX: we iterate subtrees in reverse to guarantee — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:888— // XXX: we iterate subtrees in reverse to guarantee — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/ide-diagnostics/src/handlers/type_mismatch.rs:414— // XXX: maybe should check if ctx is async — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/ide-completion/src/completions/expr.rs:195— // XXX: For parity with Rust bug #22519, this does not complete Ty::AssocType.
XxxComment crates/ide-completion/src/completions/type.rs:107— // XXX: For parity with Rust bug #22519, this does not complete Ty::AssocType.
XxxComment crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:59— // XXX: We don't currently provide this assist for struct definitions inside macros, but if we — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:202— // XXX: SyntaxEditor cannot insert after deleted element — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:245— // XXX: SyntaxEditor cannot insert after deleted element — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/ide-assists/src/handlers/replace_if_let_with_match.rs:357— // XXX: Perhaps we can extract a let statement to improve — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/ide-assists/src/handlers/replace_if_let_with_match.rs:490— // XXX: Use descend pat for sema analysis — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-ty/src/autoderef.rs:55— // XXX: The recursion limit for `Autoderef` is currently 20, so `Vec::contains()` shouldn't — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-ide/src/diagnostics/decl_check.rs:256— // XXX: only look at source_map if we do have missing fields — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-ide/src/diagnostics/decl_check.rs:342— // XXX: Only look at sources if we do have incorrect names. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-ide/src/diagnostics/decl_check.rs:432— // XXX: Only look at sources if we do have incorrect names. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-ide/src/diagnostics/decl_check.rs:522— // XXX: only look at sources if we do have incorrect names — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-ide/src/diagnostics/decl_check.rs:593— // XXX: only look at sources if we do have incorrect names — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-ide/src/diagnostics/match_check.rs:114— // XXX(iDawer): Collecting pattern adjustments feels imprecise to me. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-ide/src/diagnostics/match_check.rs:186— // XXX(iDawer): field lookup is inefficient — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment crates/hir-def/src/dyn_map.rs:80— /// XXX: AST Nodes and SyntaxNodes have identity equality semantics: nodes are — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
ide_assists::handlers::inline_call::inline (cyclomatic 51) crates/ide-assists/src/handlers/inline_call.rs:349— ide_assists::handlers::inline_call::inline has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::extract_variable::extract_variable (cyclomatic 36) crates/ide-assists/src/handlers/extract_variable.rs:74— ide_assists::handlers::extract_variable::extract_variable has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::convert_closure_to_fn::convert_closure_to_fn (cyclomatic 32) crates/ide-assists/src/handlers/convert_closure_to_fn.rs:54— ide_assists::handlers::convert_closure_to_fn::convert_closure_to_fn has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::add_missing_match_arms::add_missing_match_arms (cyclomatic 30) crates/ide-assists/src/handlers/add_missing_match_arms.rs:41— ide_assists::handlers::add_missing_match_arms::add_missing_match_arms has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::unwrap_return_type::unwrap_return_type (cyclomatic 28) crates/ide-assists/src/handlers/unwrap_return_type.rs:40— ide_assists::handlers::unwrap_return_type::unwrap_return_type has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::add_turbo_fish::add_turbo_fish (cyclomatic 22) crates/ide-assists/src/handlers/add_turbo_fish.rs:31— ide_assists::handlers::add_turbo_fish::add_turbo_fish has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::extract_function::extract_function (cyclomatic 20) crates/ide-assists/src/handlers/extract_function.rs:67— ide_assists::handlers::extract_function::extract_function has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::extract_type_alias::collect_used_generics (cyclomatic 20) crates/ide-assists/src/handlers/extract_type_alias.rs:110— ide_assists::handlers::extract_type_alias::collect_used_generics has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_assists::handlers::inline_type_alias::create_replacement (cyclomatic 20) crates/ide-assists/src/handlers/inline_type_alias.rs:320— ide_assists::handlers::inline_type_alias::create_replacement has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::remove_dbg::compute_dbg_replacement (cyclomatic 20) crates/ide-assists/src/handlers/remove_dbg.rs:72— ide_assists::handlers::remove_dbg::compute_dbg_replacement has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ide_assists::utils::gen_trait_fn_body::gen_partial_eq (cyclomatic 20) crates/ide-assists/src/utils/gen_trait_fn_body.rs:414— ide_assists::utils::gen_trait_fn_body::gen_partial_eq has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ide_assists::handlers::convert_let_else_to_match::remove_mut_and_collect_idents (cyclomatic 19) crates/ide-assists/src/handlers/convert_let_else_to_match.rs:124— ide_assists::handlers::convert_let_else_to_match::remove_mut_and_collect_idents has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::apply_demorgan::apply_demorgan (cyclomatic 18) crates/ide-assists/src/handlers/apply_demorgan.rs:40— ide_assists::handlers::apply_demorgan::apply_demorgan has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::extract_module::extract_module (cyclomatic 18) crates/ide-assists/src/handlers/extract_module.rs:56— ide_assists::handlers::extract_module::extract_module has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::generate_new::generate_new (cyclomatic 18) crates/ide-assists/src/handlers/generate_new.rs:36— ide_assists::handlers::generate_new::generate_new has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::unwrap_branch::unwrap_branch (cyclomatic 18) crates/ide-assists/src/handlers/unwrap_branch.rs:32— ide_assists::handlers::unwrap_branch::unwrap_branch has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ide_assists::handlers::wrap_return_type::wrap_return_type (cyclomatic 18) crates/ide-assists/src/handlers/wrap_return_type.rs:43— ide_assists::handlers::wrap_return_type::wrap_return_type has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::auto_import::relevance_score (cyclomatic 17) crates/ide-assists/src/handlers/auto_import.rs:258— ide_assists::handlers::auto_import::relevance_score has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_assists::handlers::convert_bool_to_enum::replace_usages (cyclomatic 17) crates/ide-assists/src/handlers/convert_bool_to_enum.rs:212— ide_assists::handlers::convert_bool_to_enum::replace_usages has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::extract_function::make_body (cyclomatic 17) crates/ide-assists/src/handlers/extract_function.rs:1800— ide_assists::handlers::extract_function::make_body has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: FunctionBody::external_control_flow (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
ide_assists::handlers::toggle_macro_delimiter::toggle_macro_delimiter (cyclomatic 17) crates/ide-assists/src/handlers/toggle_macro_delimiter.rs:29— ide_assists::handlers::toggle_macro_delimiter::toggle_macro_delimiter has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_assists::handlers::convert_closure_to_fn::compute_closure_type_params (cyclomatic 16) crates/ide-assists/src/handlers/convert_closure_to_fn.rs:351— ide_assists::handlers::convert_closure_to_fn::compute_closure_type_params has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::extract_expressions_from_format_string::extract_expressions_from_format_string (cyclomatic 16) crates/ide-assists/src/handlers/extract_expressions_from_format_string.rs:31— ide_assists::handlers::extract_expressions_from_format_string::extract_expressions_from_format_string has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::generate_delegate_methods::generate_delegate_methods (cyclomatic 16) crates/ide-assists/src/handlers/generate_delegate_methods.rs:51— ide_assists::handlers::generate_delegate_methods::generate_delegate_methods has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_assists::handlers::wrap_unwrap_cfg_attr::attempt_get_derive (cyclomatic 16) crates/ide-assists/src/handlers/wrap_unwrap_cfg_attr.rs:38— ide_assists::handlers::wrap_unwrap_cfg_attr::attempt_get_derive has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HackComment lib/text-size/src/range.rs:126— // HACK for const fn: math on primitives only — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment lib/text-size/src/range.rs:133— // HACK for const fn: math on primitives only — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment editors/code/src/client.ts:23— // HACK: This is a workaround, when the client has been disposed, VSCode — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/rust-analyzer/src/global_state.rs:196— /// HACK: Workaround for <https://github.com/rust-lang/rust-analyzer/issues/19709> — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/rust-analyzer/src/diagnostics/flycheck_to_proto.rs:28— // HACK: special case for `warnings` rustc lint. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/rust-analyzer/src/diagnostics/flycheck_to_proto.rs:36— // HACK: special case for `warnings` rustc lint. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/mbe/src/expander/matcher.rs:422— // HACK: here we use `meta_result` to pass `TtIter` back to caller because — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/mbe/src/expander/matcher.rs:567— // HACK: here we use `meta_result` to pass `TtIter` back to caller because — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/mbe/src/expander/matcher.rs:791— // HACK: Macro expansion should not be done using "rollback and try another alternative". — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/ide/src/expand_macro.rs:241— // hack until we get hygiene working (same character amount to preserve formatting as much as possible) — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/builtin_derive.rs:32— // HACK: Fake the param. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/db.rs:347— // HACK: We need this for MIR intrinsic `type_name()`, and it can't access the display infra because it is inside `hir-ide`. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/next_solver/interner.rs:1519— // HACK: For integer and float variables we have to manually look at all impls — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/next_solver/ty.rs:1219— // HACK: Coroutine witness types are lifetime erased, so they — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/next_solver/infer/errors.rs:372— /// HACK: We walk the nested obligations for a well-formed arg manually, — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/infer/callee.rs:207— // Hack: we know that there are traits implementing Fn for &F — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/infer/callee.rs:267— // HACK(async_closures): For async closures, prefer `AsyncFn*` — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/infer/op.rs:233— // HACK(eddyb) Bypass checks due to reborrows being in — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:887— // HACK: this could be a fake pattern corresponding to a deref inserted by match — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir-def/src/nameres.rs:95— /// HACK: In order to test builtin derive expansion, we gate their fast path with this atomic when cfg(test). — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir/src/diagnostics.rs:1101— // HACK: When specialization is enabled in the current crate, and there exists — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir/src/source_analyzer.rs:847— // HACK: subst for `poll()` coincides with that for `Future` because `poll()` itself — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir/src/source_analyzer.rs:881— // HACK: subst for all methods coincides with that for their trait because the methods — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir/src/source_analyzer.rs:908— // HACK: subst for all methods coincides with that for their trait because the methods — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment crates/hir/src/source_analyzer.rs:925— // HACK: subst for `index()` coincides with that for `Index` because `index()` itself — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
TooManyMethods: InferenceContext crates/hir-ty/src/infer.rs:1340— TooManyMethods — 208 methods, declared across 15 files: src/infer.rs (56), infer/pat.rs (36), infer/expr.rs (33), infer/closure.rs (19), +11 more file(s). The bar is 30 methods; this is 178 over it, 6.93× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SyntaxFactory crates/syntax/src/ast/syntax_factory.rs:16— TooManyMethods — 157 methods, declared across 2 files: syntax_factory/constructors.rs (153), ast/syntax_factory.rs (4). The bar is 30 methods; this is 127 over it, 5.23× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SemanticsImpl crates/hir/src/semantics.rs:171— TooManyMethods — 139 methods. The bar is 30 methods; this is 109 over it, 4.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ExprCollector crates/hir-def/src/expr_store/lower.rs:508— TooManyMethods — 113 methods, declared across 3 files: expr_store/lower.rs (107), lower/format_args.rs (5), lower/asm.rs (1). The bar is 30 methods; this is 83 over it, 3.77× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: InferCtxt crates/hir-ty/src/next_solver/infer/mod.rs:231— TooManyMethods — 111 methods, declared across 13 files: infer/mod.rs (71), snapshot/mod.rs (10), canonical/instantiate.rs (6), outlives/obligations.rs (5), +9 more file(s). The bar is 30 methods; this is 81 over it, 3.70× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Config crates/rust-analyzer/src/config.rs:1116— TooManyMethods — 84 methods. The bar is 30 methods; this is 54 over it, 2.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Analysis crates/ide/src/lib.rs:244— TooManyMethods — 79 methods. The bar is 30 methods; this is 49 over it, 2.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Ty crates/hir-ty/src/next_solver/ty.rs:55— TooManyMethods — 70 methods. The bar is 30 methods; this is 40 over it, 2.33× the bar. Most of these members implement ty.Ty (70 of 70 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
TooManyMethods: SourceAnalyzer crates/hir/src/source_analyzer.rs:77— TooManyMethods — 70 methods. The bar is 30 methods; this is 40 over it, 2.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Evaluator crates/hir-ty/src/mir/eval.rs:166— TooManyMethods — 69 methods, declared across 3 files: mir/eval.rs (55), eval/shim.rs (12), shim/simd.rs (2). The bar is 30 methods; this is 39 over it, 2.30× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: MirLowerCtx crates/hir-ty/src/mir/lower.rs:78— TooManyMethods — 66 methods, declared across 3 files: mir/lower.rs (48), lower/pattern_matching.rs (11), lower/as_place.rs (7). The bar is 30 methods; this is 36 over it, 2.20× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ItemScope crates/hir-def/src/item_scope.rs:125— TooManyMethods — 55 methods. The bar is 30 methods; this is 25 over it, 1.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: GlobalState crates/rust-analyzer/src/global_state.rs:84— TooManyMethods — 51 methods, declared across 4 files: src/main_loop.rs (18), src/global_state.rs (16), src/reload.rs (13), lsp/utils.rs (4). The bar is 30 methods; this is 21 over it, 1.70× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ClientCapabilities crates/rust-analyzer/src/lsp/capabilities.rs:198— TooManyMethods — 45 methods. The bar is 30 methods; this is 15 over it, 1.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: TyLoweringContext crates/hir-ty/src/lower.rs:226— TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Resolver crates/hir-def/src/resolver.rs:44— TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ExprUseVisitor crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:407— TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SourceToDefCtx crates/hir/src/semantics/source_to_def.rs:188— TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: FamousDefs crates/ide-db/src/famous_defs.rs:21— TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DefMap crates/hir-def/src/nameres.rs:174— TooManyMethods — 42 methods, declared across 3 files: src/nameres.rs (28), nameres/path_resolution.rs (12), nameres/attr_resolution.rs (2). The bar is 30 methods; this is 12 over it, 1.40× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: InferenceTable crates/hir-ty/src/infer/unify.rs:147— TooManyMethods — 41 methods, declared across 3 files: infer/unify.rs (38), infer/autoderef.rs (2), src/method_resolution.rs (1). The bar is 30 methods; this is 11 over it, 1.37× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: InferenceResult crates/hir-ty/src/infer.rs:760— TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ProbeContext crates/hir-ty/src/method_resolution/probe.rs:48— TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Completions crates/ide-completion/src/completions.rs:57— TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Semantics crates/hir/src/semantics.rs:162— TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ExprCollector crates/hir-def/src/expr_store/lower.rs:508— ClassTooLong — 2147 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 113 methods, 3 blocks, lines 508-3766. The bar is 400 significant lines; this is 1747 over it, 5.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Evaluator crates/hir-ty/src/mir/eval.rs:166— ClassTooLong — 2036 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 69 methods, 2 blocks, lines 166-3070. The bar is 400 significant lines; this is 1636 over it, 5.09× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: MirLowerCtx crates/hir-ty/src/mir/lower.rs:78— ClassTooLong — 1335 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 66 methods, 2 blocks, lines 78-1941. The bar is 400 significant lines; this is 935 over it, 3.34× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: SourceAnalyzer crates/hir/src/source_analyzer.rs:77— ClassTooLong — 1203 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 70 methods, 2 blocks, lines 77-1752. The bar is 400 significant lines; this is 803 over it, 3.01× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DefCollector crates/hir-def/src/nameres/collector.rs:232— ClassTooLong — 1005 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 22 methods, 2 blocks, lines 232-1881. The bar is 400 significant lines; this is 605 over it, 2.51× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DbInterner crates/hir-ty/src/next_solver/interner.rs:352— ClassTooLong — 849 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 19 methods, 4 blocks, lines 352-2117. The bar is 400 significant lines; this is 449 over it, 2.12× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Ty crates/hir-ty/src/next_solver/ty.rs:55— ClassTooLong — 844 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 70 methods, 12 blocks, lines 55-1416. The bar is 400 significant lines; this is 444 over it, 2.11× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: InferenceContext crates/hir-ty/src/infer.rs:1340— ClassTooLong — 828 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 208 methods, 2 blocks, lines 1340-2623. The bar is 400 significant lines; this is 428 over it, 2.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: TyLoweringContext crates/hir-ty/src/lower.rs:226— ClassTooLong — 735 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 44 methods, 3 blocks, lines 226-1398. The bar is 400 significant lines; this is 335 over it, 1.84× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ProjectWorkspace crates/project-model/src/workspace.rs:57— ClassTooLong — 728 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 19 methods, 3 blocks, lines 57-1104. The bar is 400 significant lines; this is 328 over it, 1.82× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ExprUseVisitor crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:407— ClassTooLong — 713 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 43 methods, 3 blocks, lines 407-1762. The bar is 400 significant lines; this is 313 over it, 1.78× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ProbeContext crates/hir-ty/src/method_resolution/probe.rs:48— ClassTooLong — 709 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 39 methods, 4 blocks, lines 48-2082. The bar is 400 significant lines; this is 309 over it, 1.77× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Printer crates/hir-def/src/expr_store/pretty.rs:450— ClassTooLong — 681 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 18 methods, 3 blocks, lines 450-1411. The bar is 400 significant lines; this is 281 over it, 1.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PathLoweringContext crates/hir-ty/src/lower/path.rs:58— ClassTooLong — 636 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 25 methods, 2 blocks, lines 58-1005. The bar is 400 significant lines; this is 236 over it, 1.59× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ModCollector crates/hir-def/src/nameres/collector.rs:1884— ClassTooLong — 636 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 12 methods, 2 blocks, lines 1884-2782. The bar is 400 significant lines; this is 236 over it, 1.59× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: FindUsages crates/ide-db/src/search.rs:441— ClassTooLong — 606 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 20 methods, 2 blocks, lines 441-1376. The bar is 400 significant lines; this is 206 over it, 1.52× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Resolver crates/hir-def/src/resolver.rs:44— ClassTooLong — 582 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 43 methods, 4 blocks, lines 44-1183. The bar is 400 significant lines; this is 182 over it, 1.46× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: AnyDiagnostic crates/hir/src/diagnostics.rs:132— ClassTooLong — 551 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 9 methods. The bar is 400 significant lines; this is 151 over it, 1.38× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ItemScope crates/hir-def/src/item_scope.rs:125— ClassTooLong — 474 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 55 methods, 4 blocks, lines 125-904. The bar is 400 significant lines; this is 74 over it, 1.19× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: InferCtxt crates/hir-ty/src/next_solver/infer/mod.rs:231— ClassTooLong — 456 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 111 methods, 2 blocks, lines 231-1279. The bar is 400 significant lines; this is 56 over it, 1.14× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: AttrFlags crates/hir-def/src/attrs.rs:287— ClassTooLong — 448 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 24 methods. The bar is 400 significant lines; this is 48 over it, 1.12× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Analysis crates/ide/src/lib.rs:244— ClassTooLong — 440 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 79 methods, 2 blocks, lines 244-978. The bar is 400 significant lines; this is 40 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DiagnosticsCollector crates/hir/src/diagnostics.rs:748— ClassTooLong — 434 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 23 methods, 2 blocks, lines 748-1443. The bar is 400 significant lines; this is 34 over it, 1.09× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DeclValidator crates/hir-ide/src/diagnostics/decl_check.rs:125— ClassTooLong — 421 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 21 methods, 2 blocks, lines 125-776. The bar is 400 significant lines; this is 21 over it, 1.05× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: GlobalState crates/rust-analyzer/src/global_state.rs:84— ClassTooLong — 412 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 51 methods, 3 blocks, lines 84-821. The bar is 400 significant lines; this is 12 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ide_completion::context::analysis::classify_name_ref (cognitive 172) crates/ide-completion/src/context/analysis.rs:967— ide_completion::context::analysis::classify_name_ref has cognitive complexity 172 (threshold 15). Drivers by points: if/else 48 (80 pts), match/switch 32 (67 pts), boolean chains 16, loops 2 (9 pts) (nesting depth added 74). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::completions::expr::complete_expr_path (cognitive 131) crates/ide-completion/src/completions/expr.rs:47— ide_completion::completions::expr::complete_expr_path has cognitive complexity 131 (threshold 15). Drivers by points: if/else 38 (87 pts), match/switch 13 (32 pts), boolean chains 6, loops 2 (6 pts) (nesting depth added 72). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::context::analysis::expected_type_and_name (cognitive 63) crates/ide-completion/src/context/analysis.rs:590— ide_completion::context::analysis::expected_type_and_name has cognitive complexity 63 (threshold 15). Drivers by points: if/else 14 (28 pts), match/switch 11 (23 pts), boolean chains 7, loops 3 (5 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::completions::postfix::complete_postfix (cognitive 61) crates/ide-completion/src/completions/postfix.rs:33— ide_completion::completions::postfix::complete_postfix has cognitive complexity 61 (threshold 15). Drivers by points: if/else 27 (36 pts), match/switch 10 (15 pts), boolean chains 10 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::context::analysis::expand (cognitive 58) crates/ide-completion/src/context/analysis.rs:172— ide_completion::context::analysis::expand has cognitive complexity 58 (threshold 15). Drivers by points: if/else 14 (45 pts), match/switch 4 (6 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ide_completion::completions::type::complete_type_path (cognitive 51) crates/ide-completion/src/completions/type.rs:12— ide_completion::completions::type::complete_type_path has cognitive complexity 51 (threshold 15). Drivers by points: if/else 9 (28 pts), match/switch 8 (16 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 31). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_completion::completions::use_::complete_use_path (cognitive 42) crates/ide-completion/src/completions/use_.rs:13— ide_completion::completions::use_::complete_use_path has cognitive complexity 42 (threshold 15). Drivers by points: if/else 7 (23 pts), match/switch 4 (9 pts), loops 2 (7 pts), boolean chains 3 (nesting depth added 26). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_completion::completions::item_list::add_keywords (cognitive 36) crates/ide-completion/src/completions/item_list.rs:85— ide_completion::completions::item_list::add_keywords has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 8 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::render::function::add_call_parens (cognitive 35) crates/ide-completion/src/render/function.rs:213— ide_completion::render::function::add_call_parens has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (21 pts), match/switch 4 (12 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::context::analysis::analyze (cognitive 33) crates/ide-completion/src/context/analysis.rs:442— ide_completion::context::analysis::analyze has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 8, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::completions::attribute::complete_attribute_path (cognitive 28) crates/ide-completion/src/completions/attribute.rs:70— ide_completion::completions::attribute::complete_attribute_path has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (15 pts), match/switch 4 (7 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ide_completion::completions::pattern::complete_pattern_path (cognitive 27) crates/ide-completion/src/completions/pattern.rs:130— ide_completion::completions::pattern::complete_pattern_path has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 6 (15 pts), if/else 3 (9 pts), loops 1 (3 pts) (nesting depth added 17). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_completion::completions::pattern::complete_pattern (cognitive 22) crates/ide-completion/src/completions/pattern.rs:13— ide_completion::completions::pattern::complete_pattern has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 5 (8 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::completions::item_list::trait_impl::get_transformed_fn (cognitive 21) crates/ide-completion/src/completions/item_list/trait_impl.rs:321— ide_completion::completions::item_list::trait_impl::get_transformed_fn has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 3 (8 pts), boolean chains 1 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_completion::completions::mod_::complete_mod (cognitive 19) crates/ide-completion/src/completions/mod_.rs:15— ide_completion::completions::mod_::complete_mod has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::render::function::render (cognitive 19) crates/ide-completion/src/render/function.rs:50— ide_completion::render::function::render has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, match/switch 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ide_completion::completions::attribute::cfg::complete_cfg (cognitive 18) crates/ide-completion/src/completions/attribute/cfg.rs:12— ide_completion::completions::attribute::cfg::complete_cfg has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 4 (6 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::render::render_resolution_path (cognitive 18) crates/ide-completion/src/render.rs:408— ide_completion::render::render_resolution_path has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 5, match/switch 4 (5 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::completions::attribute::derive::complete_derive_path (cognitive 17) crates/ide-completion/src/completions/attribute/derive.rs:13— ide_completion::completions::attribute::derive::complete_derive_path has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_completion::completions::postfix::format_like::add_format_like_completions (cognitive 17) crates/ide-completion/src/completions/postfix/format_like.rs:44— ide_completion::completions::postfix::format_like::add_format_like_completions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::completions::expr::complete_expr (cognitive 16) crates/ide-completion/src/completions/expr.rs:457— ide_completion::completions::expr::complete_expr has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), loops 2 (6 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_completion::completions::fn_param::fill_fn_params (cognitive 16) crates/ide-completion/src/completions/fn_param.rs:80— ide_completion::completions::fn_param::fill_fn_params has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 4 (5 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_completion::completions::item_list::trait_impl::add_type_alias_impl (cognitive 16) crates/ide-completion/src/completions/item_list/trait_impl.rs:403— ide_completion::completions::item_list::trait_impl::add_type_alias_impl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 2 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×22
Edited copy of a member (9 corresponding lines) crates/span/src/map.rs:58— crates/span/src/map.rs:58-66 | crates/span/src/map.rs:74-85 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/intern/src/gc.rs:136— crates/intern/src/gc.rs:136-144 | crates/intern/src/gc.rs:149-157 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/hir-ty/src/next_solver/infer/mod.rs:1009— crates/hir-ty/src/next_solver/infer/mod.rs:1009-1019 | crates/hir-ty/src/next_solver/infer/mod.rs:1021-1029 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/syntax/src/syntax_editor/edits.rs:250— crates/syntax/src/syntax_editor/edits.rs:250-258 | crates/syntax/src/syntax_editor/edits.rs:266-274 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/syntax/src/ast/make.rs:491— crates/syntax/src/ast/make.rs:491-499 | crates/syntax/src/ast/make.rs:1007-1015 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/hir-def/src/hir/generics.rs:385— crates/hir-def/src/hir/generics.rs:385-393 | crates/hir-def/src/hir/generics.rs:395-403 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/hir-ty/src/infer/cast.rs:459— crates/hir-ty/src/infer/cast.rs:459-467 | crates/hir-ty/src/infer/cast.rs:489-497 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:361— crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:361-369 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:380-388 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/hir-ty/src/infer.rs:2246— crates/hir-ty/src/infer.rs:2246-2254 | crates/hir-ty/src/mir/lower.rs:1524-1532 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/syntax-bridge/src/lib.rs:183— crates/syntax-bridge/src/lib.rs:183-191 | crates/syntax-bridge/src/lib.rs:198-206 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/syntax/src/syntax_editor.rs:150— crates/syntax/src/syntax_editor.rs:150-158 | crates/syntax/src/syntax_editor.rs:192-200 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) lib/expect-test/src/lib.rs:485— lib/expect-test/src/lib.rs:485-496 | lib/expect-test/src/lib.rs:497-505 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) lib/lsp-server/src/msg.rs:223— lib/lsp-server/src/msg.rs:223-231 | lib/lsp-server/src/msg.rs:248-256 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/parser/src/shortcuts.rs:117— crates/parser/src/shortcuts.rs:117-125 | crates/parser/src/shortcuts.rs:127-135 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) xtask/src/metrics.rs:89— xtask/src/metrics.rs:89-104 | xtask/src/metrics.rs:121-129 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/hir/src/lib.rs:1901— crates/hir/src/lib.rs:1901-1909 | crates/hir/src/lib.rs:5868-5876 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/ide-assists/src/handlers/generate_blanket_trait_impl.rs:292— crates/ide-assists/src/handlers/generate_blanket_trait_impl.rs:292-300 | crates/ide-assists/src/handlers/replace_qualified_name_with_use.rs:120-129 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/parser/src/grammar.rs:352— crates/parser/src/grammar.rs:352-360 | crates/parser/src/grammar.rs:362-370 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/proc-macro-api/src/legacy_protocol.rs:51— crates/proc-macro-api/src/legacy_protocol.rs:51-59 | crates/proc-macro-api/src/legacy_protocol.rs:65-74 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/ide-db/src/helpers.rs:145— crates/ide-db/src/helpers.rs:145-153 | crates/ide/src/static_index.rs:151-161 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/hir-ty/src/infer/coerce.rs:149— crates/hir-ty/src/infer/coerce.rs:149-157 | crates/hir-ty/src/infer/unify.rs:423-431 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/ide-diagnostics/src/handlers/non_exhaustive_record_expr.rs:10— crates/ide-diagnostics/src/handlers/non_exhaustive_record_expr.rs:10-18 | crates/ide-diagnostics/src/handlers/union_expr_must_have_exactly_one_field.rs:9-17 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
InferenceContext::infer_expr_inner (cognitive 96) crates/hir-ty/src/infer/expr.rs:317— InferenceContext::infer_expr_inner has cognitive complexity 96 (threshold 15). Drivers by points: if/else 27 (50 pts), match/switch 15 (33 pts), loops 4 (10 pts), boolean chains 3 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::resolve_variant (cognitive 79) crates/hir-ty/src/infer.rs:2256— InferenceContext::resolve_variant has cognitive complexity 79 (threshold 15). Drivers by points: if/else 28 (60 pts), match/switch 7 (13 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 39). Of this number, 77 points are the body's own statements and 2 belong to one function item inside it that branches. This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
InferenceContext::check_record_expr_fields (cognitive 57) crates/hir-ty/src/infer/expr.rs:968— InferenceContext::check_record_expr_fields has cognitive complexity 57 (threshold 15). Drivers by points: if/else 20 (41 pts), loops 3 (7 pts), match/switch 2 (7 pts), boolean chains 2 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::check_call_arguments (cognitive 48) crates/hir-ty/src/infer/expr.rs:1920— InferenceContext::check_call_arguments has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (28 pts), match/switch 5 (15 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::analyze_closure (cognitive 39) crates/hir-ty/src/infer/closure/analysis.rs:232— InferenceContext::analyze_closure has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (30 pts), loops 3 (5 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::infer_ref_pat (cognitive 39) crates/hir-ty/src/infer/pat.rs:1356— InferenceContext::infer_ref_pat has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (29 pts), boolean chains 5, match/switch 3 (5 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::infer_mut_expr_without_adjust (cognitive 38) crates/hir-ty/src/infer/mutability.rs:55— InferenceContext::infer_mut_expr_without_adjust has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (26 pts), match/switch 4 (8 pts), loops 2 (4 pts) (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
InferenceContext::try_find_coercion_lub (cognitive 35) crates/hir-ty/src/infer/coerce.rs:926— InferenceContext::try_find_coercion_lub has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (17 pts), match/switch 5 (11 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
InferenceContext::compute_min_captures (cognitive 31) crates/hir-ty/src/infer/closure/analysis.rs:727— InferenceContext::compute_min_captures has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 5 (13 pts), if/else 5 (11 pts), loops 4 (7 pts) (nesting depth added 17). Of this number, 29 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::deduce_closure_signature_from_predicates (cognitive 30) crates/hir-ty/src/infer/closure.rs:421— InferenceContext::deduce_closure_signature_from_predicates has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 3 (9 pts), boolean chains 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::resolve_value_path_inner (cognitive 26) crates/hir-ty/src/infer/path.rs:146— InferenceContext::resolve_value_path_inner has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 4 (13 pts) (nesting depth added 14). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::resolve_all (cognitive 26) crates/hir-ty/src/infer.rs:1644— InferenceContext::resolve_all has cognitive complexity 26 (threshold 15). Drivers by points: loops 15 (25 pts), if/else 1 (nesting depth added 10). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
InferenceContext::infer_pat_inner (cognitive 25) crates/hir-ty/src/infer/pat.rs:377— InferenceContext::infer_pat_inner has cognitive complexity 25 (threshold 15). Drivers by points: loops 3 (8 pts), match/switch 4 (7 pts), if/else 5 (6 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::infer_mut_expr (cognitive 24) crates/hir-ty/src/infer/mutability.rs:21— InferenceContext::infer_mut_expr has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 3 (12 pts), if/else 3 (10 pts), loops 1 (2 pts) (nesting depth added 17). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
InferenceContext::compute_definition_site_hidden_types (cognitive 22) crates/hir-ty/src/infer/opaques.rs:67— InferenceContext::compute_definition_site_hidden_types has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (7 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::calculate_diverging_fallback (cognitive 19) crates/hir-ty/src/infer/fallback.rs:233— InferenceContext::calculate_diverging_fallback has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 5 (8 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::check_record_pat_fields (cognitive 19) crates/hir-ty/src/infer/pat.rs:1154— InferenceContext::check_record_pat_fields has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 2 (4 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::struct_tail_with_normalize (cognitive 19) crates/hir-ty/src/infer.rs:2061— InferenceContext::struct_tail_with_normalize has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (12 pts), if/else 3 (6 pts), loops 1 (nesting depth added 11). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
InferenceContext::infer_method_call (cognitive 17) crates/hir-ty/src/infer/expr.rs:1773— InferenceContext::infer_method_call has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 5 (9 pts), if/else 3 (5 pts), loops 1 (3 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
InferenceContext::infer_tuple_struct_pat (cognitive 17) crates/hir-ty/src/infer/pat.rs:1046— InferenceContext::infer_tuple_struct_pat has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (7 pts), if/else 4 (5 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceContext::try_index_step (cognitive 16) crates/hir-ty/src/infer/place_op.rs:106— InferenceContext::try_index_step has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Duplicated block (11 lines × 2) crates/hir-def/src/expr_store.rs:793— crates/hir-def/src/expr_store.rs:793-803 | crates/hir-def/src/expr_store.rs:828-838 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/expr_store.rs:793` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) crates/hir-def/src/expr_store/pretty.rs:589— crates/hir-def/src/expr_store/pretty.rs:589-599 | crates/hir-def/src/expr_store/pretty.rs:608-618 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/expr_store/pretty.rs:589` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) crates/hir-def/src/item_scope.rs:922— crates/hir-def/src/item_scope.rs:922-932 | crates/hir-def/src/item_scope.rs:935-945 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (11 lines × 2) crates/hir-ty/src/drop.rs:82— crates/hir-ty/src/drop.rs:82-93 | crates/hir-ty/src/drop.rs:102-112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/drop.rs:82` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11 lines × 2) crates/hir-ty/src/lower.rs:1669— crates/hir-ty/src/lower.rs:1669-1679 | crates/hir-ty/src/lower.rs:1700-1710 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `def` to `ConstId` in one and `StaticId` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/hir-ty/src/lower.rs:1668` calls `loc` and `crates/hir-ty/src/lower.rs:1699` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) crates/hir-ty/src/lower.rs:1700— crates/hir-ty/src/lower.rs:1700-1710 | crates/hir-ty/src/lower.rs:2286-2296 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/hir-ty/src/lower/path.rs:751— crates/hir-ty/src/lower/path.rs:751-763 | crates/hir-ty/src/method_resolution/confirm.rs:409-419 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/lower/path.rs:751` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) crates/hir-ty/src/mir/eval.rs:2651— crates/hir-ty/src/mir/eval.rs:2651-2661 | crates/hir-ty/src/mir/eval.rs:2663-2673 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (11 lines × 2) crates/hir-ty/src/mir/eval/shim.rs:620— crates/hir-ty/src/mir/eval/shim.rs:620-630 | crates/hir-ty/src/mir/eval/shim.rs:692-702 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/mir/eval/shim.rs:620` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) crates/hir-ty/src/mir/lower.rs:430— crates/hir-ty/src/mir/lower.rs:430-440 | crates/hir-ty/src/mir/lower.rs:935-945 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/mir/lower.rs:430` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) crates/hir/src/lib.rs:3321— crates/hir/src/lib.rs:3321-3331 | crates/hir/src/lib.rs:3362-3372 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/lib.rs:3321` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) crates/hir/src/lib.rs:3346— crates/hir/src/lib.rs:3346-3356 | crates/hir/src/lib.rs:3387-3397 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/lib.rs:3346` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs:266— crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs:266-276 | crates/ide-assists/src/handlers/unwrap_return_type.rs:70-80 — before extracting anything, compare `crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs` and `crates/ide-assists/src/handlers/unwrap_return_type.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) crates/ide-assists/src/handlers/generate_enum_is_method.rs:117— crates/ide-assists/src/handlers/generate_enum_is_method.rs:117-127 | crates/ide-assists/src/handlers/generate_enum_projection_method.rs:198-208 — before extracting anything, compare `crates/ide-assists/src/handlers/generate_enum_is_method.rs` and `crates/ide-assists/src/handlers/generate_enum_projection_method.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/generate_enum_is_method.rs:117` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) crates/ide-completion/src/completions/type.rs:68— crates/ide-completion/src/completions/type.rs:68-78 | crates/ide-completion/src/completions/type.rs:111-121 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/completions/type.rs:68` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) crates/mbe/src/expander/matcher.rs:523— crates/mbe/src/expander/matcher.rs:523-533 | crates/mbe/src/expander/matcher.rs:543-553 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/mbe/src/expander/matcher.rs:523` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) crates/rust-analyzer/src/lsp/to_proto.rs:1830— crates/rust-analyzer/src/lsp/to_proto.rs:1830-1840 | crates/rust-analyzer/src/lsp/to_proto.rs:1884-1894 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) crates/syntax/src/validation.rs:375— crates/syntax/src/validation.rs:375-385 | crates/syntax/src/validation.rs:388-398 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `ty` to `ast::DynTraitType` in one and `ast::ImplTraitType` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (11 lines × 2) crates/ide-assists/src/handlers/add_missing_match_arms.rs:167— crates/ide-assists/src/handlers/add_missing_match_arms.rs:167-177 | crates/ide-assists/src/handlers/add_missing_match_arms.rs:200-210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/add_missing_match_arms.rs:167` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) crates/hir-def/src/resolver.rs:198— crates/hir-def/src/resolver.rs:198-208 | crates/hir-def/src/resolver.rs:382-392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/resolver.rs:198` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs:101— crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs:101-111 | crates/proc-macro-srv/src/server_impl/token_id.rs:94-104 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs:101` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
TodoComment editors/code/src/config.ts:575— // TODO: support for remote workspaces? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment editors/code/src/debug.ts:166— // TODO: remove lldb-dap-specific post-processing once — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/test-utils/src/minicore.rs:83— //! todo: panic — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/test-utils/src/minicore.rs:2512— // :todo — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/rust-analyzer/src/discover.rs:65— // TODO: are we sure the extra env should be empty? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/rust-analyzer/src/tracing/config.rs:89— // TODO: remove `.with_filter(LevelFilter::OFF)` on the `None` branch. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/rust-analyzer/src/tracing/config.rs:101— // TODO: remove `.with_filter(LevelFilter::OFF)` on the `None` branch. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/proc-macro-api/src/bidirectional_protocol.rs:59— // TODO: Avoid `AssertUnwindSafe` by making the callback `UnwindSafe` once `SourceDatabase` — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide-diagnostics/src/handlers/explicit_drop_method_use.rs:51— // TODO: handle macro calls. Rough plan: — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide-diagnostics/src/handlers/explicit_drop_method_use.rs:92— // TODO: make this work in macros? Might not be worth it, as this is a niche way to trigger this — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide-completion/src/context.rs:50— // TODO: Add try_tok and default_tok — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide-assists/src/handlers/add_missing_impl_members.rs:44— // todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide-assists/src/handlers/generate_blanket_trait_impl.rs:55— // todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide-assists/src/handlers/generate_function.rs:52— // todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide-assists/src/handlers/unwrap_type_to_generic_arg.rs:15— // todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide-assists/src/handlers/unwrap_type_to_generic_arg.rs:21— // todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/ide/src/moniker.rs:250— /// `BuiltinLifetime`, `TupleField`, `ToolModule`, and `InlineAsmRegOrRegClass`. TODO: it might be — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/hir-ty/src/next_solver/predicate.rs:445— // TODO implement Debug by hand — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/hir-ty/src/next_solver/infer/relate/generalize.rs:153— /// todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment crates/hir-ty/src/infer/closure.rs:1164— // TODO: def id needs to be changed? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
ide_db::syntax_helpers::format_string::lex_format_specifiers (cognitive 101) crates/ide-db/src/syntax_helpers/format_string.rs:45— ide_db::syntax_helpers::format_string::lex_format_specifiers has cognitive complexity 101 (threshold 15). Drivers by points: if/else 18 (62 pts), match/switch 7 (29 pts), boolean chains 7, loops 3 (nesting depth added 66). Of this number, 92 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ide_db::imports::insert_use::guess_granularity_from_scope (cognitive 41) crates/ide-db/src/imports/insert_use.rs:340— ide_db::imports::insert_use::guess_granularity_from_scope has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (32 pts), boolean chains 6, match/switch 2, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::rename::source_edit_from_def (cognitive 41) crates/ide-db/src/rename.rs:673— ide_db::rename::source_edit_from_def has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (27 pts), match/switch 3 (8 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ide_db::prime_caches::parallel_prime_caches (cognitive 40) crates/ide-db/src/prime_caches.rs:31— ide_db::prime_caches::parallel_prime_caches has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 8 (14 pts), match/switch 6 (8 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::traits::diff_assoc_items (cognitive 33) crates/ide-db/src/traits.rs:56— ide_db::traits::diff_assoc_items has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 3 (7 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::syntax_helpers::format_string_exprs::parse_format_exprs (cognitive 30) crates/ide-db/src/syntax_helpers/format_string_exprs.rs:44— ide_db::syntax_helpers::format_string_exprs::parse_format_exprs has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::imports::merge_imports::recursive_normalize (cognitive 29) crates/ide-db/src/imports/merge_imports.rs:292— ide_db::imports::merge_imports::recursive_normalize has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (24 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::imports::merge_imports::version_sort::version_sort (cognitive 28) crates/ide-db/src/imports/merge_imports.rs:978— ide_db::imports::merge_imports::version_sort::version_sort has cognitive complexity 28 (threshold 15). Drivers by points: match/switch 5 (14 pts), if/else 3 (11 pts), boolean chains 2, loops 1 (nesting depth added 17). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_db::syntax_helpers::node_ext::walk_patterns_in_expr (cognitive 25) crates/ide-db/src/syntax_helpers/node_ext.rs:116— ide_db::syntax_helpers::node_ext::walk_patterns_in_expr has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 3 (8 pts), boolean chains 1, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::rename::source_edit_from_name_ref (cognitive 24) crates/ide-db/src/rename.rs:578— ide_db::rename::source_edit_from_name_ref has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::imports::merge_imports::recursive_merge (cognitive 23) crates/ide-db/src/imports/merge_imports.rs:120— ide_db::imports::merge_imports::recursive_merge has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 2 (6 pts), boolean chains 3, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::symbol_index::resolve_path_to_modules (cognitive 23) crates/ide-db/src/symbol_index.rs:290— ide_db::symbol_index::resolve_path_to_modules has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (11 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::syntax_helpers::tree_diff::diff::go (cognitive 23) crates/ide-db/src/syntax_helpers/tree_diff.rs:79— ide_db::syntax_helpers::tree_diff::diff::go has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 3 (6 pts), loops 2 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::imports::insert_use::insert_use_with_editor_ (cognitive 22) crates/ide-db/src/imports/insert_use.rs:425— ide_db::imports::insert_use::insert_use_with_editor_ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::syntax_helpers::node_ext::preorder_expr_with_ctx_checker (cognitive 21) crates/ide-db/src/syntax_helpers/node_ext.rs:69— ide_db::syntax_helpers::node_ext::preorder_expr_with_ctx_checker has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::imports::insert_use::insert_use_with_alias_option_with_editor (cognitive 19) crates/ide-db/src/imports/insert_use.rs:214— ide_db::imports::insert_use::insert_use_with_alias_option_with_editor has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 4 (6 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_db::rust_doc::format_docs_ (cognitive 19) crates/ide-db/src/rust_doc.rs:40— ide_db::rust_doc::format_docs_ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::rename::rename_field_constructors (cognitive 16) crates/ide-db/src/rename.rs:425— ide_db::rename::rename_field_constructors has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, loops 5 (7 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ide_db::syntax_helpers::node_ext::for_each_tail_expr (cognitive 16) crates/ide-db/src/syntax_helpers/node_ext.rs:283— ide_db::syntax_helpers::node_ext::for_each_tail_expr has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), match/switch 3 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×19
Edited copy of a member (11 corresponding lines) crates/hir/src/source_analyzer.rs:537— crates/hir/src/source_analyzer.rs:537-547 | crates/hir/src/source_analyzer.rs:553-570 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/ide-assists/src/handlers/generate_from_impl_for_enum.rs:156— crates/ide-assists/src/handlers/generate_from_impl_for_enum.rs:156-167 | crates/ide-assists/src/handlers/generate_single_field_struct_from.rs:226-236 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) xtask/src/codegen/diagnostics_docs.rs:11— xtask/src/codegen/diagnostics_docs.rs:11-22 | xtask/src/codegen/feature_docs.rs:11-21 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/syntax/src/ast/node_ext.rs:529— crates/syntax/src/ast/node_ext.rs:529-539 | crates/syntax/src/ast/node_ext.rs:560-573 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs:2022— crates/syntax/src/ast/syntax_factory/constructors.rs:2022-2032 | crates/syntax/src/ast/syntax_factory/constructors.rs:2034-2044 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/ide/src/inlay_hints/extern_block.rs:39— crates/ide/src/inlay_hints/extern_block.rs:39-49 | crates/ide/src/inlay_hints/extern_block.rs:57-67 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/syntax/src/ast/make.rs:245— crates/syntax/src/ast/make.rs:245-255 | crates/syntax/src/ast/make.rs:262-272 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/proc-macro-api/src/lib.rs:156— crates/proc-macro-api/src/lib.rs:156-166 | crates/proc-macro-api/src/lib.rs:182-193 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/syntax/src/ast/edit.rs:139— crates/syntax/src/ast/edit.rs:139-149 | crates/syntax/src/ast/syntax_factory/constructors.rs:101-114 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/proc-macro-srv-cli/src/main_loop.rs:237— crates/proc-macro-srv-cli/src/main_loop.rs:237-247 | crates/proc-macro-srv-cli/src/main_loop.rs:274-284 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/hir-expand/src/lib.rs:1321— crates/hir-expand/src/lib.rs:1321-1331 | crates/hir-expand/src/lib.rs:1340-1350 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/hir/src/lib.rs:2559— crates/hir/src/lib.rs:2559-2569 | crates/hir/src/lib.rs:2572-2582 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/hir-ty/src/lower.rs:2715— crates/hir-ty/src/lower.rs:2715-2728 | crates/hir-ty/src/lower.rs:2733-2743 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/hir-expand/src/lib.rs:277— crates/hir-expand/src/lib.rs:277-287 | crates/hir-expand/src/lib.rs:1044-1054 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/hir-ty/src/infer.rs:2163— crates/hir-ty/src/infer.rs:2163-2173 | crates/hir-ty/src/infer.rs:2193-2203 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/hir/src/lib.rs:3069— crates/hir/src/lib.rs:3069-3079 | crates/hir/src/lib.rs:3081-3093 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/syntax/src/ast/node_ext.rs:1052— crates/syntax/src/ast/node_ext.rs:1052-1062 | crates/syntax/src/ast/node_ext.rs:1064-1074 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/ide-assists/src/handlers/sort_items.rs:178— crates/ide-assists/src/handlers/sort_items.rs:178-188 | crates/ide-assists/src/handlers/sort_items.rs:190-200 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/parser/src/parser.rs:388— crates/parser/src/parser.rs:388-398 | crates/parser/src/parser.rs:401-411 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
ide_completion::context::analysis::classify_name_ref (cyclomatic 153) crates/ide-completion/src/context/analysis.rs:967— ide_completion::context::analysis::classify_name_ref has cyclomatic complexity 153 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_completion::completions::expr::complete_expr_path (cyclomatic 75) crates/ide-completion/src/completions/expr.rs:47— ide_completion::completions::expr::complete_expr_path has cyclomatic complexity 75 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_completion::context::analysis::expected_type_and_name (cyclomatic 50) crates/ide-completion/src/context/analysis.rs:590— ide_completion::context::analysis::expected_type_and_name 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.
ide_completion::completions::postfix::complete_postfix (cyclomatic 45) crates/ide-completion/src/completions/postfix.rs:33— ide_completion::completions::postfix::complete_postfix has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_completion::completions::type::complete_type_path (cyclomatic 44) crates/ide-completion/src/completions/type.rs:12— ide_completion::completions::type::complete_type_path 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.
ide_completion::completions::pattern::complete_pattern (cyclomatic 31) crates/ide-completion/src/completions/pattern.rs:13— ide_completion::completions::pattern::complete_pattern has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_completion::context::analysis::expand (cyclomatic 27) crates/ide-completion/src/context/analysis.rs:172— ide_completion::context::analysis::expand has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_completion::render::render_resolution_path (cyclomatic 26) crates/ide-completion/src/render.rs:408— ide_completion::render::render_resolution_path has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_completion::completions::attribute::complete_attribute_path (cyclomatic 25) crates/ide-completion/src/completions/attribute.rs:70— ide_completion::completions::attribute::complete_attribute_path 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.
ide_completion::completions::item_list::add_keywords (cyclomatic 25) crates/ide-completion/src/completions/item_list.rs:85— ide_completion::completions::item_list::add_keywords has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_completion::completions::pattern::complete_pattern_path (cyclomatic 25) crates/ide-completion/src/completions/pattern.rs:130— ide_completion::completions::pattern::complete_pattern_path has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_completion::completions::use_::complete_use_path (cyclomatic 22) crates/ide-completion/src/completions/use_.rs:13— ide_completion::completions::use_::complete_use_path has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_completion::context::analysis::analyze (cyclomatic 22) crates/ide-completion/src/context/analysis.rs:442— ide_completion::context::analysis::analyze has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_completion::completions::complete_name_ref (cyclomatic 18) crates/ide-completion/src/completions.rs:723— ide_completion::completions::complete_name_ref has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_completion::render::function::render (cyclomatic 18) crates/ide-completion/src/render/function.rs:50— ide_completion::render::function::render has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ide_completion::completions::attribute::cfg::complete_cfg (cyclomatic 16) crates/ide-completion/src/completions/attribute/cfg.rs:12— ide_completion::completions::attribute::cfg::complete_cfg has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Duplicated block (12 lines × 2) crates/hir-def/src/expr_store.rs:373— crates/hir-def/src/expr_store.rs:373-384 | crates/hir-def/src/item_scope.rs:842-853 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/expr_store.rs:373` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 2) crates/hir-def/src/lang_item.rs:177— crates/hir-def/src/lang_item.rs:177-188 | crates/hir-def/src/lang_item.rs:202-213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) crates/hir-ide/src/display.rs:1792— crates/hir-ide/src/display.rs:1792-1803 | crates/hir-ide/src/display.rs:1816-1827 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/hir-ide/src/display.rs:1828` calls `async_gen_item_ty_from_yield_ty`, `lang_items`, `unwrap_or` and `crates/hir-ide/src/display.rs:1804` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 2) crates/hir-ide/src/display.rs:2069— crates/hir-ide/src/display.rs:2069-2080 | crates/hir-ide/src/display.rs:2114-2125 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ide/src/display.rs:2069` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) crates/hir-ty/src/infer.rs:2438— crates/hir-ty/src/infer.rs:2438-2449 | crates/hir-ty/src/infer.rs:2500-2511 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) crates/hir-ty/src/infer/cast.rs:346— crates/hir-ty/src/infer/cast.rs:346-357 | crates/hir-ty/src/infer/cast.rs:358-369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) crates/hir-ty/src/lib.rs:254— crates/hir-ty/src/lib.rs:254-265 | crates/hir-ty/src/lib.rs:288-299 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) crates/hir-ty/src/next_solver/ty.rs:1014— crates/hir-ty/src/next_solver/ty.rs:1014-1025 | crates/hir-ty/src/next_solver/ty.rs:1061-1072 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) crates/ide-assists/src/handlers/convert_for_to_while_let.rs:152— crates/ide-assists/src/handlers/convert_for_to_while_let.rs:152-163 | crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs:194-205 — before extracting anything, compare `crates/ide-assists/src/handlers/convert_for_to_while_let.rs` and `crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs:291— crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs:291-302 | crates/ide-assists/src/handlers/unwrap_return_type.rs:217-228 — before extracting anything, compare `crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs` and `crates/ide-assists/src/handlers/unwrap_return_type.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) crates/ide-db/src/syntax_helpers/format_string.rs:121— crates/ide-db/src/syntax_helpers/format_string.rs:121-132 | crates/ide-db/src/syntax_helpers/format_string.rs:178-189 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-db/src/syntax_helpers/format_string.rs:121` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) crates/macros/src/lib.rs:103— crates/macros/src/lib.rs:103-114 | crates/macros/src/lib.rs:121-132 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/macros/src/lib.rs:103` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) crates/rust-analyzer/src/lsp/to_proto.rs:1425— crates/rust-analyzer/src/lsp/to_proto.rs:1425-1436 | crates/rust-analyzer/src/lsp/to_proto.rs:1439-1450 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/lsp/to_proto.rs:1425` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) crates/hir-ty/src/mir/eval.rs:2464— crates/hir-ty/src/mir/eval.rs:2464-2475 | crates/hir-ty/src/mir/eval.rs:2485-2496 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:62— crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:62-73 | crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:64-75 — before extracting anything, compare `crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs` and `crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:62` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) crates/ide-assists/src/handlers/expand_glob_import.rs:45— crates/ide-assists/src/handlers/expand_glob_import.rs:45-56 | crates/ide-assists/src/handlers/expand_glob_import.rs:103-114 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/ide-assists/src/handlers/expand_glob_import.rs:116` calls `get_export_visibility_kind` and `crates/ide-assists/src/handlers/expand_glob_import.rs:58` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) crates/hir-def/src/attrs.rs:533— crates/hir-def/src/attrs.rs:533-542 | crates/hir-def/src/attrs.rs:544-553 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (10 lines × 2) crates/hir-def/src/item_scope.rs:697— crates/hir-def/src/item_scope.rs:697-706 | crates/hir-def/src/item_scope.rs:713-722 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/item_scope.rs:697` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/hir-expand/src/builtin/derive_macro.rs:1014— crates/hir-expand/src/builtin/derive_macro.rs:1014-1023 | crates/hir-expand/src/builtin/derive_macro.rs:1072-1081 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-expand/src/builtin/derive_macro.rs:1014` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/hir-ide/src/display.rs:1171— crates/hir-ide/src/display.rs:1171-1180 | crates/hir-ide/src/display.rs:1187-1196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ide/src/display.rs:1171` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/hir-ty/src/lower.rs:1508— crates/hir-ty/src/lower.rs:1508-1517 | crates/hir-ty/src/lower.rs:1840-1849 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/hir-ty/src/lower.rs:1839` calls `of` and `crates/hir-ty/src/lower.rs:1507` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) crates/ide-completion/src/completions/attribute.rs:90— crates/ide-completion/src/completions/attribute.rs:90-99 | crates/ide-completion/src/completions/attribute/derive.rs:21-30 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/completions/attribute.rs:90` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/ide-db/src/syntax_helpers/format_string.rs:131— crates/ide-db/src/syntax_helpers/format_string.rs:131-140 | crates/ide-db/src/syntax_helpers/format_string.rs:214-223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-db/src/syntax_helpers/format_string.rs:131` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/ide/src/runnables.rs:382— crates/ide/src/runnables.rs:382-391 | crates/ide/src/runnables.rs:473-482 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide/src/runnables.rs:382` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/ide/src/runnables.rs:380` calls `from_module_to_decl`, `call_site` and `crates/ide/src/runnables.rs:471` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) crates/load-cargo/src/lib.rs:656— crates/load-cargo/src/lib.rs:656-665 | crates/load-cargo/src/lib.rs:703-712 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/syntax-bridge/src/lib.rs:549— crates/syntax-bridge/src/lib.rs:549-558 | crates/syntax-bridge/src/lib.rs:591-600 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (10 lines × 2) crates/ide-assists/src/handlers/convert_for_to_while_let.rs:37— crates/ide-assists/src/handlers/convert_for_to_while_let.rs:37-46 | crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs:103-112 — before extracting anything, compare `crates/ide-assists/src/handlers/convert_for_to_while_let.rs` and `crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/convert_for_to_while_let.rs:37` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/hir-expand/src/builtin/derive_macro.rs:1036— crates/hir-expand/src/builtin/derive_macro.rs:1036-1045 | crates/hir-expand/src/builtin/derive_macro.rs:1098-1107 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-expand/src/builtin/derive_macro.rs:1036` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/ide/src/interpret.rs:25— crates/ide/src/interpret.rs:25-34 | crates/ide/src/view_mir.rs:15-24 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide/src/interpret.rs:25` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/syntax/src/validation.rs:403— crates/syntax/src/validation.rs:403-412 | crates/syntax/src/validation.rs:417-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/validation.rs:403` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `ty` to `ast::DynTraitType` in one and `ast::ImplTraitType` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (10 lines × 2) crates/hir-def/src/expr_store/pretty.rs:908— crates/hir-def/src/expr_store/pretty.rs:908-917 | crates/hir-def/src/expr_store/pretty.rs:1010-1019 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/expr_store/pretty.rs:908` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/test-fixture/src/lib.rs:393— crates/test-fixture/src/lib.rs:393-402 | crates/test-fixture/src/lib.rs:488-497 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
rust_analyzer::config::patch_old_style::patch_json_for_outdated_configs (cognitive 135) crates/rust-analyzer/src/config/patch_old_style.rs:10— rust_analyzer::config::patch_old_style::patch_json_for_outdated_configs has cognitive complexity 135 (threshold 15). Drivers by points: loops 41 (82 pts), match/switch 43 (44 pts), if/else 6 (7 pts), boolean chains 2 (nesting depth added 43). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
rust_analyzer::handlers::notification::run_flycheck (cognitive 69) crates/rust-analyzer/src/handlers/notification.rs:330— rust_analyzer::handlers::notification::run_flycheck has cognitive complexity 69 (threshold 15). Drivers by points: if/else 11 (36 pts), match/switch 6 (19 pts), loops 3 (11 pts), boolean chains 3 (nesting depth added 46). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
rust_analyzer::lsp::to_proto::completion_item (cognitive 45) crates/rust-analyzer/src/lsp/to_proto.rs:291— rust_analyzer::lsp::to_proto::completion_item has cognitive complexity 45 (threshold 15). Drivers by points: if/else 30 (38 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 9). Of this number, 43 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
rust_analyzer::handlers::request::handle_runnables (cognitive 38) crates/rust-analyzer/src/handlers/request.rs:1016— rust_analyzer::handlers::request::handle_runnables has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (28 pts), boolean chains 6, loops 2 (3 pts), match/switch 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rust_analyzer::lsp::to_proto::code_lens (cognitive 38) crates/rust-analyzer/src/lsp/to_proto.rs:1759— rust_analyzer::lsp::to_proto::code_lens has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (29 pts), match/switch 3 (6 pts), boolean chains 3 (nesting depth added 23). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
rust_analyzer::diagnostics::flycheck_to_proto::map_rust_diagnostic_to_lsp (cognitive 37) crates/rust-analyzer/src/diagnostics/flycheck_to_proto.rs:281— rust_analyzer::diagnostics::flycheck_to_proto::map_rust_diagnostic_to_lsp has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 5 (7 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rust_analyzer::handlers::request::run_rustfmt (cognitive 32) crates/rust-analyzer/src/handlers/request.rs:2405— rust_analyzer::handlers::request::run_rustfmt has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 6, match/switch 4 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rust_analyzer::lsp::to_proto::merge_text_and_snippet_edits (cognitive 23) crates/rust-analyzer/src/lsp/to_proto.rs:1197— rust_analyzer::lsp::to_proto::merge_text_and_snippet_edits has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (9 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rust_analyzer::handlers::notification::handle_did_save_text_document (cognitive 20) crates/rust-analyzer/src/handlers/notification.rs:162— rust_analyzer::handlers::notification::handle_did_save_text_document has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rust_analyzer::handlers::request::handle_run_test (cognitive 19) crates/rust-analyzer/src/handlers/request.rs:250— rust_analyzer::handlers::request::handle_run_test has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 2 (7 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rust_analyzer::handlers::request::handle_workspace_symbol (cognitive 19) crates/rust-analyzer/src/handlers/request.rs:676— rust_analyzer::handlers::request::handle_workspace_symbol has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 6, boolean chains 2, loops 1 (nesting depth added 5). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 2 function items inside it that branch (decide_search_kind_and_scope, exec_query). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
rust_analyzer::handlers::request::handle_code_action (cognitive 19) crates/rust-analyzer/src/handlers/request.rs:1499— rust_analyzer::handlers::request::handle_code_action has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rust_analyzer::handlers::request::handle_parent_module (cognitive 18) crates/rust-analyzer/src/handlers/request.rs:931— rust_analyzer::handlers::request::handle_parent_module has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (13 pts), if/else 3 (5 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
rust_analyzer::lsp::to_proto::semantic_tokens (cognitive 18) crates/rust-analyzer/src/lsp/to_proto.rs:749— rust_analyzer::lsp::to_proto::semantic_tokens has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 2 (6 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rust_analyzer::session::run_session (cognitive 16) crates/rust-analyzer/src/session.rs:37— rust_analyzer::session::run_session has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 4, boolean chains 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::expr_store::lower::path::lower_path (cognitive 72) crates/hir-def/src/expr_store/lower/path.rs:41— hir_def::expr_store::lower::path::lower_path has cognitive complexity 72 (threshold 15). Drivers by points: if/else 25 (47 pts), match/switch 7 (19 pts), boolean chains 5, loops 1 (nesting depth added 34). Of this number, 71 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::hir::format_args::parse (cognitive 54) crates/hir-def/src/hir/format_args.rs:172— hir_def::hir::format_args::parse has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (27 pts), match/switch 10 (25 pts), loops 2 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::attrs::match_attr_flags (cognitive 46) crates/hir-def/src/attrs.rs:131— hir_def::attrs::match_attr_flags has cognitive complexity 46 (threshold 15). Drivers by points: match/switch 11 (31 pts), if/else 6 (13 pts), boolean chains 2 (nesting depth added 27). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_def::attrs::parse_repr_tt (cognitive 42) crates/hir-def/src/attrs.rs:1272— hir_def::attrs::parse_repr_tt has cognitive complexity 42 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 4 (16 pts), boolean chains 2, loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::expr_store::lower::lower_body (cognitive 34) crates/hir-def/src/expr_store/lower.rs:70— hir_def::expr_store::lower::lower_body has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 4 (9 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::expr_store::pretty::print_generic_params (cognitive 29) crates/hir-def/src/expr_store/pretty.rs:368— hir_def::expr_store::pretty::print_generic_params has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (4 pts), match/switch 1 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::attrs::docs::get_horizontal_trim (cognitive 27) crates/hir-def/src/attrs/docs.rs:511— hir_def::attrs::docs::get_horizontal_trim has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (7 pts), boolean chains 3, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::find_path::find_path_for_module (cognitive 25) crates/hir-def/src/find_path.rs:177— hir_def::find_path::find_path_for_module has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::find_path::find_local_import_locations (cognitive 25) crates/hir-def/src/find_path.rs:577— hir_def::find_path::find_local_import_locations has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::expr_store::pretty::print_where_clauses (cognitive 24) crates/hir-def/src/expr_store/pretty.rs:328— hir_def::expr_store::pretty::print_where_clauses has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 2 (7 pts), match/switch 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_def::lang_item::crate_lang_items (cognitive 23) crates/hir-def/src/lang_item.rs:41— hir_def::lang_item::crate_lang_items has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 3 (11 pts), loops 4 (8 pts), if/else 4 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_def::expr_store::lower::lower_function (cognitive 22) crates/hir-def/src/expr_store/lower.rs:377— hir_def::expr_store::lower::lower_function has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 3 (11 pts), if/else 5 (8 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_def::attrs::docs::extend_with_attrs (cognitive 18) crates/hir-def/src/attrs/docs.rs:649— hir_def::attrs::docs::extend_with_attrs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_def::find_path::find_in_sysroot (cognitive 16) crates/hir-def/src/find_path.rs:387— hir_def::find_path::find_in_sysroot has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_db::syntax_helpers::format_string::lex_format_specifiers (cyclomatic 40) crates/ide-db/src/syntax_helpers/format_string.rs:45— ide_db::syntax_helpers::format_string::lex_format_specifiers has cyclomatic complexity 40 (threshold 15). Of this number, 35 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_db::syntax_helpers::format_string_exprs::parse_format_exprs (cyclomatic 29) crates/ide-db/src/syntax_helpers/format_string_exprs.rs:44— ide_db::syntax_helpers::format_string_exprs::parse_format_exprs has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_db::prime_caches::parallel_prime_caches (cyclomatic 27) crates/ide-db/src/prime_caches.rs:31— ide_db::prime_caches::parallel_prime_caches has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ide_db::imports::insert_use::guess_granularity_from_scope (cyclomatic 23) crates/ide-db/src/imports/insert_use.rs:340— ide_db::imports::insert_use::guess_granularity_from_scope has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_db::imports::import_assets::filter_by_definition_kind (cyclomatic 19) crates/ide-db/src/imports/import_assets.rs:553— ide_db::imports::import_assets::filter_by_definition_kind has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_db::imports::import_assets::validate_resolvable (cyclomatic 19) crates/ide-db/src/imports/import_assets.rs:660— ide_db::imports::import_assets::validate_resolvable has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_db::imports::insert_use::insert_use_with_alias_option_with_editor (cyclomatic 19) crates/ide-db/src/imports/insert_use.rs:214— ide_db::imports::insert_use::insert_use_with_alias_option_with_editor has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_db::syntax_helpers::node_ext::for_each_tail_expr (cyclomatic 19) crates/ide-db/src/syntax_helpers/node_ext.rs:283— ide_db::syntax_helpers::node_ext::for_each_tail_expr has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_db::traits::diff_assoc_items (cyclomatic 19) crates/ide-db/src/traits.rs:56— ide_db::traits::diff_assoc_items has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_db::imports::merge_imports::recursive_normalize (cyclomatic 17) crates/ide-db/src/imports/merge_imports.rs:292— ide_db::imports::merge_imports::recursive_normalize has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ide_db::imports::merge_imports::version_sort::version_sort (cyclomatic 17) crates/ide-db/src/imports/merge_imports.rs:978— ide_db::imports::merge_imports::version_sort::version_sort has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_db::syntax_helpers::tree_diff::diff (cyclomatic 17) crates/ide-db/src/syntax_helpers/tree_diff.rs:51— ide_db::syntax_helpers::tree_diff::diff has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (go, syntax_element_eq). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ide_db::imports::merge_imports::use_tree_cmp (cyclomatic 16) crates/ide-db/src/imports/merge_imports.rs:521— ide_db::imports::merge_imports::use_tree_cmp has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_ty::layout::layout_of_ty_query (cognitive 75) crates/hir-ty/src/layout.rs:162— hir_ty::layout::layout_of_ty_query has cognitive complexity 75 (threshold 15). Drivers by points: if/else 20 (54 pts), match/switch 9 (21 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::lower::path::substs_from_args_and_bindings (cognitive 50) crates/hir-ty/src/lower/path.rs:1156— hir_ty::lower::path::substs_from_args_and_bindings has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (31 pts), loops 3 (10 pts), match/switch 3 (9 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::lower::resolve_type_param_assoc_type_shorthand (cognitive 48) crates/hir-ty/src/lower.rs:2114— hir_ty::lower::resolve_type_param_assoc_type_shorthand has cognitive complexity 48 (threshold 15). Drivers by points: if/else 15 (36 pts), match/switch 2 (7 pts), loops 2 (3 pts), 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.
hir_ty::next_solver::consts::valtree::allocation_to_const (cognitive 46) crates/hir-ty/src/next_solver/consts/valtree.rs:73— hir_ty::next_solver::consts::valtree::allocation_to_const has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (38 pts), match/switch 4 (8 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::lower::remap_gat_vars_and_recurse_into_nested_projections (cognitive 33) crates/hir-ty/src/lower.rs:2373— hir_ty::lower::remap_gat_vars_and_recurse_into_nested_projections has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (27 pts), match/switch 2 (3 pts), loops 2, 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.
hir_ty::mir::lower::mir_body_for_closure_query (cognitive 25) crates/hir-ty/src/mir/lower.rs:1998— hir_ty::mir::lower::mir_body_for_closure_query has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 4 (7 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::next_solver::util::sizedness_fast_path (cognitive 20) crates/hir-ty/src/next_solver/util.rs:731— hir_ty::next_solver::util::sizedness_fast_path has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, loops 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::lower::generic_predicates (cognitive 18) crates/hir-ty/src/lower.rs:2778— hir_ty::lower::generic_predicates has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 6). Of this number, 16 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::drop::has_drop_glue_impl (cognitive 17) crates/hir-ty/src/drop.rs:52— hir_ty::drop::has_drop_glue_impl has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::dyn_compatibility::virtual_call_violations_for_method (cognitive 17) crates/hir-ty/src/dyn_compatibility.rs:315— hir_ty::dyn_compatibility::virtual_call_violations_for_method has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
hir_ty::lower::path::check_generic_args_len (cognitive 17) crates/hir-ty/src/lower/path.rs:1063— hir_ty::lower::path::check_generic_args_len has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6, match/switch 3 (6 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::traits::check_orphan_rules (cognitive 17) crates/hir-ty/src/traits.rs:334— hir_ty::traits::check_orphan_rules has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 3 (7 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ty::consteval::literal_ty (cognitive 16) crates/hir-ty/src/consteval.rs:127— hir_ty::consteval::literal_ty has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 7 (16 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
parser::grammar::expressions::atom::parse_asm_expr (cognitive 39) crates/parser/src/grammar/expressions/atom.rs:349— parser::grammar::expressions::atom::parse_asm_expr has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (34 pts), boolean chains 4, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser::grammar::expressions::atom::builtin_expr (cognitive 34) crates/parser/src/grammar/expressions/atom.rs:256— parser::grammar::expressions::atom::builtin_expr has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser::grammar::items::opt_item (cognitive 32) crates/parser/src/grammar/items.rs:110— parser::grammar::items::opt_item has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 13, match/switch 3 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
parser::grammar::expressions::expr_bp (cognitive 24) crates/parser/src/grammar/expressions.rs:248— parser::grammar::expressions::expr_bp has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 5, match/switch 2 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser::grammar::params::param (cognitive 23) crates/parser/src/grammar/params.rs:95— parser::grammar::params::param has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 3, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
parser::grammar::paths::path_segment (cognitive 23) crates/parser/src/grammar/paths.rs:87— parser::grammar::paths::path_segment has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser::grammar::expressions::lhs (cognitive 21) crates/parser/src/grammar/expressions.rs:339— parser::grammar::expressions::lhs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, loops 1 (2 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
parser::grammar::items::adt::record_field_list (cognitive 21) crates/parser/src/grammar/items/adt.rs:122— parser::grammar::items::adt::record_field_list has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 3, loops 1 (nesting depth added 6). Most of this is not in the body itself: 6 of the 21 points are its own statements and the rest belongs to one function item inside it that branches (record_field). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
parser::grammar::params::list_ (cognitive 20) crates/parser/src/grammar/params.rs:32— parser::grammar::params::list_ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (5 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser::event::process (cognitive 17) crates/parser/src/event.rs:89— parser::event::process has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (7 pts), match/switch 2 (6 pts), if/else 1 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser::grammar::expressions::record_expr_field_list (cognitive 17) crates/parser/src/grammar/expressions.rs:708— parser::grammar::expressions::record_expr_field_list has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser::grammar::expressions::stmt (cognitive 16) crates/parser/src/grammar/expressions.rs:43— parser::grammar::expressions::stmt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 5, match/switch 2 (3 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser::grammar::patterns::pattern_single_r (cognitive 16) crates/parser/src/grammar/patterns.rs:66— parser::grammar::patterns::pattern_single_r has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×13
Edited copy of a member (8 corresponding lines) crates/hir-ty/src/mir/monomorphization.rs:83— crates/hir-ty/src/mir/monomorphization.rs:83-90 | crates/hir-ty/src/mir/monomorphization.rs:92-99 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/ide-db/src/active_parameter.rs:182— crates/ide-db/src/active_parameter.rs:182-189 | crates/syntax/src/ast/node_ext.rs:58-65 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/syntax/src/parsing.rs:12— crates/syntax/src/parsing.rs:12-19 | crates/syntax/src/parsing.rs:25-32 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/hir-ty/src/next_solver/def_id.rs:577— crates/hir-ty/src/next_solver/def_id.rs:577-584 | crates/hir-ty/src/next_solver/def_id.rs:628-635 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/hir-ty/src/infer/pat.rs:979— crates/hir-ty/src/infer/pat.rs:979-986 | crates/hir-ty/src/infer/pat.rs:1037-1044 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/parser/src/grammar/items.rs:376— crates/parser/src/grammar/items.rs:376-383 | crates/parser/src/grammar/items.rs:385-392 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/parser/src/grammar/expressions/atom.rs:702— crates/parser/src/grammar/expressions/atom.rs:702-709 | crates/parser/src/grammar/expressions/atom.rs:715-724 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/parser/src/grammar/patterns.rs:450— crates/parser/src/grammar/patterns.rs:450-457 | crates/parser/src/grammar/types.rs:208-218 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/project-model/src/sysroot.rs:78— crates/project-model/src/sysroot.rs:78-85 | crates/project-model/src/sysroot.rs:98-105 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/parser/src/grammar/expressions.rs:524— crates/parser/src/grammar/expressions.rs:524-531 | crates/parser/src/grammar/expressions/atom.rs:898-905 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/hir-def/src/nameres.rs:531— crates/hir-def/src/nameres.rs:531-538 | crates/hir-def/src/nameres.rs:548-559 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/parser/src/grammar/attributes.rs:117— crates/parser/src/grammar/attributes.rs:117-127 | crates/parser/src/grammar/patterns.rs:519-526 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/hir-ide/src/diagnostics/match_check/pat_util.rs:54— crates/hir-ide/src/diagnostics/match_check/pat_util.rs:54-61 | crates/hir-ty/src/utils.rs:210-217 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
InferenceContext::infer_expr_inner (cyclomatic 84) crates/hir-ty/src/infer/expr.rs:317— InferenceContext::infer_expr_inner has cyclomatic complexity 84 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
InferenceContext::resolve_variant (cyclomatic 48) crates/hir-ty/src/infer.rs:2256— InferenceContext::resolve_variant has cyclomatic complexity 48 (threshold 15). Of this number, 47 points are the body's own statements and 1 belongs to one function item inside it that branches. This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
InferenceContext::infer_mut_expr_without_adjust (cyclomatic 40) crates/hir-ty/src/infer/mutability.rs:55— InferenceContext::infer_mut_expr_without_adjust has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
InferenceContext::infer_pat_inner (cyclomatic 32) crates/hir-ty/src/infer/pat.rs:377— InferenceContext::infer_pat_inner has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
InferenceContext::try_find_coercion_lub (cyclomatic 27) crates/hir-ty/src/infer/coerce.rs:926— InferenceContext::try_find_coercion_lub 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.
InferenceContext::analyze_closure (cyclomatic 26) crates/hir-ty/src/infer/closure/analysis.rs:232— InferenceContext::analyze_closure has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InferenceContext::check_record_expr_fields (cyclomatic 24) crates/hir-ty/src/infer/expr.rs:968— InferenceContext::check_record_expr_fields has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InferenceContext::check_call_arguments (cyclomatic 23) crates/hir-ty/src/infer/expr.rs:1920— InferenceContext::check_call_arguments has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InferenceContext::infer_ref_pat (cyclomatic 20) crates/hir-ty/src/infer/pat.rs:1356— InferenceContext::infer_ref_pat has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InferenceContext::compute_min_captures (cyclomatic 17) crates/hir-ty/src/infer/closure/analysis.rs:727— InferenceContext::compute_min_captures has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
InferenceContext::deduce_closure_signature_from_predicates (cyclomatic 17) crates/hir-ty/src/infer/closure.rs:421— InferenceContext::deduce_closure_signature_from_predicates has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InferenceContext::resolve_all (cyclomatic 17) crates/hir-ty/src/infer.rs:1644— InferenceContext::resolve_all has cyclomatic complexity 17 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×12
Edited copy of a member (12 corresponding lines) crates/ide/src/interpret.rs:24— crates/ide/src/interpret.rs:24-59 | crates/ide/src/view_mir.rs:14-28 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs:618— crates/syntax/src/ast/syntax_factory/constructors.rs:618-636 | crates/syntax/src/ast/syntax_factory/constructors.rs:864-875 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/syntax/src/validation.rs:401— crates/syntax/src/validation.rs:401-412 | crates/syntax/src/validation.rs:415-426 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/hir-ty/src/mir.rs:184— crates/hir-ty/src/mir.rs:184-195 | crates/hir-ty/src/mir.rs:200-211 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs:779— crates/syntax/src/ast/syntax_factory/constructors.rs:779-790 | crates/syntax/src/ast/syntax_factory/constructors.rs:921-932 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/rust-analyzer/src/diagnostics.rs:91— crates/rust-analyzer/src/diagnostics.rs:91-102 | crates/rust-analyzer/src/diagnostics.rs:131-147 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/tt/src/storage.rs:173— crates/tt/src/storage.rs:173-184 | crates/tt/src/storage.rs:706-718 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/hir-ty/src/next_solver/fold.rs:81— crates/hir-ty/src/next_solver/fold.rs:81-98 | crates/hir-ty/src/next_solver/fold.rs:122-133 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/test-utils/src/lib.rs:423— crates/test-utils/src/lib.rs:423-434 | lib/expect-test/src/lib.rs:730-741 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/rust-analyzer/src/lsp/capabilities.rs:522— crates/rust-analyzer/src/lsp/capabilities.rs:522-533 | crates/rust-analyzer/src/lsp/capabilities.rs:535-547 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/ide-db/src/syntax_helpers/suggest_name.rs:113— crates/ide-db/src/syntax_helpers/suggest_name.rs:113-124 | crates/ide-db/src/syntax_helpers/suggest_name.rs:126-138 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/hir-ty/src/next_solver/infer/region_constraints/mod.rs:474— crates/hir-ty/src/next_solver/infer/region_constraints/mod.rs:474-485 | crates/hir-ty/src/next_solver/infer/region_constraints/mod.rs:493-506 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×12
Edited copy of a member (13 corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs:1569— crates/syntax/src/ast/syntax_factory/constructors.rs:1569-1598 | crates/syntax/src/ast/syntax_factory/constructors.rs:1725-1744 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/hir-def/src/item_scope.rs:366— crates/hir-def/src/item_scope.rs:366-378 | crates/hir-def/src/item_scope.rs:385-421 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs:1975— crates/syntax/src/ast/syntax_factory/constructors.rs:1975-1987 | crates/syntax/src/ast/syntax_factory/constructors.rs:1993-2005 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/hir/src/lib.rs:5927— crates/hir/src/lib.rs:5927-5939 | crates/hir/src/lib.rs:5941-5953 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/syntax/src/ast/make.rs:1380— crates/syntax/src/ast/make.rs:1380-1392 | crates/syntax/src/ast/make.rs:1400-1412 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/hir-ty/src/mir/eval.rs:2041— crates/hir-ty/src/mir/eval.rs:2041-2056 | crates/hir-ty/src/mir/eval.rs:2058-2070 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/hir-ty/src/next_solver/interner.rs:1185— crates/hir-ty/src/next_solver/interner.rs:1185-1197 | crates/hir-ty/src/next_solver/interner.rs:1199-1212 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/hir-ty/src/infer/closure/analysis.rs:1227— crates/hir-ty/src/infer/closure/analysis.rs:1227-1239 | crates/hir-ty/src/infer/closure/analysis.rs:1242-1254 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/hir-def/src/attrs.rs:83— crates/hir-def/src/attrs.rs:83-97 | crates/hir-def/src/attrs.rs:99-111 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/ide-db/src/imports/import_assets.rs:376— crates/ide-db/src/imports/import_assets.rs:376-388 | crates/ide-db/src/imports/import_assets.rs:391-403 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/syntax/src/ast/token_ext.rs:491— crates/syntax/src/ast/token_ext.rs:491-503 | crates/syntax/src/ast/token_ext.rs:507-519 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/hir/src/lib.rs:4914— crates/hir/src/lib.rs:4914-4926 | crates/hir/src/lib.rs:4951-4965 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×12
Edited copy of a member (10 corresponding lines) crates/tt/src/storage.rs:120— crates/tt/src/storage.rs:120-129 | crates/tt/src/storage.rs:161-170 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/hir/src/has_source.rs:179— crates/hir/src/has_source.rs:179-188 | crates/hir/src/has_source.rs:240-249 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/ide-diagnostics/src/handlers/type_mismatch.rs:484— crates/ide-diagnostics/src/handlers/type_mismatch.rs:484-493 | crates/ide-diagnostics/src/handlers/type_mismatch.rs:495-504 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:370— crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:370-379 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:389-398 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/hir-ty/src/infer/closure.rs:340— crates/hir-ty/src/infer/closure.rs:340-349 | crates/hir-ty/src/infer/closure.rs:354-365 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/hir-def/src/nameres/collector.rs:683— crates/hir-def/src/nameres/collector.rs:683-700 | crates/hir-def/src/nameres/collector.rs:747-756 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/intern/src/gc.rs:32— crates/intern/src/gc.rs:32-41 | crates/intern/src/gc.rs:56-66 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/ide-diagnostics/src/handlers/undeclared_label.rs:7— crates/ide-diagnostics/src/handlers/undeclared_label.rs:7-16 | crates/ide-diagnostics/src/handlers/unreachable_label.rs:7-16 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/ide-db/src/ty_filter.rs:51— crates/ide-db/src/ty_filter.rs:51-60 | crates/ide-db/src/ty_filter.rs:73-86 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/ide-db/src/syntax_helpers/node_ext.rs:45— crates/ide-db/src/syntax_helpers/node_ext.rs:45-60 | crates/ide/src/highlight_related.rs:775-784 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/rust-analyzer/src/cli/diagnostics.rs:15— crates/rust-analyzer/src/cli/diagnostics.rs:15-24 | crates/rust-analyzer/src/cli/unresolved_references.rs:13-22 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/ide-diagnostics/src/handlers/invalid_derive_target.rs:10— crates/ide-diagnostics/src/handlers/invalid_derive_target.rs:10-19 | crates/ide-diagnostics/src/handlers/malformed_derive.rs:9-18 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
hir_ty::layout::layout_of_ty_query (cyclomatic 59) crates/hir-ty/src/layout.rs:162— hir_ty::layout::layout_of_ty_query has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_ty::next_solver::consts::valtree::allocation_to_const (cyclomatic 40) crates/hir-ty/src/next_solver/consts/valtree.rs:73— hir_ty::next_solver::consts::valtree::allocation_to_const has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_ty::consteval::literal_ty (cyclomatic 24) crates/hir-ty/src/consteval.rs:127— hir_ty::consteval::literal_ty has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_ty::drop::has_drop_glue_impl (cyclomatic 23) crates/hir-ty/src/drop.rs:52— hir_ty::drop::has_drop_glue_impl has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_ty::lower::resolve_type_param_assoc_type_shorthand (cyclomatic 23) crates/hir-ty/src/lower.rs:2114— hir_ty::lower::resolve_type_param_assoc_type_shorthand has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_ty::lower::path::substs_from_args_and_bindings (cyclomatic 23) crates/hir-ty/src/lower/path.rs:1156— hir_ty::lower::path::substs_from_args_and_bindings has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_ty::lower::remap_gat_vars_and_recurse_into_nested_projections (cyclomatic 20) crates/hir-ty/src/lower.rs:2373— hir_ty::lower::remap_gat_vars_and_recurse_into_nested_projections 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.
hir_ty::lower::path::check_generic_args_len (cyclomatic 17) crates/hir-ty/src/lower/path.rs:1063— hir_ty::lower::path::check_generic_args_len has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_ty::mir::lower::mir_body_for_closure_query (cyclomatic 17) crates/hir-ty/src/mir/lower.rs:1998— hir_ty::mir::lower::mir_body_for_closure_query has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_ty::consteval::intern_const_ref (cyclomatic 16) crates/hir-ty/src/consteval.rs:56— hir_ty::consteval::intern_const_ref has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_ty::infer::infer_query_with_inspect (cyclomatic 16) crates/hir-ty/src/infer.rs:124— hir_ty::infer::infer_query_with_inspect has cyclomatic complexity 16 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
Evaluator::exec_intrinsic (cognitive 213) crates/hir-ty/src/mir/eval/shim.rs:560— Evaluator::exec_intrinsic has cognitive complexity 213 (threshold 15). Drivers by points: if/else 86 (177 pts), match/switch 14 (27 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 107). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Evaluator::eval_rvalue (cognitive 146) crates/hir-ty/src/mir/eval.rs:1029— Evaluator::eval_rvalue has cognitive complexity 146 (threshold 15). Drivers by points: match/switch 25 (68 pts), if/else 24 (66 pts), loops 4 (12 pts) (nesting depth added 93). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Evaluator::exec_simd_intrinsic (cognitive 45) crates/hir-ty/src/mir/eval/shim/simd.rs:51— Evaluator::exec_simd_intrinsic has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (24 pts), match/switch 5 (11 pts), loops 4 (9 pts), boolean chains 1 (nesting depth added 25). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Evaluator::interpret_mir (cognitive 44) crates/hir-ty/src/mir/eval.rs:796— Evaluator::interpret_mir has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 5 (15 pts), loops 4 (9 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Evaluator::place_addr_and_ty_and_metadata (cognitive 39) crates/hir-ty/src/mir/eval.rs:638— Evaluator::place_addr_and_ty_and_metadata has cognitive complexity 39 (threshold 15). Drivers by points: match/switch 8 (27 pts), if/else 5 (11 pts), loops 1 (nesting depth added 25). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Evaluator::create_memory_map::rec (cognitive 35) crates/hir-ty/src/mir/eval.rs:2223— Evaluator::create_memory_map::rec has cognitive complexity 35 (threshold 15). Drivers by points: loops 5 (15 pts), match/switch 6 (13 pts), if/else 3 (7 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Evaluator::exec_extern_c (cognitive 33) crates/hir-ty/src/mir/eval/shim.rs:396— Evaluator::exec_extern_c has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 4 (7 pts), loops 1 (2 pts) (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Evaluator::patch_addresses (cognitive 32) crates/hir-ty/src/mir/eval.rs:2396— Evaluator::patch_addresses has cognitive complexity 32 (threshold 15). Drivers by points: loops 5 (15 pts), match/switch 6 (11 pts), if/else 2 (6 pts) (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Evaluator::exec_atomic_intrinsic (cognitive 20) crates/hir-ty/src/mir/eval/shim.rs:1511— Evaluator::exec_atomic_intrinsic has cognitive complexity 20 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Evaluator::run_drop_glue_deep (cognitive 18) crates/hir-ty/src/mir/eval.rs:2952— Evaluator::run_drop_glue_deep has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), match/switch 3 (6 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Evaluator::unsizing_ptr_from_addr (cognitive 17) crates/hir-ty/src/mir/eval.rs:1619— Evaluator::unsizing_ptr_from_addr has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 5 (11 pts), if/else 2 (6 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×11
Edited copy of a member (14 corresponding lines) crates/hir/src/display.rs:412— crates/hir/src/display.rs:412-425 | crates/hir/src/display.rs:429-442 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/hir-ty/src/next_solver/consts.rs:301— crates/hir-ty/src/next_solver/consts.rs:301-314 | crates/hir-ty/src/next_solver/consts.rs:318-331 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/syntax/src/algo.rs:77— crates/syntax/src/algo.rs:77-90 | crates/syntax/src/algo.rs:92-110 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/ide/src/inlay_hints.rs:725— crates/ide/src/inlay_hints.rs:725-738 | crates/ide/src/inlay_hints.rs:740-753 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/tt/src/iter.rs:173— crates/tt/src/iter.rs:173-186 | crates/tt/src/iter.rs:250-266 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/hir/src/lib.rs:5362— crates/hir/src/lib.rs:5362-5375 | crates/hir/src/lib.rs:5518-5532 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/base-db/src/input.rs:521— crates/base-db/src/input.rs:521-537 | crates/base-db/src/input.rs:777-790 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/ide-assists/src/handlers/extract_function.rs:1604— crates/ide-assists/src/handlers/extract_function.rs:1604-1621 | crates/ide-assists/src/handlers/extract_function.rs:1642-1655 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/hir-ty/src/infer/expr.rs:114— crates/hir-ty/src/infer/expr.rs:114-127 | crates/hir-ty/src/infer/pat.rs:1718-1731 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/ide-completion/src/completions.rs:232— crates/ide-completion/src/completions.rs:232-245 | crates/ide-completion/src/completions.rs:253-266 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/ide/src/signature_help.rs:451— crates/ide/src/signature_help.rs:451-465 | crates/ide/src/signature_help.rs:473-486 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×11
Edited copy of a member (15 corresponding lines) crates/hir-expand/src/lib.rs:1426— crates/hir-expand/src/lib.rs:1426-1440 | crates/hir-expand/src/lib.rs:1449-1463 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/ide/src/doc_links/intra_doc_links.rs:16— crates/ide/src/doc_links/intra_doc_links.rs:16-36 | crates/ide/src/doc_links/intra_doc_links.rs:38-52 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/hir-def/src/lang_item.rs:176— crates/hir-def/src/lang_item.rs:176-194 | crates/hir-def/src/lang_item.rs:201-215 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/hir-def/src/nameres.rs:349— crates/hir-def/src/nameres.rs:349-366 | crates/hir-def/src/nameres.rs:789-803 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/ide-db/src/search.rs:161— crates/ide-db/src/search.rs:161-176 | crates/ide-db/src/search.rs:179-193 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) lib/line-index/src/lib.rs:147— lib/line-index/src/lib.rs:147-161 | lib/line-index/src/lib.rs:164-178 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/hir-ty/src/next_solver/interner.rs:768— crates/hir-ty/src/next_solver/interner.rs:768-783 | crates/hir-ty/src/next_solver/interner.rs:785-799 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/ide-assists/src/handlers/introduce_named_lifetime.rs:132— crates/ide-assists/src/handlers/introduce_named_lifetime.rs:132-146 | crates/ide-assists/src/handlers/introduce_named_lifetime.rs:191-205 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/ide-assists/src/handlers/merge_imports.rs:90— crates/ide-assists/src/handlers/merge_imports.rs:90-108 | crates/ide-assists/src/handlers/merge_imports.rs:114-128 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/hir-ty/src/next_solver/generic_arg.rs:709— crates/hir-ty/src/next_solver/generic_arg.rs:709-726 | crates/hir-ty/src/next_solver/generic_arg.rs:728-742 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/parser/src/grammar/expressions/atom.rs:654— crates/parser/src/grammar/expressions/atom.rs:654-668 | crates/parser/src/grammar/expressions/atom.rs:865-881 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (14 lines × 2) crates/hir-expand/src/lib.rs:1206— crates/hir-expand/src/lib.rs:1206-1219 | crates/hir-expand/src/lib.rs:1247-1260 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-expand/src/lib.rs:1206` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) crates/hir-ide/src/display.rs:1535— crates/hir-ide/src/display.rs:1535-1548 | crates/hir-ide/src/display.rs:1594-1607 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ide/src/display.rs:1535` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) crates/hir-ide/src/display.rs:1867— crates/hir-ide/src/display.rs:1867-1880 | crates/hir-ide/src/display.rs:1919-1932 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (14 lines × 2) crates/hir-ty/src/mir/lower.rs:1180— crates/hir-ty/src/mir/lower.rs:1180-1193 | crates/hir-ty/src/mir/lower.rs:1210-1223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/mir/lower.rs:1180` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (14 lines × 2) crates/hir/src/term_search/tactics.rs:144— crates/hir/src/term_search/tactics.rs:144-158 | crates/hir/src/term_search/tactics.rs:193-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) crates/hir/src/term_search/tactics.rs:424— crates/hir/src/term_search/tactics.rs:424-437 | crates/hir/src/term_search/tactics.rs:619-632 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/term_search/tactics.rs:424` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/hir/src/term_search/tactics.rs:616` calls `filter`, `is_unsafe` and `crates/hir/src/term_search/tactics.rs:421` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14 lines × 2) crates/ide-assists/src/handlers/generate_function.rs:590— crates/ide-assists/src/handlers/generate_function.rs:590-603 | crates/ide-assists/src/handlers/generate_function.rs:649-662 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/generate_function.rs:590` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (14 lines × 2) crates/ide-completion/src/completions/flyimport.rs:277— crates/ide-completion/src/completions/flyimport.rs:277-290 | crates/ide-completion/src/completions/flyimport.rs:373-386 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/completions/flyimport.rs:277` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) crates/ide-completion/src/context/analysis.rs:2110— crates/ide-completion/src/context/analysis.rs:2110-2123 | crates/syntax/src/algo.rs:137-150 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (14 lines × 2) crates/ide-completion/src/render/const_.rs:30— crates/ide-completion/src/render/const_.rs:30-43 | crates/ide-completion/src/render/type_alias.rs:52-65 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/render/const_.rs:30` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/ide-completion/src/render/const_.rs:29` calls `const_value`, `Some` and `crates/ide-completion/src/render/type_alias.rs:51` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:1011— crates/rust-analyzer/src/cli/analysis_stats.rs:1011-1024 | crates/rust-analyzer/src/cli/analysis_stats.rs:1115-1128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/cli/analysis_stats.rs:1011` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
rust_analyzer::config::patch_old_style::patch_json_for_outdated_configs (cyclomatic 95) crates/rust-analyzer/src/config/patch_old_style.rs:10— rust_analyzer::config::patch_old_style::patch_json_for_outdated_configs has cyclomatic complexity 95 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
rust_analyzer::lsp::to_proto::semantic_token_type_and_modifiers (cyclomatic 82) crates/rust-analyzer/src/lsp/to_proto.rs:818— rust_analyzer::lsp::to_proto::semantic_token_type_and_modifiers has cyclomatic complexity 82 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
rust_analyzer::handlers::notification::run_flycheck (cyclomatic 28) crates/rust-analyzer/src/handlers/notification.rs:330— rust_analyzer::handlers::notification::run_flycheck has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rust_analyzer::lsp::to_proto::completion_item (cyclomatic 25) crates/rust-analyzer/src/lsp/to_proto.rs:291— rust_analyzer::lsp::to_proto::completion_item has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: rust_analyzer::lsp::to_proto::completion_item_kind (cyclomatic 37) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
rust_analyzer::diagnostics::flycheck_to_proto::map_rust_diagnostic_to_lsp (cyclomatic 24) crates/rust-analyzer/src/diagnostics/flycheck_to_proto.rs:281— rust_analyzer::diagnostics::flycheck_to_proto::map_rust_diagnostic_to_lsp has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rust_analyzer::handlers::request::handle_runnables (cyclomatic 21) crates/rust-analyzer/src/handlers/request.rs:1016— rust_analyzer::handlers::request::handle_runnables has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rust_analyzer::handlers::request::run_rustfmt (cyclomatic 21) crates/rust-analyzer/src/handlers/request.rs:2405— rust_analyzer::handlers::request::run_rustfmt has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rust_analyzer::lsp::completion_item_hash (cyclomatic 17) crates/rust-analyzer/src/lsp.rs:37— rust_analyzer::lsp::completion_item_hash has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function item inside it that branches (hash_completion_relevance). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
rust_analyzer::lsp::to_proto::code_lens (cyclomatic 17) crates/rust-analyzer/src/lsp/to_proto.rs:1759— rust_analyzer::lsp::to_proto::code_lens has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rust_analyzer::lsp::to_proto::completion_item_kind (cyclomatic 37) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
rust_analyzer::session::run_session (cyclomatic 16) crates/rust-analyzer/src/session.rs:37— rust_analyzer::session::run_session has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×10
Edited copy of a member (6 corresponding lines) crates/ide-assists/src/handlers/add_missing_match_arms.rs:548— crates/ide-assists/src/handlers/add_missing_match_arms.rs:548-553 | crates/ide-assists/src/handlers/add_missing_match_arms.rs:583-590 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/hir-ide/src/display.rs:812— crates/hir-ide/src/display.rs:812-817 | crates/hir-ide/src/display.rs:1087-1092 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/mbe/src/expander/matcher.rs:271— crates/mbe/src/expander/matcher.rs:271-276 | crates/mbe/src/expander/matcher.rs:294-299 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/parser/src/grammar/patterns.rs:438— crates/parser/src/grammar/patterns.rs:438-443 | crates/parser/src/grammar/types.rs:222-227 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/parser/src/grammar/patterns.rs:463— crates/parser/src/grammar/patterns.rs:463-469 | crates/parser/src/grammar/types.rs:139-144 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/syntax/src/ast/expr_ext.rs:237— crates/syntax/src/ast/expr_ext.rs:237-242 | crates/syntax/src/ast/node_ext.rs:1160-1165 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/syntax/src/ast/expr_ext.rs:473— crates/syntax/src/ast/expr_ext.rs:473-478 | crates/syntax/src/ast/node_ext.rs:1182-1187 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/proc-macro-api/src/bidirectional_protocol/msg.rs:192— crates/proc-macro-api/src/bidirectional_protocol/msg.rs:192-197 | crates/proc-macro-api/src/legacy_protocol/msg.rs:166-171 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/proc-macro-api/src/bidirectional_protocol.rs:205— crates/proc-macro-api/src/bidirectional_protocol.rs:205-210 | crates/proc-macro-api/src/legacy_protocol.rs:145-151 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/hir-ty/src/lib.rs:571— crates/hir-ty/src/lib.rs:571-576 | crates/hir-ty/src/next_solver/def_id.rs:187-192 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (13 lines × 2) crates/hir-ty/src/next_solver/normalize.rs:252— crates/hir-ty/src/next_solver/normalize.rs:252-264 | crates/hir-ty/src/next_solver/normalize.rs:267-279 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (13 lines × 2) crates/hir-ty/src/traits.rs:253— crates/hir-ty/src/traits.rs:253-265 | crates/hir-ty/src/traits.rs:276-288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/traits.rs:253` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) crates/hir/src/term_search.rs:120— crates/hir/src/term_search.rs:120-132 | crates/hir/src/term_search.rs:158-170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/term_search.rs:120` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) crates/ide-completion/src/completions/flyimport.rs:280— crates/ide-completion/src/completions/flyimport.rs:280-292 | crates/ide-completion/src/completions/flyimport.rs:331-343 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/completions/flyimport.rs:280` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/ide-completion/src/completions/flyimport.rs:278` calls `filter`, `filter_excluded_flyimport` and `crates/ide-completion/src/completions/flyimport.rs:329` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) crates/ide-completion/src/context/analysis.rs:238— crates/ide-completion/src/context/analysis.rs:238-250 | crates/ide-completion/src/context/analysis.rs:359-371 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/context/analysis.rs:238` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) crates/ide/src/inlay_hints/lifetime.rs:35— crates/ide/src/inlay_hints/lifetime.rs:35-47 | crates/ide/src/inlay_hints/lifetime.rs:91-103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide/src/inlay_hints/lifetime.rs:35` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) crates/rust-analyzer/src/lsp/to_proto.rs:685— crates/rust-analyzer/src/lsp/to_proto.rs:685-697 | crates/rust-analyzer/src/lsp/to_proto.rs:709-721 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/lsp/to_proto.rs:685` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/rust-analyzer/src/lsp/to_proto.rs:698` calls `String` and `crates/rust-analyzer/src/lsp/to_proto.rs:722` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) crates/hir/src/semantics/child_by_source.rs:61— crates/hir/src/semantics/child_by_source.rs:61-73 | crates/hir/src/semantics/child_by_source.rs:88-100 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:195— crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:195-207 | crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:238-250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:195` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) xtask/src/codegen/lints.rs:173— xtask/src/codegen/lints.rs:173-185 | xtask/src/codegen/lints.rs:194-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `xtask/src/codegen/lints.rs:173` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Evaluator::exec_intrinsic (cyclomatic 197) crates/hir-ty/src/mir/eval/shim.rs:560— Evaluator::exec_intrinsic has cyclomatic complexity 197 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Evaluator::eval_rvalue (cyclomatic 100) crates/hir-ty/src/mir/eval.rs:1029— Evaluator::eval_rvalue has cyclomatic complexity 100 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Evaluator::exec_extern_c (cyclomatic 27) crates/hir-ty/src/mir/eval/shim.rs:396— Evaluator::exec_extern_c has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Evaluator::exec_simd_intrinsic (cyclomatic 26) crates/hir-ty/src/mir/eval/shim/simd.rs:51— Evaluator::exec_simd_intrinsic has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Evaluator::interpret_mir (cyclomatic 24) crates/hir-ty/src/mir/eval.rs:796— Evaluator::interpret_mir has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Evaluator::create_memory_map::rec (cyclomatic 22) crates/hir-ty/src/mir/eval.rs:2223— Evaluator::create_memory_map::rec has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Evaluator::exec_atomic_intrinsic (cyclomatic 19) crates/hir-ty/src/mir/eval/shim.rs:1511— Evaluator::exec_atomic_intrinsic has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Evaluator::patch_addresses (cyclomatic 19) crates/hir-ty/src/mir/eval.rs:2396— Evaluator::patch_addresses has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Evaluator::place_addr_and_ty_and_metadata (cyclomatic 18) crates/hir-ty/src/mir/eval.rs:638— Evaluator::place_addr_and_ty_and_metadata has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mbe::expander::matcher::match_loop_inner (cognitive 133) crates/mbe/src/expander/matcher.rs:366— mbe::expander::matcher::match_loop_inner has cognitive complexity 133 (threshold 15). Drivers by points: if/else 44 (115 pts), match/switch 4 (11 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 79). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
mbe::expander::transcriber::expand_subtree (cognitive 64) crates/mbe/src/expander/transcriber.rs:167— mbe::expander::transcriber::expand_subtree has cognitive complexity 64 (threshold 15). Drivers by points: if/else 8 (29 pts), match/switch 7 (28 pts), loops 3 (7 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mbe::expander::matcher::match_loop (cognitive 53) crates/mbe/src/expander/matcher.rs:624— mbe::expander::matcher::match_loop has cognitive complexity 53 (threshold 15). Drivers by points: if/else 16 (37 pts), match/switch 2 (8 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mbe::parser::parse_metavar_expr (cognitive 22) crates/mbe/src/parser.rs:391— mbe::parser::parse_metavar_expr has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mbe::expander::transcriber::expand_repeat (cognitive 21) crates/mbe/src/expander/transcriber.rs:463— mbe::expander::transcriber::expand_repeat has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (5 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mbe::parser::parse_repeat (cognitive 21) crates/mbe/src/parser.rs:345— mbe::parser::parse_repeat has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 7 (20 pts), loops 1 (nesting depth added 13). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
mbe::parser::next_op (cognitive 19) crates/mbe/src/parser.rs:188— mbe::parser::next_op has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 7 (19 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
mbe::expander::expand_rules (cognitive 16) crates/mbe/src/expander.rs:17— mbe::expander::expand_rules has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mbe::expander::matcher::match_meta_var (cognitive 16) crates/mbe/src/expander/matcher.rs:775— mbe::expander::matcher::match_meta_var has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), match/switch 4 (7 pts), boolean chains 2 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ExprCollector::maybe_collect_expr (cognitive 119) crates/hir-def/src/expr_store/lower.rs:1417— ExprCollector::maybe_collect_expr has cognitive complexity 119 (threshold 15). Drivers by points: if/else 51 (93 pts), match/switch 9 (19 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprCollector::lower_inline_asm (cognitive 100) crates/hir-def/src/expr_store/lower/asm.rs:17— ExprCollector::lower_inline_asm has cognitive complexity 100 (threshold 15). Drivers by points: if/else 27 (65 pts), match/switch 10 (28 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 58). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprCollector::collect_format_args_impl (cognitive 71) crates/hir-def/src/expr_store/lower/format_args.rs:110— ExprCollector::collect_format_args_impl has cognitive complexity 71 (threshold 15). Drivers by points: if/else 23 (56 pts), match/switch 3 (8 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprCollector::collect_pat (cognitive 40) crates/hir-def/src/expr_store/lower.rs:2918— ExprCollector::collect_pat has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 4 (10 pts), match/switch 4 (8 pts), boolean chains 1 (nesting depth added 21). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ExprCollector::maybe_collect_expr_as_pat (cognitive 36) crates/hir-def/src/expr_store/lower.rs:2086— ExprCollector::maybe_collect_expr_as_pat has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 7 (11 pts), boolean chains 1 (nesting depth added 16). Of this number, 23 points are the body's own statements and 13 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprCollector::collect_range_expr (cognitive 20) crates/hir-def/src/expr_store/lower.rs:1942— ExprCollector::collect_range_expr has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprCollector::lower_generic_args (cognitive 19) crates/hir-def/src/expr_store/lower.rs:1023— ExprCollector::lower_generic_args has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprCollector::lower_coroutine_body_with_moved_arguments (cognitive 18) crates/hir-def/src/expr_store/lower.rs:1097— ExprCollector::lower_coroutine_body_with_moved_arguments has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprCollector::collect_stmt (cognitive 17) crates/hir-def/src/expr_store/lower.rs:2725— ExprCollector::collect_stmt has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Change coupling: rust_analyzer_span.rs ↔ token_id.rs crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs:1— `crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs` and `crates/proc-macro-srv/src/server_impl/token_id.rs` change together 83% of the time (20 of the 24 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 20 shared commits counted here, the most recent 3 are `250f6fca` Remove experimental `--env-set` option; `6d2fbc00` Cleanup bidirection proc-macro-srv protocol a bit; `35aec104` reduce the amount of panics in `{TokenStream, Literal}::from_str` calls — run `git show` on any of them.
Change coupling: lower.rs ↔ pretty.rs crates/hir-def/src/item_tree/lower.rs:1— `crates/hir-def/src/item_tree/lower.rs` and `crates/hir-def/src/item_tree/pretty.rs` change together 74% of the time (14 of the 19 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 14 shared commits counted here, the most recent 3 are `0c8f6494` Do not declare the value NS constructor for structs/enum variants if …; `d59f559d` Optimize memory usage of the item tree; `439c0952` Reduce `impl_signature` query dependencies in method resolution — run `git show` on any of them.
Change coupling: test_db.rs ↔ lib.rs crates/hir-ide/src/test_db.rs:1— `crates/hir-ide/src/test_db.rs` and `crates/ide-db/src/lib.rs` change together 67% of the time (8 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `57632bea` move `DefDatabase::expand_proc_attr_macros` out of the query group (at that commit the file was still `crates/hir-ty/src/test_db.rs`); `273abbb6` internal: Improve panic message when FileSourceRootInput is missing (at that commit the file was still `crates/hir-ty/src/test_db.rs`); `b8d2768f` Provide access to `RootDatabase`'s `LineIndex` for the proc macro pro… (at that commit the file was still `crates/hir-ty/src/test_db.rs`) — run `git show` on any of them.
Change coupling: expander.rs ↔ collector.rs crates/hir-def/src/expr_store/expander.rs:1— `crates/hir-def/src/expr_store/expander.rs` and `crates/hir-def/src/nameres/collector.rs` change together 58% of the time (7 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `9fb66968` Stop at eager macro recursion overflow; `ddbe6aca` Store the macro depth inside `MacroCallId`; `20f6d47a` Optimised the depth calculation to be cached instead of calculating O… — run `git show` on any of them.
Change coupling: lower.rs ↔ scope.rs crates/hir-def/src/expr_store/lower.rs:1— `crates/hir-def/src/expr_store/lower.rs` and `crates/hir-def/src/expr_store/scope.rs` change together 55% of the time (12 of the 22 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 12 shared commits counted here, the most recent 3 are `9d3d1f9e` fix: Don't support const blocks in patterns; `36ac7e21` merge `hir_def::hir::Expr::Unsafe` into `Expr::Block`; `88887b09` Fix handling of params of coroutine fns — run `git show` on any of them.
Change coupling: mod_path.rs ↔ symbols.rs crates/hir-expand/src/mod_path.rs:1— `crates/hir-expand/src/mod_path.rs` and `crates/intern/src/symbol/symbols.rs` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `c7662ba9` fix; `75b41dc5` feat: Implement support for `feature(new_range)`; `72a6823f` rust-analyzer: Also use `semiopaque` instead of `semitransparent` — run `git show` on any of them.
Change coupling: expr.rs ↔ keyword.rs crates/ide-completion/src/completions/expr.rs:1— `crates/ide-completion/src/completions/expr.rs` and `crates/ide-completion/src/completions/keyword.rs` change together 53% of the time (8 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `1e3d049c` feat: complete 'let' 'letm' in arm expr and closure expr; `56114fc3` Add allow `else` keyword completion in LetStmt; `57044318` Add if..else completions in LetStmt and ArgList — run `git show` on any of them.
Change coupling: expander.rs ↔ assoc.rs crates/hir-def/src/expr_store/expander.rs:1— `crates/hir-def/src/expr_store/expander.rs` and `crates/hir-def/src/nameres/assoc.rs` change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `9fb66968` Stop at eager macro recursion overflow; `ddbe6aca` Store the macro depth inside `MacroCallId`; `b361c979` migrate `DefDatabase::macro_def` — run `git show` on any of them.
Change coupling: lower.rs ↔ tests.rs crates/hir-def/src/expr_store/lower.rs:1— `crates/hir-def/src/expr_store/lower.rs` and `crates/hir-def/src/expr_store/tests.rs` change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `9a5a11fb` fix: Fix `format_args` lowering using wrong integer suffix; `419231c7` Remove fixme and add a missing test attribute; `8956b1e1` Lower ast::Ident to hir::Path when lowering RangePats — run `git show` on any of them.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×9
Edited copy of a member (7 corresponding lines) crates/hir/src/has_source.rs:119— crates/hir/src/has_source.rs:119-125 | crates/hir/src/has_source.rs:129-135 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/vfs/src/vfs_path.rs:86— crates/vfs/src/vfs_path.rs:86-92 | crates/vfs/src/vfs_path.rs:94-100 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/ide-assists/src/handlers/add_missing_match_arms.rs:461— crates/ide-assists/src/handlers/add_missing_match_arms.rs:461-467 | crates/ide-assists/src/handlers/replace_if_let_with_match.rs:366-375 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/syntax/src/ast/node_ext.rs:1036— crates/syntax/src/ast/node_ext.rs:1036-1042 | crates/syntax/src/ast/node_ext.rs:1044-1050 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/hir-ty/src/mir/monomorphization.rs:244— crates/hir-ty/src/mir/monomorphization.rs:244-250 | crates/hir-ty/src/mir/monomorphization.rs:268-274 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/hir-ty/src/method_resolution.rs:590— crates/hir-ty/src/method_resolution.rs:590-596 | crates/hir-ty/src/method_resolution.rs:706-712 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/hir-ty/src/next_solver/generic_arg.rs:262— crates/hir-ty/src/next_solver/generic_arg.rs:262-268 | crates/hir-ty/src/next_solver/generic_arg.rs:757-763 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/hir-def/src/lib.rs:1052— crates/hir-def/src/lib.rs:1052-1058 | crates/hir-ty/src/next_solver/def_id.rs:617-623 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/hir-def/src/lib.rs:1175— crates/hir-def/src/lib.rs:1175-1181 | crates/hir-ty/src/next_solver/def_id.rs:197-203 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (7 lines × 3) crates/hir-def/src/item_scope.rs:391— crates/hir-def/src/item_scope.rs:391-397 | crates/hir-def/src/item_scope.rs:402-408 | crates/hir-def/src/item_scope.rs:413-419 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/item_scope.rs:391` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 3) crates/hir-expand/src/attrs.rs:323— crates/hir-expand/src/attrs.rs:323-329 | crates/syntax/src/ast/token_ext.rs:276-282 | crates/syntax/src/ast/token_ext.rs:320-326 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-expand/src/attrs.rs:323` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) crates/hir-ty/src/db.rs:380— crates/hir-ty/src/db.rs:380-386 | crates/hir-ty/src/db.rs:409-415 | crates/hir-ty/src/db.rs:439-445 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/db.rs:380` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) crates/hir/src/lib.rs:5723— crates/hir/src/lib.rs:5723-5729 | crates/hir/src/lib.rs:5738-5744 | crates/hir/src/lib.rs:5749-5755 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/ide/src/hover/render.rs:120— crates/ide/src/hover/render.rs:120-127 | crates/ide/src/hover/render.rs:166-172 | crates/ide/src/hover/render.rs:983-989 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/ide/src/hover/render.rs:166— crates/ide/src/hover/render.rs:166-172 | crates/ide/src/hover/render.rs:280-286 | crates/ide/src/hover/render.rs:983-989 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/parser/src/grammar/items/adt.rs:149— crates/parser/src/grammar/items/adt.rs:149-155 | crates/parser/src/grammar/items/adt.rs:161-167 | crates/parser/src/grammar/items/adt.rs:221-227 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/parser/src/grammar/items/adt.rs:149` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) crates/syntax/src/ast/syntax_factory/constructors.rs:361— crates/syntax/src/ast/syntax_factory/constructors.rs:361-367 | crates/syntax/src/ast/syntax_factory/constructors.rs:409-415 | crates/syntax/src/ast/syntax_factory/constructors.rs:2166-2172 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/syntax/src/ast/syntax_factory/constructors.rs:368` calls `map_node`, `syntax`, `clone` and `crates/syntax/src/ast/syntax_factory/constructors.rs:416` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 3) crates/hir-ty/src/mir/eval/shim.rs:986— crates/hir-ty/src/mir/eval/shim.rs:986-992 | crates/hir-ty/src/mir/eval/shim.rs:1200-1206 | crates/hir-ty/src/mir/eval/shim.rs:1305-1311 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/mir/eval/shim.rs:986` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
hir_def::attrs::match_attr_flags (cyclomatic 71) crates/hir-def/src/attrs.rs:131— hir_def::attrs::match_attr_flags has cyclomatic complexity 71 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_def::hir::format_args::parse (cyclomatic 42) crates/hir-def/src/hir/format_args.rs:172— hir_def::hir::format_args::parse has cyclomatic complexity 42 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_def::expr_store::lower::path::lower_path (cyclomatic 38) crates/hir-def/src/expr_store/lower/path.rs:41— hir_def::expr_store::lower::path::lower_path has cyclomatic complexity 38 (threshold 15). Of this number, 37 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_def::attrs::parse_repr_tt (cyclomatic 27) crates/hir-def/src/attrs.rs:1272— hir_def::attrs::parse_repr_tt has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_def::expr_store::lower::lower_body (cyclomatic 22) crates/hir-def/src/expr_store/lower.rs:70— hir_def::expr_store::lower::lower_body has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_def::lang_item::crate_lang_items (cyclomatic 20) crates/hir-def/src/lang_item.rs:41— hir_def::lang_item::crate_lang_items has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_def::find_path::find_path_for_module (cyclomatic 17) crates/hir-def/src/find_path.rs:177— hir_def::find_path::find_path_for_module has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_def::find_path::find_local_import_locations (cyclomatic 16) crates/hir-def/src/find_path.rs:577— hir_def::find_path::find_local_import_locations has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GlobalState::handle_event (cognitive 109) crates/rust-analyzer/src/main_loop.rs:315— GlobalState::handle_event has cognitive complexity 109 (threshold 15). Drivers by points: if/else 31 (60 pts), boolean chains 19, loops 8 (16 pts), match/switch 6 (14 pts) (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GlobalState::switch_workspaces (cognitive 62) crates/rust-analyzer/src/reload.rs:467— GlobalState::switch_workspaces has cognitive complexity 62 (threshold 15). Drivers by points: if/else 20 (41 pts), match/switch 5 (10 pts), loops 2 (6 pts), boolean chains 5 (nesting depth added 30). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
GlobalState::process_changes (cognitive 57) crates/rust-analyzer/src/global_state.rs:338— GlobalState::process_changes has cognitive complexity 57 (threshold 15). Drivers by points: if/else 22 (45 pts), match/switch 2 (7 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
GlobalState::handle_task (cognitive 40) crates/rust-analyzer/src/main_loop.rs:850— GlobalState::handle_task has cognitive complexity 40 (threshold 15). Drivers by points: match/switch 9 (21 pts), if/else 7 (19 pts) (nesting depth added 24). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
GlobalState::current_status (cognitive 37) crates/rust-analyzer/src/reload.rs:128— GlobalState::current_status has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (30 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GlobalState::compute_priming_scope (cognitive 30) crates/rust-analyzer/src/global_state.rs:756— GlobalState::compute_priming_scope has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (19 pts), loops 4 (9 pts), match/switch 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GlobalState::handle_vfs_msg (cognitive 21) crates/rust-analyzer/src/main_loop.rs:980— GlobalState::handle_vfs_msg has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 3 (5 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
GlobalState::handle_deferred_task (cognitive 17) crates/rust-analyzer/src/main_loop.rs:1085— GlobalState::handle_deferred_task has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 2 (3 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_expand::cfg_process::macro_input_callback (cognitive 86) crates/hir-expand/src/cfg_process.rs:47— hir_expand::cfg_process::macro_input_callback has cognitive complexity 86 (threshold 15). Drivers by points: if/else 23 (61 pts), match/switch 4 (11 pts), loops 3 (10 pts), boolean chains 4 (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_expand::fixup::fixup_syntax (cognitive 74) crates/hir-expand/src/fixup.rs:52— hir_expand::fixup::fixup_syntax has cognitive complexity 74 (threshold 15). Drivers by points: if/else 18 (50 pts), match/switch 5 (17 pts), boolean chains 6, loops 1 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_expand::builtin::derive_macro::coerce_pointee_expand (cognitive 64) crates/hir-expand/src/builtin/derive_macro.rs:1128— hir_expand::builtin::derive_macro::coerce_pointee_expand has cognitive complexity 64 (threshold 15). Drivers by points: if/else 31 (46 pts), match/switch 8 (10 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 18). Of this number, 46 points are the body's own statements and 18 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_expand::attrs::expand_cfg_attr_with_doc_comments (cognitive 32) crates/hir-expand/src/attrs.rs:111— hir_expand::attrs::expand_cfg_attr_with_doc_comments has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_expand::eager::eager_macro_recur (cognitive 27) crates/hir-expand/src/eager.rs:151— hir_expand::eager::eager_macro_recur has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 7 (17 pts), if/else 4 (9 pts), loops 1 (nesting depth added 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_expand::builtin::fn_macro::concat_expand (cognitive 24) crates/hir-expand/src/builtin/fn_macro.rs:544— hir_expand::builtin::fn_macro::concat_expand has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 2 (6 pts), boolean chains 5, loops 1 (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_expand::builtin::fn_macro::cfg_select_expand (cognitive 20) crates/hir-expand/src/builtin/fn_macro.rs:342— hir_expand::builtin::fn_macro::cfg_select_expand has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (5 pts), boolean chains 4, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_expand::mod_path::convert_path (cognitive 18) crates/hir-expand/src/mod_path.rs:259— hir_expand::mod_path::convert_path has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (8 pts), if/else 4 (6 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×8
Edited copy of a member (20 corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs:669— crates/syntax/src/ast/syntax_factory/constructors.rs:669-688 | crates/syntax/src/ast/syntax_factory/constructors.rs:1482-1505 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/ide-db/src/helpers.rs:39— crates/ide-db/src/helpers.rs:39-58 | crates/ide-db/src/helpers.rs:64-83 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/hir-ty/src/next_solver/def_id.rs:246— crates/hir-ty/src/next_solver/def_id.rs:246-265 | crates/hir-ty/src/next_solver/def_id.rs:272-291 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/ide-assists/src/handlers/apply_demorgan.rs:261— crates/ide-assists/src/handlers/apply_demorgan.rs:261-280 | crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs:210-231 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/hir/src/semantics.rs:1160— crates/hir/src/semantics.rs:1160-1179 | crates/hir/src/semantics.rs:1186-1205 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/ide-completion/src/completions/postfix.rs:526— crates/ide-completion/src/completions/postfix.rs:526-546 | crates/ide-completion/src/completions/snippet.rs:137-156 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/ide-assists/src/handlers/raw_string.rs:27— crates/ide-assists/src/handlers/raw_string.rs:27-46 | crates/ide-assists/src/handlers/raw_string.rs:63-83 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/hir/src/source_analyzer.rs:1630— crates/hir/src/source_analyzer.rs:1630-1649 | crates/hir/src/source_analyzer.rs:1671-1690 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Off the main sequence: edition — edition: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
Off the main sequence: paths — paths: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 9 project(s), so it's rigid to change.
Off the main sequence: profile — profile: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 4 project(s), so it's rigid to change.
Off the main sequence: stdx — stdx: abstractness 0.17, instability 0.00, distance 0.83 — zone of pain — concrete and depended on by 24 project(s), so it's rigid to change.
Off the main sequence: span — span: abstractness 0.05, instability 0.16, distance 0.79 — zone of pain — concrete and depended on by 16 project(s), so it's rigid to change.
Off the main sequence: cfg — cfg: abstractness 0.00, instability 0.25, distance 0.75 — zone of pain — concrete and depended on by 9 project(s), so it's rigid to change.
Off the main sequence: parser — parser: abstractness 0.13, instability 0.13, distance 0.74 — zone of pain — concrete and depended on by 7 project(s), so it's rigid to change.
Off the main sequence: tt — tt: abstractness 0.05, instability 0.25, distance 0.70 — zone of pain — concrete and depended on by 9 project(s), so it's rigid to change.
Low cohesion: Completions (LCOM4 14) crates/ide-completion/src/completions.rs:57— Completions's methods fall into 14 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 14 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Config (LCOM4 10) crates/rust-analyzer/src/config.rs:1116— Config's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: MacroCallId (LCOM4 6) crates/hir-expand/src/lib.rs:1556— MacroCallId's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: GenericArgs (LCOM4 5) crates/hir-def/src/expr_store/path.rs:59— GenericArgs's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: ExpressionStore (LCOM4 5) crates/hir-def/src/expr_store.rs:160— ExpressionStore's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: DbInterner (LCOM4 5) crates/hir-ty/src/next_solver/interner.rs:352— DbInterner's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: ModuleIdLt (LCOM4 4) crates/hir-def/src/lib.rs:545— ModuleIdLt's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Diagnostic (LCOM4 4) crates/ide-diagnostics/src/lib.rs:184— Diagnostic's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
hir::display::write_function (cognitive 31) crates/hir/src/display.rs:159— hir::display::write_function has cognitive complexity 31 (threshold 15). Drivers by points: if/else 20 (22 pts), match/switch 3 (7 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
hir::source_analyzer::resolve_hir_path_ (cognitive 29) crates/hir/src/source_analyzer.rs:1873— hir::source_analyzer::resolve_hir_path_ has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (20 pts), match/switch 4 (5 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir::display::write_generic_params_or_args (cognitive 25) crates/hir/src/display.rs:710— hir::display::write_generic_params_or_args has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 3, match/switch 1 (3 pts), loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir::display::write_variants (cognitive 24) crates/hir/src/display.rs:497— hir::display::write_variants has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 1 (3 pts), loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir::term_search::tactics::data_constructor (cognitive 23) crates/hir/src/term_search/tactics.rs:126— hir::term_search::tactics::data_constructor has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 2, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir::display::write_fields (cognitive 19) crates/hir/src/display.rs:462— hir::display::write_fields has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir::term_search::tactics::free_function (cognitive 18) crates/hir/src/term_search/tactics.rs:270— hir::term_search::tactics::free_function has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×7
Edited copy of a member (16 corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs:962— crates/syntax/src/ast/syntax_factory/constructors.rs:962-977 | crates/syntax/src/ast/syntax_factory/constructors.rs:2339-2356 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/syntax/src/ast/edit.rs:90— crates/syntax/src/ast/edit.rs:90-105 | crates/syntax/src/ast/edit.rs:107-123 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:159— crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:159-174 | crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:148-165 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/hir/src/lib.rs:3903— crates/hir/src/lib.rs:3903-3919 | crates/hir/src/lib.rs:3921-3936 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs:441— crates/syntax/src/ast/syntax_factory/constructors.rs:441-457 | crates/syntax/src/ast/syntax_factory/constructors.rs:706-721 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/hir-ty/src/lower.rs:1720— crates/hir-ty/src/lower.rs:1720-1735 | crates/hir-ty/src/lower.rs:1741-1756 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/hir-ide/src/diagnostics/decl_check.rs:645— crates/hir-ide/src/diagnostics/decl_check.rs:645-662 | crates/hir-ide/src/diagnostics/decl_check.rs:683-698 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×7
Edited copy of a member (18 corresponding lines) crates/ide-diagnostics/src/handlers/type_mismatch.rs:388— crates/ide-diagnostics/src/handlers/type_mismatch.rs:388-405 | crates/ide-diagnostics/src/handlers/type_mismatch.rs:412-429 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/hir-ty/src/lower.rs:1665— crates/hir-ty/src/lower.rs:1665-1683 | crates/hir-ty/src/lower.rs:1697-1714 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/hir-ty/src/lower.rs:1504— crates/hir-ty/src/lower.rs:1504-1522 | crates/hir-ty/src/lower.rs:1836-1853 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/hir-def/src/expr_store.rs:790— crates/hir-def/src/expr_store.rs:790-807 | crates/hir-def/src/expr_store.rs:825-842 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/ide-diagnostics/src/handlers/remove_trailing_return.rs:15— crates/ide-diagnostics/src/handlers/remove_trailing_return.rs:15-37 | crates/ide-diagnostics/src/handlers/remove_unnecessary_else.rs:24-41 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/parser/src/grammar/expressions.rs:654— crates/parser/src/grammar/expressions.rs:654-671 | crates/parser/src/grammar/items/use_item.rs:87-108 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/hir-ty/src/next_solver/opaques.rs:104— crates/hir-ty/src/next_solver/opaques.rs:104-121 | crates/hir-ty/src/next_solver/opaques.rs:122-139 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
ExprCollector::maybe_collect_expr (cyclomatic 90) crates/hir-def/src/expr_store/lower.rs:1417— ExprCollector::maybe_collect_expr has cyclomatic complexity 90 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ExprCollector::lower_inline_asm (cyclomatic 49) crates/hir-def/src/expr_store/lower/asm.rs:17— ExprCollector::lower_inline_asm has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ExprCollector::collect_pat (cyclomatic 40) crates/hir-def/src/expr_store/lower.rs:2918— ExprCollector::collect_pat has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ExprCollector::maybe_collect_expr_as_pat (cyclomatic 29) crates/hir-def/src/expr_store/lower.rs:2086— ExprCollector::maybe_collect_expr_as_pat has cyclomatic complexity 29 (threshold 15). Of this number, 20 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ExprCollector::collect_format_args_impl (cyclomatic 27) crates/hir-def/src/expr_store/lower/format_args.rs:110— ExprCollector::collect_format_args_impl has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ExprCollector::lower_type_ref (cyclomatic 20) crates/hir-def/src/expr_store/lower.rs:746— ExprCollector::lower_type_ref has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
DefCollector::resolve_macros (cognitive 75) crates/hir-def/src/nameres/collector.rs:1306— DefCollector::resolve_macros has cognitive complexity 75 (threshold 15). Drivers by points: if/else 18 (56 pts), match/switch 6 (11 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 46). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DefCollector::record_resolved_import (cognitive 53) crates/hir-def/src/nameres/collector.rs:882— DefCollector::record_resolved_import has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (36 pts), match/switch 6 (16 pts), boolean chains 1 (nesting depth added 31). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
DefCollector::seed_with_top_level (cognitive 31) crates/hir-def/src/nameres/collector.rs:277— DefCollector::seed_with_top_level has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 4 (9 pts), boolean chains 3, loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefCollector::push_res_and_update_glob_vis (cognitive 31) crates/hir-def/src/nameres/collector.rs:1202— DefCollector::push_res_and_update_glob_vis has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 9 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefCollector::update_recursive (cognitive 20) crates/hir-def/src/nameres/collector.rs:1111— DefCollector::update_recursive has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (8 pts), loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefCollector::resolution_loop (cognitive 18) crates/hir-def/src/nameres/collector.rs:420— DefCollector::resolution_loop has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×6
Edited copy of a member (17 corresponding lines) crates/ide-assists/src/handlers/flip_or_pattern.rs:24— crates/ide-assists/src/handlers/flip_or_pattern.rs:24-40 | crates/ide-assists/src/handlers/flip_trait_bound.rs:20-42 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/hir-ty/src/next_solver/generic_arg.rs:108— crates/hir-ty/src/next_solver/generic_arg.rs:108-125 | crates/hir-ty/src/next_solver/generic_arg.rs:128-144 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/hir-def/src/visibility.rs:47— crates/hir-def/src/visibility.rs:47-63 | crates/hir-def/src/visibility.rs:70-93 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/hir-ty/src/infer/unify.rs:369— crates/hir-ty/src/infer/unify.rs:369-385 | crates/hir-ty/src/infer/unify.rs:391-409 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/cfg/src/dnf.rs:126— crates/cfg/src/dnf.rs:126-142 | crates/cfg/src/dnf.rs:166-182 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/hir/src/lib.rs:4878— crates/hir/src/lib.rs:4878-4896 | crates/hir/src/lib.rs:4929-4945 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (21 lines × 2) crates/hir/src/diagnostics.rs:1470— crates/hir/src/diagnostics.rs:1470-1490 | crates/hir/src/diagnostics.rs:1915-1935 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/diagnostics.rs:1470` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/hir/src/diagnostics.rs:1491` calls `Some` and `crates/hir/src/diagnostics.rs:1936` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (21 lines × 2) crates/ide-assists/src/handlers/generate_enum_is_method.rs:76— crates/ide-assists/src/handlers/generate_enum_is_method.rs:76-96 | crates/ide-assists/src/handlers/generate_enum_projection_method.rs:155-175 — before extracting anything, compare `crates/ide-assists/src/handlers/generate_enum_is_method.rs` and `crates/ide-assists/src/handlers/generate_enum_projection_method.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/generate_enum_is_method.rs:76` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 2) crates/ide-completion/src/context/analysis.rs:1587— crates/ide-completion/src/context/analysis.rs:1587-1607 | crates/ide-completion/src/context/analysis.rs:1616-1636 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/context/analysis.rs:1587` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (21 lines × 2) crates/ide-diagnostics/src/handlers/field_shorthand.rs:38— crates/ide-diagnostics/src/handlers/field_shorthand.rs:38-58 | crates/ide-diagnostics/src/handlers/field_shorthand.rs:84-104 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-diagnostics/src/handlers/field_shorthand.rs:38` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (21 lines × 2) crates/hir/src/semantics.rs:2478— crates/hir/src/semantics.rs:2478-2498 | crates/ide-assists/src/handlers/extract_function.rs:709-729 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/semantics.rs:2478` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 2) crates/hir-ty/src/lower/path.rs:351— crates/hir-ty/src/lower/path.rs:351-371 | crates/hir-ty/src/lower/path.rs:407-427 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/lower/path.rs:351` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `crate) fn resolve_path_in_type_ns(&mut` in one and `crate) fn resolve_path_in_value_ns( &mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (17 lines × 2) crates/hir-ty/src/infer/expr.rs:76— crates/hir-ty/src/infer/expr.rs:76-92 | crates/hir-ty/src/infer/expr.rs:293-309 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/infer/expr.rs:76` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) crates/ide-diagnostics/src/handlers/unresolved_field.rs:37— crates/ide-diagnostics/src/handlers/unresolved_field.rs:37-53 | crates/ide-diagnostics/src/handlers/unresolved_method.rs:34-50 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-diagnostics/src/handlers/unresolved_field.rs:37` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `d` to `&hir::UnresolvedField<'_>` in one and `&hir::UnresolvedMethodCall<'_>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (17 lines × 2) crates/ide/src/syntax_highlighting/highlight.rs:540— crates/ide/src/syntax_highlighting/highlight.rs:540-556 | crates/ide/src/syntax_highlighting/highlight.rs:563-579 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide/src/syntax_highlighting/highlight.rs:540` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) crates/span/src/map.rs:167— crates/span/src/map.rs:167-183 | crates/syntax/src/lib.rs:223-239 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/span/src/map.rs:167` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) crates/ide-db/src/imports/import_assets.rs:891— crates/ide-db/src/imports/import_assets.rs:891-907 | crates/ide-db/src/imports/import_assets.rs:916-932 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-db/src/imports/import_assets.rs:891` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/ide-db/src/imports/import_assets.rs:915` calls `as_assoc_item` and `crates/ide-db/src/imports/import_assets.rs:890` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 2) crates/rust-analyzer/src/handlers/request.rs:2001— crates/rust-analyzer/src/handlers/request.rs:2001-2017 | crates/rust-analyzer/src/handlers/request.rs:2031-2047 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `params` to `SemanticTokensParams` in one and `SemanticTokensDeltaParams` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (16 lines × 2) crates/hir-ty/src/infer/callee.rs:137— crates/hir-ty/src/infer/callee.rs:137-152 | crates/hir-ty/src/infer/callee.rs:190-205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/infer/callee.rs:137` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (16 lines × 2) crates/hir-ty/src/infer/pat.rs:1380— crates/hir-ty/src/infer/pat.rs:1380-1395 | crates/hir-ty/src/infer/pat.rs:1416-1435 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/infer/pat.rs:1416` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (16 lines × 2) crates/ide-assists/src/handlers/generate_deref.rs:70— crates/ide-assists/src/handlers/generate_deref.rs:70-85 | crates/ide-assists/src/handlers/generate_deref.rs:113-128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/generate_deref.rs:70` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) crates/ide-db/src/imports/merge_imports.rs:879— crates/ide-db/src/imports/merge_imports.rs:879-894 | crates/ide-db/src/imports/merge_imports.rs:918-933 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-db/src/imports/merge_imports.rs:879` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) crates/ide/src/runnables.rs:364— crates/ide/src/runnables.rs:364-379 | crates/ide/src/runnables.rs:456-471 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) xtask/src/codegen/lints.rs:279— xtask/src/codegen/lints.rs:279-294 | xtask/src/codegen/lints.rs:295-310 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/ide-assists/src/utils/gen_trait_fn_body.rs:444— crates/ide-assists/src/utils/gen_trait_fn_body.rs:444-458 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:637-651 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/utils/gen_trait_fn_body.rs:444` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) crates/ide/src/doc_links.rs:601— crates/ide/src/doc_links.rs:601-615 | crates/ide/src/doc_links.rs:617-631 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (15 lines × 2) crates/ide/src/syntax_highlighting/escape.rs:47— crates/ide/src/syntax_highlighting/escape.rs:47-61 | crates/ide/src/syntax_highlighting/escape.rs:76-90 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide/src/syntax_highlighting/escape.rs:47` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:958— crates/rust-analyzer/src/cli/analysis_stats.rs:958-972 | crates/rust-analyzer/src/cli/analysis_stats.rs:1063-1077 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/cli/analysis_stats.rs:958` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) crates/hir-ide/src/display.rs:1063— crates/hir-ide/src/display.rs:1063-1077 | crates/hir-ide/src/display.rs:1209-1223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:844— crates/rust-analyzer/src/cli/analysis_stats.rs:844-858 | crates/rust-analyzer/src/cli/analysis_stats.rs:1265-1279 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/cli/analysis_stats.rs:844` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Printer::print_expr_in (cyclomatic 79) crates/hir-def/src/expr_store/pretty.rs:531— Printer::print_expr_in has cyclomatic complexity 79 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Printer::print_pat (cyclomatic 40) crates/hir-def/src/expr_store/pretty.rs:896— Printer::print_pat has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Printer::print_path (cyclomatic 27) crates/hir-def/src/expr_store/pretty.rs:1111— Printer::print_path has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Printer::print_type_ref (cyclomatic 26) crates/hir-def/src/expr_store/pretty.rs:1259— Printer::print_type_ref has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Printer::print_mod_item (cyclomatic 21) crates/hir-def/src/item_tree/pretty.rs:155— Printer::print_mod_item has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
GlobalState::handle_event (cyclomatic 74) crates/rust-analyzer/src/main_loop.rs:315— GlobalState::handle_event has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GlobalState::handle_task (cyclomatic 30) crates/rust-analyzer/src/main_loop.rs:850— GlobalState::handle_task has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
GlobalState::switch_workspaces (cyclomatic 29) crates/rust-analyzer/src/reload.rs:467— GlobalState::switch_workspaces has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GlobalState::process_changes (cyclomatic 25) crates/rust-analyzer/src/global_state.rs:338— GlobalState::process_changes has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GlobalState::current_status (cyclomatic 22) crates/rust-analyzer/src/reload.rs:128— GlobalState::current_status has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_expand::builtin::derive_macro::coerce_pointee_expand (cyclomatic 57) crates/hir-expand/src/builtin/derive_macro.rs:1128— hir_expand::builtin::derive_macro::coerce_pointee_expand has cyclomatic complexity 57 (threshold 15). Of this number, 33 points are the body's own statements and 24 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_expand::fixup::fixup_syntax (cyclomatic 41) crates/hir-expand/src/fixup.rs:52— hir_expand::fixup::fixup_syntax has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_expand::cfg_process::macro_input_callback (cyclomatic 35) crates/hir-expand/src/cfg_process.rs:47— hir_expand::cfg_process::macro_input_callback has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_expand::builtin::fn_macro::concat_expand (cyclomatic 21) crates/hir-expand/src/builtin/fn_macro.rs:544— hir_expand::builtin::fn_macro::concat_expand has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: BuiltinFnLikeExpander::find_by_name (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
hir_expand::mod_path::convert_path (cyclomatic 19) crates/hir-expand/src/mod_path.rs:259— hir_expand::mod_path::convert_path has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mbe::expander::matcher::match_loop_inner (cyclomatic 45) crates/mbe/src/expander/matcher.rs:366— mbe::expander::matcher::match_loop_inner has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mbe::expander::transcriber::expand_subtree (cyclomatic 30) crates/mbe/src/expander/transcriber.rs:167— mbe::expander::transcriber::expand_subtree has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mbe::expander::matcher::match_loop (cyclomatic 22) crates/mbe/src/expander/matcher.rs:624— mbe::expander::matcher::match_loop has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mbe::expander::matcher::match_meta_var (cyclomatic 21) crates/mbe/src/expander/matcher.rs:775— mbe::expander::matcher::match_meta_var has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mbe::parser::eat_fragment_kind (cyclomatic 19) crates/mbe/src/parser.rs:296— mbe::parser::eat_fragment_kind has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
parser::grammar::items::opt_item (cyclomatic 39) crates/parser/src/grammar/items.rs:110— parser::grammar::items::opt_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.
parser::grammar::expressions::atom::atom_expr (cyclomatic 37) crates/parser/src/grammar/expressions/atom.rs:73— parser::grammar::expressions::atom::atom_expr has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
parser::grammar::expressions::atom::parse_asm_expr (cyclomatic 22) crates/parser/src/grammar/expressions/atom.rs:349— parser::grammar::expressions::atom::parse_asm_expr has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
parser::grammar::expressions::atom::builtin_expr (cyclomatic 18) crates/parser/src/grammar/expressions/atom.rs:256— parser::grammar::expressions::atom::builtin_expr has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
parser::grammar::expressions::expr_bp (cyclomatic 16) crates/parser/src/grammar/expressions.rs:248— parser::grammar::expressions::expr_bp has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: parser::grammar::expressions::current_op (cyclomatic 33) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
MirLowerCtx::lower_expr_to_place_without_adjust (cognitive 208) crates/hir-ty/src/mir/lower.rs:370— MirLowerCtx::lower_expr_to_place_without_adjust has cognitive complexity 208 (threshold 15). Drivers by points: if/else 62 (140 pts), match/switch 23 (54 pts), loops 4 (9 pts), boolean chains 5 (nesting depth added 114). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
MirLowerCtx::pattern_match_inner (cognitive 78) crates/hir-ty/src/mir/lower/pattern_matching.rs:117— MirLowerCtx::pattern_match_inner has cognitive complexity 78 (threshold 15). Drivers by points: if/else 26 (60 pts), match/switch 5 (10 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 42). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
MirLowerCtx::lower_expr_as_place_without_adjust (cognitive 37) crates/hir-ty/src/mir/lower/as_place.rs:117— MirLowerCtx::lower_expr_as_place_without_adjust has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (30 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MirLowerCtx::lower_block_to_place (cognitive 34) crates/hir-ty/src/mir/lower.rs:1677— MirLowerCtx::lower_block_to_place has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (27 pts), match/switch 2 (6 pts), loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MirLowerCtx::lower_params_and_bindings (cognitive 20) crates/hir-ty/src/mir/lower.rs:1758— MirLowerCtx::lower_params_and_bindings has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, loops 2, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Printer::print_expr_in (cognitive 88) crates/hir-def/src/expr_store/pretty.rs:531— Printer::print_expr_in has cognitive complexity 88 (threshold 15). Drivers by points: if/else 23 (50 pts), loops 7 (19 pts), match/switch 10 (19 pts) (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Printer::print_pat (cognitive 54) crates/hir-def/src/expr_store/pretty.rs:896— Printer::print_pat has cognitive complexity 54 (threshold 15). Drivers by points: if/else 15 (37 pts), loops 6 (12 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 29). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Printer::print_type_ref (cognitive 28) crates/hir-def/src/expr_store/pretty.rs:1259— Printer::print_type_ref has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 3 (5 pts), loops 2 (4 pts) (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Printer::print_path (cognitive 22) crates/hir-def/src/expr_store/pretty.rs:1111— Printer::print_path has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 3 (5 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Printer::print_type_bounds (cognitive 19) crates/hir-def/src/expr_store/pretty.rs:1364— Printer::print_type_bounds has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 3 (9 pts), if/else 2 (6 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
DeclValidator::validate_struct_fields (cognitive 18) crates/hir-ide/src/diagnostics/decl_check.rs:322— DeclValidator::validate_struct_fields has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DeclValidator::validate_enum_variant_fields) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DeclValidator::validate_enum_variants (cognitive 18) crates/hir-ide/src/diagnostics/decl_check.rs:503— DeclValidator::validate_enum_variants has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeclValidator::validate_enum_variant_fields (cognitive 18) crates/hir-ide/src/diagnostics/decl_check.rs:573— DeclValidator::validate_enum_variant_fields has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DeclValidator::validate_struct_fields) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DeclValidator::validate_union_fields (cognitive 17) crates/hir-ide/src/diagnostics/decl_check.rs:415— DeclValidator::validate_union_fields has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeclValidator::validate_func_body (cognitive 16) crates/hir-ide/src/diagnostics/decl_check.rs:233— DeclValidator::validate_func_body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×5
Members sharing a duplicated core (4 members, 50+ identical tokens) crates/hir-ide/src/diagnostics/decl_check.rs:322— crates/hir-ide/src/diagnostics/decl_check.rs:322-392 | crates/hir-ide/src/diagnostics/decl_check.rs:415-480 | crates/hir-ide/src/diagnostics/decl_check.rs:503-570 | crates/hir-ide/src/diagnostics/decl_check.rs:573-643 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) crates/hir-ide/src/diagnostics/expr.rs:627— crates/hir-ide/src/diagnostics/expr.rs:627-663 | crates/hir-ide/src/diagnostics/expr.rs:670-700 | crates/hir/src/source_analyzer.rs:2181-2206 | crates/hir/src/source_analyzer.rs:2213-2238 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) crates/ide/src/hover/render.rs:66— crates/ide/src/hover/render.rs:66-153 | crates/ide/src/hover/render.rs:161-217 | crates/ide/src/hover/render.rs:273-306 | crates/ide/src/hover/render.rs:977-1028 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) crates/rust-analyzer/src/cli/analysis_stats.rs:1498— crates/rust-analyzer/src/cli/analysis_stats.rs:1498-1512 | crates/rust-analyzer/src/cli/analysis_stats.rs:1514-1528 | crates/rust-analyzer/src/cli/analysis_stats.rs:1535-1550 | crates/rust-analyzer/src/cli/analysis_stats.rs:1556-1571 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) crates/syntax/src/syntax_editor/edits.rs:58— crates/syntax/src/syntax_editor/edits.rs:58-66 | crates/syntax/src/syntax_editor/edits.rs:70-82 | crates/syntax/src/syntax_editor/edits.rs:86-100 | crates/syntax/src/syntax_editor/edits.rs:104-112 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Edited copy of a member (30 corresponding lines) · ×5
Edited copy of a member (30 corresponding lines) crates/ide-completion/src/render/const_.rs:17— crates/ide-completion/src/render/const_.rs:17-46 | crates/ide-completion/src/render/type_alias.rs:29-68 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) crates/ide-assists/src/handlers/generate_impl.rs:48— crates/ide-assists/src/handlers/generate_impl.rs:48-77 | crates/ide-assists/src/handlers/generate_impl.rs:96-129 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) crates/ide-assists/src/handlers/convert_for_to_while_let.rs:119— crates/ide-assists/src/handlers/convert_for_to_while_let.rs:119-148 | crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs:161-190 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) crates/proc-macro-srv-cli/src/main_loop.rs:289— crates/proc-macro-srv-cli/src/main_loop.rs:289-320 | crates/proc-macro-srv-cli/src/main_loop.rs:325-354 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) crates/ide-db/src/imports/merge_imports.rs:871— crates/ide-db/src/imports/merge_imports.rs:871-900 | crates/ide-db/src/imports/merge_imports.rs:905-936 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×5
Edited copy of a member (25 corresponding lines) crates/proc-macro-srv/src/token_stream.rs:525— crates/proc-macro-srv/src/token_stream.rs:525-567 | crates/tt/src/lib.rs:666-690 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:288— crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:288-316 | crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:346-370 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) crates/hir-def/src/item_tree/lower.rs:67— crates/hir-def/src/item_tree/lower.rs:67-100 | crates/hir-def/src/item_tree/lower.rs:102-126 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) crates/hir-ty/src/next_solver/normalize.rs:178— crates/hir-ty/src/next_solver/normalize.rs:178-202 | crates/hir-ty/src/next_solver/normalize.rs:204-228 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) crates/ide-db/src/syntax_helpers/node_ext.rs:178— crates/ide-db/src/syntax_helpers/node_ext.rs:178-202 | crates/ide-db/src/syntax_helpers/node_ext.rs:206-231 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×5
Edited copy of a member (22 corresponding lines) crates/syntax/src/syntax_editor/edits.rs:213— crates/syntax/src/syntax_editor/edits.rs:213-242 | crates/syntax/src/syntax_editor/edits.rs:372-393 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) crates/rust-analyzer/src/handlers/request.rs:1998— crates/rust-analyzer/src/handlers/request.rs:1998-2023 | crates/rust-analyzer/src/handlers/request.rs:2070-2091 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) crates/rust-analyzer/src/config.rs:3650— crates/rust-analyzer/src/config.rs:3650-3671 | crates/rust-analyzer/src/config.rs:3678-3699 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) xtask/src/publish/notes.rs:202— xtask/src/publish/notes.rs:202-224 | xtask/src/publish/notes.rs:226-247 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) lib/smol_str/src/lib.rs:1052— lib/smol_str/src/lib.rs:1052-1073 | lib/smol_str/src/lib.rs:1076-1100 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×5
Edited copy of a member (23 corresponding lines) crates/hir-expand/src/builtin/derive_macro.rs:459— crates/hir-expand/src/builtin/derive_macro.rs:459-483 | crates/hir-expand/src/builtin/derive_macro.rs:616-638 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) crates/base-db/src/lib.rs:406— crates/base-db/src/lib.rs:406-431 | crates/stdx/src/panic_context.rs:18-40 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) crates/ide-completion/src/render/pattern.rs:179— crates/ide-completion/src/render/pattern.rs:179-201 | crates/ide-completion/src/render/pattern.rs:208-230 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) crates/hir-ty/src/infer/place_op.rs:194— crates/hir-ty/src/infer/place_op.rs:194-216 | crates/hir-ty/src/infer/place_op.rs:224-249 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) crates/ide/src/inlay_hints/param_name.rs:191— crates/ide/src/inlay_hints/param_name.rs:191-223 | crates/ide/src/inlay_hints/param_name.rs:232-254 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (5 corresponding lines) · ×5
Edited copy of a member (5 corresponding lines) crates/hir/src/lib.rs:4776— crates/hir/src/lib.rs:4776-4780 | crates/hir/src/lib.rs:5123-5128 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) crates/hir/src/lib.rs:711— crates/hir/src/lib.rs:711-719 | crates/hir/src/lib.rs:721-725 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) crates/hir/src/semantics.rs:1648— crates/hir/src/semantics.rs:1648-1652 | crates/syntax/src/algo.rs:18-22 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) crates/hir-def/src/visibility.rs:370— crates/hir-def/src/visibility.rs:370-374 | crates/hir/src/lib.rs:944-948 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) crates/intern/src/intern.rs:267— crates/intern/src/intern.rs:267-271 | crates/intern/src/intern_slice.rs:227-231 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (12–13 lines × 2) crates/ide-assists/src/handlers/convert_bool_to_enum.rs:234— crates/ide-assists/src/handlers/convert_bool_to_enum.rs:234-245 | crates/ide-assists/src/handlers/convert_bool_to_enum.rs:274-286 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/convert_bool_to_enum.rs:274` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 2) crates/ide-assists/src/handlers/generate_default_from_new.rs:106— crates/ide-assists/src/handlers/generate_default_from_new.rs:106-117 | crates/ide-assists/src/utils.rs:655-667 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/generate_default_from_new.rs:106` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 2) crates/ide-completion/src/completions/snippet.rs:17— crates/ide-completion/src/completions/snippet.rs:17-29 | crates/ide-completion/src/completions/snippet.rs:57-68 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/completions/snippet.rs:17` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 2) crates/ide-db/src/syntax_helpers/node_ext.rs:47— crates/ide-db/src/syntax_helpers/node_ext.rs:47-59 | crates/ide-db/src/syntax_helpers/node_ext.rs:146-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-db/src/syntax_helpers/node_ext.rs:47` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–13 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:157— crates/rust-analyzer/src/cli/analysis_stats.rs:157-168 | crates/rust-analyzer/src/cli/analysis_stats.rs:170-182 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/cli/analysis_stats.rs:170` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10–11 lines × 2) crates/hir/src/lib.rs:4227— crates/hir/src/lib.rs:4227-4236 | crates/hir/src/lib.rs:4261-4271 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/lib.rs:4227` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) crates/hir/src/term_search/tactics.rs:53— crates/hir/src/term_search/tactics.rs:53-62 | crates/hir/src/term_search/tactics.rs:102-112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/term_search/tactics.rs:53` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) crates/ide-assists/src/utils/gen_trait_fn_body.rs:662— crates/ide-assists/src/utils/gen_trait_fn_body.rs:662-672 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:682-691 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/utils/gen_trait_fn_body.rs:662` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) crates/ide/src/inlay_hints.rs:103— crates/ide/src/inlay_hints.rs:103-112 | crates/ide/src/inlay_hints.rs:150-160 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide/src/inlay_hints.rs:103` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) crates/syntax/src/ast/edit.rs:91— crates/syntax/src/ast/edit.rs:91-100 | crates/syntax/src/ast/edit.rs:108-118 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/edit.rs:91` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 3) crates/ide-assists/src/handlers/apply_demorgan.rs:230— crates/ide-assists/src/handlers/apply_demorgan.rs:230-237 | crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs:270-277 | crates/ide-assists/src/handlers/unwrap_return_type.rs:74-81 — before extracting anything, compare `crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs` and `crates/ide-assists/src/handlers/unwrap_return_type.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 3) crates/ide-db/src/search.rs:1247— crates/ide-db/src/search.rs:1247-1254 | crates/ide-db/src/search.rs:1263-1270 | crates/ide-db/src/search.rs:1275-1282 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8 lines × 3) crates/ide/src/syntax_highlighting/highlight.rs:165— crates/ide/src/syntax_highlighting/highlight.rs:165-172 | crates/ide/src/syntax_highlighting/highlight.rs:182-189 | crates/ide/src/syntax_highlighting/highlight.rs:199-206 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide/src/syntax_highlighting/highlight.rs:165` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) crates/syntax/src/ast/syntax_factory/constructors.rs:166— crates/syntax/src/ast/syntax_factory/constructors.rs:166-173 | crates/syntax/src/ast/syntax_factory/constructors.rs:1484-1491 | crates/syntax/src/ast/syntax_factory/constructors.rs:1868-1875 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:166` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 3) crates/hir/src/lib.rs:2797— crates/hir/src/lib.rs:2797-2804 | crates/hir/src/lib.rs:2818-2825 | crates/ide-db/src/defs.rs:929-936 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Note first that the copies are not typed on the same thing: the declarations holding them bind `db` to `&dyn HirDatabase` in one and `&dyn hir::db::HirDatabase` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (6 lines × 3) crates/hir-def/src/visibility.rs:336— crates/hir-def/src/visibility.rs:336-341 | crates/hir-def/src/visibility.rs:343-348 | crates/hir-def/src/visibility.rs:350-355 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (6 lines × 3) crates/hir/src/semantics.rs:2308— crates/hir/src/semantics.rs:2308-2313 | crates/hir/src/semantics.rs:2315-2320 | crates/hir/src/semantics.rs:2322-2327 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (6 lines × 3) crates/syntax/src/ast/make.rs:492— crates/syntax/src/ast/make.rs:492-497 | crates/syntax/src/ast/make.rs:1008-1013 | crates/syntax/src/ast/make.rs:1308-1313 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/syntax/src/ast/syntax_factory/constructors.rs:181— crates/syntax/src/ast/syntax_factory/constructors.rs:181-187 | crates/syntax/src/ast/syntax_factory/constructors.rs:362-367 | crates/syntax/src/ast/syntax_factory/constructors.rs:2167-2172 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/syntax/src/ast/syntax_factory/constructors.rs:368` calls `map_node`, `syntax`, `clone` and `crates/syntax/src/ast/syntax_factory/constructors.rs:2173` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 3) crates/syntax/src/ast/syntax_factory/constructors.rs:181— crates/syntax/src/ast/syntax_factory/constructors.rs:181-186 | crates/syntax/src/ast/syntax_factory/constructors.rs:1817-1822 | crates/syntax/src/ast/syntax_factory/constructors.rs:1947-1952 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
AnalysisStats::run_inference (cyclomatic 49) crates/rust-analyzer/src/cli/analysis_stats.rs:774— AnalysisStats::run_inference has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AnalysisStats::run (cyclomatic 48) crates/rust-analyzer/src/cli/analysis_stats.rs:52— AnalysisStats::run has cyclomatic complexity 48 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
AnalysisStats::run_body_lowering (cyclomatic 31) crates/rust-analyzer/src/cli/analysis_stats.rs:1162— AnalysisStats::run_body_lowering has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AnalysisStats::run_term_search (cyclomatic 28) crates/rust-analyzer/src/cli/analysis_stats.rs:494— AnalysisStats::run_term_search has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DefCollector::resolve_macros (cyclomatic 31) crates/hir-def/src/nameres/collector.rs:1306— DefCollector::resolve_macros has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DefCollector::seed_with_top_level (cyclomatic 25) crates/hir-def/src/nameres/collector.rs:277— DefCollector::seed_with_top_level has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
DefCollector::record_resolved_import (cyclomatic 24) crates/hir-def/src/nameres/collector.rs:882— DefCollector::record_resolved_import has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DefCollector::push_res_and_update_glob_vis (cyclomatic 23) crates/hir-def/src/nameres/collector.rs:1202— DefCollector::push_res_and_update_glob_vis has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir::source_analyzer::resolve_hir_path_ (cyclomatic 25) crates/hir/src/source_analyzer.rs:1873— hir::source_analyzer::resolve_hir_path_ has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir::attrs::resolve_doc_path_on_ (cyclomatic 23) crates/hir/src/attrs.rs:316— hir::attrs::resolve_doc_path_on_ has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir::display::write_function (cyclomatic 23) crates/hir/src/display.rs:159— hir::display::write_function has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
hir::attrs::resolve_assoc_or_field (cyclomatic 21) crates/hir/src/attrs.rs:372— hir::attrs::resolve_assoc_or_field has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
AnalysisStats::run_inference (cognitive 134) crates/rust-analyzer/src/cli/analysis_stats.rs:774— AnalysisStats::run_inference has cognitive complexity 134 (threshold 15). Drivers by points: if/else 43 (115 pts), match/switch 4 (8 pts), boolean chains 6, loops 3 (5 pts) (nesting depth added 78). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnalysisStats::run (cognitive 81) crates/rust-analyzer/src/cli/analysis_stats.rs:52— AnalysisStats::run has cognitive complexity 81 (threshold 15). Drivers by points: if/else 25 (35 pts), match/switch 6 (22 pts), loops 8 (21 pts), boolean chains 3 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnalysisStats::run_term_search (cognitive 67) crates/rust-analyzer/src/cli/analysis_stats.rs:494— AnalysisStats::run_term_search has cognitive complexity 67 (threshold 15). Drivers by points: if/else 10 (31 pts), match/switch 9 (26 pts), loops 4 (8 pts), boolean chains 2 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnalysisStats::run_body_lowering (cognitive 50) crates/rust-analyzer/src/cli/analysis_stats.rs:1162— AnalysisStats::run_body_lowering has cognitive complexity 50 (threshold 15). Drivers by points: if/else 20 (37 pts), match/switch 4 (10 pts), loops 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
project_model::workspace::cargo_to_crate_graph (cognitive 72) crates/project-model/src/workspace.rs:1264— project_model::workspace::cargo_to_crate_graph has cognitive complexity 72 (threshold 15). Drivers by points: if/else 22 (55 pts), loops 7 (12 pts), boolean chains 5 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
project_model::workspace::handle_rustc_crates (cognitive 60) crates/project-model/src/workspace.rs:1536— project_model::workspace::handle_rustc_crates has cognitive complexity 60 (threshold 15). Drivers by points: if/else 11 (37 pts), loops 9 (23 pts) (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
project_model::env::cargo_config_env (cognitive 34) crates/project-model/src/env.rs:63— project_model::env::cargo_config_env has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (31 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
project_model::workspace::project_json_to_crate_graph (cognitive 27) crates/project-model/src/workspace.rs:1107— project_model::workspace::project_json_to_crate_graph has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 2 (4 pts), boolean chains 2, match/switch 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Resolver::resolve_path_in_value_ns_with_prefix_info (cognitive 61) crates/hir-def/src/resolver.rs:353— Resolver::resolve_path_in_value_ns_with_prefix_info has cognitive complexity 61 (threshold 15). Drivers by points: if/else 16 (41 pts), match/switch 5 (11 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Resolver::resolve_path_in_type_ns_with_prefix_info (cognitive 34) crates/hir-def/src/resolver.rs:183— Resolver::resolve_path_in_type_ns_with_prefix_info has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (23 pts), match/switch 4 (9 pts), boolean chains 1, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Resolver::rename_will_conflict_with_renamed (cognitive 24) crates/hir-def/src/resolver.rs:846— Resolver::rename_will_conflict_with_renamed has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Resolver::rename_will_conflict_with_another_variable (cognitive 22) crates/hir-def/src/resolver.rs:797— Resolver::rename_will_conflict_with_another_variable has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_diagnostics::handlers::unlinked_file::fixes (cognitive 37) crates/ide-diagnostics/src/handlers/unlinked_file.rs:77— ide_diagnostics::handlers::unlinked_file::fixes has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 4 (11 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_diagnostics::handlers::missing_fields::fixes (cognitive 29) crates/ide-diagnostics/src/handlers/missing_fields.rs:56— ide_diagnostics::handlers::missing_fields::fixes has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 2 (4 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ide_diagnostics::semantic_diagnostics (cognitive 26) crates/ide-diagnostics/src/lib.rs:377— ide_diagnostics::semantic_diagnostics has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 8 (18 pts), if/else 3 (4 pts), boolean chains 2, loops 2 (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ide_diagnostics::handlers::type_mismatch::add_missing_ok_or_some (cognitive 22) crates/ide-diagnostics/src/handlers/type_mismatch.rs:176— ide_diagnostics::handlers::type_mismatch::add_missing_ok_or_some has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkspaceBuildScripts::build_command (cognitive 35) crates/project-model/src/build_dependencies.rs:435— WorkspaceBuildScripts::build_command has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (28 pts), match/switch 3 (7 pts) (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
WorkspaceBuildScripts::rustc_crates (cognitive 25) crates/project-model/src/build_dependencies.rs:183— WorkspaceBuildScripts::rustc_crates has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 3 (9 pts), loops 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkspaceBuildScripts::run_command (cognitive 23) crates/project-model/src/build_dependencies.rs:328— WorkspaceBuildScripts::run_command has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 3 (7 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkspaceBuildScripts::run_once (cognitive 17) crates/project-model/src/build_dependencies.rs:100— WorkspaceBuildScripts::run_once has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
syntax::validation::validate_literal (cognitive 26) crates/syntax/src/validation.rs:124— syntax::validation::validate_literal has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 5, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
syntax::validation::validate_path_keywords (cognitive 18) crates/syntax/src/validation.rs:285— syntax::validation::validate_path_keywords has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to one function item inside it that branches (use_prefix). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
syntax::ast::prec::precedence (cognitive 16) crates/syntax/src/ast/prec.rs:73— syntax::ast::prec::precedence has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 6 (16 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
syntax::parsing::reparsing::reparse_token (cognitive 16) crates/syntax/src/parsing/reparsing.rs:46— syntax::parsing::reparsing::reparse_token has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 3, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ExprUseVisitor::cat_pattern (cognitive 23) crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:1496— ExprUseVisitor::cat_pattern has cognitive complexity 23 (threshold 15). Drivers by points: loops 7 (13 pts), match/switch 3 (6 pts), if/else 2 (4 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
ExprUseVisitor::walk_expr (cognitive 22) crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:502— ExprUseVisitor::walk_expr has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (6 pts), match/switch 2 (4 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ExprUseVisitor::walk_captures (cognitive 22) crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:1052— ExprUseVisitor::walk_captures has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (7 pts), match/switch 2 (7 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExprUseVisitor::walk_pat (cognitive 19) crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:879— ExprUseVisitor::walk_pat has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
xtask::codegen::lints::generate_descriptor_clippy (cognitive 20) xtask/src/codegen/lints.rs:433— xtask::codegen::lints::generate_descriptor_clippy has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3, match/switch 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
xtask::codegen::lints::generate_lint_descriptor (cognitive 19) xtask/src/codegen/lints.rs:151— xtask::codegen::lints::generate_lint_descriptor has cognitive complexity 19 (threshold 15). Drivers by points: loops 9, if/else 3 (6 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 4). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to one function item inside it that branches (insert_lints). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
xtask::publish::notes::process_inline_macros (cognitive 18) xtask/src/publish/notes.rs:437— xtask::publish::notes::process_inline_macros has cognitive complexity 18 (threshold 15). Drivers by points: loops 7 (15 pts), match/switch 2 (3 pts) (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
xtask::tidy::check_cargo_toml (cognitive 16) xtask/src/tidy.rs:83— xtask::tidy::check_cargo_toml has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Edited copy of a member (24 corresponding lines) · ×4
Edited copy of a member (24 corresponding lines) crates/hir/src/semantics/child_by_source.rs:58— crates/hir/src/semantics/child_by_source.rs:58-82 | crates/hir/src/semantics/child_by_source.rs:86-109 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) crates/hir-ty/src/infer/expr.rs:74— crates/hir-ty/src/infer/expr.rs:74-97 | crates/hir-ty/src/infer/expr.rs:289-314 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) crates/ide/src/syntax_highlighting/escape.rs:36— crates/ide/src/syntax_highlighting/escape.rs:36-61 | crates/ide/src/syntax_highlighting/escape.rs:67-90 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) crates/ide-db/src/use_trivial_constructor.rs:16— crates/ide-db/src/use_trivial_constructor.rs:16-39 | crates/ide-db/src/use_trivial_constructor.rs:47-70 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (11–12 lines × 2) crates/hir-def/src/signatures.rs:91— crates/hir-def/src/signatures.rs:91-102 | crates/hir-def/src/signatures.rs:179-189 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `id` to `StructId` in one and `UnionId` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/hir-def/src/signatures.rs:90` calls `source` and `crates/hir-def/src/signatures.rs:178` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11–12 lines × 2) crates/hir-def/src/signatures.rs:191— crates/hir-def/src/signatures.rs:191-201 | crates/hir-def/src/signatures.rs:267-278 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/signatures.rs:191` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `id` to `UnionId` in one and `EnumId` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (11–12 lines × 2) crates/hir-ty/src/lower.rs:1785— crates/hir-ty/src/lower.rs:1785-1796 | crates/hir-ty/src/lower.rs:2285-2295 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/lower.rs:2285` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11–12 lines × 2) crates/hir-ty/src/infer/expr.rs:734— crates/hir-ty/src/infer/expr.rs:734-744 | crates/hir-ty/src/infer/expr.rs:746-757 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/infer/expr.rs:734` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 4) crates/hir-ide/src/display.rs:849— crates/hir-ide/src/display.rs:849-856 | crates/hir-ide/src/display.rs:868-875 | crates/hir-ide/src/display.rs:1122-1129 | crates/hir-ide/src/display.rs:1141-1148 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ide/src/display.rs:849` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 4) crates/syntax/src/ast/syntax_factory/constructors.rs:353— crates/syntax/src/ast/syntax_factory/constructors.rs:353-360 | crates/syntax/src/ast/syntax_factory/constructors.rs:401-408 | crates/syntax/src/ast/syntax_factory/constructors.rs:1484-1491 | crates/syntax/src/ast/syntax_factory/constructors.rs:2158-2165 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:353` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 4) crates/syntax/src/ast/syntax_factory/constructors.rs:353— crates/syntax/src/ast/syntax_factory/constructors.rs:353-360 | crates/syntax/src/ast/syntax_factory/constructors.rs:401-408 | crates/syntax/src/ast/syntax_factory/constructors.rs:1800-1807 | crates/syntax/src/ast/syntax_factory/constructors.rs:2158-2165 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:353` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/syntax/src/ast/syntax_factory/constructors.rs:361` calls `map_children`, `attrs`, `syntax` and `crates/syntax/src/ast/syntax_factory/constructors.rs:1808` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 4) crates/syntax/src/ast/syntax_factory/constructors.rs:420— crates/syntax/src/ast/syntax_factory/constructors.rs:420-427 | crates/syntax/src/ast/syntax_factory/constructors.rs:1821-1829 | crates/syntax/src/ast/syntax_factory/constructors.rs:1951-1958 | crates/syntax/src/ast/syntax_factory/constructors.rs:2214-2221 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:420` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
MirLowerCtx::lower_expr_to_place_without_adjust (cyclomatic 131) crates/hir-ty/src/mir/lower.rs:370— MirLowerCtx::lower_expr_to_place_without_adjust has cyclomatic complexity 131 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MirLowerCtx::pattern_match_inner (cyclomatic 46) crates/hir-ty/src/mir/lower/pattern_matching.rs:117— MirLowerCtx::pattern_match_inner has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MirLowerCtx::lower_expr_as_place_without_adjust (cyclomatic 25) crates/hir-ty/src/mir/lower/as_place.rs:117— MirLowerCtx::lower_expr_as_place_without_adjust has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_ide::display::render_const_scalar_inner (cyclomatic 57) crates/hir-ide/src/display.rs:819— hir_ide::display::render_const_scalar_inner has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hir_ide::display::render_const_scalar_from_valtree_inner (cyclomatic 36) crates/hir-ide/src/display.rs:1094— hir_ide::display::render_const_scalar_from_valtree_inner has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hir_ide::display::write_bounds_like_dyn_trait (cyclomatic 36) crates/hir-ide/src/display.rs:2099— hir_ide::display::write_bounds_like_dyn_trait has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Definition::search_scope (cyclomatic 48) crates/ide-db/src/search.rs:290— Definition::search_scope has cyclomatic complexity 48 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Definition::label (cyclomatic 28) crates/ide-db/src/defs.rs:310— Definition::label has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Definition::range_for_rename (cyclomatic 27) crates/ide-db/src/rename.rs:136— Definition::range_for_rename has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ExprUseVisitor::walk_expr (cyclomatic 40) crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:502— ExprUseVisitor::walk_expr has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ExprUseVisitor::cat_pattern (cyclomatic 20) crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:1496— ExprUseVisitor::cat_pattern has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ExprUseVisitor::walk_pat (cyclomatic 19) crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:879— ExprUseVisitor::walk_pat has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
syntax_bridge::prettify_macro_expansion::prettify_macro_expansion (cyclomatic 40) crates/syntax-bridge/src/prettify_macro_expansion.rs:23— syntax_bridge::prettify_macro_expansion::prettify_macro_expansion has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
syntax_bridge::to_parser_input::to_parser_input (cyclomatic 32) crates/syntax-bridge/src/to_parser_input.rs:8— syntax_bridge::to_parser_input::to_parser_input 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.
syntax_bridge::convert_tokens (cyclomatic 31) crates/syntax-bridge/src/lib.rs:208— syntax_bridge::convert_tokens has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
project_model::workspace::cargo_to_crate_graph (cyclomatic 31) crates/project-model/src/workspace.rs:1264— project_model::workspace::cargo_to_crate_graph has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
project_model::workspace::handle_rustc_crates (cyclomatic 20) crates/project-model/src/workspace.rs:1536— project_model::workspace::handle_rustc_crates has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
project_model::workspace::project_json_to_crate_graph (cyclomatic 16) crates/project-model/src/workspace.rs:1107— project_model::workspace::project_json_to_crate_graph has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Expr::gen_source_code (cyclomatic 27) crates/hir/src/term_search/expr.rs:102— Expr::gen_source_code has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Expr::needs_parens_in_expr (cyclomatic 24) crates/syntax/src/ast/prec.rs:199— Expr::needs_parens_in_expr has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Expr::binding_power (cyclomatic 19) crates/syntax/src/ast/prec.rs:334— Expr::binding_power has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Expr::is_ordered_before_parent_in_place_of::order (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
Repeated repair: crates/stdx/src/tempfile.rs crates/stdx/src/tempfile.rs:82— crates/stdx/src/tempfile.rs changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is stdx::tempfile::general_imp::create at line 82), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “Fix flaky `NamedTempFile` test”; “Fix flaky CI test `named_temp_file_new_creates_file`”; “Fix NamedTempFile issues on windows”; “Fix `NamedTempFile`”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/stdx/src/tempfile.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/ide-diagnostics/src/handlers/type_mismatch.rs crates/ide-diagnostics/src/handlers/type_mismatch.rs:22— crates/ide-diagnostics/src/handlers/type_mismatch.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is ide_diagnostics::handlers::type_mismatch::type_mismatch at line 22), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: emit assoc item bound only with generics on builtin derive”; “Fix TypeMismatch quickfix position error”; “Fix `hir::Type` owner mismatches between anon consts”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/ide-diagnostics/src/handlers/type_mismatch.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/ide-completion/src/completions/mod_.rs crates/ide-completion/src/completions/mod_.rs:15— crates/ide-completion/src/completions/mod_.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is ide_completion::completions::mod_::complete_mod at line 15), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: complete 'main' 'lib' module in sub module”; “fix: dedup raw-ident module name”; “fix: escape keyword module name completions”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 06:30:58 +00:00' --until='2026-11-13 06:30:58 +00:00' --full-history --no-merges -- crates/ide-completion/src/completions/mod_.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
hir_ide::display::render_const_scalar_inner (cognitive 87) crates/hir-ide/src/display.rs:819— hir_ide::display::render_const_scalar_inner has cognitive complexity 87 (threshold 15). Drivers by points: if/else 27 (67 pts), match/switch 6 (13 pts), loops 3 (7 pts) (nesting depth added 51). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hir_ide::display::write_bounds_like_dyn_trait (cognitive 77) crates/hir-ide/src/display.rs:2099— hir_ide::display::write_bounds_like_dyn_trait has cognitive complexity 77 (threshold 15). Drivers by points: if/else 26 (69 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hir_ide::display::render_const_scalar_from_valtree_inner (cognitive 35) crates/hir-ide/src/display.rs:1094— hir_ide::display::render_const_scalar_from_valtree_inner has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (26 pts), match/switch 3 (5 pts), loops 2 (4 pts) (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SemanticsImpl::descend_into_macros_impl (cognitive 78) crates/hir/src/semantics.rs:1237— SemanticsImpl::descend_into_macros_impl has cognitive complexity 78 (threshold 15). Drivers by points: if/else 10 (41 pts), match/switch 6 (20 pts), loops 5 (16 pts), boolean chains 1 (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SemanticsImpl::analyze_impl (cognitive 16) crates/hir/src/semantics.rs:2283— SemanticsImpl::analyze_impl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 1 (nesting depth added 5). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SemanticsImpl::locals_used (cognitive 16) crates/hir/src/semantics.rs:2459— SemanticsImpl::locals_used has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 3 (4 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
syntax_bridge::convert_tokens (cognitive 51) crates/syntax-bridge/src/lib.rs:208— syntax_bridge::convert_tokens has cognitive complexity 51 (threshold 15). Drivers by points: match/switch 8 (24 pts), if/else 4 (15 pts), loops 4 (11 pts), boolean chains 1 (nesting depth added 34). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
syntax_bridge::to_parser_input::to_parser_input (cognitive 50) crates/syntax-bridge/src/to_parser_input.rs:8— syntax_bridge::to_parser_input::to_parser_input has cognitive complexity 50 (threshold 15). Drivers by points: match/switch 9 (31 pts), if/else 5 (16 pts), boolean chains 2, loops 1 (nesting depth added 33). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
syntax_bridge::prettify_macro_expansion::prettify_macro_expansion (cognitive 41) crates/syntax-bridge/src/prettify_macro_expansion.rs:23— syntax_bridge::prettify_macro_expansion::prettify_macro_expansion has cognitive complexity 41 (threshold 15). Drivers by points: if/else 7 (19 pts), match/switch 5 (12 pts), boolean chains 7, loops 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Module::get_usages_and_record_fields (cognitive 47) crates/ide-assists/src/handlers/extract_module.rs:276— Module::get_usages_and_record_fields has cognitive complexity 47 (threshold 15). Drivers by points: if/else 10 (34 pts), match/switch 3 (12 pts), 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.
Module::process_def_in_sel (cognitive 39) crates/ide-assists/src/handlers/extract_module.rs:551— Module::process_def_in_sel has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 11, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Module::expand_and_group_usages_file_wise (cognitive 18) crates/ide-assists/src/handlers/extract_module.rs:375— Module::expand_and_group_usages_file_wise has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModCollector::collect (cognitive 42) crates/hir-def/src/nameres/collector.rs:1898— ModCollector::collect has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (28 pts), match/switch 5 (8 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModCollector::collect_macro_def (cognitive 19) crates/hir-def/src/nameres/collector.rs:2599— ModCollector::collect_macro_def has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModCollector::collect_macro_rules (cognitive 16) crates/hir-def/src/nameres/collector.rs:2517— ModCollector::collect_macro_rules has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 4 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×3
Edited copy of a member (29 corresponding lines) crates/proc-macro-srv/src/token_stream.rs:697— crates/proc-macro-srv/src/token_stream.rs:697-731 | crates/tt/src/lib.rs:435-484 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) crates/hir/src/lib.rs:4218— crates/hir/src/lib.rs:4218-4246 | crates/hir/src/lib.rs:4248-4282 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) crates/span/src/map.rs:155— crates/span/src/map.rs:155-183 | crates/syntax/src/lib.rs:211-239 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (33 corresponding lines) · ×3
Edited copy of a member (33 corresponding lines) crates/hir-ty/src/consteval.rs:209— crates/hir-ty/src/consteval.rs:209-241 | crates/hir-ty/src/consteval.rs:247-279 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (33 corresponding lines) crates/rust-analyzer/src/handlers/request.rs:1922— crates/rust-analyzer/src/handlers/request.rs:1922-1956 | crates/rust-analyzer/src/handlers/request.rs:1961-1993 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (33 corresponding lines) crates/hir-ty/src/layout/adt.rs:123— crates/hir-ty/src/layout/adt.rs:123-155 | crates/hir-ty/src/next_solver/util.rs:180-215 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 11+ corresponding lines) · ×3
Edited copies of one member (4 members, 11+ corresponding lines) crates/hir/src/source_analyzer.rs:1512— crates/hir/src/source_analyzer.rs:1512-1522 | crates/hir/src/source_analyzer.rs:1528-1539 | crates/hir/src/source_analyzer.rs:1545-1556 | crates/hir/src/source_analyzer.rs:1562-1573 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 11+ corresponding lines) crates/base-db/src/lib.rs:89— crates/base-db/src/lib.rs:89-99 | crates/base-db/src/lib.rs:107-118 | crates/base-db/src/lib.rs:138-149 | crates/base-db/src/lib.rs:183-198 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 11+ corresponding lines) crates/rust-analyzer/src/lsp/to_proto.rs:1109— crates/rust-analyzer/src/lsp/to_proto.rs:1109-1119 | crates/rust-analyzer/src/lsp/to_proto.rs:1125-1135 | crates/rust-analyzer/src/lsp/to_proto.rs:1141-1151 | crates/rust-analyzer/src/lsp/to_proto.rs:1157-1167 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 12+ corresponding lines) · ×3
Edited copies of one member (4 members, 12+ corresponding lines) crates/rust-analyzer/src/handlers/request.rs:447— crates/rust-analyzer/src/handlers/request.rs:447-462 | crates/rust-analyzer/src/handlers/request.rs:841-853 | crates/rust-analyzer/src/handlers/request.rs:901-913 | crates/rust-analyzer/src/handlers/request.rs:918-929 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 12+ corresponding lines) crates/parser/src/grammar.rs:128— crates/parser/src/grammar.rs:128-139 | crates/parser/src/grammar.rs:141-152 | crates/parser/src/grammar.rs:154-165 | crates/parser/src/grammar.rs:167-178 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 12+ corresponding lines) crates/ide-diagnostics/src/handlers/cannot_be_dereferenced.rs:12— crates/ide-diagnostics/src/handlers/cannot_be_dereferenced.rs:12-23 | crates/ide-diagnostics/src/handlers/cannot_implicitly_deref_trait_object.rs:12-23 | crates/ide-diagnostics/src/handlers/cannot_index_into.rs:12-23 | crates/ide-diagnostics/src/handlers/expected_array_or_slice_pat.rs:12-23 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 8+ corresponding lines) · ×3
Edited copies of one member (3 members, 8+ corresponding lines) crates/hir/src/lib.rs:1453— crates/hir/src/lib.rs:1453-1460 | crates/hir/src/lib.rs:1463-1470 | crates/hir/src/lib.rs:1473-1480 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) crates/hir/src/lib.rs:1317— crates/hir/src/lib.rs:1317-1324 | crates/hir/src/lib.rs:2118-2125 | crates/hir/src/lib.rs:2199-2206 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) crates/test-fixture/src/lib.rs:146— crates/test-fixture/src/lib.rs:146-153 | crates/test-fixture/src/lib.rs:159-170 | crates/test-fixture/src/lib.rs:216-226 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (18 lines × 2) crates/hir-def/src/expr_store/lower.rs:107— crates/hir-def/src/expr_store/lower.rs:107-124 | crates/hir-def/src/expr_store/lower.rs:142-159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) crates/hir-ty/src/mir/eval.rs:1435— crates/hir-ty/src/mir/eval.rs:1435-1452 | crates/hir-ty/src/mir/eval.rs:1473-1490 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) crates/syntax/src/ast/syntax_factory/constructors.rs:369— crates/syntax/src/ast/syntax_factory/constructors.rs:369-386 | crates/syntax/src/ast/syntax_factory/constructors.rs:2173-2190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:369` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/syntax/src/ast/syntax_factory/constructors.rs:368` calls `map_node`, `syntax`, `clone` and `crates/syntax/src/ast/syntax_factory/constructors.rs:2172` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–14 lines × 2) crates/hir/src/lib.rs:5441— crates/hir/src/lib.rs:5441-5454 | crates/hir/src/lib.rs:5550-5562 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/lib.rs:5441` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13–14 lines × 2) crates/ide-completion/src/completions/flyimport.rs:263— crates/ide-completion/src/completions/flyimport.rs:263-276 | crates/ide-completion/src/completions/flyimport.rs:316-328 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/completions/flyimport.rs:263` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/ide-completion/src/completions/flyimport.rs:278` calls `filter`, `filter_excluded_flyimport` and `crates/ide-completion/src/completions/flyimport.rs:330` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–14 lines × 2) crates/proc-macro-srv-cli/src/main_loop.rs:304— crates/proc-macro-srv-cli/src/main_loop.rs:304-317 | crates/proc-macro-srv-cli/src/main_loop.rs:337-349 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–11 lines × 2) crates/hir-def/src/expr_store/lower.rs:2562— crates/hir-def/src/expr_store/lower.rs:2562-2572 | crates/hir-def/src/expr_store/lower.rs:2578-2586 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/expr_store/lower.rs:2562` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–11 lines × 2) crates/hir/src/diagnostics.rs:1793— crates/hir/src/diagnostics.rs:1793-1803 | crates/hir/src/diagnostics.rs:1817-1825 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/diagnostics.rs:1793` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–11 lines × 2) crates/ide-assists/src/handlers/generate_impl.rs:121— crates/ide-assists/src/handlers/generate_impl.rs:121-129 | crates/ide-assists/src/handlers/generate_impl.rs:236-246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/generate_impl.rs:121` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `crates/ide-assists/src/handlers/generate_impl.rs:121` is reached only past a guard at line 101 that tests `ctx.find_node_at_offset` and leaves the function early, and `crates/ide-assists/src/handlers/generate_impl.rs:236` reads `ctx.find_node_at_offset` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
Duplicated block (8–10 lines × 2) crates/ide-assists/src/handlers/generate_enum_is_method.rs:47— crates/ide-assists/src/handlers/generate_enum_is_method.rs:47-54 | crates/ide-assists/src/handlers/generate_enum_projection_method.rs:124-133 — before extracting anything, compare `crates/ide-assists/src/handlers/generate_enum_is_method.rs` and `crates/ide-assists/src/handlers/generate_enum_projection_method.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8–10 lines × 2) crates/ide-completion/src/completions/dot.rs:46— crates/ide-completion/src/completions/dot.rs:46-55 | crates/ide-completion/src/completions/dot.rs:108-115 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/completions/dot.rs:46` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8–10 lines × 2) crates/proc-macro-srv/src/dylib/proc_macros.rs:38— crates/proc-macro-srv/src/dylib/proc_macros.rs:38-47 | crates/proc-macro-srv/src/dylib/proc_macros.rs:49-56 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (9–10 lines × 2) crates/ide-assists/src/utils/gen_trait_fn_body.rs:126— crates/ide-assists/src/utils/gen_trait_fn_body.rs:126-135 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:330-338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/utils/gen_trait_fn_body.rs:126` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9–10 lines × 2) crates/ide/src/rename.rs:682— crates/ide/src/rename.rs:682-690 | crates/ide/src/rename.rs:695-704 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (9–10 lines × 2) crates/rust-analyzer/src/cli/lsif.rs:310— crates/rust-analyzer/src/cli/lsif.rs:310-318 | crates/rust-analyzer/src/cli/scip.rs:64-73 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/cli/scip.rs:64` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 2) crates/hir-def/src/attrs.rs:1289— crates/hir-def/src/attrs.rs:1289-1297 | crates/hir-def/src/attrs.rs:1310-1317 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/attrs.rs:1289` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8–9 lines × 2) crates/ide-assists/src/handlers/convert_closure_to_fn.rs:428— crates/ide-assists/src/handlers/convert_closure_to_fn.rs:428-436 | crates/ide-assists/src/handlers/convert_closure_to_fn.rs:438-445 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) crates/rust-analyzer/src/config.rs:2467— crates/rust-analyzer/src/config.rs:2467-2475 | crates/rust-analyzer/src/config.rs:2478-2485 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/config.rs:2467` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) crates/hir-ty/src/next_solver/util.rs:646— crates/hir-ty/src/next_solver/util.rs:646-655 | crates/hir-ty/src/next_solver/util.rs:674-683 | crates/hir-ty/src/next_solver/util.rs:705-714 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/next_solver/util.rs:646` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) crates/syntax/src/ast/expr_ext.rs:76— crates/syntax/src/ast/expr_ext.rs:76-85 | crates/syntax/src/ast/node_ext.rs:1147-1156 | crates/syntax/src/ast/node_ext.rs:1169-1178 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (10 lines × 3) crates/hir-ide/src/display.rs:1769— crates/hir-ide/src/display.rs:1769-1778 | crates/hir-ide/src/display.rs:1793-1802 | crates/hir-ide/src/display.rs:1817-1826 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ide/src/display.rs:1769` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/hir-ide/src/display.rs:1828` calls `async_gen_item_ty_from_yield_ty`, `lang_items`, `unwrap_or` and `crates/hir-ide/src/display.rs:1780` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 3) crates/ide-assists/src/handlers/expand_rest_pattern.rs:129— crates/ide-assists/src/handlers/expand_rest_pattern.rs:129-134 | crates/ide-assists/src/handlers/expand_rest_pattern.rs:191-195 | crates/ide-assists/src/handlers/expand_rest_pattern.rs:252-257 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/expand_rest_pattern.rs:129` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) crates/hir-def/src/expr_store/body.rs:111— crates/hir-def/src/expr_store/body.rs:111-115 | crates/hir-def/src/expr_store/body.rs:117-121 | crates/hir-def/src/expr_store/body.rs:122-126 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/expr_store/body.rs:122` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 3) crates/ide-assists/src/utils/gen_trait_fn_body.rs:120— crates/ide-assists/src/utils/gen_trait_fn_body.rs:120-124 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:384-388 | crates/ide-assists/src/utils/gen_trait_fn_body.rs:655-659 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/utils/gen_trait_fn_body.rs:120` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
ide_diagnostics::semantic_diagnostics (cyclomatic 95) crates/ide-diagnostics/src/lib.rs:377— ide_diagnostics::semantic_diagnostics has cyclomatic complexity 95 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ide_diagnostics::handlers::unlinked_file::fixes (cyclomatic 18) crates/ide-diagnostics/src/handlers/unlinked_file.rs:77— ide_diagnostics::handlers::unlinked_file::fixes has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AnyDiagnostic::inference_diagnostic (cyclomatic 66) crates/hir/src/diagnostics.rs:1578— AnyDiagnostic::inference_diagnostic 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.
AnyDiagnostic::body_validation_diagnostic (cyclomatic 20) crates/hir/src/diagnostics.rs:1446— AnyDiagnostic::body_validation_diagnostic has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Converter::extend_token (cyclomatic 53) crates/parser/src/lexed_str.rs:206— Converter::extend_token has cyclomatic complexity 53 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Converter::extend_literal (cyclomatic 25) crates/parser/src/lexed_str.rs:343— Converter::extend_literal has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: parser::lexed_str::err_to_msg (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
Resolver::resolve_path_in_value_ns_with_prefix_info (cyclomatic 41) crates/hir-def/src/resolver.rs:353— Resolver::resolve_path_in_value_ns_with_prefix_info has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Resolver::resolve_path_in_type_ns_with_prefix_info (cyclomatic 22) crates/hir-def/src/resolver.rs:183— Resolver::resolve_path_in_type_ns_with_prefix_info has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FindUsages::search (cyclomatic 39) crates/ide-db/src/search.rs:929— FindUsages::search has cyclomatic complexity 39 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
FindUsages::short_associated_function_fast_search::collect_possible_aliases (cyclomatic 24) crates/ide-db/src/search.rs:654— FindUsages::short_associated_function_fast_search::collect_possible_aliases has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tt::storage::encode (cyclomatic 29) crates/tt/src/storage.rs:332— tt::storage::encode 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.
tt::storage::decode (cyclomatic 26) crates/tt/src/storage.rs:831— tt::storage::decode 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.
Reader::read_tokenstream (cyclomatic 28) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:871— Reader::read_tokenstream 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.
Reader::read_subtree (cyclomatic 22) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:759— Reader::read_subtree has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ItemScope::push_res_with_import (cyclomatic 27) crates/hir-def/src/item_scope.rs:585— ItemScope::push_res_with_import has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ItemScope::dump (cyclomatic 20) crates/hir-def/src/item_scope.rs:751— ItemScope::dump has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Module::process_def_in_sel (cyclomatic 27) crates/ide-assists/src/handlers/extract_module.rs:551— Module::process_def_in_sel has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Module::get_usages_and_record_fields (cyclomatic 23) crates/ide-assists/src/handlers/extract_module.rs:276— Module::get_usages_and_record_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.
TyLoweringContext::lower_dyn_trait (cyclomatic 26) crates/hir-ty/src/lower.rs:1034— TyLoweringContext::lower_dyn_trait 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.
TyLoweringContext::lower_ty_ext (cyclomatic 22) crates/hir-ty/src/lower.rs:593— TyLoweringContext::lower_ty_ext has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Config::apply_change_with_sink (cyclomatic 21) crates/rust-analyzer/src/config.rs:1209— Config::apply_change_with_sink has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rust_analyzer::config::field_props (cyclomatic 49) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
Config::inlay_hints (cyclomatic 20) crates/rust-analyzer/src/config.rs:2087— Config::inlay_hints 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. This is NOT this file's highest cyclomatic complexity: rust_analyzer::config::field_props (cyclomatic 49) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
FlycheckActor::run (cyclomatic 21) crates/rust-analyzer/src/flycheck.rs:579— FlycheckActor::run has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FlycheckActor::check_command (cyclomatic 16) crates/rust-analyzer/src/flycheck.rs:884— FlycheckActor::check_command has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
syntax::validation::validate_literal (cyclomatic 20) crates/syntax/src/validation.rs:124— syntax::validation::validate_literal has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: syntax::validation::rustc_unescape_error_to_string (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
syntax::ast::prec::precedence (cyclomatic 19) crates/syntax/src/ast/prec.rs:73— syntax::ast::prec::precedence has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Expr::is_ordered_before_parent_in_place_of::order (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
Writer::subtree (cyclomatic 19) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:504— Writer::subtree has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Writer::group (cyclomatic 19) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:647— Writer::group has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
PathLoweringContext::substs_from_args_and_bindings (cyclomatic 17) crates/hir-ty/src/lower/path.rs:682— PathLoweringContext::substs_from_args_and_bindings has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
PathLoweringContext::resolve_path_in_value_ns (cyclomatic 16) crates/hir-ty/src/lower/path.rs:383— PathLoweringContext::resolve_path_in_value_ns has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
WorkspaceBuildScripts::run_command (cyclomatic 16) crates/project-model/src/build_dependencies.rs:328— WorkspaceBuildScripts::run_command has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WorkspaceBuildScripts::build_command (cyclomatic 16) crates/project-model/src/build_dependencies.rs:435— WorkspaceBuildScripts::build_command has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
xtask::codegen::lints::generate_lint_descriptor (cyclomatic 16) xtask/src/codegen/lints.rs:151— xtask::codegen::lints::generate_lint_descriptor has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
xtask::publish::notes::get_next_line_component (cyclomatic 16) xtask/src/publish/notes.rs:479— xtask::publish::notes::get_next_line_component has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
SourceAnalyzer::resolve_path (cognitive 99) crates/hir/src/source_analyzer.rs:1158— SourceAnalyzer::resolve_path has cognitive complexity 99 (threshold 15). Drivers by points: if/else 30 (67 pts), match/switch 8 (23 pts), loops 1 (6 pts), boolean chains 3 (nesting depth added 57). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SourceAnalyzer::resolve_offset_of_field (cognitive 16) crates/hir/src/source_analyzer.rs:1084— SourceAnalyzer::resolve_offset_of_field has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 4 (11 pts), if/else 2 (4 pts), loops 1 (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
FindUsages::search (cognitive 98) crates/ide-db/src/search.rs:929— FindUsages::search has cognitive complexity 98 (threshold 15). Drivers by points: if/else 16 (44 pts), loops 12 (36 pts), match/switch 8 (17 pts), boolean chains 1 (nesting depth added 61). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FindUsages::short_associated_function_fast_search::collect_possible_aliases (cognitive 97) crates/ide-db/src/search.rs:654— FindUsages::short_associated_function_fast_search::collect_possible_aliases has cognitive complexity 97 (threshold 15). Drivers by points: if/else 15 (73 pts), loops 6 (20 pts), boolean chains 4 (nesting depth added 72). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NotifyActor::run (cognitive 63) crates/vfs-notify/src/lib.rs:99— NotifyActor::run has cognitive complexity 63 (threshold 15). Drivers by points: if/else 9 (36 pts), loops 4 (13 pts), match/switch 3 (10 pts), boolean chains 4 (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NotifyActor::load_entry (cognitive 24) crates/vfs-notify/src/lib.rs:280— NotifyActor::load_entry has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 5, loops 1 (2 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FlycheckActor::run (cognitive 56) crates/rust-analyzer/src/flycheck.rs:579— FlycheckActor::run has cognitive complexity 56 (threshold 15). Drivers by points: if/else 9 (28 pts), match/switch 6 (19 pts), loops 3 (9 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FlycheckActor::check_command (cognitive 25) crates/rust-analyzer/src/flycheck.rs:884— FlycheckActor::check_command has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 5 (10 pts), boolean chains 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ItemScope::push_res_with_import (cognitive 51) crates/hir-def/src/item_scope.rs:585— ItemScope::push_res_with_import has cognitive complexity 51 (threshold 15). Drivers by points: if/else 12 (32 pts), match/switch 7 (14 pts), boolean chains 5 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ItemScope::dump (cognitive 24) crates/hir-def/src/item_scope.rs:751— ItemScope::dump has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 4 (9 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TyLoweringContext::lower_dyn_trait (cognitive 49) crates/hir-ty/src/lower.rs:1034— TyLoweringContext::lower_dyn_trait has cognitive complexity 49 (threshold 15). Drivers by points: if/else 15 (30 pts), match/switch 5 (13 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TyLoweringContext::lower_ty_ext (cognitive 20) crates/hir-ty/src/lower.rs:593— TyLoweringContext::lower_ty_ext has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 4 (10 pts), if/else 3 (9 pts), boolean chains 1 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Converter::extend_literal (cognitive 41) crates/parser/src/lexed_str.rs:343— Converter::extend_literal has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20 (40 pts), match/switch 1 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Converter::next_token (cognitive 21) crates/syntax-bridge/src/lib.rs:663— Converter::next_token has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 2 (6 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefMap::resolve_remaining_segments (cognitive 35) crates/hir-def/src/nameres/path_resolution.rs:448— DefMap::resolve_remaining_segments has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 5 (14 pts), loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefMap::resolve_path_fp_with_macro_single (cognitive 22) crates/hir-def/src/nameres/path_resolution.rs:242— DefMap::resolve_path_fp_with_macro_single has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 4 (6 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Reader::read_tokenstream (cognitive 35) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:871— Reader::read_tokenstream has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (23 pts), match/switch 4 (11 pts), 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.
Reader::read_subtree (cognitive 33) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:759— Reader::read_subtree has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (22 pts), match/switch 2 (8 pts), loops 2 (3 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Definition::search_scope (cognitive 34) crates/ide-db/src/search.rs:290— Definition::search_scope has cognitive complexity 34 (threshold 15). Drivers by points: match/switch 15 (25 pts), if/else 8, boolean chains 1 (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Definition::range_for_rename (cognitive 18) crates/ide-db/src/rename.rs:136— Definition::range_for_rename has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 7 (15 pts), if/else 2 (3 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ProbeContext::consider_probe (cognitive 30) crates/hir-ty/src/method_resolution/probe.rs:1567— ProbeContext::consider_probe has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 5 (8 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProbeContext::collapse_candidates_to_subtrait_pick (cognitive 16) crates/hir-ty/src/method_resolution/probe.rs:1909— ProbeContext::collapse_candidates_to_subtrait_pick has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SolverContext::compute_goal_fast_path (cognitive 28) crates/hir-ty/src/next_solver/solver.rs:285— SolverContext::compute_goal_fast_path has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SolverContext::fetch_eligible_assoc_item (cognitive 19) crates/hir-ty/src/next_solver/solver.rs:176— SolverContext::fetch_eligible_assoc_item has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Generalizer::tys (cognitive 27) crates/hir-ty/src/next_solver/infer/relate/generalize.rs:434— Generalizer::tys has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 4 (10 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Generalizer::consts (cognitive 17) crates/hir-ty/src/next_solver/infer/relate/generalize.rs:592— Generalizer::consts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Writer::subtree (cognitive 27) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:504— Writer::subtree has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 3 (9 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Writer::group (cognitive 19) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:647— Writer::group has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tt::storage::encode (cognitive 27) crates/tt/src/storage.rs:332— tt::storage::encode has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 3 (7 pts), boolean chains 4 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
tt::transform_tt (cognitive 25) crates/tt/src/lib.rs:761— tt::transform_tt has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (6 pts), match/switch 2 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Coerce::coerce_from_fn_item (cognitive 25) crates/hir-ty/src/infer/coerce.rs:742— Coerce::coerce_from_fn_item has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (22 pts), boolean chains 2, match/switch 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Coerce::coerce_borrowed_pointer (cognitive 22) crates/hir-ty/src/infer/coerce.rs:350— Coerce::coerce_borrowed_pointer has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Expr::gen_source_code (cognitive 23) crates/hir/src/term_search/expr.rs:102— Expr::gen_source_code has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 8 (17 pts), if/else 3 (6 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Expr::needs_parens_in_expr (cognitive 20) crates/syntax/src/ast/prec.rs:199— Expr::needs_parens_in_expr has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 7, match/switch 2 (3 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Visibility::max (cognitive 22) crates/hir-def/src/visibility.rs:154— Visibility::max has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (Visibility::min) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Visibility::min (cognitive 22) crates/hir-def/src/visibility.rs:220— Visibility::min has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (Visibility::max) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AnyDiagnostic::body_validation_diagnostic (cognitive 21) crates/hir/src/diagnostics.rs:1446— AnyDiagnostic::body_validation_diagnostic has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 3 (5 pts), boolean chains 4 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
AnyDiagnostic::inference_diagnostic (cognitive 20) crates/hir/src/diagnostics.rs:1578— AnyDiagnostic::inference_diagnostic has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 11 (20 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
FetchMetadata::new (cognitive 21) crates/project-model/src/cargo_workspace.rs:623— FetchMetadata::new has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (17 pts), 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.
FetchMetadata::exec (cognitive 16) crates/project-model/src/cargo_workspace.rs:739— FetchMetadata::exec has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Docs::push_doc_lines (cognitive 16) crates/hir-def/src/attrs/docs.rs:263— Docs::push_doc_lines has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (3 pts), boolean chains 2, match/switch 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Docs::remove_indent (cognitive 16) crates/hir-def/src/attrs/docs.rs:346— Docs::remove_indent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities· Medium advisory (unsound) · ×2
REDACTED
REDACTED
D30 · Dependency Vulnerabilities· Medium vulnerability · ×2
D4 · Code Duplication· Edited copy of a member (45 corresponding lines) · ×2
Edited copy of a member (45 corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs:342— crates/syntax/src/ast/syntax_factory/constructors.rs:342-386 | crates/syntax/src/ast/syntax_factory/constructors.rs:1919-1970 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (45 corresponding lines) crates/hir/src/symbols.rs:491— crates/hir/src/symbols.rs:491-538 | crates/hir/src/symbols.rs:540-584 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (40 corresponding lines) · ×2
Edited copy of a member (40 corresponding lines) crates/ide-assists/src/handlers/expand_rest_pattern.rs:171— crates/ide-assists/src/handlers/expand_rest_pattern.rs:171-211 | crates/ide-assists/src/handlers/expand_rest_pattern.rs:233-272 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (40 corresponding lines) crates/ide-diagnostics/src/handlers/field_shorthand.rs:31— crates/ide-diagnostics/src/handlers/field_shorthand.rs:31-70 | crates/ide-diagnostics/src/handlers/field_shorthand.rs:77-116 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (39 corresponding lines) · ×2
Edited copy of a member (39 corresponding lines) crates/hir/src/lib.rs:3320— crates/hir/src/lib.rs:3320-3358 | crates/hir/src/lib.rs:3361-3399 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (39 corresponding lines) crates/proc-macro-api/src/bidirectional_protocol.rs:161— crates/proc-macro-api/src/bidirectional_protocol.rs:161-199 | crates/proc-macro-api/src/legacy_protocol.rs:86-142 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (36 corresponding lines) · ×2
Edited copy of a member (36 corresponding lines) crates/ide-assists/src/handlers/expand_glob_import.rs:44— crates/ide-assists/src/handlers/expand_glob_import.rs:44-79 | crates/ide-assists/src/handlers/expand_glob_import.rs:102-140 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (36 corresponding lines) crates/ide-assists/src/handlers/generate_getter_or_setter.rs:38— crates/ide-assists/src/handlers/generate_getter_or_setter.rs:38-75 | crates/ide-assists/src/handlers/generate_getter_or_setter.rs:180-215 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (46 corresponding lines) · ×2
Edited copy of a member (46 corresponding lines) crates/ide-assists/src/handlers/convert_comment_from_or_to_doc.rs:36— crates/ide-assists/src/handlers/convert_comment_from_or_to_doc.rs:36-81 | crates/ide-assists/src/handlers/convert_comment_from_or_to_doc.rs:83-137 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (46 corresponding lines) crates/ide-assists/src/handlers/convert_bool_to_enum.rs:348— crates/ide-assists/src/handlers/convert_bool_to_enum.rs:348-394 | crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs:184-229 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (35 corresponding lines) · ×2
Edited copy of a member (35 corresponding lines) crates/ide/src/runnables.rs:363— crates/ide/src/runnables.rs:363-397 | crates/ide/src/runnables.rs:453-488 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (35 corresponding lines) crates/cfg/src/lib.rs:201— crates/cfg/src/lib.rs:201-235 | crates/cfg/src/lib.rs:244-280 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (31 corresponding lines) · ×2
Edited copy of a member (31 corresponding lines) crates/hir-def/src/import_map.rs:459— crates/hir-def/src/import_map.rs:459-493 | crates/ide-db/src/symbol_index.rs:549-579 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) crates/ide-completion/src/completions/attribute/diagnostic.rs:14— crates/ide-completion/src/completions/attribute/diagnostic.rs:14-52 | crates/ide-completion/src/completions/attribute/repr.rs:12-42 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×2
Edited copy of a member (28 corresponding lines) crates/ide-assists/src/handlers/move_from_mod_rs.rs:23— crates/ide-assists/src/handlers/move_from_mod_rs.rs:23-50 | crates/ide-assists/src/handlers/move_to_mod_rs.rs:23-50 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) crates/hir-ty/src/next_solver/util.rs:669— crates/hir-ty/src/next_solver/util.rs:669-699 | crates/hir-ty/src/next_solver/util.rs:701-728 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×2
Edited copy of a member (27 corresponding lines) xtask/src/codegen/diagnostics_docs.rs:32— xtask/src/codegen/diagnostics_docs.rs:32-58 | xtask/src/codegen/feature_docs.rs:31-57 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) crates/ide-diagnostics/src/handlers/unresolved_field.rs:27— crates/ide-diagnostics/src/handlers/unresolved_field.rs:27-53 | crates/ide-diagnostics/src/handlers/unresolved_method.rs:22-50 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (34 corresponding lines) · ×2
Edited copy of a member (34 corresponding lines) crates/hir-def/src/signatures.rs:177— crates/hir-def/src/signatures.rs:177-210 | crates/hir-def/src/signatures.rs:253-287 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (34 corresponding lines) crates/ide-completion/src/completions/snippet.rs:16— crates/ide-completion/src/completions/snippet.rs:16-49 | crates/ide-completion/src/completions/snippet.rs:56-118 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 13+ corresponding lines) · ×2
Edited copies of one member (3 members, 13+ corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs:643— crates/syntax/src/ast/syntax_factory/constructors.rs:643-661 | crates/syntax/src/ast/syntax_factory/constructors.rs:1158-1170 | crates/syntax/src/ast/syntax_factory/constructors.rs:1280-1301 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 13+ corresponding lines) xtask/src/codegen/grammar.rs:742— xtask/src/codegen/grammar.rs:742-754 | xtask/src/codegen/grammar.rs:756-768 | xtask/src/codegen/grammar.rs:770-784 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 25+ corresponding lines) · ×2
Edited copies of one member (3 members, 25+ corresponding lines) crates/intern/src/intern.rs:48— crates/intern/src/intern.rs:48-72 | crates/intern/src/intern.rs:75-99 | crates/intern/src/intern_slice.rs:52-87 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 25+ corresponding lines) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:174— crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:174-198 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:292-316 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:323-347 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (21 corresponding lines) · ×2
Edited copy of a member (21 corresponding lines) crates/hir-ty/src/mir/eval.rs:2913— crates/hir-ty/src/mir/eval.rs:2913-2933 | crates/hir-ty/src/mir/lower.rs:1843-1863 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) crates/ide-assists/src/handlers/generate_enum_is_method.rs:107— crates/ide-assists/src/handlers/generate_enum_is_method.rs:107-127 | crates/ide-assists/src/handlers/generate_enum_projection_method.rs:186-208 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×2
Edited copy of a member (19 corresponding lines) crates/hir-def/src/attrs.rs:741— crates/hir-def/src/attrs.rs:741-762 | crates/hir-def/src/attrs.rs:1205-1223 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) crates/parser/src/grammar/expressions/atom.rs:772— crates/parser/src/grammar/expressions/atom.rs:772-801 | crates/parser/src/grammar/items/traits.rs:84-102 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 18+ corresponding lines) · ×2
Edited copies of one member (3 members, 18+ corresponding lines) crates/ide/src/navigation_target.rs:688— crates/ide/src/navigation_target.rs:688-705 | crates/ide/src/navigation_target.rs:760-777 | crates/ide/src/navigation_target.rs:784-809 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 18+ corresponding lines) crates/hir-ty/src/db.rs:379— crates/hir-ty/src/db.rs:379-396 | crates/hir-ty/src/db.rs:408-426 | crates/hir-ty/src/db.rs:438-455 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 14+ corresponding lines) · ×2
Edited copies of one member (3 members, 14+ corresponding lines) crates/hir/src/lib.rs:469— crates/hir/src/lib.rs:469-483 | crates/hir/src/lib.rs:486-499 | crates/hir/src/lib.rs:501-514 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 14+ corresponding lines) crates/stdx/src/thin_map.rs:919— crates/stdx/src/thin_map.rs:919-937 | crates/stdx/src/thin_map.rs:940-963 | crates/stdx/src/thin_map.rs:966-979 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 11+ corresponding lines) · ×2
Edited copies of one member (3 members, 11+ corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs:472— crates/syntax/src/ast/syntax_factory/constructors.rs:472-482 | crates/syntax/src/ast/syntax_factory/constructors.rs:1519-1529 | crates/syntax/src/ast/syntax_factory/constructors.rs:2358-2372 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) crates/hir-ty/src/builtin_derive.rs:467— crates/hir-ty/src/builtin_derive.rs:467-481 | crates/hir-ty/src/builtin_derive.rs:483-497 | crates/hir-ty/src/builtin_derive.rs:499-509 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 10+ corresponding lines) · ×2
Edited copies of one member (3 members, 10+ corresponding lines) crates/hir-ty/src/next_solver/consts.rs:54— crates/hir-ty/src/next_solver/consts.rs:54-63 | crates/hir-ty/src/next_solver/predicate.rs:201-215 | crates/hir-ty/src/next_solver/ty.rs:76-85 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) crates/hir/src/lib.rs:5722— crates/hir/src/lib.rs:5722-5731 | crates/hir/src/lib.rs:5737-5746 | crates/hir/src/lib.rs:5748-5757 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 9+ corresponding lines) · ×2
Edited copies of one member (3 members, 9+ corresponding lines) crates/hir/src/lib.rs:3751— crates/hir/src/lib.rs:3751-3761 | crates/hir/src/lib.rs:3770-3778 | crates/hir/src/lib.rs:3780-3788 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) crates/hir/src/attrs.rs:156— crates/hir/src/attrs.rs:156-165 | crates/hir/src/attrs.rs:168-176 | crates/hir/src/attrs.rs:197-205 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (24 lines × 2) crates/hir-ty/src/mir/eval/shim.rs:591— crates/hir-ty/src/mir/eval/shim.rs:591-614 | crates/hir-ty/src/mir/eval/shim.rs:663-686 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/mir/eval/shim.rs:591` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (24 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:932— crates/rust-analyzer/src/cli/analysis_stats.rs:932-955 | crates/rust-analyzer/src/cli/analysis_stats.rs:1037-1060 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/cli/analysis_stats.rs:932` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (23 lines × 2) crates/tt/src/storage.rs:886— crates/tt/src/storage.rs:886-908 | crates/tt/src/storage.rs:910-932 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/tt/src/storage.rs:886` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (23 lines × 2) crates/proc-macro-srv/src/token_stream.rs:194— crates/proc-macro-srv/src/token_stream.rs:194-216 | crates/proc-macro-srv/src/token_stream.rs:220-242 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/proc-macro-srv/src/token_stream.rs:194` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 3) crates/hir-ide/src/diagnostics/decl_check.rs:327— crates/hir-ide/src/diagnostics/decl_check.rs:327-348 | crates/hir-ide/src/diagnostics/decl_check.rs:417-438 | crates/hir-ide/src/diagnostics/decl_check.rs:578-599 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (22 lines × 3) crates/rust-analyzer/src/cli/analysis_stats.rs:855— crates/rust-analyzer/src/cli/analysis_stats.rs:855-876 | crates/rust-analyzer/src/cli/analysis_stats.rs:1197-1218 | crates/rust-analyzer/src/cli/analysis_stats.rs:1276-1297 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/cli/analysis_stats.rs:855` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/rust-analyzer/src/cli/analysis_stats.rs:1196` calls `Impl`, `source`, `syntax` and `crates/rust-analyzer/src/cli/analysis_stats.rs:854` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (20 lines × 2) crates/hir-def/src/resolver.rs:823— crates/hir-def/src/resolver.rs:823-842 | crates/hir-def/src/resolver.rs:873-892 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/resolver.rs:823` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) crates/rust-analyzer/src/cli/analysis_stats.rs:986— crates/rust-analyzer/src/cli/analysis_stats.rs:986-1005 | crates/rust-analyzer/src/cli/analysis_stats.rs:1090-1109 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/cli/analysis_stats.rs:986` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (19 lines × 2) crates/intern/src/intern.rs:51— crates/intern/src/intern.rs:51-69 | crates/intern/src/intern.rs:78-96 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) crates/proc-macro-srv-cli/src/version.rs:40— crates/proc-macro-srv-cli/src/version.rs:40-58 | crates/rust-analyzer/src/version.rs:39-57 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (18 lines × 3) crates/hir-ty/src/infer.rs:1956— crates/hir-ty/src/infer.rs:1956-1973 | crates/hir-ty/src/infer.rs:2263-2280 | crates/hir-ty/src/infer/path.rs:153-170 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (18 lines × 3) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:176— crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:176-193 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:294-311 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:325-342 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17–18 lines × 2) crates/ide-diagnostics/src/handlers/unlinked_file.rs:130— crates/ide-diagnostics/src/handlers/unlinked_file.rs:130-147 | crates/ide-diagnostics/src/handlers/unlinked_file.rs:190-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-diagnostics/src/handlers/unlinked_file.rs:130` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–18 lines × 2) crates/ide/src/inlay_hints/lifetime.rs:249— crates/ide/src/inlay_hints/lifetime.rs:249-265 | crates/ide/src/inlay_hints/lifetime.rs:345-362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide/src/inlay_hints/lifetime.rs:249` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (17 lines × 3) crates/hir-ide/src/diagnostics/decl_check.rs:357— crates/hir-ide/src/diagnostics/decl_check.rs:357-373 | crates/hir-ide/src/diagnostics/decl_check.rs:445-461 | crates/hir-ide/src/diagnostics/decl_check.rs:608-624 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ide/src/diagnostics/decl_check.rs:357` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 3) crates/proc-macro-srv/src/token_stream.rs:115— crates/proc-macro-srv/src/token_stream.rs:115-131 | crates/proc-macro-srv/src/token_stream.rs:143-159 | crates/proc-macro-srv/src/token_stream.rs:171-187 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (15 lines × 3) crates/hir/src/source_analyzer.rs:136— crates/hir/src/source_analyzer.rs:136-150 | crates/hir/src/source_analyzer.rs:189-203 | crates/hir/src/source_analyzer.rs:234-248 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 3) crates/span/src/ast_id.rs:883— crates/span/src/ast_id.rs:883-897 | crates/span/src/map.rs:166-180 | crates/syntax/src/lib.rs:222-236 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `crates/span/src/ast_id.rs:883` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 3) crates/hir-ty/src/infer.rs:2473— crates/hir-ty/src/infer.rs:2473-2481 | crates/hir-ty/src/infer.rs:2514-2522 | crates/hir-ty/src/infer.rs:2577-2585 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/infer.rs:2473` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 3) crates/syntax/src/ast/syntax_factory/constructors.rs:351— crates/syntax/src/ast/syntax_factory/constructors.rs:351-359 | crates/syntax/src/ast/syntax_factory/constructors.rs:1798-1806 | crates/syntax/src/ast/syntax_factory/constructors.rs:2156-2164 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:351` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/syntax/src/ast/syntax_factory/constructors.rs:361` calls `map_children`, `attrs`, `syntax` and `crates/syntax/src/ast/syntax_factory/constructors.rs:1808` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 2 locations) editors/code/src/commands.ts:1015— editors/code/src/commands.ts:1015 · editors/code/src/commands.ts:1050 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (12 lines × 2 locations) editors/code/src/commands.ts:1041— editors/code/src/commands.ts:1041 · editors/code/src/commands.ts:1066 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Boundary violation [package:third-party-deep-import] editors/code/src/client.ts:5— editors/code/src/client.ts:5 imports vscode-languageclient/lib/common/utils/is, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] editors/code/src/config.ts:1— editors/code/src/config.ts:1 imports vscode-languageclient/lib/common/utils/is, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Ty::hir_fmt (cyclomatic 117) crates/hir-ide/src/display.rs:1281— Ty::hir_fmt has cyclomatic complexity 117 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TokenStream::from_str (cyclomatic 61) crates/proc-macro-srv/src/token_stream.rs:50— TokenStream::from_str 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.
SymbolCollector::collect_from_module (cyclomatic 53) crates/hir/src/symbols.rs:197— SymbolCollector::collect_from_module has cyclomatic complexity 53 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
SourceAnalyzer::resolve_path (cyclomatic 45) crates/hir/src/source_analyzer.rs:1158— SourceAnalyzer::resolve_path has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ErasedFileAstId::kind_typed (cyclomatic 45) crates/span/src/ast_id.rs:198— ErasedFileAstId::kind_typed has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ModCollector::collect (cyclomatic 38) crates/hir-def/src/nameres/collector.rs:1898— ModCollector::collect has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DiagnosticsCollector::collect_impl (cyclomatic 34) crates/hir/src/diagnostics.rs:953— DiagnosticsCollector::collect_impl has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UnsafeVisitor::walk_expr (cyclomatic 33) crates/hir-ide/src/diagnostics/unsafe_check.rs:266— UnsafeVisitor::walk_expr has cyclomatic complexity 33 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
client.createClient (cyclomatic 33) editors/code/src/client.ts:13— client.createClient has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 6 of the 33 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 60, callback, a function literal at line 84, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ExpressionStore::visit_expr_children (cyclomatic 32) crates/hir-def/src/expr_store.rs:670— ExpressionStore::visit_expr_children has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Path::hir_fmt (cyclomatic 29) crates/hir-ide/src/display.rs:2681— Path::hir_fmt has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CompletionRelevance::score (cyclomatic 27) crates/ide-completion/src/item.rs:287— CompletionRelevance::score has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: CompletionItemKind::tag (cyclomatic 37) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
SemanticsImpl::descend_into_macros_impl (cyclomatic 26) crates/hir/src/semantics.rs:1237— SemanticsImpl::descend_into_macros_impl has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scip::run (cyclomatic 26) crates/rust-analyzer/src/cli/scip.rs:24— Scip::run has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NameRefClass::classify (cyclomatic 25) crates/ide-db/src/defs.rs:745— NameRefClass::classify has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Definition::docs_with_rangemap (cyclomatic 26) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
Ctx::transform_path_ (cyclomatic 25) crates/ide-db/src/path_transform.rs:355— Ctx::transform_path_ has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImportMap::collect_import_map (cyclomatic 24) crates/hir-def/src/import_map.rs:136— ImportMap::collect_import_map has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CastCheck::do_check (cyclomatic 24) crates/hir-ty/src/infer/cast.rs:162— CastCheck::do_check has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Pat::hir_fmt (cyclomatic 23) crates/hir-ide/src/diagnostics/match_check.rs:306— Pat::hir_fmt has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FunctionBody::analyze_container (cyclomatic 23) crates/ide-assists/src/handlers/extract_function.rs:844— FunctionBody::analyze_container has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
SourceToDefCtx::container_to_def (cyclomatic 22) crates/hir/src/semantics/source_to_def.rs:610— SourceToDefCtx::container_to_def has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Context::add_constraints_from_ty (cyclomatic 21) crates/hir-ty/src/variance.rs:176— Context::add_constraints_from_ty has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
NotifyActor::run (cyclomatic 21) crates/vfs-notify/src/lib.rs:99— NotifyActor::run has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SolverContext::compute_goal_fast_path (cyclomatic 20) crates/hir-ty/src/next_solver/solver.rs:285— SolverContext::compute_goal_fast_path has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
debug.getDebugConfiguration (cyclomatic 20) editors/code/src/debug.ts:81— debug.getDebugConfiguration has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BuiltinDeriveImplTrait::get_method (cyclomatic 19) crates/hir-def/src/builtin_derive.rs:45— BuiltinDeriveImplTrait::get_method has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ProbeContext::consider_probe (cyclomatic 19) crates/hir-ty/src/method_resolution/probe.rs:1567— ProbeContext::consider_probe has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MirEvalError::pretty_print (cyclomatic 19) crates/hir-ide/src/mir_pretty/errors.rs:112— MirEvalError::pretty_print has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ProjectFolders::new (cyclomatic 19) crates/load-cargo/src/lib.rs:215— ProjectFolders::new has cyclomatic complexity 19 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
TtTreeSink::token (cyclomatic 19) crates/syntax-bridge/src/lib.rs:933— TtTreeSink::token 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.
MacroCallId::expand_speculative (cyclomatic 18) crates/hir-expand/src/lib.rs:783— MacroCallId::expand_speculative has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MirBody::walk_places (cyclomatic 18) crates/hir-ty/src/mir.rs:1033— MirBody::walk_places has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
BestObligation::visit_goal (cyclomatic 18) crates/hir-ty/src/next_solver/infer/errors.rs:535— BestObligation::visit_goal has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ungrammar::lexer::advance (cyclomatic 18) lib/ungrammar/src/lexer.rs:73— ungrammar::lexer::advance has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
CargoWorkspace::new (cyclomatic 17) crates/project-model/src/cargo_workspace.rs:316— CargoWorkspace::new has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Sysroot::load_workspace (cyclomatic 17) crates/project-model/src/sysroot.rs:249— Sysroot::load_workspace has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UseTree::expand_impl (cyclomatic 16) crates/hir-def/src/item_tree.rs:736— UseTree::expand_impl has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
DefMap::resolve_path_fp_with_macro_single (cyclomatic 16) crates/hir-def/src/nameres/path_resolution.rs:242— DefMap::resolve_path_fp_with_macro_single has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
FunctionSignature::with_source_map (cyclomatic 16) crates/hir-def/src/signatures.rs:631— FunctionSignature::with_source_map has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Filler::fill_body (cyclomatic 16) crates/hir-ty/src/mir/monomorphization.rs:162— Filler::fill_body has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Generalizer::tys (cyclomatic 16) crates/hir-ty/src/next_solver/infer/relate/generalize.rs:434— Generalizer::tys has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CompletionContext::new (cyclomatic 16) crates/ide-completion/src/context.rs:800— CompletionContext::new has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProjectWorkspace::load_cargo (cyclomatic 16) crates/project-model/src/workspace.rs:211— ProjectWorkspace::load_cargo has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
AstIdMap::from_source (cyclomatic 16) crates/span/src/ast_id.rs:633— AstIdMap::from_source has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: ErasedFileAstIdKind::syntax_kind (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
FixmeComment repeated across 16 files crates/syntax/src/fuzz.rs:70— The identical FixmeComment appears in 16 files (23 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 23 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// FIXME". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
Ty::hir_fmt (cognitive 149) crates/hir-ide/src/display.rs:1281— Ty::hir_fmt has cognitive complexity 149 (threshold 15). Drivers by points: if/else 46 (102 pts), match/switch 21 (42 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 78). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiagnosticsCollector::collect_impl (cognitive 75) crates/hir/src/diagnostics.rs:953— DiagnosticsCollector::collect_impl has cognitive complexity 75 (threshold 15). Drivers by points: if/else 16 (45 pts), match/switch 4 (12 pts), loops 3 (11 pts), boolean chains 7 (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Path::hir_fmt (cognitive 73) crates/hir-ide/src/display.rs:2681— Path::hir_fmt has cognitive complexity 73 (threshold 15). Drivers by points: if/else 14 (42 pts), match/switch 5 (18 pts), loops 4 (11 pts), boolean chains 2 (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scip::run (cognitive 57) crates/rust-analyzer/src/cli/scip.rs:24— Scip::run has cognitive complexity 57 (threshold 15). Drivers by points: if/else 20 (40 pts), match/switch 3 (9 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SymbolCollector::collect_from_module (cognitive 48) crates/hir/src/symbols.rs:197— SymbolCollector::collect_from_module has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (17 pts), match/switch 9 (16 pts), loops 8 (10 pts), boolean chains 5 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImportMap::collect_import_map (cognitive 48) crates/hir-def/src/import_map.rs:136— ImportMap::collect_import_map has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (22 pts), match/switch 4 (20 pts), loops 3 (6 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Ctx::transform_path_ (cognitive 46) crates/ide-db/src/path_transform.rs:355— Ctx::transform_path_ has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (36 pts), boolean chains 5, match/switch 2 (5 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TokenStream::from_str (cognitive 45) crates/proc-macro-srv/src/token_stream.rs:50— TokenStream::from_str has cognitive complexity 45 (threshold 15). Drivers by points: if/else 20 (41 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Config::apply_change_with_sink (cognitive 45) crates/rust-analyzer/src/config.rs:1209— Config::apply_change_with_sink has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (21 pts), match/switch 5 (17 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
client.createClient (cognitive 44) editors/code/src/client.ts:13— client.createClient has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 6, match/switch 1 (5 pts), loops 2, ternaries 2 (nesting depth added 16). Most of this is not in the body itself: 4 of the 44 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 60, callback, a function literal at line 169, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
Sysroot::load_workspace (cognitive 40) crates/project-model/src/sysroot.rs:249— Sysroot::load_workspace has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 4 (11 pts), match/switch 1 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TtTreeSink::token (cognitive 37) crates/syntax-bridge/src/lib.rs:933— TtTreeSink::token has cognitive complexity 37 (threshold 15). Drivers by points: match/switch 8 (27 pts), if/else 4 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 22). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Pat::hir_fmt (cognitive 36) crates/hir-ide/src/diagnostics/match_check.rs:306— Pat::hir_fmt has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 5 (11 pts), boolean chains 2 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ExprValidator::check_for_unnecessary_else (cognitive 35) crates/hir-ide/src/diagnostics/expr.rs:502— ExprValidator::check_for_unnecessary_else has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (27 pts), loops 1 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Filler::fill_body (cognitive 35) crates/hir-ty/src/mir/monomorphization.rs:162— Filler::fill_body has cognitive complexity 35 (threshold 15). Drivers by points: match/switch 5 (20 pts), loops 5 (13 pts), if/else 1 (2 pts) (nesting depth added 24). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ProjectFolders::new (cognitive 34) crates/load-cargo/src/lib.rs:215— ProjectFolders::new has cognitive complexity 34 (threshold 15). Drivers by points: loops 10 (18 pts), if/else 5 (10 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 16). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
Matcher::attempt_match_token_tree (cognitive 33) crates/ide-ssr/src/matching.rs:443— Matcher::attempt_match_token_tree has cognitive complexity 33 (threshold 15). Drivers by points: if/else 5 (16 pts), match/switch 4 (12 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SourceToDefCtx::container_to_def (cognitive 32) crates/hir/src/semantics/source_to_def.rs:610— SourceToDefCtx::container_to_def has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (26 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UnsafeVisitor::walk_expr (cognitive 31) crates/hir-ide/src/diagnostics/unsafe_check.rs:266— UnsafeVisitor::walk_expr has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 5 (8 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
MirEvalError::pretty_print (cognitive 31) crates/hir-ide/src/mir_pretty/errors.rs:112— MirEvalError::pretty_print has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 9 (28 pts), loops 2 (3 pts) (nesting depth added 20). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
AstIdMap::from_source (cognitive 30) crates/span/src/ast_id.rs:633— AstIdMap::from_source has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 3 (7 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 15). Of this number, 29 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
debug.getDebugConfiguration (cognitive 28) editors/code/src/debug.ts:81— debug.getDebugConfiguration has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 2 (4 pts), boolean chains 3, ternaries 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CompletionRelevance::score (cognitive 27) crates/ide-completion/src/item.rs:287— CompletionRelevance::score has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (21 pts), match/switch 4 (6 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
MirBody::walk_places (cognitive 26) crates/hir-ty/src/mir.rs:1033— MirBody::walk_places has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 6 (18 pts), loops 3 (8 pts) (nesting depth added 17). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
NameRefClass::classify (cognitive 26) crates/ide-db/src/defs.rs:745— NameRefClass::classify has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 6 (11 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImportScope::find_insert_use_container (cognitive 26) crates/ide-db/src/imports/insert_use.rs:74— ImportScope::find_insert_use_container has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (24 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ErasedFileAstId::kind_typed (cognitive 26) crates/span/src/ast_id.rs:198— ErasedFileAstId::kind_typed has cognitive complexity 26 (threshold 15). Drivers by points: if/else 24, match/switch 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SyntaxEditor::add_generic_param (cognitive 26) crates/syntax/src/syntax_editor/edits.rs:117— SyntaxEditor::add_generic_param has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (25 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
TraitImpls::collect_def_map::collect (cognitive 25) crates/hir-ty/src/method_resolution.rs:732— TraitImpls::collect_def_map::collect has cognitive complexity 25 (threshold 15). Drivers by points: loops 5 (10 pts), if/else 3 (9 pts), match/switch 2 (6 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AdtDef::new (cognitive 25) crates/hir-ty/src/next_solver/interner.rs:482— AdtDef::new has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
config.substituteVariablesInEnv (cognitive 24) editors/code/src/config.ts:482— config.substituteVariablesInEnv has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 5 (7 pts), boolean chains 3 (nesting depth added 9). Of this number, 18 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bootstrap.getServer (cognitive 24) REDACTED:36— bootstrap.getServer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (5 pts), boolean chains 1, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Diagnostics::run_ (cognitive 23) crates/rust-analyzer/src/cli/diagnostics.rs:25— Diagnostics::run_ has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts), match/switch 1 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FulfillmentCtxt::try_evaluate_obligations (cognitive 22) crates/hir-ty/src/next_solver/fulfill.rs:155— FulfillmentCtxt::try_evaluate_obligations has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 3 (8 pts), loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Query::search_maps (cognitive 22) crates/ide-db/src/symbol_index.rs:581— Query::search_maps has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 6, loops 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CargoWorkspace::new (cognitive 22) crates/project-model/src/cargo_workspace.rs:316— CargoWorkspace::new has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 6 (8 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 7). Of this number, 16 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Trait::hir_fmt (cognitive 21) crates/hir/src/display.rs:908— Trait::hir_fmt has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 1 (4 pts), loops 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BuiltinDeriveImplTrait::get_method (cognitive 21) crates/hir-def/src/builtin_derive.rs:45— BuiltinDeriveImplTrait::get_method has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 13 (21 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
BindingsBuilder::build_inner (cognitive 21) crates/mbe/src/expander/matcher.rs:220— BindingsBuilder::build_inner has cognitive complexity 21 (threshold 15). Drivers by points: loops 4 (14 pts), if/else 1 (5 pts), match/switch 1 (2 pts) (nesting depth added 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
EditPlan::build (cognitive 21) crates/syntax/src/syntax_editor/edit_algo.rs:71— EditPlan::build has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 5, match/switch 1 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InactiveReason::fmt (cognitive 20) crates/cfg/src/lib.rs:244— InactiveReason::fmt has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 2 (6 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MacroCallId::expand_speculative (cognitive 20) crates/hir-expand/src/lib.rs:783— MacroCallId::expand_speculative has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 3, boolean chains 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
InferCtxt::query_response_instantiation_guess (cognitive 20) crates/hir-ty/src/next_solver/infer/canonical/instantiate.rs:322— InferCtxt::query_response_instantiation_guess has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (4 pts), loops 3, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Anchor::from (cognitive 20) crates/ide-assists/src/handlers/extract_variable.rs:488— Anchor::from has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReplacementRenderer::render_token (cognitive 20) crates/ide-ssr/src/replacing.rs:129— ReplacementRenderer::render_token has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CargoOptions::apply_on_command (cognitive 20) crates/rust-analyzer/src/flycheck.rs:67— CargoOptions::apply_on_command has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 1 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MirPrettyCtx::blocks (cognitive 19) crates/hir-ide/src/mir_pretty.rs:243— MirPrettyCtx::blocks has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (12 pts), loops 3 (7 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Canonicalizer::fold_ty (cognitive 19) crates/hir-ty/src/next_solver/infer/canonical/canonicalizer.rs:328— Canonicalizer::fold_ty has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (3 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
CompletionContext::new (cognitive 19) crates/ide-completion/src/context.rs:800— CompletionContext::new has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 5 (6 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeclarativeMacro::parse_macro2 (cognitive 19) crates/mbe/src/lib.rs:193— DeclarativeMacro::parse_macro2 has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (5 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CfgExpr::parse_from_ast (cognitive 18) crates/cfg/src/cfg_expr.rs:109— CfgExpr::parse_from_ast has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 4 (8 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
UseTree::expand_impl (cognitive 18) crates/hir-def/src/item_tree.rs:736— UseTree::expand_impl has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (9 pts), if/else 3 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). Of this number, 14 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
MatchCheckCtx::ctors_for_ty (cognitive 18) crates/hir-ide/src/diagnostics/match_check/pat_analysis.rs:406— MatchCheckCtx::ctors_for_ty has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 1 (4 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
CastCheck::do_check (cognitive 18) crates/hir-ty/src/infer/cast.rs:162— CastCheck::do_check has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 6 (14 pts), if/else 1 (4 pts) (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ProcMacroServerProcess::run (cognitive 18) crates/proc-macro-api/src/process.rs:125— ProcMacroServerProcess::run has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 3 (8 pts), if/else 5 (7 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
stdx::process::imp::read2 (cognitive 18) crates/stdx/src/process.rs:88— stdx::process::imp::read2 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SyntaxTreeProvider.getElementByRange (cognitive 18) editors/code/src/syntax_tree_provider.ts:138— SyntaxTreeProvider.getElementByRange has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
commands.asWorkspaceSnippetEdit (cognitive 18) editors/code/src/commands.ts:1130— commands.asWorkspaceSnippetEdit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UseTreeLowering::lower_use_tree (cognitive 17) crates/hir-def/src/item_tree/lower.rs:462— UseTreeLowering::lower_use_tree has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 4 (7 pts), boolean chains 1 (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Scope::process_names (cognitive 17) crates/hir-def/src/resolver.rs:1053— Scope::process_names has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 2 (5 pts), loops 2 (4 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
FunctionSignature::with_source_map (cognitive 17) crates/hir-def/src/signatures.rs:631— FunctionSignature::with_source_map has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15 (16 pts), match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CoerceMany::coerce_inner (cognitive 17) crates/hir-ty/src/infer/coerce.rs:1280— CoerceMany::coerce_inner has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 3 (6 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PathLoweringContext::substs_from_args_and_bindings (cognitive 17) crates/hir-ty/src/lower/path.rs:682— PathLoweringContext::substs_from_args_and_bindings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 4, boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceFudger::fold_ty (cognitive 17) crates/hir-ty/src/next_solver/infer/snapshot/fudge.rs:179— InferenceFudger::fold_ty has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GeneratedFunctionTarget::insert_fn_at (cognitive 17) crates/ide-assists/src/handlers/generate_function.rs:623— GeneratedFunctionTarget::insert_fn_at has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (4 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ScriptSource::parse (cognitive 17) crates/parser/src/frontmatter.rs:28— ScriptSource::parse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 4). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
LexedStr::to_input (cognitive 17) crates/parser/src/shortcuts.rs:28— LexedStr::to_input has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Function::hir_fmt (cognitive 16) crates/hir/src/display.rs:90— Function::hir_fmt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 3 (4 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AssocItemCollector::record_item (cognitive 16) crates/hir-def/src/nameres/assoc.rs:261— AssocItemCollector::record_item has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (6 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
HirFormatter::format_bounds_with (cognitive 16) crates/hir-ide/src/display.rs:179— HirFormatter::format_bounds_with has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DbInterner::unsizing_params_for_adt (cognitive 16) crates/hir-ty/src/next_solver/interner.rs:1701— DbInterner::unsizing_params_for_adt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), match/switch 4 (6 pts), loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MatchFinder::output_debug_for_nodes_at_range (cognitive 16) crates/ide-ssr/src/lib.rs:252— MatchFinder::output_debug_for_nodes_at_range has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SourceRootConfig::source_root_parent_map (cognitive 16) crates/load-cargo/src/lib.rs:427— SourceRootConfig::source_root_parent_map has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LsifManager::add_token (cognitive 16) crates/rust-analyzer/src/cli/lsif.rs:155— LsifManager::add_token has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
line_index::analyze_source_file_sse2 (cognitive 16) lib/line-index/src/lib.rs:262— line_index::analyze_source_file_sse2 has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TooManyFields: GlobalState crates/rust-analyzer/src/global_state.rs:84— TooManyFields — 49 stored fields beside 51 methods. The bar is 30 stored fields; this is 19 over it, 1.63× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
D30 · Dependency Vulnerabilities· Medium advisory (unmaintained) · ×1
Change-coupling hub: mutability.rs → expr_store.rs, pretty.rs, expr.rs crates/hir-ty/src/infer/mutability.rs— `crates/hir-ty/src/infer/mutability.rs` changes together with 3 other files — `crates/hir-def/src/expr_store.rs`, `crates/hir-def/src/expr_store/pretty.rs`, `crates/hir-ide/src/diagnostics/expr.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Near-duplicate member pair (41 shared lines) crates/hir/src/term_search/tactics.rs:411— crates/hir/src/term_search/tactics.rs:411-508 | crates/hir/src/term_search/tactics.rs:603-687 — These two members are variants of one another: 41 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (19 shared lines) crates/hir-ty/src/consteval.rs:133— crates/hir-ty/src/consteval.rs:133-184 | crates/hir-ty/src/next_solver/ty.rs:690-719 — These two members are variants of one another: 19 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Members sharing a duplicated core (19 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (19 members, 50+ identical tokens) crates/syntax/src/ast/syntax_factory/constructors.rs:54— crates/syntax/src/ast/syntax_factory/constructors.rs:54-64 | crates/syntax/src/ast/syntax_factory/constructors.rs:195-205 | crates/syntax/src/ast/syntax_factory/constructors.rs:314-326 | crates/syntax/src/ast/syntax_factory/constructors.rs:564-577 | crates/syntax/src/ast/syntax_factory/constructors.rs:602-612 | crates/syntax/src/ast/syntax_factory/constructors.rs:1059-1069 | crates/syntax/src/ast/syntax_factory/constructors.rs:1084-1095 | crates/syntax/src/ast/syntax_factory/constructors.rs:1097-1110 | crates/syntax/src/ast/syntax_factory/constructors.rs:1116-1126 | crates/syntax/src/ast/syntax_factory/constructors.rs:1128-1138 | crates/syntax/src/ast/syntax_factory/constructors.rs:1140-1151 | crates/syntax/src/ast/syntax_factory/constructors.rs:1185-1197 | crates/syntax/src/ast/syntax_factory/constructors.rs:1218-1230 | crates/syntax/src/ast/syntax_factory/constructors.rs:1303-1313 | crates/syntax/src/ast/syntax_factory/constructors.rs:1360-1370 | crates/syntax/src/ast/syntax_factory/constructors.rs:1372-1386 | crates/syntax/src/ast/syntax_factory/constructors.rs:1507-1517 | crates/syntax/src/ast/syntax_factory/constructors.rs:2232-2241 | crates/syntax/src/ast/syntax_factory/constructors.rs:2281-2291 — These 19 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 19 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 19 times.
D4 · Code Duplication· Members sharing a duplicated core (10 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (10 members, 50+ identical tokens) crates/syntax/src/ast/syntax_factory/constructors.rs:207— crates/syntax/src/ast/syntax_factory/constructors.rs:207-217 | crates/syntax/src/ast/syntax_factory/constructors.rs:877-887 | crates/syntax/src/ast/syntax_factory/constructors.rs:934-944 | crates/syntax/src/ast/syntax_factory/constructors.rs:950-960 | crates/syntax/src/ast/syntax_factory/constructors.rs:979-989 | crates/syntax/src/ast/syntax_factory/constructors.rs:1333-1345 | crates/syntax/src/ast/syntax_factory/constructors.rs:1347-1358 | crates/syntax/src/ast/syntax_factory/constructors.rs:1408-1422 | crates/syntax/src/ast/syntax_factory/constructors.rs:1457-1474 | crates/syntax/src/ast/syntax_factory/constructors.rs:1600-1611 — These 10 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 10 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 10 times.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (7 members, 50+ identical tokens) crates/ide-assists/src/handlers/generate_blanket_trait_impl.rs:62— crates/ide-assists/src/handlers/generate_blanket_trait_impl.rs:62-151 | crates/ide-assists/src/handlers/generate_default_from_new.rs:50-95 | crates/ide-assists/src/handlers/generate_delegate_methods.rs:54-238 | crates/ide-assists/src/handlers/generate_enum_is_method.rs:46-100 | crates/ide-assists/src/handlers/generate_enum_projection_method.rs:123-179 | crates/ide-assists/src/handlers/generate_impl.rs:14-29 | crates/ide-assists/src/handlers/generate_single_field_struct_from.rs:47-155 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (6 members, 50+ identical tokens) crates/syntax/src/ast/syntax_factory/constructors.rs:120— crates/syntax/src/ast/syntax_factory/constructors.rs:120-136 | crates/syntax/src/ast/syntax_factory/constructors.rs:459-470 | crates/syntax/src/ast/syntax_factory/constructors.rs:747-757 | crates/syntax/src/ast/syntax_factory/constructors.rs:759-769 | crates/syntax/src/ast/syntax_factory/constructors.rs:889-911 | crates/syntax/src/ast/syntax_factory/constructors.rs:2007-2020 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/ide/src/highlight_related.rs:311— crates/ide/src/highlight_related.rs:311-388 | crates/ide/src/highlight_related.rs:394-459 | crates/ide/src/highlight_related.rs:494-584 | crates/ide/src/highlight_related.rs:589-660 | crates/ide/src/highlight_related.rs:790-821 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Edited copy of a member (74 corresponding lines) · ×1
Edited copy of a member (74 corresponding lines) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:504— crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:504-582 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:652-725 — These two members are one piece of code written twice and then edited apart: 74 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (44 corresponding lines) · ×1
Edited copy of a member (44 corresponding lines) crates/hir-ty/src/next_solver/ty.rs:983— crates/hir-ty/src/next_solver/ty.rs:983-1030 | crates/hir-ty/src/next_solver/ty.rs:1034-1077 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (53 corresponding lines) · ×1
Edited copy of a member (53 corresponding lines) crates/hir-expand/src/builtin/derive_macro.rs:1011— crates/hir-expand/src/builtin/derive_macro.rs:1011-1063 | crates/hir-expand/src/builtin/derive_macro.rs:1069-1126 — These two members are one piece of code written twice and then edited apart: 53 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (56 corresponding lines) · ×1
Edited copy of a member (56 corresponding lines) crates/hir-def/src/visibility.rs:159— crates/hir-def/src/visibility.rs:159-214 | crates/hir-def/src/visibility.rs:225-280 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (58 corresponding lines) · ×1
Edited copy of a member (58 corresponding lines) crates/hir/src/lib.rs:5438— crates/hir/src/lib.rs:5438-5508 | crates/hir/src/lib.rs:5547-5604 — These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (50 corresponding lines) · ×1
Edited copy of a member (50 corresponding lines) crates/ide/src/inlay_hints/lifetime.rs:74— crates/ide/src/inlay_hints/lifetime.rs:74-131 | crates/ide/src/inlay_hints/lifetime.rs:139-188 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (41 corresponding lines) · ×1
Edited copy of a member (41 corresponding lines) crates/ide-assists/src/handlers/generate_deref.rs:45— crates/ide-assists/src/handlers/generate_deref.rs:45-85 | crates/ide-assists/src/handlers/generate_deref.rs:87-128 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 32+ corresponding lines) · ×1
Edited copies of one member (3 members, 32+ corresponding lines) crates/syntax/src/ast/token_ext.rs:264— crates/syntax/src/ast/token_ext.rs:264-295 | crates/syntax/src/ast/token_ext.rs:308-339 | crates/syntax/src/ast/token_ext.rs:354-387 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 32 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (73 corresponding lines) · ×1
Edited copy of a member (73 corresponding lines) lib/line-index/src/lib.rs:266— lib/line-index/src/lib.rs:266-349 | lib/line-index/src/lib.rs:376-448 — These two members are one piece of code written twice and then edited apart: 73 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (32 corresponding lines) · ×1
Edited copy of a member (32 corresponding lines) crates/ide/src/inlay_hints.rs:90— crates/ide/src/inlay_hints.rs:90-124 | crates/ide/src/inlay_hints.rs:139-170 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 22+ corresponding lines) · ×1
Edited copies of one member (5 members, 22+ corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs:164— crates/syntax/src/ast/syntax_factory/constructors.rs:164-193 | crates/syntax/src/ast/syntax_factory/constructors.rs:396-435 | crates/syntax/src/ast/syntax_factory/constructors.rs:1538-1559 | crates/syntax/src/ast/syntax_factory/constructors.rs:1796-1840 | crates/syntax/src/ast/syntax_factory/constructors.rs:1866-1903 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (37 corresponding lines) · ×1
Edited copy of a member (37 corresponding lines) crates/hir/src/source_analyzer.rs:187— crates/hir/src/source_analyzer.rs:187-223 | crates/hir/src/source_analyzer.rs:232-273 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 29+ corresponding lines) · ×1
Edited copies of one member (3 members, 29+ corresponding lines) crates/hir-ty/src/consteval.rs:459— crates/hir-ty/src/consteval.rs:459-491 | crates/hir-ty/src/consteval.rs:498-533 | crates/hir-ty/src/consteval.rs:538-566 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 29 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 37+ corresponding lines) · ×1
Edited copies of one member (3 members, 37+ corresponding lines) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:132— crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:132-168 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:208-244 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:250-286 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 37 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (38 corresponding lines) · ×1
Edited copy of a member (38 corresponding lines) crates/hir-def/src/resolver.rs:805— crates/hir-def/src/resolver.rs:805-842 | crates/hir-def/src/resolver.rs:853-892 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 18+ corresponding lines) · ×1
Edited copies of one member (4 members, 18+ corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs:528— crates/syntax/src/ast/syntax_factory/constructors.rs:528-545 | crates/syntax/src/ast/syntax_factory/constructors.rs:995-1022 | crates/syntax/src/ast/syntax_factory/constructors.rs:1028-1053 | crates/syntax/src/ast/syntax_factory/constructors.rs:1236-1253 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 23+ corresponding lines) · ×1
Edited copies of one member (3 members, 23+ corresponding lines) crates/hir-ty/src/lower.rs:2509— crates/hir-ty/src/lower.rs:2509-2537 | crates/hir-ty/src/lower.rs:2539-2561 | crates/hir-ty/src/lower.rs:2563-2586 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 13+ corresponding lines) · ×1
Edited copies of one member (4 members, 13+ corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs:547— crates/syntax/src/ast/syntax_factory/constructors.rs:547-561 | crates/syntax/src/ast/syntax_factory/constructors.rs:827-841 | crates/syntax/src/ast/syntax_factory/constructors.rs:1388-1401 | crates/syntax/src/ast/syntax_factory/constructors.rs:1638-1650 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (7 members, 12+ corresponding lines) · ×1
Edited copies of one member (7 members, 12+ corresponding lines) crates/syntax/src/ast/syntax_factory/constructors.rs:587— crates/syntax/src/ast/syntax_factory/constructors.rs:587-600 | crates/syntax/src/ast/syntax_factory/constructors.rs:792-803 | crates/syntax/src/ast/syntax_factory/constructors.rs:809-821 | crates/syntax/src/ast/syntax_factory/constructors.rs:1071-1082 | crates/syntax/src/ast/syntax_factory/constructors.rs:1655-1666 | crates/syntax/src/ast/syntax_factory/constructors.rs:1705-1718 | crates/syntax/src/ast/syntax_factory/constructors.rs:1749-1762 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 15+ corresponding lines) · ×1
Edited copies of one member (3 members, 15+ corresponding lines) crates/syntax/src/validation.rs:326— crates/syntax/src/validation.rs:326-340 | crates/syntax/src/validation.rs:342-356 | crates/syntax/src/validation.rs:358-372 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (1 corresponding lines) · ×1
Edited copy of a member (1 corresponding lines) crates/hir-def/src/lib.rs:914— crates/hir-def/src/lib.rs:914-914 | crates/hir-def/src/lib.rs:1061-1061 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 19+ corresponding lines) · ×1
Edited copies of one member (3 members, 19+ corresponding lines) crates/hir-ide/src/diagnostics/decl_check.rs:301— crates/hir-ide/src/diagnostics/decl_check.rs:301-319 | crates/hir-ide/src/diagnostics/decl_check.rs:394-412 | crates/hir-ide/src/diagnostics/decl_check.rs:482-500 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 12+ corresponding lines) · ×1
Edited copies of one member (3 members, 12+ corresponding lines) crates/proc-macro-api/src/bidirectional_protocol.rs:100— crates/proc-macro-api/src/bidirectional_protocol.rs:100-111 | crates/proc-macro-api/src/bidirectional_protocol.rs:117-130 | crates/proc-macro-api/src/bidirectional_protocol.rs:137-148 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 5+ corresponding lines) · ×1
Edited copies of one member (3 members, 5+ corresponding lines) crates/hir/src/semantics/source_to_def.rs:485— crates/hir/src/semantics/source_to_def.rs:485-489 | crates/hir/src/semantics/source_to_def.rs:494-498 | crates/hir/src/semantics/source_to_def.rs:503-507 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 14+ corresponding lines) · ×1
Edited copies of one member (6 members, 14+ corresponding lines) crates/ide-completion/src/completions.rs:302— crates/ide-completion/src/completions.rs:302-315 | crates/ide-completion/src/completions.rs:323-337 | crates/ide-completion/src/completions.rs:346-361 | crates/ide-completion/src/completions.rs:474-489 | crates/ide-completion/src/completions.rs:497-511 | crates/ide-completion/src/completions.rs:519-532 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 7+ corresponding lines) · ×1
Edited copies of one member (4 members, 7+ corresponding lines) crates/hir-def/src/expr_store/lower.rs:3555— crates/hir-def/src/expr_store/lower.rs:3555-3561 | crates/hir-def/src/expr_store/lower.rs:3590-3596 | crates/hir-def/src/expr_store/lower.rs:3598-3604 | crates/hir-def/src/expr_store/lower.rs:3606-3612 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 7+ corresponding lines) · ×1
Edited copies of one member (6 members, 7+ corresponding lines) crates/hir-def/src/item_tree/lower.rs:259— crates/hir-def/src/item_tree/lower.rs:259-265 | crates/hir-def/src/item_tree/lower.rs:267-273 | crates/hir-def/src/item_tree/lower.rs:275-284 | crates/hir-def/src/item_tree/lower.rs:286-292 | crates/hir-def/src/item_tree/lower.rs:294-300 | crates/hir-def/src/item_tree/lower.rs:333-340 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 1+ corresponding lines) · ×1
Edited copies of one member (5 members, 1+ corresponding lines) crates/hir-ty/src/next_solver/allocation.rs:73— crates/hir-ty/src/next_solver/allocation.rs:73-73 | crates/hir-ty/src/next_solver/consts.rs:43-43 | crates/hir-ty/src/next_solver/predicate.rs:260-260 | crates/hir-ty/src/next_solver/region.rs:33-33 | crates/hir-ty/src/next_solver/ty.rs:64-64 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 4+ corresponding lines) · ×1
Edited copies of one member (5 members, 4+ corresponding lines) crates/hir-ty/src/next_solver/allocation.rs:29— crates/hir-ty/src/next_solver/allocation.rs:29-32 | crates/hir-ty/src/next_solver/consts/valtree.rs:348-351 | crates/hir-ty/src/next_solver/interner.rs:755-758 | crates/hir-ty/src/next_solver/opaques.rs:65-72 | crates/hir-ty/src/next_solver/region.rs:52-55 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (4 corresponding lines) · ×1
Edited copy of a member (4 corresponding lines) crates/hir-expand/src/builtin/derive_macro.rs:61— crates/hir-expand/src/builtin/derive_macro.rs:61-64 | crates/hir-expand/src/builtin/fn_macro.rs:58-61 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 4+ corresponding lines) · ×1
Edited copies of one member (3 members, 4+ corresponding lines) crates/ide-db/src/search.rs:1449— crates/ide-db/src/search.rs:1449-1452 | crates/ide/src/lib.rs:369-374 | crates/ide/src/references.rs:226-229 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (49 lines × 2) crates/project-model/src/workspace.rs:835— crates/project-model/src/workspace.rs:835-883 | crates/project-model/src/workspace.rs:917-965 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/project-model/src/workspace.rs:835` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (42 lines × 2) crates/hir-def/src/visibility.rs:173— crates/hir-def/src/visibility.rs:173-214 | crates/hir-def/src/visibility.rs:239-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/visibility.rs:173` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (33 lines × 2) crates/hir/src/term_search/expr.rs:187— crates/hir/src/term_search/expr.rs:187-219 | crates/hir/src/term_search/expr.rs:229-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/term_search/expr.rs:187` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (32–33 lines × 2) crates/ide/src/hover/render.rs:529— crates/ide/src/hover/render.rs:529-560 | crates/ide/src/hover/render.rs:562-594 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (30–33 lines × 2) lib/line-index/src/lib.rs:317— lib/line-index/src/lib.rs:317-349 | lib/line-index/src/lib.rs:419-448 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/line-index/src/lib.rs:317` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (28–30 lines × 2) xtask/src/codegen/grammar.rs:203— xtask/src/codegen/grammar.rs:203-230 | xtask/src/codegen/grammar.rs:349-378 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `xtask/src/codegen/grammar.rs:203` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27 lines × 2) crates/ide/src/inlay_hints/lifetime.rs:105— crates/ide/src/inlay_hints/lifetime.rs:105-131 | crates/ide/src/inlay_hints/lifetime.rs:162-188 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide/src/inlay_hints/lifetime.rs:105` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (26 lines × 2) crates/ide-assists/src/handlers/convert_for_to_while_let.rs:120— crates/ide-assists/src/handlers/convert_for_to_while_let.rs:120-145 | crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs:162-187 — before extracting anything, compare `crates/ide-assists/src/handlers/convert_for_to_while_let.rs` and `crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21–24 lines × 2) crates/ide-completion/src/completions/expr.rs:121— crates/ide-completion/src/completions/expr.rs:121-141 | crates/ide-completion/src/completions/expr.rs:190-213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/completions/expr.rs:190` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19–23 lines × 2) crates/ide-completion/src/completions/expr.rs:204— crates/ide-completion/src/completions/expr.rs:204-226 | crates/ide-completion/src/completions/type.rs:115-133 — before extracting anything, compare `crates/ide-completion/src/completions/expr.rs` and `crates/ide-completion/src/completions/type.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/completions/expr.rs:204` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22–23 lines × 2) crates/ide-completion/src/context/analysis.rs:224— crates/ide-completion/src/context/analysis.rs:224-245 | crates/ide-completion/src/context/analysis.rs:410-432 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/context/analysis.rs:224` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (21–23 lines × 2) crates/syntax/src/ast/syntax_factory/constructors.rs:1000— crates/syntax/src/ast/syntax_factory/constructors.rs:1000-1022 | crates/syntax/src/ast/syntax_factory/constructors.rs:1033-1053 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:1000` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) crates/hir/src/term_search/tactics.rs:441— crates/hir/src/term_search/tactics.rs:441-462 | crates/hir/src/term_search/tactics.rs:636-657 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/term_search/tactics.rs:441` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20–21 lines × 3) crates/ide-completion/src/context/analysis.rs:217— crates/ide-completion/src/context/analysis.rs:217-236 | crates/ide-completion/src/context/analysis.rs:338-357 | crates/ide-completion/src/context/analysis.rs:402-422 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/context/analysis.rs:217` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (28 lines × 2) crates/proc-macro-srv/src/token_stream.rs:698— crates/proc-macro-srv/src/token_stream.rs:698-725 | crates/tt/src/lib.rs:447-474 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/proc-macro-srv/src/token_stream.rs:698` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5–20 lines × 3) crates/hir-ty/src/mir/eval.rs:2323— crates/hir-ty/src/mir/eval.rs:2323-2342 | crates/hir-ty/src/mir/eval.rs:2354-2371 | crates/hir-ty/src/mir/eval.rs:3004-3008 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/mir/eval.rs:2323` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (18–19 lines × 4) crates/hir-ty/src/mir/eval.rs:1140— crates/hir-ty/src/mir/eval.rs:1140-1158 | crates/hir-ty/src/mir/eval.rs:1173-1190 | crates/hir-ty/src/mir/eval.rs:1201-1218 | crates/hir-ty/src/mir/eval.rs:1229-1246 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/mir/eval.rs:1140` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (19 lines × 3) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:150— crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:150-168 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:226-244 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:268-286 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:150` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–18 lines × 2) crates/ide-completion/src/completions/expr.rs:132— crates/ide-completion/src/completions/expr.rs:132-149 | crates/ide-completion/src/completions/type.rs:72-87 — before extracting anything, compare `crates/ide-completion/src/completions/expr.rs` and `crates/ide-completion/src/completions/type.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/completions/expr.rs:132` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–17 lines × 2) crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:831— crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:831-847 | crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:942-956 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:831` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:848` calls `push` and `crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:957` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12–16 lines × 3) crates/syntax/src/ast/syntax_factory/constructors.rs:1817— crates/syntax/src/ast/syntax_factory/constructors.rs:1817-1832 | crates/syntax/src/ast/syntax_factory/constructors.rs:1947-1958 | crates/syntax/src/ast/syntax_factory/constructors.rs:2210-2223 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:1817` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (15–16 lines × 2) crates/hir/src/source_analyzer.rs:1633— crates/hir/src/source_analyzer.rs:1633-1648 | crates/hir/src/source_analyzer.rs:1674-1688 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/source_analyzer.rs:1633` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (25 lines × 2) crates/hir/src/source_analyzer.rs:1929— crates/hir/src/source_analyzer.rs:1929-1953 | crates/hir/src/source_analyzer.rs:2130-2154 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir/src/source_analyzer.rs:1929` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–15 lines × 2) crates/hir-def/src/nameres/collector.rs:2147— crates/hir-def/src/nameres/collector.rs:2147-2161 | crates/hir-def/src/nameres/collector.rs:2169-2178 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/nameres/collector.rs:2147` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (14 lines × 5) crates/hir-expand/src/fixup.rs:150— crates/hir-expand/src/fixup.rs:150-163 | crates/hir-expand/src/fixup.rs:180-193 | crates/hir-expand/src/fixup.rs:196-209 | crates/hir-expand/src/fixup.rs:226-239 | crates/hir-expand/src/fixup.rs:266-279 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-expand/src/fixup.rs:150` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/hir-expand/src/fixup.rs:194` calls `LoopExpr` and `crates/hir-expand/src/fixup.rs:178` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12–14 lines × 4) crates/hir-ide/src/diagnostics/expr.rs:634— crates/hir-ide/src/diagnostics/expr.rs:634-647 | crates/hir-ide/src/diagnostics/expr.rs:677-690 | crates/hir/src/source_analyzer.rs:2188-2199 | crates/hir/src/source_analyzer.rs:2220-2231 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ide/src/diagnostics/expr.rs:677` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–14 lines × 2) crates/hir-ty/src/mir/lower/pattern_matching.rs:223— crates/hir-ty/src/mir/lower/pattern_matching.rs:223-234 | crates/hir-ty/src/mir/lower/pattern_matching.rs:308-321 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/mir/lower/pattern_matching.rs:223` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–14 lines × 2) xtask/src/codegen/lints.rs:333— xtask/src/codegen/lints.rs:333-343 | xtask/src/codegen/lints.rs:359-372 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 4) crates/hir-ide/src/diagnostics/decl_check.rs:363— crates/hir-ide/src/diagnostics/decl_check.rs:363-375 | crates/hir-ide/src/diagnostics/decl_check.rs:451-463 | crates/hir-ide/src/diagnostics/decl_check.rs:541-553 | crates/hir-ide/src/diagnostics/decl_check.rs:614-626 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ide/src/diagnostics/decl_check.rs:363` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 3) crates/syntax/src/validation.rs:328— crates/syntax/src/validation.rs:328-340 | crates/syntax/src/validation.rs:344-356 | crates/syntax/src/validation.rs:360-372 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/validation.rs:328` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `ty` to `ast::RefType` in one and `ast::PtrType` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (10–13 lines × 2) crates/ide-assists/src/handlers/wrap_unwrap_cfg_attr.rs:215— crates/ide-assists/src/handlers/wrap_unwrap_cfg_attr.rs:215-227 | crates/ide-assists/src/handlers/wrap_unwrap_cfg_attr.rs:256-265 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/wrap_unwrap_cfg_attr.rs:215` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–12 lines × 3) crates/hir-def/src/nameres/collector.rs:2146— crates/hir-def/src/nameres/collector.rs:2146-2156 | crates/hir-def/src/nameres/collector.rs:2168-2178 | crates/hir-def/src/nameres/collector.rs:2183-2194 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-def/src/nameres/collector.rs:2146` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/hir-def/src/nameres/collector.rs:2195` calls `resolve_vis` and `crates/hir-def/src/nameres/collector.rs:2179` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 3) xtask/src/codegen/grammar.rs:94— xtask/src/codegen/grammar.rs:94-105 | xtask/src/codegen/grammar.rs:207-218 | xtask/src/codegen/grammar.rs:355-366 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `xtask/src/codegen/grammar.rs:94` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (29 lines × 2) crates/ide-db/src/search.rs:312— crates/ide-db/src/search.rs:312-340 | crates/ide-db/src/search.rs:343-371 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-db/src/search.rs:312` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–11 lines × 4) crates/ide-assists/src/handlers/generate_blanket_trait_impl.rs:129— crates/ide-assists/src/handlers/generate_blanket_trait_impl.rs:129-139 | crates/ide-assists/src/handlers/generate_default_from_new.rs:83-91 | crates/ide-assists/src/handlers/generate_delegate_methods.rs:213-222 | crates/ide-assists/src/handlers/generate_impl.rs:18-26 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/generate_blanket_trait_impl.rs:129` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 4) crates/ide-assists/src/handlers/generate_default_from_new.rs:85— crates/ide-assists/src/handlers/generate_default_from_new.rs:85-95 | crates/ide-assists/src/handlers/generate_enum_is_method.rs:90-100 | crates/ide-assists/src/handlers/generate_enum_projection_method.rs:169-179 | crates/ide-assists/src/handlers/generate_single_field_struct_from.rs:145-155 — before extracting anything, compare `crates/ide-assists/src/handlers/generate_enum_is_method.rs` and `crates/ide-assists/src/handlers/generate_enum_projection_method.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/generate_default_from_new.rs:85` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) crates/ide/src/static_index.rs:121— crates/ide/src/static_index.rs:121-131 | crates/rust-analyzer/src/cli/diagnostics.rs:131-141 | crates/rust-analyzer/src/cli/unresolved_references.rs:100-110 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8–11 lines × 2) crates/hir-ty/src/infer/op.rs:211— crates/hir-ty/src/infer/op.rs:211-218 | crates/hir-ty/src/infer/op.rs:222-232 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/infer/op.rs:211` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–11 lines × 2) crates/parser/src/grammar/expressions.rs:710— crates/parser/src/grammar/expressions.rs:710-720 | crates/parser/src/grammar/patterns.rs:407-413 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/parser/src/grammar/expressions.rs:710` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 5) crates/syntax/src/ast/syntax_factory/constructors.rs:167— crates/syntax/src/ast/syntax_factory/constructors.rs:167-176 | crates/syntax/src/ast/syntax_factory/constructors.rs:1574-1583 | crates/syntax/src/ast/syntax_factory/constructors.rs:1801-1810 | crates/syntax/src/ast/syntax_factory/constructors.rs:1869-1878 | crates/syntax/src/ast/syntax_factory/constructors.rs:2203-2212 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:167` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9–10 lines × 4) crates/syntax/src/ast/syntax_factory/constructors.rs:410— crates/syntax/src/ast/syntax_factory/constructors.rs:410-418 | crates/syntax/src/ast/syntax_factory/constructors.rs:1817-1826 | crates/syntax/src/ast/syntax_factory/constructors.rs:1947-1955 | crates/syntax/src/ast/syntax_factory/constructors.rs:2210-2218 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:410` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/syntax/src/ast/syntax_factory/constructors.rs:409` calls `map_children`, `attrs`, `syntax` and `crates/syntax/src/ast/syntax_factory/constructors.rs:2209` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7–10 lines × 2) crates/ide-completion/src/completions.rs:347— crates/ide-completion/src/completions.rs:347-353 | crates/ide-completion/src/completions.rs:370-379 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-completion/src/completions.rs:347` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (4–10 lines × 3) crates/ide/src/hover/render.rs:382— crates/ide/src/hover/render.rs:382-391 | crates/ide/src/hover/render.rs:400-409 | crates/ide/src/hover/render.rs:421-424 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide/src/hover/render.rs:382` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (4–9 lines × 3) crates/hir-ide/src/display.rs:890— crates/hir-ide/src/display.rs:890-893 | crates/hir-ide/src/display.rs:925-933 | crates/hir-ide/src/display.rs:955-963 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ide/src/display.rs:925` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7–9 lines × 2) crates/ide-assists/src/handlers/destructure_struct_binding.rs:230— crates/ide-assists/src/handlers/destructure_struct_binding.rs:230-238 | crates/ide-assists/src/handlers/destructure_tuple_binding.rs:135-141 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/destructure_struct_binding.rs:230` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 6) crates/syntax/src/ast/syntax_factory/constructors.rs:172— crates/syntax/src/ast/syntax_factory/constructors.rs:172-179 | crates/syntax/src/ast/syntax_factory/constructors.rs:1579-1586 | crates/syntax/src/ast/syntax_factory/constructors.rs:1728-1735 | crates/syntax/src/ast/syntax_factory/constructors.rs:1771-1778 | crates/syntax/src/ast/syntax_factory/constructors.rs:1806-1813 | crates/syntax/src/ast/syntax_factory/constructors.rs:1874-1881 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:172` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/syntax/src/ast/syntax_factory/constructors.rs:1737` calls `map_node`, `syntax`, `clone` and `crates/syntax/src/ast/syntax_factory/constructors.rs:1780` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (4–8 lines × 3) crates/hir-ty/src/next_solver/consts/valtree.rs:136— crates/hir-ty/src/next_solver/consts/valtree.rs:136-139 | crates/hir-ty/src/next_solver/consts/valtree.rs:165-172 | crates/hir-ty/src/next_solver/consts/valtree.rs:190-197 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/hir-ty/src/next_solver/consts/valtree.rs:165` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (4–8 lines × 4) crates/rust-analyzer/src/cli/analysis_stats.rs:1505— crates/rust-analyzer/src/cli/analysis_stats.rs:1505-1508 | crates/rust-analyzer/src/cli/analysis_stats.rs:1521-1524 | crates/rust-analyzer/src/cli/analysis_stats.rs:1543-1550 | crates/rust-analyzer/src/cli/analysis_stats.rs:1564-1571 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/cli/analysis_stats.rs:1543` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/rust-analyzer/src/cli/analysis_stats.rs:1541` calls `file_path`, `file_id`, `line_index` and `crates/rust-analyzer/src/cli/analysis_stats.rs:1505` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (2–7 lines × 7) crates/syntax/src/ast/syntax_factory/constructors.rs:594— crates/syntax/src/ast/syntax_factory/constructors.rs:594-600 | crates/syntax/src/ast/syntax_factory/constructors.rs:797-803 | crates/syntax/src/ast/syntax_factory/constructors.rs:851-852 | crates/syntax/src/ast/syntax_factory/constructors.rs:1076-1082 | crates/syntax/src/ast/syntax_factory/constructors.rs:1660-1666 | crates/syntax/src/ast/syntax_factory/constructors.rs:1710-1718 | crates/syntax/src/ast/syntax_factory/constructors.rs:1754-1762 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:594` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `fields` to `impl IntoIterator<Item = ast::Expr>` in one and `impl IntoIterator<Item = ast::RecordExprField>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (7 lines × 4) crates/syntax/src/syntax_editor/edits.rs:60— crates/syntax/src/syntax_editor/edits.rs:60-66 | crates/syntax/src/syntax_editor/edits.rs:76-82 | crates/syntax/src/syntax_editor/edits.rs:94-100 | crates/syntax/src/syntax_editor/edits.rs:106-112 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/syntax_editor/edits.rs:60` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–7 lines × 2) crates/ide-assists/src/handlers/generate_default_from_new.rs:98— crates/ide-assists/src/handlers/generate_default_from_new.rs:98-104 | crates/ide-assists/src/utils.rs:637-642 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/generate_default_from_new.rs:98` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 2) crates/span/src/lib.rs:93— crates/span/src/lib.rs:93-99 | crates/span/src/lib.rs:112-119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/span/src/lib.rs:92` calls `alternate` and `crates/span/src/lib.rs:111` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 9) crates/syntax/src/ast/syntax_factory/constructors.rs:174— crates/syntax/src/ast/syntax_factory/constructors.rs:174-179 | crates/syntax/src/ast/syntax_factory/constructors.rs:650-655 | crates/syntax/src/ast/syntax_factory/constructors.rs:1546-1551 | crates/syntax/src/ast/syntax_factory/constructors.rs:1581-1586 | crates/syntax/src/ast/syntax_factory/constructors.rs:1730-1735 | crates/syntax/src/ast/syntax_factory/constructors.rs:1773-1778 | crates/syntax/src/ast/syntax_factory/constructors.rs:1808-1813 | crates/syntax/src/ast/syntax_factory/constructors.rs:1876-1881 | crates/syntax/src/ast/syntax_factory/constructors.rs:1940-1945 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/syntax/src/ast/syntax_factory/constructors.rs:649` calls `map_children`, `attrs`, `syntax` and `crates/syntax/src/ast/syntax_factory/constructors.rs:173` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (2–6 lines × 10) crates/syntax/src/ast/syntax_factory/constructors.rs:212— crates/syntax/src/ast/syntax_factory/constructors.rs:212-217 | crates/syntax/src/ast/syntax_factory/constructors.rs:882-887 | crates/syntax/src/ast/syntax_factory/constructors.rs:939-944 | crates/syntax/src/ast/syntax_factory/constructors.rs:955-960 | crates/syntax/src/ast/syntax_factory/constructors.rs:984-989 | crates/syntax/src/ast/syntax_factory/constructors.rs:1337-1338 | crates/syntax/src/ast/syntax_factory/constructors.rs:1351-1352 | crates/syntax/src/ast/syntax_factory/constructors.rs:1412-1413 | crates/syntax/src/ast/syntax_factory/constructors.rs:1461-1462 | crates/syntax/src/ast/syntax_factory/constructors.rs:1604-1605 — all 10 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:212` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/syntax/src/ast/syntax_factory/constructors.rs:212` calls `map_node`, `syntax`, `clone` and `crates/syntax/src/ast/syntax_factory/constructors.rs:1337` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 5) crates/syntax/src/ast/syntax_factory/constructors.rs:321— crates/syntax/src/ast/syntax_factory/constructors.rs:321-326 | crates/syntax/src/ast/syntax_factory/constructors.rs:1064-1069 | crates/syntax/src/ast/syntax_factory/constructors.rs:1133-1138 | crates/syntax/src/ast/syntax_factory/constructors.rs:1365-1370 | crates/syntax/src/ast/syntax_factory/constructors.rs:2286-2291 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:321` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (1–6 lines × 5) crates/syntax/src/ast/syntax_factory/constructors.rs:465— crates/syntax/src/ast/syntax_factory/constructors.rs:465-470 | crates/syntax/src/ast/syntax_factory/constructors.rs:1553-1553 | crates/syntax/src/ast/syntax_factory/constructors.rs:1589-1589 | crates/syntax/src/ast/syntax_factory/constructors.rs:1606-1611 | crates/syntax/src/ast/syntax_factory/constructors.rs:1738-1744 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:465` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (2–6 lines × 8) crates/syntax/src/ast/syntax_factory/constructors.rs:57— crates/syntax/src/ast/syntax_factory/constructors.rs:57-58 | crates/syntax/src/ast/syntax_factory/constructors.rs:565-570 | crates/syntax/src/ast/syntax_factory/constructors.rs:605-606 | crates/syntax/src/ast/syntax_factory/constructors.rs:1087-1088 | crates/syntax/src/ast/syntax_factory/constructors.rs:1098-1103 | crates/syntax/src/ast/syntax_factory/constructors.rs:1119-1120 | crates/syntax/src/ast/syntax_factory/constructors.rs:1306-1307 | crates/syntax/src/ast/syntax_factory/constructors.rs:2284-2285 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:57` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (2–6 lines × 6) crates/syntax/src/ast/syntax_factory/constructors.rs:124— crates/syntax/src/ast/syntax_factory/constructors.rs:124-125 | crates/syntax/src/ast/syntax_factory/constructors.rs:463-464 | crates/syntax/src/ast/syntax_factory/constructors.rs:752-757 | crates/syntax/src/ast/syntax_factory/constructors.rs:764-769 | crates/syntax/src/ast/syntax_factory/constructors.rs:902-904 | crates/syntax/src/ast/syntax_factory/constructors.rs:2011-2012 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:752` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/syntax/src/ast/syntax_factory/constructors.rs:752` calls `map_node`, `syntax`, `clone` and `crates/syntax/src/ast/syntax_factory/constructors.rs:124` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (3–6 lines × 3) crates/syntax/src/ast/syntax_factory/constructors.rs:572— crates/syntax/src/ast/syntax_factory/constructors.rs:572-574 | crates/syntax/src/ast/syntax_factory/constructors.rs:1090-1095 | crates/syntax/src/ast/syntax_factory/constructors.rs:1105-1110 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:572` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (3–5 lines × 5) crates/ide/src/highlight_related.rs:315— crates/ide/src/highlight_related.rs:315-319 | crates/ide/src/highlight_related.rs:398-402 | crates/ide/src/highlight_related.rs:505-509 | crates/ide/src/highlight_related.rs:598-602 | crates/ide/src/highlight_related.rs:798-800 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide/src/highlight_related.rs:798` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/ide/src/highlight_related.rs:398` calls `Some`, `original_frange` and `crates/ide/src/highlight_related.rs:798` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (2–5 lines × 4) crates/syntax/src/ast/syntax_factory/constructors.rs:200— crates/syntax/src/ast/syntax_factory/constructors.rs:200-205 | crates/syntax/src/ast/syntax_factory/constructors.rs:606-607 | crates/syntax/src/ast/syntax_factory/constructors.rs:1512-1517 | crates/syntax/src/ast/syntax_factory/constructors.rs:2237-2241 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:200` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/syntax/src/ast/syntax_factory/constructors.rs:200` calls `map_node`, `syntax`, `clone` and `crates/syntax/src/ast/syntax_factory/constructors.rs:606` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (2–5 lines × 9) crates/syntax/src/ast/syntax_factory/constructors.rs:316— crates/syntax/src/ast/syntax_factory/constructors.rs:316-320 | crates/syntax/src/ast/syntax_factory/constructors.rs:1062-1063 | crates/syntax/src/ast/syntax_factory/constructors.rs:1131-1132 | crates/syntax/src/ast/syntax_factory/constructors.rs:1143-1144 | crates/syntax/src/ast/syntax_factory/constructors.rs:1187-1191 | crates/syntax/src/ast/syntax_factory/constructors.rs:1220-1224 | crates/syntax/src/ast/syntax_factory/constructors.rs:1363-1364 | crates/syntax/src/ast/syntax_factory/constructors.rs:1375-1376 | crates/syntax/src/ast/syntax_factory/constructors.rs:2284-2285 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/syntax/src/ast/syntax_factory/constructors.rs:316` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/syntax/src/ast/syntax_factory/constructors.rs:1146` calls `map_node`, `syntax`, `clone` and `crates/syntax/src/ast/syntax_factory/constructors.rs:322` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (3–5 lines × 3) crates/ide-assists/src/handlers/extract_function.rs:1510— crates/ide-assists/src/handlers/extract_function.rs:1510-1514 | crates/ide-assists/src/handlers/extract_function.rs:1529-1533 | crates/ide-assists/src/handlers/extract_function.rs:1535-1537 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/ide-assists/src/handlers/extract_function.rs:1510` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/ide-assists/src/handlers/extract_function.rs:1510` calls `tuple_struct_pat`, `once`, `into` and `crates/ide-assists/src/handlers/extract_function.rs:1535` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (3–5 lines × 4) crates/rust-analyzer/src/cli/analysis_stats.rs:1500— crates/rust-analyzer/src/cli/analysis_stats.rs:1500-1504 | crates/rust-analyzer/src/cli/analysis_stats.rs:1516-1520 | crates/rust-analyzer/src/cli/analysis_stats.rs:1538-1540 | crates/rust-analyzer/src/cli/analysis_stats.rs:1559-1561 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rust-analyzer/src/cli/analysis_stats.rs:1500` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/rust-analyzer/src/cli/analysis_stats.rs:1504` calls `to_node`, `syntax`, `clone` and `crates/rust-analyzer/src/cli/analysis_stats.rs:1540` does not — after which the two agree again for 5 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 4) crates/hir-ty/src/next_solver/infer/at.rs:213— crates/hir-ty/src/next_solver/infer/at.rs:213-218 | crates/hir-ty/src/next_solver/infer/at.rs:228-233 | crates/hir-ty/src/next_solver/infer/mod.rs:1330-1335 | crates/hir-ty/src/next_solver/infer/mod.rs:1345-1350 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Note first that the copies are not typed on the same thing: the declarations holding them bind `a` to `Self` in one and `Ty<'db>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (6 lines × 8) crates/hir-ty/src/mir/eval/shim.rs:825— crates/hir-ty/src/mir/eval/shim.rs:825-830 | crates/hir-ty/src/mir/eval/shim.rs:847-852 | crates/hir-ty/src/mir/eval/shim.rs:876-881 | crates/hir-ty/src/mir/eval/shim.rs:887-892 | crates/hir-ty/src/mir/eval/shim.rs:899-904 | crates/hir-ty/src/mir/eval/shim.rs:911-916 | crates/hir-ty/src/mir/eval/shim.rs:923-928 | crates/hir-ty/src/mir/eval/shim.rs:937-942 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 4) crates/parser/src/lexed_str.rs:365— crates/parser/src/lexed_str.rs:365-369 | crates/parser/src/lexed_str.rs:377-381 | crates/parser/src/lexed_str.rs:389-393 | crates/parser/src/lexed_str.rs:403-407 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/parser/src/lexed_str.rs:365` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Unstable project test-fixture — test-fixture has instability 0.90 with 1 dependents.
P12 · CI test-gate honesty· Coverage collected but not gated · ×1
Coverage collected but not gated — CI collects a coverage report but no step enforces a minimum — coverage could halve and CI stays green. Add a step that fails the build when coverage drops below a floor (your coverage tool's minimum-threshold flag, or a coverage-gate action) so the number guards something. What was searched, so you can tell an absence from a miss: this repository's CI files AND its coverage configuration — the well-known coverage and test-runner config files, read at the repository root and inside workspace package directories two levels down, so a floor declared beside the tests rather than in the pipeline is credited — matched against the threshold settings this check knows by name. A floor set in your coverage service's web UI rather than in a committed file, or under a setting whose name is not one of those, is not seen here.
Duplicated block (36 lines × 2 locations) editors/code/src/commands.ts:210— editors/code/src/commands.ts:210 · editors/code/src/commands.ts:247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34 lines × 2 locations) editors/code/src/commands.ts:722— editors/code/src/commands.ts:722 · editors/code/src/commands.ts:786 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (16 lines × 3 locations) editors/code/src/commands.ts:622— editors/code/src/commands.ts:622 · editors/code/src/commands.ts:727 · editors/code/src/commands.ts:791 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 2 locations) editors/code/src/commands.ts:648— editors/code/src/commands.ts:648 · editors/code/src/commands.ts:817 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (11 lines × 2 locations) editors/code/src/commands.ts:102— editors/code/src/commands.ts:102 · editors/code/src/commands.ts:279 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (10 matched lines × 2 locations) · ×1
Duplicated block with local edits (10 matched lines × 2 locations) REDACTED:203— REDACTED:203 · editors/code/src/ctx.ts:223 — the two spans are one implementation copied and then locally edited — 58 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (10 lines × 4 locations) editors/code/src/commands.ts:55— editors/code/src/commands.ts:55 · editors/code/src/commands.ts:770 · editors/code/src/commands.ts:836 · editors/code/src/commands.ts:949 — all 4 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (8 lines × 2 locations) editors/code/src/commands.ts:767— editors/code/src/commands.ts:767 · editors/code/src/commands.ts:833 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Complex function getDebugConfiguration (cyclomatic 20, cognitive 28) editors/code/src/debug.ts:81— getDebugConfiguration has cyclomatic complexity 20 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function toggleCheckOnSave (cyclomatic 16, cognitive 15) editors/code/src/config.ts:305— toggleCheckOnSave has cyclomatic complexity 16 and cognitive complexity 15; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function getServer (cyclomatic 15, cognitive 25) REDACTED:36— getServer has cyclomatic complexity 15 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 15, cognitive 21) editors/code/src/client.ts:60— (anonymous) has cyclomatic complexity 15 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function substituteVariablesInEnv (cyclomatic 13, cognitive 20) editors/code/src/config.ts:482— substituteVariablesInEnv has cyclomatic complexity 13 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files· editors/code/src/commands.ts · ×1
editors/code/src/commands.ts: 1400 lines of code editors/code/src/commands.ts:1— editors/code/src/commands.ts has 1400 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
editors/code/src/ctx.ts: 572 lines of code editors/code/src/ctx.ts:1— editors/code/src/ctx.ts has 572 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
editors/code/src/config.ts: 546 lines of code editors/code/src/config.ts:1— editors/code/src/config.ts has 546 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
Unused dependency 'tslib' — Declared in editors/code/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
SC1 · Supply-chain hygiene· JavaScript dependencies are not locked · ×1
JavaScript dependencies are not locked .github/actions/github-release/package.json:5— .github/actions/github-release/package.json declares dependencies that no committed lockfile resolves — there is no REDACTED / yarn.lock / pnpm-lock.yaml / bun.lock beside it, and no locked workspace above it names it — so its installs aren't reproducible (SSDF PW.4.4). Commit its package manager's lockfile (or add it to the locked workspace) and install from it (`npm ci`, `yarn --immutable`, `pnpm i --frozen-lockfile` or `bun i --frozen-lockfile`). Advisory — never scored.
Interpolated log message defeats structured logging crates/vfs-notify/src/lib.rs:372— `warn!` at line 372 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/stdx/src/tempfile.rs:43— `info!` at line 43 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/stdx/src/tempfile.rs:67— `info!` at line 67 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/config.rs:1216— `info!` at line 1216 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/config.rs:1240— `info!` at line 1240 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/config.rs:1318— `info!` at line 1318 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/config.rs:1360— `info!` at line 1360 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/config.rs:1807— `info!` at line 1807 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/config.rs:1809— `error!` at line 1809 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/config.rs:2302— `error!` at line 2302 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/config.rs:3665— `warn!` at line 3665 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/config.rs:3694— `warn!` at line 3694 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/flycheck.rs:692— `error!` at line 692 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/global_state.rs:511— `error!` at line 511 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/main_loop.rs:42— `info!` at line 42 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/main_loop.rs:633— `warn!` at line 633 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/main_loop.rs:691— `trace!` at line 691 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `trace!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/main_loop.rs:787— `trace!` at line 787 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `trace!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/main_loop.rs:885— `error!` at line 885 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/main_loop.rs:941— `error!` at line 941 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/main_loop.rs:1238— `error!` at line 1238 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/reload.rs:712— `info!` at line 712 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/reload.rs:721— `error!` at line 721 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/session.rs:42— `info!` at line 42 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/rust-analyzer/src/session.rs:54— `info!` at line 54 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Orphaned file crates/ide-assists/src/handlers/convert_comment_from_or_to_doc.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/ide-assists/src/handlers/toggle_async_sugar.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file editors/code/src/syntax_tree_provider.ts:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/ide-assists/src/handlers/remove_unused_param.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/ide/src/inlay_hints/generic_param.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/ide-assists/src/handlers/move_module_to_file.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/ide-assists/src/handlers/generate_constant.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/hir-ty/src/next_solver/infer/snapshot/undo_log.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file editors/code/src/diagnostics.ts:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/ide-assists/src/handlers/convert_from_to_tryfrom.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/ide-db/src/assists.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/hir-ty/src/next_solver/infer/opaque_types/table.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file editors/code/src/dependencies_provider.ts:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file xtask/src/publish.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/ide-ssr/src/nester.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/parser/test_data/parser/ok/0035_weird_exprs.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/hir-ty/src/next_solver/infer/relate/higher_ranked.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/rust-analyzer/src/cli/parse.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/ide-assists/src/handlers/unwrap_type_to_generic_arg.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/ide/src/child_modules.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/ide-assists/src/handlers/convert_char_literal.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/syntax/src/syntax_node.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/rust-analyzer/src/tracing/json.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Silent fallback default on Err crates/hir/src/lib.rs:3050— `params` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/hir/src/lib.rs:3070— `lifetime_params` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/hir/src/lib.rs:3082— `type_or_const_params` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/hir/src/semantics.rs:1981— `get_unsafe_ops` turns every `Err` into `Default::default()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/hir-ty/src/next_solver/interner.rs:1795— `opaque_types_defined_by` turns every `Err` into `SolverDefIds::default()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/hir-ty/src/next_solver/interner.rs:1806— `opaque_types_and_coroutines_defined_by` turns every `Err` into `SolverDefIds::default()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/ide-assists/src/utils.rs:771— `type_to_string` turns every `Err` into `"_".to_owned()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/proc-macro-api/src/process.rs:119— `spawn` turns every `Err` into `"unknown version".to_owned()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/rust-analyzer/src/cli/analysis_stats.rs:1501— `location_csv_expr` turns every `Err` into `"synthetic,,".to_owned()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/rust-analyzer/src/cli/analysis_stats.rs:1517— `location_csv_pat` turns every `Err` into `"synthetic,,".to_owned()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 14 significant file(s) lose their only recent owner: crates/hir-ty/src/next_solver/infer/region_constraints/mod.rs, crates/hir-ty/src/infer/fallback.rs, crates/ide-diagnostics/src/handlers/generic_args_prohibited.rs, crates/hir-def/src/upvars.rs, crates/ide-diagnostics/src/handlers/inactive_code.rs, crates/macros/src/lib.rs, crates/ide-diagnostics/src/handlers/field_shorthand.rs, crates/parser/src/grammar/params.rs (+6 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 7 significant file(s) lose their only recent owner: crates/ide/src/inlay_hints/closure_captures.rs, crates/rust-analyzer/src/session.rs, crates/ide/src/inlay_hints/discriminant.rs, crates/stdx/src/macros.rs, crates/ide/src/predicate_eval.rs, crates/vfs/src/file_set/tests.rs, crates/hir-ty/src/solver_errors.rs. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 4 significant file(s) lose their only recent owner: crates/ide-completion/src/context/tests.rs, crates/ide-assists/src/handlers/add_return_type.rs, crates/ide-completion/src/completions/mod_.rs, crates/ide-assists/src/handlers/generate_is_empty_from_len.rs. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 3 significant file(s) lose their only recent owner: crates/ide-assists/src/handlers/introduce_named_lifetime.rs, crates/ide-assists/src/handlers/move_const_to_impl.rs, crates/proc-macro-api/src/pool.rs. Pair on, review, or document these before any departure.
Duplicated predicate crates/hir-expand/src/attrs.rs:325— `char_range.len() == 1 && char_range.start == prev_end` appears character-identically in 2 files — crates/hir-expand/src/attrs.rs, crates/syntax/src/ast/token_ext.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate crates/ide-assists/src/handlers/add_missing_impl_members.rs:212— `func.syntax().descendants().find_map(ast::MacroCall::cast) && m.syntax().text() == "todo!()"` appears character-identically in 2 files — crates/ide-assists/src/handlers/add_missing_impl_members.rs, crates/ide-assists/src/handlers/replace_derive_with_manual_impl.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate crates/hir-ty/src/infer/callee.rs:53— `result.is_none() && autoderef.next().is_some()` appears character-identically in 2 files — crates/hir-ty/src/infer/callee.rs, crates/hir-ty/src/infer/place_op.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
P10 · Library API & versioning· Implementation type on the public API · ×2
Implementation type on the public API crates/hir/src/diagnostics.rs:523— 1 public type in `hir.diagnostics` is marked as implementation by its own namespace, folder or name: `IncoherentImpl` (crates/hir/src/diagnostics.rs:523, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
Implementation type on the public API crates/hir/src/semantics.rs:171— 1 public type in `hir.semantics` is marked as implementation by its own namespace, folder or name: `SemanticsImpl` (crates/hir/src/semantics.rs:171, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 9 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (37 single-owned of 751 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 751 of the 1439 production source files in this repository met that bar). They are anonymized user #5 (1 file(s)), anonymized user #6 (1 file(s)), anonymized user #7 (1 file(s)), anonymized user #8 (1 file(s)), anonymized user #9 (1 file(s)), anonymized user #10 (1 file(s)) (+3 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: crates/ide/src/move_item.rs, editors/code/src/new_project.ts, crates/stdx/src/variance.rs, crates/syntax/src/tests.rs, crates/ide/src/matching_brace.rs, crates/rust-analyzer/src/line_index.rs, crates/rust-analyzer/src/cli/parse.rs, crates/ide-diagnostics/src/handlers/unary_operator_cannot_be_applied.rs (+1 more).
Documentation: no build, run or usage example README.md:1— the repository holds project manifests and neither `README.md` nor the documents it links hold a code block or a command. Show the command that builds or runs it, or a usage snippet.
No ADRs found lib/ungrammar/ungrammar2json/src/main.rs:1— No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `lib/ungrammar/ungrammar2json/src/main.rs` makes this repository a deployable product (line 1).
redundant comment editors/code/src/commands.ts:1152— "is a snippet text edit" repeats the code it sits on: 3 of its 3 words (snippet, text, edit) are already in `snippetTextEdits.push(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 8 of 43 project(s) overshoot their size bounds, lowering Project Cohesion to 6.3/10. The most over is `crates/ide-assists` (97954 LoC, 142 module-visible types across 3 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D34 · Knowledge Freshness· Further orphaned files (smaller) · ×1
Further orphaned files (smaller) — 23 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: crates/ide-assists/src/handlers/convert_comment_from_or_to_doc.rs, crates/ide-assists/src/handlers/toggle_async_sugar.rs, editors/code/src/syntax_tree_provider.ts, crates/ide-assists/src/handlers/remove_unused_param.rs, crates/ide/src/inlay_hints/generic_param.rs, crates/ide-assists/src/handlers/move_module_to_file.rs, crates/ide-assists/src/handlers/generate_constant.rs, crates/hir-ty/src/next_solver/infer/snapshot/undo_log.rs (and 15 more) (26 orphaned of 751 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 751 of the 1439 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
Logging is not universal — Only 24/31 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `crates/mbe`, `crates/proc-macro-srv-cli`, `crates/syntax-bridge`, `crates/test-utils`, `lib/expect-test/xtask` and 2 more.
No dependency-update automation .github/actions/github-release/package.json:5— `.github/actions/github-release/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
R7 · Dead Code· Unused export 'fetchDependencyGraph' · ×1
Unused export 'fetchDependencyGraph' editors/code/src/lsp_ext.ts:160— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'unwrapNullable' · ×1
Unused export 'unwrapNullable' REDACTED:236— Nothing imports this binding — it is safe to review for removal.
Null assertions (`!`) override strict null checking — ~1.7 `!` null assertions per 1k TypeScript source lines — 12 assertion(s) across the 7054 source line(s) of the 20 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: editors/code/src/dependencies_provider.ts (3), editors/code/src/client.ts (2), editors/code/src/commands.ts (2). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
Silent fallback default in catch lib/smol_str/src/gdb_smolstr_printer.py:54— `to_string` swallows every exception into `return '<SmolStr: missing __0>'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Outdated: anyhow — `anyhow` is locked at 1.0.102 but 1.0.104 is the current stable release on crates.io, and it already satisfies the `"1.0.98"` requirement declared in xtask/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p anyhow` and commit the updated REDACTED.
Outdated: arbitrary — `arbitrary` is locked at 1.4.2 but 1.5.0 is the current stable release on crates.io, and it already satisfies the `"1.3"` requirement declared in lib/smol_str/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p arbitrary` and commit the updated REDACTED.
Outdated: arrayvec — `arrayvec` is locked at 0.7.6 but 0.7.8 is the current stable release on crates.io, and it already satisfies the `"0.7.6"` requirement declared in crates/hir-def/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p arrayvec` and commit the updated REDACTED.
Outdated: backtrace — `backtrace` is locked at 0.3.76 but 0.3.77 is the current stable release on crates.io, and it already satisfies the `"0.3.75"` requirement declared in crates/stdx/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p backtrace` and commit the updated REDACTED.
Outdated: bitflags — `bitflags` is locked at 2.12.1 but 2.13.2 is the current stable release on crates.io, and it already satisfies the `"2.9.1"` requirement declared in crates/hir-def/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bitflags` and commit the updated REDACTED.
Outdated: borsh — `borsh` is locked at 1.6.1 but 1.8.1 is the current stable release on crates.io, and it already satisfies the `"1.4.0"` requirement declared in lib/smol_str/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p borsh` and commit the updated REDACTED.
Outdated: camino — `camino` is locked at 1.2.2 but 1.2.6 is the current stable release on crates.io, and it already satisfies the `"1.2.2"` requirement declared in crates/paths/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p camino` and commit the updated REDACTED.
Outdated: clap — `clap` is locked at 4.6.1 but 4.6.7 is the current stable release on crates.io, and it already satisfies the `"4.5.42"` requirement declared in crates/proc-macro-srv-cli/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap` and commit the updated REDACTED.
Outdated: crossbeam-channel — `crossbeam-channel` is locked at 0.5.15 but 0.5.17 is the current stable release on crates.io, and it already satisfies the `"0.5.15"` requirement declared in crates/ide-db/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p crossbeam-channel` and commit the updated REDACTED.
Outdated: crossbeam-utils — `crossbeam-utils` is locked at 0.8.21 but 0.8.23 is the current stable release on crates.io, and it already satisfies the `"0.8.21"` requirement declared in crates/stdx/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p crossbeam-utils` and commit the updated REDACTED.
Outdated: either — `either` is locked at 1.16.0 but 1.19.0 is the current stable release on crates.io, and it already satisfies the `"1.15.0"` requirement declared in xtask/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p either` and commit the updated REDACTED.
Outdated: flate2 — `flate2` is locked at 1.1.9 but 1.1.11 is the current stable release on crates.io, and it already satisfies the `"1.1.2"` requirement declared in xtask/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p flate2` and commit the updated REDACTED.
Outdated: indexmap — `indexmap` is locked at 2.14.0 but 2.14.2 is the current stable release on crates.io, and it already satisfies the `"2.9.0"` requirement declared in crates/base-db/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p indexmap` and commit the updated REDACTED.
Outdated: libc — `libc` is locked at 0.2.186 but 0.2.191 is the current stable release on crates.io, and it already satisfies the `"0.2.172"` requirement declared in crates/profile/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p libc` and commit the updated REDACTED.
Outdated: log — `log` is locked at 0.4.31 but 0.4.35 is the current stable release on crates.io, and it already satisfies the `"0.4.27"` requirement declared in lib/lsp-server/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p log` and commit the updated REDACTED.
Outdated: memchr — `memchr` is locked at 2.8.1 but 2.8.3 is the current stable release on crates.io, and it already satisfies the `"2.7.5"` requirement declared in crates/ide-db/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p memchr` and commit the updated REDACTED.
Outdated: notify — `notify` is locked at 8.2.1 but 8.2.2 is the current stable release on crates.io, and it already satisfies the `"8.2.0"` requirement declared in crates/vfs-notify/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p notify` and commit the updated REDACTED.
Outdated: proc-macro2 — `proc-macro2` is locked at 1.0.106 but 1.0.107 is the current stable release on crates.io, and it already satisfies the `"1.0.95"` requirement declared in xtask/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p proc-macro2` and commit the updated REDACTED.
Outdated: quote — `quote` is locked at 1.0.45 but 1.0.47 is the current stable release on crates.io, and it already satisfies the `"1.0.40"` requirement declared in xtask/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p quote` and commit the updated REDACTED.
Outdated: rustc-hash — `rustc-hash` is locked at 2.1.2 but 2.1.3 is the current stable release on crates.io, and it already satisfies the `"2.1.1"` requirement declared in crates/base-db/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p rustc-hash` and commit the updated REDACTED.
Outdated: serde — `serde` is locked at 1.0.228 but 1.0.229 is the current stable release on crates.io, and it already satisfies the `"1.0.219"` requirement declared in crates/hir-ty/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde` and commit the updated REDACTED.
Outdated: serde_core — `serde_core` is locked at 1.0.228 but 1.0.229 is the current stable release on crates.io, and it already satisfies the `"1.0.220"` requirement declared in lib/smol_str/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde_core` and commit the updated REDACTED.
Outdated: serde_derive — `serde_derive` is locked at 1.0.228 but 1.0.229 is the current stable release on crates.io, and it already satisfies the `"1.0.219"` requirement declared in crates/hir-ty/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde_derive` and commit the updated REDACTED.
Outdated: serde_json — `serde_json` is locked at 1.0.150 but 1.0.154 is the current stable release on crates.io, and it already satisfies the `"1.0.140"` requirement declared in crates/hir/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde_json` and commit the updated REDACTED.
Outdated: smallvec — `smallvec` is locked at 1.15.1 but 1.16.5 is the current stable release on crates.io, and it already satisfies the `"1.15.1"` requirement declared in crates/hir-def/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p smallvec` and commit the updated REDACTED.
+ 5 more in this group — see findings.md.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a1da9b-9923-7265-926b-4fa4cb86c787 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 23 · Warnings: 2979 · Recommendations: 100 · Info: 30 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 14-11-2026 @ 15:09 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.