Public report of huggingface/candle, 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, 06:38 UTC · Survey ID cd_6553695d1e924f18aa4f1c1e5ceb4317
huggingface/candle
Measured 14 November 2026, 06:35 UTC, at code version cfcbd71
CAI scoreWeak
CriticalWeakAdequateStrongExemplary
Down 7 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: 155,929 lines of product code in 13 projects, tests not counted · Estimated rebuild effort: about 1.2 person-years · Weakest lens: Accessibility, 28
Findings by how serious they are
43 critical2170 serious259 minor
17 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, 06:35 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.
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 ▸
54of 54 dimensions measured by tools.
2456of 2472 findings point to an exact file and line, so you can open each one in the code. The other 16 concern the repository as a whole, such as missing documentation.
54dimensions across 7 lenses, read from 155,929 lines of product code in 13 projects.
huggingface/candle falls short of our standard for a preview release because it has images with no text description and controls that only work with a mouse. It scores 43 out of 100 and is rated Weak, and four of its 43 critical findings are security problems in the build pipeline and in its automatic dependency updates.
Accessibility, at 28, is the weakest lens and counts most in the score. The best first steps are adding text alternatives and making the controls keyboard-usable, each worth about 6 points. Raising Accessibility to 65 would lift the score to about 54.
Fifteen images have no description for people who can't see them. Five controls can't be used without a mouse, and six form fields can't be read by a screen reader. Making the controls work with a keyboard, describing the images and labelling the form fields would close these risks. Pinning each tool to an exact version would fix the two pipeline tools referenced by a changeable name, and setting a waiting period for automatic updates would deal with the automatic dependency update that takes a new release at once. The ten pages that don't say their language need their language set.
The product code is 155,929 lines, about €180,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.
If Accessibility rose from 28 to 65, the lowest score rated Strong, the score would rise from 43 to about 54.
Code composition: what the lines of code are
Product code 75%Tests 25%
New since the last survey: 742 findings
These 742 critical or serious findings weren't in the previous survey, on 26 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
God Classes · MethodTooLong: QMetalStorage.indexed_moe_forward candle-core/src/quantized/metal/moe.rs
God Classes · FunctionTooLong: candle_metal_kernels::kernels::quantized_moe::call_quantized_moe candle-metal-kernels/src/kernels/quantized_moe.rs
Code Duplication · Near-duplicate member family (16 members, 14 shared lines) candle-transformers/src/models/based.rs
Code Duplication · Near-duplicate member family (7 members, 21 shared lines) candle-core/src/quantized/neon.rs
Code Duplication · Near-duplicate member family (6 members, 13 shared lines) candle-nn/src/attention/cpu_flash/causal.rs
Code Duplication · Near-duplicate member family (6 members, 13 shared lines) candle-transformers/src/models/olmo.rs
Code Duplication · Near-duplicate member family (5 members, 32 shared lines) candle-nn/src/attention/cpu_flash/causal.rs
Code Duplication · Near-duplicate member family (5 members, 18 shared lines) candle-transformers/src/models/granite.rs
Code Duplication · Near-duplicate member family (4 members, 64 shared lines) candle-flash-attn-v3/src/lib.rs
Code Duplication · Near-duplicate member family (4 members, 35 shared lines) candle-transformers/src/models/quantized_rwkv_v5.rs
Code Duplication · Near-duplicate member family (4 members, 32 shared lines) candle-transformers/src/models/paddleocr_vl/mod.rs
Code Duplication · Near-duplicate member family (4 members, 10 shared lines) candle-core/src/cuda_backend/mod.rs
Code Duplication · Near-duplicate member family (4 members, 9 shared lines) candle-core/src/cuda_backend/mod.rs
Code Duplication · Near-duplicate member family (3 members, 15 shared lines) candle-core/src/quantized/k_quants.rs
Code Duplication · Near-duplicate member pair (115 shared lines) candle-transformers/src/models/quantized_t5.rs
Code Duplication · Near-duplicate member pair (78 shared lines) candle-core/src/cpu_backend/mod.rs
Code Duplication · Near-duplicate member pair (61 shared lines) candle-core/src/quantized/k_quants.rs
Code Duplication · Near-duplicate member pair (59 shared lines) candle-core/src/cuda_backend/cudnn.rs
Code Duplication · Near-duplicate member pair (54 shared lines) candle-core/src/quantized/neon.rs
Code Duplication · Near-duplicate member pair (37 shared lines) candle-core/src/metal_backend/mod.rs
Code Duplication · Near-duplicate member pair (36 shared lines) candle-core/src/quantized/avx.rs
Code Duplication · Near-duplicate member pair (33 shared lines) candle-core/src/cuda_backend/mod.rs
Code Duplication · Near-duplicate member pair (28 shared lines) candle-transformers/src/models/quantized_phi.rs
Code Duplication · Near-duplicate member pair (28 shared lines) candle-nn/src/attention/cpu_flash/causal.rs
Code Duplication · Near-duplicate member pair (26 shared lines) candle-transformers/src/models/paddleocr_vl/vision.rs
Code Duplication · Near-duplicate member pair (25 shared lines) candle-core/src/quantized/neon.rs
Code Duplication · Near-duplicate member pair (25 shared lines) candle-core/src/quantized/neon.rs
Code Duplication · Edited copy of a member (42 corresponding lines) candle-transformers/src/models/llama2_c.rs
Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) candle-nn/src/ops.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) candle-core/src/cuda_backend/mod.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) candle-core/src/tensor.rs
Code Duplication · Edited copy of a member (101 corresponding lines) candle-transformers/src/models/stable_diffusion/uni_pc.rs
Code Duplication · Edited copy of a member (71 corresponding lines) candle-core/src/quantized/k_quants.rs
Code Duplication · Edited copies of one member (3 members, 65+ corresponding lines) candle-nn/src/rotary_emb.rs
Code Duplication · Edited copy of a member (72 corresponding lines) candle-core/src/metal_backend/mod.rs
Code Duplication · Edited copy of a member (56 corresponding lines) candle-transformers/src/models/mpt.rs
Code Duplication · Edited copy of a member (79 corresponding lines) candle-core/src/quantized/neon.rs
Code Duplication · Edited copy of a member (86 corresponding lines) candle-transformers/src/models/fastvit.rs
Code Duplication · Edited copy of a member (71 corresponding lines) candle-core/src/safetensors.rs
Code Duplication · Edited copy of a member (70 corresponding lines) candle-transformers/src/models/lfm2.rs
Code Duplication · Edited copy of a member (63 corresponding lines) candle-core/src/cpu_backend/mod.rs
Code Duplication · Edited copy of a member (82 corresponding lines) candle-core/src/metal_backend/mod.rs
Code Duplication · Edited copy of a member (36 corresponding lines) candle-core/src/cpu_backend/mod.rs
Code Duplication · Edited copy of a member (34 corresponding lines) candle-core/src/cpu_backend/mod.rs
Code Duplication · Edited copy of a member (62 corresponding lines) candle-transformers/src/models/quantized_glm4.rs
Code Duplication · Edited copy of a member (54 corresponding lines) candle-core/src/quantized/cuda.rs
Code Duplication · Edited copy of a member (61 corresponding lines) candle-core/src/cpu_backend/mod.rs
Code Duplication · Edited copy of a member (100 corresponding lines) candle-transformers/src/models/mimi/seanet.rs
Code Duplication · Edited copy of a member (50 corresponding lines) candle-core/src/metal_backend/mod.rs
Code Duplication · Edited copies of one member (3 members, 20+ corresponding lines) candle-core/src/cpu_backend/utils.rs
Code Duplication · Edited copy of a member (54 corresponding lines) candle-transformers/src/models/llama2_c_weights.rs
Code Duplication · Edited copies of one member (3 members, 39+ corresponding lines) candle-core/src/cpu_backend/mod.rs
Code Duplication · Edited copy of a member (54 corresponding lines) candle-core/src/cuda_backend/device.rs
Code Duplication · Edited copy of a member (43 corresponding lines) candle-core/src/quantized/repack_x86.rs
Code Duplication · Edited copies of one member (3 members, 58+ corresponding lines) candle-core/src/cuda_backend/device.rs
Code Duplication · Edited copy of a member (40 corresponding lines) candle-core/src/metal_backend/mod.rs
Code Duplication · Edited copy of a member (58 corresponding lines) candle-transformers/src/models/paddleocr_vl/vision.rs
Code Duplication · Edited copies of one member (3 members, 34+ corresponding lines) candle-transformers/src/models/chinese_clip/vision_model.rs
Code Duplication · Edited copy of a member (34 corresponding lines) candle-transformers/src/models/resnet.rs
Code Duplication · Edited copy of a member (19 corresponding lines) candle-core/src/cpu_backend/utils.rs
Code Duplication · Edited copy of a member (38 corresponding lines) candle-core/src/quantized/simd128.rs
Code Duplication · Edited copy of a member (33 corresponding lines) candle-core/src/quantized/repack_x86.rs
Code Duplication · Edited copy of a member (22 corresponding lines) candle-core/src/quantized/repack_x86.rs
Code Duplication · Edited copy of a member (36 corresponding lines) candle-core/src/cpu_backend/mod.rs
Code Duplication · Edited copy of a member (41 corresponding lines) candle-transformers/src/models/whisper/model.rs
Code Duplication · Edited copy of a member (37 corresponding lines) candle-core/src/quantized/k_quants.rs
Code Duplication · Edited copy of a member (25 corresponding lines) candle-transformers/src/models/metavoice.rs
Code Duplication · Edited copies of one member (3 members, 14+ corresponding lines) candle-core/src/cuda_backend/utils.rs
Code Duplication · Edited copy of a member (35 corresponding lines) candle-transformers/src/models/metavoice.rs
Code Duplication · Edited copy of a member (31 corresponding lines) candle-transformers/src/models/jina_bert.rs
Code Duplication · Edited copy of a member (48 corresponding lines) candle-core/src/cpu_backend/mod.rs
Code Duplication · Edited copy of a member (24 corresponding lines) candle-datasets/src/vision/cifar.rs
Code Duplication · Edited copies of one member (3 members, 31+ corresponding lines) candle-core/src/cuda_backend/mod.rs
Code Duplication · Edited copy of a member (29 corresponding lines) candle-transformers/src/models/quantized_llama.rs
Code Duplication · Edited copy of a member (25 corresponding lines) candle-core/src/cuda_backend/mod.rs
Code Duplication · Edited copy of a member (25 corresponding lines) candle-transformers/src/models/pixtral/vision_model.rs
Code Duplication · Edited copy of a member (35 corresponding lines) candle-transformers/src/models/quantized_t5.rs
Code Duplication · Edited copy of a member (41 corresponding lines) candle-core/src/metal_backend/mod.rs
Code Duplication · Edited copy of a member (18 corresponding lines) candle-core/src/cuda_backend/utils.rs
Code Duplication · Edited copies of one member (3 members, 43+ corresponding lines) candle-core/src/cuda_backend/mod.rs
Code Duplication · Edited copy of a member (40 corresponding lines) candle-transformers/src/models/z_image/transformer.rs
Code Duplication · Edited copy of a member (41 corresponding lines) candle-core/src/metal_backend/mod.rs
Code Duplication · Edited copy of a member (31 corresponding lines) candle-core/src/tensor.rs
Code Duplication · Edited copy of a member (38 corresponding lines) candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs
Code Duplication · Edited copy of a member (58 corresponding lines) candle-transformers/src/models/z_image/vae.rs
Code Duplication · Edited copy of a member (23 corresponding lines) candle-datasets/src/vision/cifar.rs
Code Duplication · Edited copy of a member (46 corresponding lines) candle-metal-kernels/src/kernels/reduce.rs
Code Duplication · Edited copy of a member (22 corresponding lines) candle-core/src/quantized/repack_x86.rs
Code Duplication · Edited copies of one member (3 members, 22+ corresponding lines) candle-transformers/src/models/dinov2.rs
Code Duplication · Edited copy of a member (23 corresponding lines) candle-transformers/src/models/quantized_lfm2.rs
Code Duplication · Edited copies of one member (3 members, 22+ corresponding lines) candle-transformers/src/models/bert.rs
Code Duplication · Edited copy of a member (22 corresponding lines) candle-core/src/quantized/cuda.rs
Code Duplication · Edited copies of one member (3 members, 25+ corresponding lines) candle-transformers/src/models/vgg.rs
Code Duplication · Edited copy of a member (28 corresponding lines) candle-transformers/src/models/bert.rs
Code Duplication · Edited copy of a member (47 corresponding lines) candle-core/src/cuda_backend/device.rs
Code Duplication · Edited copies of one member (5 members, 31+ corresponding lines) candle-transformers/src/models/convnext.rs
Code Duplication · Edited copies of one member (3 members, 25+ corresponding lines) candle-core/src/storage.rs
Code Duplication · Edited copy of a member (20 corresponding lines) candle-nn/src/rnn.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: 307 findings
These 307 critical or serious findings were in the previous survey, on 26 October 2026, and are gone from this one. The first 100 are listed here.
Code Duplication · Near-duplicate member family (14 members, 20 shared lines) candle-transformers/src/models/based.rs
Code Duplication · Near-duplicate member family (5 members, 18 shared lines) candle-transformers/src/models/granite.rs
Code Duplication · Near-duplicate member family (4 members, 42 shared lines) candle-flash-attn-v3/src/lib.rs
Code Duplication · Near-duplicate member family (4 members, 25 shared lines) candle-transformers/src/models/quantized_rwkv_v5.rs
Code Duplication · Near-duplicate member family (4 members, 22 shared lines) candle-transformers/src/models/paddleocr_vl/mod.rs
Code Duplication · Near-duplicate member family (4 members, 14 shared lines) candle-core/src/quantized/k_quants.rs
Code Duplication · Near-duplicate member family (4 members, 10 shared lines) candle-core/src/cuda_backend/mod.rs
Code Duplication · Near-duplicate member family (4 members, 9 shared lines) candle-core/src/cuda_backend/mod.rs
Code Duplication · Near-duplicate member family (3 members, 39 shared lines) candle-nn/src/rotary_emb.rs
Code Duplication · Near-duplicate member family (3 members, 15 shared lines) candle-transformers/src/models/chatglm.rs
Code Duplication · Near-duplicate member family (3 members, 15 shared lines) candle-transformers/src/models/granite.rs
Code Duplication · Near-duplicate member pair (97 shared lines) candle-transformers/src/models/quantized_t5.rs
Code Duplication · Near-duplicate member pair (74 shared lines) candle-core/src/cpu_backend/mod.rs
Code Duplication · Near-duplicate member pair (59 shared lines) candle-core/src/cuda_backend/cudnn.rs
Code Duplication · Near-duplicate member pair (54 shared lines) candle-core/src/quantized/k_quants.rs
Code Duplication · Near-duplicate member pair (49 shared lines) candle-core/src/quantized/k_quants.rs
Code Duplication · Near-duplicate member pair (46 shared lines) candle-transformers/src/models/mpt.rs
Code Duplication · Near-duplicate member pair (42 shared lines) candle-core/src/quantized/neon.rs
Code Duplication · Near-duplicate member pair (37 shared lines) candle-core/src/metal_backend/mod.rs
Code Duplication · Near-duplicate member pair (35 shared lines) candle-transformers/src/models/llama2_c.rs
Code Duplication · Near-duplicate member pair (33 shared lines) candle-transformers/src/models/metavoice.rs
Code Duplication · Near-duplicate member pair (29 shared lines) candle-core/src/cuda_backend/mod.rs
Code Duplication · Near-duplicate member pair (24 shared lines) candle-transformers/src/models/paddleocr_vl/vision.rs
Code Duplication · Edited copy of a member (55 corresponding lines) candle-transformers/src/models/quantized_recurrent_gemma.rs
Code Duplication · Edited copy of a member (45 corresponding lines) candle-transformers/src/models/marian.rs
Code Duplication · Edited copy of a member (37 corresponding lines) candle-transformers/src/models/flux/model.rs
Code Duplication · Edited copy of a member (17 corresponding lines) candle-transformers/src/models/flux/model.rs
Code Duplication · Edited copy of a member (26 corresponding lines) candle-transformers/src/models/flux/model.rs
Code Duplication · Edited copy of a member (26 corresponding lines) candle-transformers/src/models/whisper/model.rs
Code Duplication · Edited copy of a member (22 corresponding lines) candle-transformers/src/models/blip.rs
Code Duplication · Edited copy of a member (13 corresponding lines) candle-transformers/src/models/glm4_new.rs
Code Duplication · Edited copy of a member (16 corresponding lines) candle-transformers/src/models/segment_anything/transformer.rs
Code Duplication · Edited copy of a member (17 corresponding lines) candle-core/src/cpu/avx.rs
Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) candle-transformers/src/models/marian.rs
Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) candle-core/src/quantized/avx.rs
Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) candle-transformers/src/models/marian.rs
Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) candle-transformers/src/models/olmo.rs
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) candle-nn/src/attention/cpu_flash/causal.rs
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) candle-transformers/src/models/quantized_gemma3.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) candle-core/src/quantized/cuda.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) candle-core/src/quantized/cuda.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) candle-core/src/quantized/neon.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) candle-core/src/tensor.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) candle-nn/src/ops.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) candle-transformers/src/models/deepseek2.rs
€60,000 to €300,000, for 1,004 to 3,185 hours of work, about 1.2 person-years for 1 to 3 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.7 at a score of 43. 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: 155,929 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
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Raises the score by about 6 points · Medium effort · Text alternatives
2
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
Raises the score by about 4 points · Medium effort · Type Safety
Diagnosis: what the measurements show together
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €180,000 to build again, about 1.2 person-years of work. Its weakest lens is Accessibility, at 28 (Weak). Accessibility is about whether the interface is built so that everyone can use it, including people who can't see the screen or can't use a mouse. Because the weakest lens counts most in the score, work on Accessibility also moves the score most.
Based on: the rebuild estimate · the Accessibility grade · how much each lens counts
What to do: Start with the Accessibility actions in Top priorities.
If you do one thing first · First action
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video. Of all the actions in this report, it raises the score most for the work it takes: about 6 points for medium effort. 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 4.6 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 8% to 19% on every change. The history of the code shows how much it changes: about 18,092 lines over the last 90 days, which is about 73,373 lines a year. At that pace, the extra work comes to an estimated 15.4 to 92.3 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.
431 modules, with 1734 dependencies between them. 5 loops run through 42 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 391 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.
candle_core.dtype uses candle_core.cpu_backend, so a change to candle_core.cpu_backend can break candle_core.dtype, while a change to candle_core.dtype can't break candle_core.cpu_backend.
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.
candle_core.layout uses candle_core.shape, so a change to candle_core.shape can break candle_core.layout, while a change to candle_core.layout can't break candle_core.shape.
Position
Below the diagonal: candle_core.layout uses a module listed above it, which is the healthy direction.
candle_metal_kernels.kernel uses candle_metal_kernels.metal.device, so a change to candle_metal_kernels.metal.device can break candle_metal_kernels.kernel, while a change to candle_metal_kernels.kernel can't break candle_metal_kernels.metal.device.
Position
Below the diagonal: candle_metal_kernels.kernel uses a module listed above it, which is the healthy direction.
8→14 candle_metal_kernels.metal.buffer uses candle_metal_kernels.utilspart of a loop✕
Connections
1 pair of types, where a type in candle_metal_kernels.metal.buffer uses a type in candle_metal_kernels.utils.
candle_metal_kernels.metal.buffer uses candle_metal_kernels.utils, so a change to candle_metal_kernels.utils can break candle_metal_kernels.metal.buffer, while a change to candle_metal_kernels.metal.buffer can't break candle_metal_kernels.utils.
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.
candle_nn.conv uses candle_kernels, so a change to candle_kernels can break candle_nn.conv, while a change to candle_nn.conv can't break candle_kernels.
Position
Below the diagonal: candle_nn.conv uses a module listed above it, which is the healthy direction.
candle_nn.group_norm uses candle_kernels, so a change to candle_kernels can break candle_nn.group_norm, while a change to candle_nn.group_norm can't break candle_kernels.
Position
Below the diagonal: candle_nn.group_norm uses a module listed above it, which is the healthy direction.
candle_transformers.quantized_var_builder uses candle_metal_kernels, so a change to candle_metal_kernels can break candle_transformers.quantized_var_builder, while a change to candle_transformers.quantized_var_builder can't break candle_metal_kernels.
Position
Below the diagonal: candle_transformers.quantized_var_builder uses a module listed above it, which is the healthy direction.
candle_transformers.quantized_var_builder uses candle_metal_kernels.metal.device, so a change to candle_metal_kernels.metal.device can break candle_transformers.quantized_var_builder, while a change to candle_transformers.quantized_var_builder can't break candle_metal_kernels.metal.device.
Position
Below the diagonal: candle_transformers.quantized_var_builder uses a module listed above it, which is the healthy direction.
candle_core.cuda_backend.device uses candle_core.shape, so a change to candle_core.shape can break candle_core.cuda_backend.device, while a change to candle_core.cuda_backend.device can't break candle_core.shape.
Position
Below the diagonal: candle_core.cuda_backend.device uses a module listed above it, which is the healthy direction.
candle_core.cuda_backend.device uses candle_core.dtype, so a change to candle_core.dtype can break candle_core.cuda_backend.device, while a change to candle_core.cuda_backend.device can't break candle_core.dtype.
Position
Below the diagonal: candle_core.cuda_backend.device uses a module listed above it, which is the healthy direction.
12→21 candle_core.cuda_backend.device uses candle_core.devicepart of a loop✕
Connections
1 pair of types, where a type in candle_core.cuda_backend.device uses a type in candle_core.device.
candle_core.cuda_backend.device uses candle_core.device, so a change to candle_core.device can break candle_core.cuda_backend.device, while a change to candle_core.cuda_backend.device can't break candle_core.device.
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.
12→23 candle_core.cuda_backend.device uses candle_core.cpu_backendpart of a loop✕
Connections
1 pair of types, where a type in candle_core.cuda_backend.device uses a type in candle_core.cpu_backend.
candle_core.cuda_backend.device uses candle_core.cpu_backend, so a change to candle_core.cpu_backend can break candle_core.cuda_backend.device, while a change to candle_core.cuda_backend.device can't break candle_core.cpu_backend.
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.
12→25 candle_core.cuda_backend.device uses candle_core.backendpart of a loop✕
Connections
1 pair of types, where a type in candle_core.cuda_backend.device uses a type in candle_core.backend.
candle_core.cuda_backend.device uses candle_core.backend, so a change to candle_core.backend can break candle_core.cuda_backend.device, while a change to candle_core.cuda_backend.device can't break candle_core.backend.
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.
candle_core.dummy_metal_backend uses candle_core.shape, so a change to candle_core.shape can break candle_core.dummy_metal_backend, while a change to candle_core.dummy_metal_backend can't break candle_core.shape.
Position
Below the diagonal: candle_core.dummy_metal_backend uses a module listed above it, which is the healthy direction.
candle_core.dummy_metal_backend uses candle_core.dtype, so a change to candle_core.dtype can break candle_core.dummy_metal_backend, while a change to candle_core.dummy_metal_backend can't break candle_core.dtype.
Position
Below the diagonal: candle_core.dummy_metal_backend uses a module listed above it, which is the healthy direction.
candle_core.dummy_metal_backend uses candle_core.layout, so a change to candle_core.layout can break candle_core.dummy_metal_backend, while a change to candle_core.dummy_metal_backend can't break candle_core.layout.
Position
Below the diagonal: candle_core.dummy_metal_backend uses a module listed above it, which is the healthy direction.
13→21 candle_core.dummy_metal_backend uses candle_core.devicepart of a loop✕
Connections
2 pairs of types, where a type in candle_core.dummy_metal_backend uses a type in candle_core.device.
candle_core.dummy_metal_backend uses candle_core.device, so a change to candle_core.device can break candle_core.dummy_metal_backend, while a change to candle_core.dummy_metal_backend can't break candle_core.device.
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.
13→23 candle_core.dummy_metal_backend uses candle_core.cpu_backendpart of a loop✕
Connections
1 pair of types, where a type in candle_core.dummy_metal_backend uses a type in candle_core.cpu_backend.
candle_core.dummy_metal_backend uses candle_core.cpu_backend, so a change to candle_core.cpu_backend can break candle_core.dummy_metal_backend, while a change to candle_core.dummy_metal_backend can't break candle_core.cpu_backend.
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.
13→25 candle_core.dummy_metal_backend uses candle_core.backendpart of a loop✕
Connections
2 pairs of types, where a type in candle_core.dummy_metal_backend uses a type in candle_core.backend.
candle_core.dummy_metal_backend uses candle_core.backend, so a change to candle_core.backend can break candle_core.dummy_metal_backend, while a change to candle_core.dummy_metal_backend can't break candle_core.backend.
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.
candle_metal_kernels.utils uses candle_metal_kernels.metal.buffer, so a change to candle_metal_kernels.metal.buffer can break candle_metal_kernels.utils, while a change to candle_metal_kernels.utils can't break candle_metal_kernels.metal.buffer.
Position
Below the diagonal: candle_metal_kernels.utils uses a module listed above it, which is the healthy direction.
candle_transformers.models.t5 uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.t5, while a change to candle_transformers.models.t5 can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.t5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.t5 uses candle_metal_kernels, so a change to candle_metal_kernels can break candle_transformers.models.t5, while a change to candle_transformers.models.t5 can't break candle_metal_kernels.
Position
Below the diagonal: candle_transformers.models.t5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.t5 uses candle_metal_kernels.metal.device, so a change to candle_metal_kernels.metal.device can break candle_transformers.models.t5, while a change to candle_transformers.models.t5 can't break candle_metal_kernels.metal.device.
Position
Below the diagonal: candle_transformers.models.t5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.t5 uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.t5, while a change to candle_transformers.models.t5 can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.t5 uses a module listed above it, which is the healthy direction.
15→18 candle_transformers.models.t5 uses candle_transformers.models.chinese_clippart of a loop✕
Connections
3 pairs of types, where a type in candle_transformers.models.t5 uses a type in candle_transformers.models.chinese_clip.
candle_transformers.models.t5 uses candle_transformers.models.chinese_clip, so a change to candle_transformers.models.chinese_clip can break candle_transformers.models.t5, while a change to candle_transformers.models.t5 can't break candle_transformers.models.chinese_clip.
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.
15→28 candle_transformers.models.t5 uses candle_transformers.models.chatglmpart of a loop✕
Connections
3 pairs of types, where a type in candle_transformers.models.t5 uses a type in candle_transformers.models.chatglm.
candle_transformers.models.t5 uses candle_transformers.models.chatglm, so a change to candle_transformers.models.chatglm can break candle_transformers.models.t5, while a change to candle_transformers.models.t5 can't break candle_transformers.models.chatglm.
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.
15→29 candle_transformers.models.t5 uses candle_transformers.models.basedpart of a loop✕
Connections
10 pairs of types, where a type in candle_transformers.models.t5 uses a type in candle_transformers.models.based.
candle_transformers.models.t5 uses candle_transformers.models.based, so a change to candle_transformers.models.based can break candle_transformers.models.t5, while a change to candle_transformers.models.t5 can't break candle_transformers.models.based.
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.
candle_core.cuda_backend uses candle_core.dtype, so a change to candle_core.dtype can break candle_core.cuda_backend, while a change to candle_core.cuda_backend can't break candle_core.dtype.
Position
Below the diagonal: candle_core.cuda_backend uses a module listed above it, which is the healthy direction.
candle_core.cuda_backend uses candle_core.layout, so a change to candle_core.layout can break candle_core.cuda_backend, while a change to candle_core.cuda_backend can't break candle_core.layout.
Position
Below the diagonal: candle_core.cuda_backend uses a module listed above it, which is the healthy direction.
candle_core.cuda_backend uses candle_core.cuda_backend.device, so a change to candle_core.cuda_backend.device can break candle_core.cuda_backend, while a change to candle_core.cuda_backend can't break candle_core.cuda_backend.device.
Position
Below the diagonal: candle_core.cuda_backend uses a module listed above it, which is the healthy direction.
16→25 candle_core.cuda_backend uses candle_core.backendpart of a loop✕
Connections
1 pair of types, where a type in candle_core.cuda_backend uses a type in candle_core.backend.
candle_core.cuda_backend uses candle_core.backend, so a change to candle_core.backend can break candle_core.cuda_backend, while a change to candle_core.cuda_backend can't break candle_core.backend.
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.
candle_core.tensor uses candle_core.shape, so a change to candle_core.shape can break candle_core.tensor, while a change to candle_core.tensor can't break candle_core.shape.
Position
Below the diagonal: candle_core.tensor uses a module listed above it, which is the healthy direction.
candle_core.tensor uses candle_core.dtype, so a change to candle_core.dtype can break candle_core.tensor, while a change to candle_core.tensor can't break candle_core.dtype.
Position
Below the diagonal: candle_core.tensor uses a module listed above it, which is the healthy direction.
candle_core.tensor uses candle_core.layout, so a change to candle_core.layout can break candle_core.tensor, while a change to candle_core.tensor can't break candle_core.layout.
Position
Below the diagonal: candle_core.tensor uses a module listed above it, which is the healthy direction.
candle_core.tensor uses candle_metal_kernels.utils, so a change to candle_metal_kernels.utils can break candle_core.tensor, while a change to candle_core.tensor can't break candle_metal_kernels.utils.
Position
Below the diagonal: candle_core.tensor uses a module listed above it, which is the healthy direction.
17→21 candle_core.tensor uses candle_core.devicepart of a loop✕
Connections
2 pairs of types, where a type in candle_core.tensor uses a type in candle_core.device.
candle_core.tensor uses candle_core.device, so a change to candle_core.device can break candle_core.tensor, while a change to candle_core.tensor can't break candle_core.device.
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.
17→23 candle_core.tensor uses candle_core.cpu_backendpart of a loop✕
Connections
1 pair of types, where a type in candle_core.tensor uses a type in candle_core.cpu_backend.
candle_core.tensor uses candle_core.cpu_backend, so a change to candle_core.cpu_backend can break candle_core.tensor, while a change to candle_core.tensor can't break candle_core.cpu_backend.
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.
candle_transformers.models.chinese_clip uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.chinese_clip, while a change to candle_transformers.models.chinese_clip can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.chinese_clip uses a module listed above it, which is the healthy direction.
candle_transformers.models.chinese_clip uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.chinese_clip, while a change to candle_transformers.models.chinese_clip can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.chinese_clip uses a module listed above it, which is the healthy direction.
candle_transformers.models.chinese_clip uses candle_transformers.models.t5, so a change to candle_transformers.models.t5 can break candle_transformers.models.chinese_clip, while a change to candle_transformers.models.chinese_clip can't break candle_transformers.models.t5.
Position
Below the diagonal: candle_transformers.models.chinese_clip uses a module listed above it, which is the healthy direction.
candle_core.quantized uses candle_core.shape, so a change to candle_core.shape can break candle_core.quantized, while a change to candle_core.quantized can't break candle_core.shape.
Position
Below the diagonal: candle_core.quantized uses a module listed above it, which is the healthy direction.
candle_core.quantized uses candle_core.layout, so a change to candle_core.layout can break candle_core.quantized, while a change to candle_core.quantized can't break candle_core.layout.
Position
Below the diagonal: candle_core.quantized uses a module listed above it, which is the healthy direction.
candle_core.quantized uses candle_core.dummy_metal_backend, so a change to candle_core.dummy_metal_backend can break candle_core.quantized, while a change to candle_core.quantized can't break candle_core.dummy_metal_backend.
Position
Below the diagonal: candle_core.quantized uses a module listed above it, which is the healthy direction.
candle_core.quantized uses candle_core.cuda_backend, so a change to candle_core.cuda_backend can break candle_core.quantized, while a change to candle_core.quantized can't break candle_core.cuda_backend.
Position
Below the diagonal: candle_core.quantized uses a module listed above it, which is the healthy direction.
candle_core.quantized uses candle_core.tensor, so a change to candle_core.tensor can break candle_core.quantized, while a change to candle_core.quantized can't break candle_core.tensor.
Position
Below the diagonal: candle_core.quantized uses a module listed above it, which is the healthy direction.
19→21 candle_core.quantized uses candle_core.devicepart of a loop✕
Connections
2 pairs of types, where a type in candle_core.quantized uses a type in candle_core.device.
candle_core.quantized uses candle_core.device, so a change to candle_core.device can break candle_core.quantized, while a change to candle_core.quantized can't break candle_core.device.
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.
19→23 candle_core.quantized uses candle_core.cpu_backendpart of a loop✕
Connections
1 pair of types, where a type in candle_core.quantized uses a type in candle_core.cpu_backend.
candle_core.quantized uses candle_core.cpu_backend, so a change to candle_core.cpu_backend can break candle_core.quantized, while a change to candle_core.quantized can't break candle_core.cpu_backend.
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.
candle_transformers.models.gemma uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.gemma, while a change to candle_transformers.models.gemma can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.gemma uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma uses candle_metal_kernels, so a change to candle_metal_kernels can break candle_transformers.models.gemma, while a change to candle_transformers.models.gemma can't break candle_metal_kernels.
Position
Below the diagonal: candle_transformers.models.gemma uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma uses candle_metal_kernels.metal.device, so a change to candle_metal_kernels.metal.device can break candle_transformers.models.gemma, while a change to candle_transformers.models.gemma can't break candle_metal_kernels.metal.device.
Position
Below the diagonal: candle_transformers.models.gemma uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.gemma, while a change to candle_transformers.models.gemma can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.gemma uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma uses candle_transformers.models.t5, so a change to candle_transformers.models.t5 can break candle_transformers.models.gemma, while a change to candle_transformers.models.gemma can't break candle_transformers.models.t5.
Position
Below the diagonal: candle_transformers.models.gemma uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma uses candle_transformers.models.chinese_clip, so a change to candle_transformers.models.chinese_clip can break candle_transformers.models.gemma, while a change to candle_transformers.models.gemma can't break candle_transformers.models.chinese_clip.
Position
Below the diagonal: candle_transformers.models.gemma uses a module listed above it, which is the healthy direction.
20→27 candle_transformers.models.gemma uses candle_transformers.models.beitpart of a loop✕
Connections
1 pair of types, where a type in candle_transformers.models.gemma uses a type in candle_transformers.models.beit.
candle_transformers.models.gemma uses candle_transformers.models.beit, so a change to candle_transformers.models.beit can break candle_transformers.models.gemma, while a change to candle_transformers.models.gemma can't break candle_transformers.models.beit.
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.
20→28 candle_transformers.models.gemma uses candle_transformers.models.chatglmpart of a loop✕
Connections
1 pair of types, where a type in candle_transformers.models.gemma uses a type in candle_transformers.models.chatglm.
candle_transformers.models.gemma uses candle_transformers.models.chatglm, so a change to candle_transformers.models.chatglm can break candle_transformers.models.gemma, while a change to candle_transformers.models.gemma can't break candle_transformers.models.chatglm.
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.
20→29 candle_transformers.models.gemma uses candle_transformers.models.basedpart of a loop✕
Connections
9 pairs of types, where a type in candle_transformers.models.gemma uses a type in candle_transformers.models.based.
candle_transformers.models.gemma uses candle_transformers.models.based, so a change to candle_transformers.models.based can break candle_transformers.models.gemma, while a change to candle_transformers.models.gemma can't break candle_transformers.models.based.
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.
candle_core.device uses candle_core.shape, so a change to candle_core.shape can break candle_core.device, while a change to candle_core.device can't break candle_core.shape.
Position
Below the diagonal: candle_core.device uses a module listed above it, which is the healthy direction.
candle_core.device uses candle_core.dtype, so a change to candle_core.dtype can break candle_core.device, while a change to candle_core.device can't break candle_core.dtype.
Position
Below the diagonal: candle_core.device uses a module listed above it, which is the healthy direction.
candle_core.device uses candle_core.quantized, so a change to candle_core.quantized can break candle_core.device, while a change to candle_core.device can't break candle_core.quantized.
Position
Below the diagonal: candle_core.device uses a module listed above it, which is the healthy direction.
21→23 candle_core.device uses candle_core.cpu_backendpart of a loop✕
Connections
1 pair of types, where a type in candle_core.device uses a type in candle_core.cpu_backend.
candle_core.device uses candle_core.cpu_backend, so a change to candle_core.cpu_backend can break candle_core.device, while a change to candle_core.device can't break candle_core.cpu_backend.
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.
candle_transformers.models.quantized_gemma3 uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.quantized_gemma3, while a change to candle_transformers.models.quantized_gemma3 can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.quantized_gemma3 uses a module listed above it, which is the healthy direction.
candle_transformers.models.quantized_gemma3 uses candle_metal_kernels, so a change to candle_metal_kernels can break candle_transformers.models.quantized_gemma3, while a change to candle_transformers.models.quantized_gemma3 can't break candle_metal_kernels.
Position
Below the diagonal: candle_transformers.models.quantized_gemma3 uses a module listed above it, which is the healthy direction.
candle_transformers.models.quantized_gemma3 uses candle_metal_kernels.metal.device, so a change to candle_metal_kernels.metal.device can break candle_transformers.models.quantized_gemma3, while a change to candle_transformers.models.quantized_gemma3 can't break candle_metal_kernels.metal.device.
Position
Below the diagonal: candle_transformers.models.quantized_gemma3 uses a module listed above it, which is the healthy direction.
candle_transformers.models.quantized_gemma3 uses candle_transformers.models.gemma, so a change to candle_transformers.models.gemma can break candle_transformers.models.quantized_gemma3, while a change to candle_transformers.models.quantized_gemma3 can't break candle_transformers.models.gemma.
Position
Below the diagonal: candle_transformers.models.quantized_gemma3 uses a module listed above it, which is the healthy direction.
22→27 candle_transformers.models.quantized_gemma3 uses candle_transformers.models.beitpart of a loop✕
Connections
1 pair of types, where a type in candle_transformers.models.quantized_gemma3 uses a type in candle_transformers.models.beit.
candle_transformers.models.quantized_gemma3 uses candle_transformers.models.beit, so a change to candle_transformers.models.beit can break candle_transformers.models.quantized_gemma3, while a change to candle_transformers.models.quantized_gemma3 can't break candle_transformers.models.beit.
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→28 candle_transformers.models.quantized_gemma3 uses candle_transformers.models.chatglmpart of a loop✕
Connections
1 pair of types, where a type in candle_transformers.models.quantized_gemma3 uses a type in candle_transformers.models.chatglm.
candle_transformers.models.quantized_gemma3 uses candle_transformers.models.chatglm, so a change to candle_transformers.models.chatglm can break candle_transformers.models.quantized_gemma3, while a change to candle_transformers.models.quantized_gemma3 can't break candle_transformers.models.chatglm.
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→29 candle_transformers.models.quantized_gemma3 uses candle_transformers.models.basedpart of a loop✕
Connections
1 pair of types, where a type in candle_transformers.models.quantized_gemma3 uses a type in candle_transformers.models.based.
candle_transformers.models.quantized_gemma3 uses candle_transformers.models.based, so a change to candle_transformers.models.based can break candle_transformers.models.quantized_gemma3, while a change to candle_transformers.models.quantized_gemma3 can't break candle_transformers.models.based.
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.
candle_core.cpu_backend uses candle_core.shape, so a change to candle_core.shape can break candle_core.cpu_backend, while a change to candle_core.cpu_backend can't break candle_core.shape.
Position
Below the diagonal: candle_core.cpu_backend uses a module listed above it, which is the healthy direction.
candle_core.cpu_backend uses candle_core.dtype, so a change to candle_core.dtype can break candle_core.cpu_backend, while a change to candle_core.cpu_backend can't break candle_core.dtype.
Position
Below the diagonal: candle_core.cpu_backend uses a module listed above it, which is the healthy direction.
candle_core.cpu_backend uses candle_core.layout, so a change to candle_core.layout can break candle_core.cpu_backend, while a change to candle_core.cpu_backend can't break candle_core.layout.
Position
Below the diagonal: candle_core.cpu_backend uses a module listed above it, which is the healthy direction.
candle_core.cpu_backend uses candle_core.device, so a change to candle_core.device can break candle_core.cpu_backend, while a change to candle_core.cpu_backend can't break candle_core.device.
Position
Below the diagonal: candle_core.cpu_backend uses a module listed above it, which is the healthy direction.
23→25 candle_core.cpu_backend uses candle_core.backendpart of a loop✕
Connections
2 pairs of types, where a type in candle_core.cpu_backend uses a type in candle_core.backend.
candle_core.cpu_backend uses candle_core.backend, so a change to candle_core.backend can break candle_core.cpu_backend, while a change to candle_core.cpu_backend can't break candle_core.backend.
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.
candle_transformers.models.with_tracing uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.with_tracing, while a change to candle_transformers.models.with_tracing can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.with_tracing uses a module listed above it, which is the healthy direction.
candle_transformers.models.with_tracing uses candle_nn.conv, so a change to candle_nn.conv can break candle_transformers.models.with_tracing, while a change to candle_transformers.models.with_tracing can't break candle_nn.conv.
Position
Below the diagonal: candle_transformers.models.with_tracing uses a module listed above it, which is the healthy direction.
candle_transformers.models.with_tracing uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.with_tracing, while a change to candle_transformers.models.with_tracing can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.with_tracing uses a module listed above it, which is the healthy direction.
candle_transformers.models.with_tracing uses candle_transformers.models.t5, so a change to candle_transformers.models.t5 can break candle_transformers.models.with_tracing, while a change to candle_transformers.models.with_tracing can't break candle_transformers.models.t5.
Position
Below the diagonal: candle_transformers.models.with_tracing uses a module listed above it, which is the healthy direction.
candle_transformers.models.with_tracing uses candle_transformers.models.gemma, so a change to candle_transformers.models.gemma can break candle_transformers.models.with_tracing, while a change to candle_transformers.models.with_tracing can't break candle_transformers.models.gemma.
Position
Below the diagonal: candle_transformers.models.with_tracing uses a module listed above it, which is the healthy direction.
candle_transformers.models.with_tracing uses candle_transformers.models.quantized_gemma3, so a change to candle_transformers.models.quantized_gemma3 can break candle_transformers.models.with_tracing, while a change to candle_transformers.models.with_tracing can't break candle_transformers.models.quantized_gemma3.
Position
Below the diagonal: candle_transformers.models.with_tracing uses a module listed above it, which is the healthy direction.
24→26 candle_transformers.models.with_tracing uses candle_transformers.models.gemma4.audiopart of a loop✕
Connections
1 pair of types, where a type in candle_transformers.models.with_tracing uses a type in candle_transformers.models.gemma4.audio.
candle_transformers.models.with_tracing uses candle_transformers.models.gemma4.audio, so a change to candle_transformers.models.gemma4.audio can break candle_transformers.models.with_tracing, while a change to candle_transformers.models.with_tracing can't break candle_transformers.models.gemma4.audio.
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→28 candle_transformers.models.with_tracing uses candle_transformers.models.chatglmpart of a loop✕
Connections
1 pair of types, where a type in candle_transformers.models.with_tracing uses a type in candle_transformers.models.chatglm.
candle_transformers.models.with_tracing uses candle_transformers.models.chatglm, so a change to candle_transformers.models.chatglm can break candle_transformers.models.with_tracing, while a change to candle_transformers.models.with_tracing can't break candle_transformers.models.chatglm.
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.
candle_core.backend uses candle_core.shape, so a change to candle_core.shape can break candle_core.backend, while a change to candle_core.backend can't break candle_core.shape.
Position
Below the diagonal: candle_core.backend uses a module listed above it, which is the healthy direction.
candle_core.backend uses candle_core.dtype, so a change to candle_core.dtype can break candle_core.backend, while a change to candle_core.backend can't break candle_core.dtype.
Position
Below the diagonal: candle_core.backend uses a module listed above it, which is the healthy direction.
candle_core.backend uses candle_core.layout, so a change to candle_core.layout can break candle_core.backend, while a change to candle_core.backend can't break candle_core.layout.
Position
Below the diagonal: candle_core.backend uses a module listed above it, which is the healthy direction.
candle_core.backend uses candle_core.cuda_backend, so a change to candle_core.cuda_backend can break candle_core.backend, while a change to candle_core.backend can't break candle_core.cuda_backend.
Position
Below the diagonal: candle_core.backend uses a module listed above it, which is the healthy direction.
candle_core.backend uses candle_core.device, so a change to candle_core.device can break candle_core.backend, while a change to candle_core.backend can't break candle_core.device.
Position
Below the diagonal: candle_core.backend uses a module listed above it, which is the healthy direction.
candle_core.backend uses candle_core.cpu_backend, so a change to candle_core.cpu_backend can break candle_core.backend, while a change to candle_core.backend can't break candle_core.cpu_backend.
Position
Below the diagonal: candle_core.backend uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma4.audio uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.gemma4.audio, while a change to candle_transformers.models.gemma4.audio can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.gemma4.audio uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma4.audio uses candle_metal_kernels, so a change to candle_metal_kernels can break candle_transformers.models.gemma4.audio, while a change to candle_transformers.models.gemma4.audio can't break candle_metal_kernels.
Position
Below the diagonal: candle_transformers.models.gemma4.audio uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma4.audio uses candle_nn.conv, so a change to candle_nn.conv can break candle_transformers.models.gemma4.audio, while a change to candle_transformers.models.gemma4.audio can't break candle_nn.conv.
Position
Below the diagonal: candle_transformers.models.gemma4.audio uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma4.audio uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.gemma4.audio, while a change to candle_transformers.models.gemma4.audio can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.gemma4.audio uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma4.audio uses candle_transformers.models.t5, so a change to candle_transformers.models.t5 can break candle_transformers.models.gemma4.audio, while a change to candle_transformers.models.gemma4.audio can't break candle_transformers.models.t5.
Position
Below the diagonal: candle_transformers.models.gemma4.audio uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma4.audio uses candle_transformers.models.gemma, so a change to candle_transformers.models.gemma can break candle_transformers.models.gemma4.audio, while a change to candle_transformers.models.gemma4.audio can't break candle_transformers.models.gemma.
Position
Below the diagonal: candle_transformers.models.gemma4.audio uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma4.audio uses candle_transformers.models.with_tracing, so a change to candle_transformers.models.with_tracing can break candle_transformers.models.gemma4.audio, while a change to candle_transformers.models.gemma4.audio can't break candle_transformers.models.with_tracing.
Position
Below the diagonal: candle_transformers.models.gemma4.audio uses a module listed above it, which is the healthy direction.
candle_transformers.models.beit uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.beit, while a change to candle_transformers.models.beit can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.beit uses a module listed above it, which is the healthy direction.
candle_transformers.models.beit uses candle_metal_kernels.metal.device, so a change to candle_metal_kernels.metal.device can break candle_transformers.models.beit, while a change to candle_transformers.models.beit can't break candle_metal_kernels.metal.device.
Position
Below the diagonal: candle_transformers.models.beit uses a module listed above it, which is the healthy direction.
candle_transformers.models.beit uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.beit, while a change to candle_transformers.models.beit can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.beit uses a module listed above it, which is the healthy direction.
candle_transformers.models.beit uses candle_transformers.models.t5, so a change to candle_transformers.models.t5 can break candle_transformers.models.beit, while a change to candle_transformers.models.beit can't break candle_transformers.models.t5.
Position
Below the diagonal: candle_transformers.models.beit uses a module listed above it, which is the healthy direction.
candle_transformers.models.beit uses candle_transformers.models.with_tracing, so a change to candle_transformers.models.with_tracing can break candle_transformers.models.beit, while a change to candle_transformers.models.beit can't break candle_transformers.models.with_tracing.
Position
Below the diagonal: candle_transformers.models.beit uses a module listed above it, which is the healthy direction.
candle_transformers.models.beit uses candle_transformers.models.gemma4.audio, so a change to candle_transformers.models.gemma4.audio can break candle_transformers.models.beit, while a change to candle_transformers.models.beit can't break candle_transformers.models.gemma4.audio.
Position
Below the diagonal: candle_transformers.models.beit uses a module listed above it, which is the healthy direction.
candle_transformers.models.chatglm uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.chatglm, while a change to candle_transformers.models.chatglm can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.chatglm uses a module listed above it, which is the healthy direction.
candle_transformers.models.chatglm uses candle_metal_kernels, so a change to candle_metal_kernels can break candle_transformers.models.chatglm, while a change to candle_transformers.models.chatglm can't break candle_metal_kernels.
Position
Below the diagonal: candle_transformers.models.chatglm uses a module listed above it, which is the healthy direction.
candle_transformers.models.chatglm uses candle_metal_kernels.metal.device, so a change to candle_metal_kernels.metal.device can break candle_transformers.models.chatglm, while a change to candle_transformers.models.chatglm can't break candle_metal_kernels.metal.device.
Position
Below the diagonal: candle_transformers.models.chatglm uses a module listed above it, which is the healthy direction.
candle_transformers.models.chatglm uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.chatglm, while a change to candle_transformers.models.chatglm can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.chatglm uses a module listed above it, which is the healthy direction.
candle_transformers.models.chatglm uses candle_transformers.models.t5, so a change to candle_transformers.models.t5 can break candle_transformers.models.chatglm, while a change to candle_transformers.models.chatglm can't break candle_transformers.models.t5.
Position
Below the diagonal: candle_transformers.models.chatglm uses a module listed above it, which is the healthy direction.
candle_transformers.models.chatglm uses candle_transformers.models.gemma4.audio, so a change to candle_transformers.models.gemma4.audio can break candle_transformers.models.chatglm, while a change to candle_transformers.models.chatglm can't break candle_transformers.models.gemma4.audio.
Position
Below the diagonal: candle_transformers.models.chatglm uses a module listed above it, which is the healthy direction.
candle_transformers.models.chatglm uses candle_transformers.models.beit, so a change to candle_transformers.models.beit can break candle_transformers.models.chatglm, while a change to candle_transformers.models.chatglm can't break candle_transformers.models.beit.
Position
Below the diagonal: candle_transformers.models.chatglm uses a module listed above it, which is the healthy direction.
28→29 candle_transformers.models.chatglm uses candle_transformers.models.basedpart of a loop✕
Connections
12 pairs of types, where a type in candle_transformers.models.chatglm uses a type in candle_transformers.models.based.
candle_transformers.models.chatglm uses candle_transformers.models.based, so a change to candle_transformers.models.based can break candle_transformers.models.chatglm, while a change to candle_transformers.models.chatglm can't break candle_transformers.models.based.
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.
candle_transformers.models.based uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.based, while a change to candle_transformers.models.based can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.based uses a module listed above it, which is the healthy direction.
candle_transformers.models.based uses candle_metal_kernels, so a change to candle_metal_kernels can break candle_transformers.models.based, while a change to candle_transformers.models.based can't break candle_metal_kernels.
Position
Below the diagonal: candle_transformers.models.based uses a module listed above it, which is the healthy direction.
candle_transformers.models.based uses candle_metal_kernels.metal.device, so a change to candle_metal_kernels.metal.device can break candle_transformers.models.based, while a change to candle_transformers.models.based can't break candle_metal_kernels.metal.device.
Position
Below the diagonal: candle_transformers.models.based uses a module listed above it, which is the healthy direction.
candle_transformers.models.based uses candle_nn.conv, so a change to candle_nn.conv can break candle_transformers.models.based, while a change to candle_transformers.models.based can't break candle_nn.conv.
Position
Below the diagonal: candle_transformers.models.based uses a module listed above it, which is the healthy direction.
candle_transformers.models.based uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.based, while a change to candle_transformers.models.based can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.based uses a module listed above it, which is the healthy direction.
candle_transformers.models.based uses candle_transformers.models.t5, so a change to candle_transformers.models.t5 can break candle_transformers.models.based, while a change to candle_transformers.models.based can't break candle_transformers.models.t5.
Position
Below the diagonal: candle_transformers.models.based uses a module listed above it, which is the healthy direction.
candle_transformers.models.based uses candle_transformers.models.gemma, so a change to candle_transformers.models.gemma can break candle_transformers.models.based, while a change to candle_transformers.models.based can't break candle_transformers.models.gemma.
Position
Below the diagonal: candle_transformers.models.based uses a module listed above it, which is the healthy direction.
candle_transformers.models.based uses candle_transformers.models.chatglm, so a change to candle_transformers.models.chatglm can break candle_transformers.models.based, while a change to candle_transformers.models.based can't break candle_transformers.models.chatglm.
Position
Below the diagonal: candle_transformers.models.based uses a module listed above it, which is the healthy direction.
candle_transformers.models.bert uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.bert, while a change to candle_transformers.models.bert can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.bert uses a module listed above it, which is the healthy direction.
candle_transformers.models.bert uses candle_metal_kernels, so a change to candle_metal_kernels can break candle_transformers.models.bert, while a change to candle_transformers.models.bert can't break candle_metal_kernels.
Position
Below the diagonal: candle_transformers.models.bert uses a module listed above it, which is the healthy direction.
candle_transformers.models.bert uses candle_metal_kernels.metal.device, so a change to candle_metal_kernels.metal.device can break candle_transformers.models.bert, while a change to candle_transformers.models.bert can't break candle_metal_kernels.metal.device.
Position
Below the diagonal: candle_transformers.models.bert uses a module listed above it, which is the healthy direction.
candle_transformers.models.bert uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.bert, while a change to candle_transformers.models.bert can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.bert uses a module listed above it, which is the healthy direction.
candle_transformers.models.bert uses candle_transformers.models.t5, so a change to candle_transformers.models.t5 can break candle_transformers.models.bert, while a change to candle_transformers.models.bert can't break candle_transformers.models.t5.
Position
Below the diagonal: candle_transformers.models.bert uses a module listed above it, which is the healthy direction.
candle_transformers.models.bert uses candle_transformers.models.gemma4.audio, so a change to candle_transformers.models.gemma4.audio can break candle_transformers.models.bert, while a change to candle_transformers.models.bert can't break candle_transformers.models.gemma4.audio.
Position
Below the diagonal: candle_transformers.models.bert uses a module listed above it, which is the healthy direction.
candle_transformers.models.bert uses candle_transformers.models.chatglm, so a change to candle_transformers.models.chatglm can break candle_transformers.models.bert, while a change to candle_transformers.models.bert can't break candle_transformers.models.chatglm.
Position
Below the diagonal: candle_transformers.models.bert uses a module listed above it, which is the healthy direction.
candle_transformers.models.bert uses candle_transformers.models.based, so a change to candle_transformers.models.based can break candle_transformers.models.bert, while a change to candle_transformers.models.bert can't break candle_transformers.models.based.
Position
Below the diagonal: candle_transformers.models.bert uses a module listed above it, which is the healthy direction.
candle_transformers.models.blip_text uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.blip_text, while a change to candle_transformers.models.blip_text can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.blip_text uses a module listed above it, which is the healthy direction.
candle_transformers.models.blip_text uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.blip_text, while a change to candle_transformers.models.blip_text can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.blip_text uses a module listed above it, which is the healthy direction.
candle_transformers.models.blip_text uses candle_transformers.models.t5, so a change to candle_transformers.models.t5 can break candle_transformers.models.blip_text, while a change to candle_transformers.models.blip_text can't break candle_transformers.models.t5.
Position
Below the diagonal: candle_transformers.models.blip_text uses a module listed above it, which is the healthy direction.
candle_transformers.models.blip_text uses candle_transformers.models.chinese_clip, so a change to candle_transformers.models.chinese_clip can break candle_transformers.models.blip_text, while a change to candle_transformers.models.blip_text can't break candle_transformers.models.chinese_clip.
Position
Below the diagonal: candle_transformers.models.blip_text uses a module listed above it, which is the healthy direction.
candle_transformers.models.blip_text uses candle_transformers.models.gemma4.audio, so a change to candle_transformers.models.gemma4.audio can break candle_transformers.models.blip_text, while a change to candle_transformers.models.blip_text can't break candle_transformers.models.gemma4.audio.
Position
Below the diagonal: candle_transformers.models.blip_text uses a module listed above it, which is the healthy direction.
candle_transformers.models.blip_text uses candle_transformers.models.chatglm, so a change to candle_transformers.models.chatglm can break candle_transformers.models.blip_text, while a change to candle_transformers.models.blip_text can't break candle_transformers.models.chatglm.
Position
Below the diagonal: candle_transformers.models.blip_text uses a module listed above it, which is the healthy direction.
candle_transformers.models.blip_text uses candle_transformers.models.based, so a change to candle_transformers.models.based can break candle_transformers.models.blip_text, while a change to candle_transformers.models.blip_text can't break candle_transformers.models.based.
Position
Below the diagonal: candle_transformers.models.blip_text uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma3 uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.gemma3, while a change to candle_transformers.models.gemma3 can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.gemma3 uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma3 uses candle_metal_kernels, so a change to candle_metal_kernels can break candle_transformers.models.gemma3, while a change to candle_transformers.models.gemma3 can't break candle_metal_kernels.
Position
Below the diagonal: candle_transformers.models.gemma3 uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma3 uses candle_metal_kernels.metal.device, so a change to candle_metal_kernels.metal.device can break candle_transformers.models.gemma3, while a change to candle_transformers.models.gemma3 can't break candle_metal_kernels.metal.device.
Position
Below the diagonal: candle_transformers.models.gemma3 uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma3 uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.gemma3, while a change to candle_transformers.models.gemma3 can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.gemma3 uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma3 uses candle_transformers.models.t5, so a change to candle_transformers.models.t5 can break candle_transformers.models.gemma3, while a change to candle_transformers.models.gemma3 can't break candle_transformers.models.t5.
Position
Below the diagonal: candle_transformers.models.gemma3 uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma3 uses candle_transformers.models.chinese_clip, so a change to candle_transformers.models.chinese_clip can break candle_transformers.models.gemma3, while a change to candle_transformers.models.gemma3 can't break candle_transformers.models.chinese_clip.
Position
Below the diagonal: candle_transformers.models.gemma3 uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma3 uses candle_transformers.models.gemma, so a change to candle_transformers.models.gemma can break candle_transformers.models.gemma3, while a change to candle_transformers.models.gemma3 can't break candle_transformers.models.gemma.
Position
Below the diagonal: candle_transformers.models.gemma3 uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma3 uses candle_transformers.models.beit, so a change to candle_transformers.models.beit can break candle_transformers.models.gemma3, while a change to candle_transformers.models.gemma3 can't break candle_transformers.models.beit.
Position
Below the diagonal: candle_transformers.models.gemma3 uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma3 uses candle_transformers.models.chatglm, so a change to candle_transformers.models.chatglm can break candle_transformers.models.gemma3, while a change to candle_transformers.models.gemma3 can't break candle_transformers.models.chatglm.
Position
Below the diagonal: candle_transformers.models.gemma3 uses a module listed above it, which is the healthy direction.
candle_transformers.models.gemma3 uses candle_transformers.models.based, so a change to candle_transformers.models.based can break candle_transformers.models.gemma3, while a change to candle_transformers.models.gemma3 can't break candle_transformers.models.based.
Position
Below the diagonal: candle_transformers.models.gemma3 uses a module listed above it, which is the healthy direction.
candle_transformers.models.granite uses candle_metal_kernels, so a change to candle_metal_kernels can break candle_transformers.models.granite, while a change to candle_transformers.models.granite can't break candle_metal_kernels.
Position
Below the diagonal: candle_transformers.models.granite uses a module listed above it, which is the healthy direction.
candle_transformers.models.granite uses candle_metal_kernels.metal.device, so a change to candle_metal_kernels.metal.device can break candle_transformers.models.granite, while a change to candle_transformers.models.granite can't break candle_metal_kernels.metal.device.
Position
Below the diagonal: candle_transformers.models.granite uses a module listed above it, which is the healthy direction.
candle_transformers.models.granite uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.granite, while a change to candle_transformers.models.granite can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.granite uses a module listed above it, which is the healthy direction.
candle_transformers.models.granite uses candle_transformers.models.t5, so a change to candle_transformers.models.t5 can break candle_transformers.models.granite, while a change to candle_transformers.models.granite can't break candle_transformers.models.t5.
Position
Below the diagonal: candle_transformers.models.granite uses a module listed above it, which is the healthy direction.
candle_transformers.models.granite uses candle_transformers.models.gemma, so a change to candle_transformers.models.gemma can break candle_transformers.models.granite, while a change to candle_transformers.models.granite can't break candle_transformers.models.gemma.
Position
Below the diagonal: candle_transformers.models.granite uses a module listed above it, which is the healthy direction.
candle_transformers.models.granite uses candle_transformers.models.beit, so a change to candle_transformers.models.beit can break candle_transformers.models.granite, while a change to candle_transformers.models.granite can't break candle_transformers.models.beit.
Position
Below the diagonal: candle_transformers.models.granite uses a module listed above it, which is the healthy direction.
candle_transformers.models.granite uses candle_transformers.models.chatglm, so a change to candle_transformers.models.chatglm can break candle_transformers.models.granite, while a change to candle_transformers.models.granite can't break candle_transformers.models.chatglm.
Position
Below the diagonal: candle_transformers.models.granite uses a module listed above it, which is the healthy direction.
candle_transformers.models.granite uses candle_transformers.models.based, so a change to candle_transformers.models.based can break candle_transformers.models.granite, while a change to candle_transformers.models.granite can't break candle_transformers.models.based.
Position
Below the diagonal: candle_transformers.models.granite uses a module listed above it, which is the healthy direction.
candle_transformers.models.metavoice.transformer uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.metavoice.transformer, while a change to candle_transformers.models.metavoice.transformer can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.metavoice.transformer uses a module listed above it, which is the healthy direction.
candle_transformers.models.metavoice.transformer uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.metavoice.transformer, while a change to candle_transformers.models.metavoice.transformer can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.metavoice.transformer uses a module listed above it, which is the healthy direction.
candle_transformers.models.metavoice.transformer uses candle_transformers.models.t5, so a change to candle_transformers.models.t5 can break candle_transformers.models.metavoice.transformer, while a change to candle_transformers.models.metavoice.transformer can't break candle_transformers.models.t5.
Position
Below the diagonal: candle_transformers.models.metavoice.transformer uses a module listed above it, which is the healthy direction.
candle_transformers.models.metavoice.transformer uses candle_transformers.models.gemma, so a change to candle_transformers.models.gemma can break candle_transformers.models.metavoice.transformer, while a change to candle_transformers.models.metavoice.transformer can't break candle_transformers.models.gemma.
Position
Below the diagonal: candle_transformers.models.metavoice.transformer uses a module listed above it, which is the healthy direction.
candle_transformers.models.metavoice.transformer uses candle_transformers.models.beit, so a change to candle_transformers.models.beit can break candle_transformers.models.metavoice.transformer, while a change to candle_transformers.models.metavoice.transformer can't break candle_transformers.models.beit.
Position
Below the diagonal: candle_transformers.models.metavoice.transformer uses a module listed above it, which is the healthy direction.
candle_transformers.models.metavoice.transformer uses candle_transformers.models.chatglm, so a change to candle_transformers.models.chatglm can break candle_transformers.models.metavoice.transformer, while a change to candle_transformers.models.metavoice.transformer can't break candle_transformers.models.chatglm.
Position
Below the diagonal: candle_transformers.models.metavoice.transformer uses a module listed above it, which is the healthy direction.
candle_transformers.models.metavoice.transformer uses candle_transformers.models.based, so a change to candle_transformers.models.based can break candle_transformers.models.metavoice.transformer, while a change to candle_transformers.models.metavoice.transformer can't break candle_transformers.models.based.
Position
Below the diagonal: candle_transformers.models.metavoice.transformer uses a module listed above it, which is the healthy direction.
candle_transformers.models.blip uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.blip, while a change to candle_transformers.models.blip can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.blip uses a module listed above it, which is the healthy direction.
candle_transformers.models.blip uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.blip, while a change to candle_transformers.models.blip can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.blip uses a module listed above it, which is the healthy direction.
candle_transformers.models.blip uses candle_transformers.models.t5, so a change to candle_transformers.models.t5 can break candle_transformers.models.blip, while a change to candle_transformers.models.blip can't break candle_transformers.models.t5.
Position
Below the diagonal: candle_transformers.models.blip uses a module listed above it, which is the healthy direction.
candle_transformers.models.blip uses candle_transformers.models.chinese_clip, so a change to candle_transformers.models.chinese_clip can break candle_transformers.models.blip, while a change to candle_transformers.models.blip can't break candle_transformers.models.chinese_clip.
Position
Below the diagonal: candle_transformers.models.blip uses a module listed above it, which is the healthy direction.
candle_transformers.models.blip uses candle_transformers.models.with_tracing, so a change to candle_transformers.models.with_tracing can break candle_transformers.models.blip, while a change to candle_transformers.models.blip can't break candle_transformers.models.with_tracing.
Position
Below the diagonal: candle_transformers.models.blip uses a module listed above it, which is the healthy direction.
candle_transformers.models.blip uses candle_transformers.models.gemma4.audio, so a change to candle_transformers.models.gemma4.audio can break candle_transformers.models.blip, while a change to candle_transformers.models.blip can't break candle_transformers.models.gemma4.audio.
Position
Below the diagonal: candle_transformers.models.blip uses a module listed above it, which is the healthy direction.
candle_transformers.models.blip uses candle_transformers.models.beit, so a change to candle_transformers.models.beit can break candle_transformers.models.blip, while a change to candle_transformers.models.blip can't break candle_transformers.models.beit.
Position
Below the diagonal: candle_transformers.models.blip uses a module listed above it, which is the healthy direction.
candle_transformers.models.blip uses candle_transformers.models.based, so a change to candle_transformers.models.based can break candle_transformers.models.blip, while a change to candle_transformers.models.blip can't break candle_transformers.models.based.
Position
Below the diagonal: candle_transformers.models.blip uses a module listed above it, which is the healthy direction.
candle_transformers.models.blip uses candle_transformers.models.blip_text, so a change to candle_transformers.models.blip_text can break candle_transformers.models.blip, while a change to candle_transformers.models.blip can't break candle_transformers.models.blip_text.
Position
Below the diagonal: candle_transformers.models.blip uses a module listed above it, which is the healthy direction.
candle_transformers.models.rwkv_v5 uses candle_metal_kernels.metal.device, so a change to candle_metal_kernels.metal.device can break candle_transformers.models.rwkv_v5, while a change to candle_transformers.models.rwkv_v5 can't break candle_metal_kernels.metal.device.
Position
Below the diagonal: candle_transformers.models.rwkv_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.rwkv_v5 uses candle_nn.group_norm, so a change to candle_nn.group_norm can break candle_transformers.models.rwkv_v5, while a change to candle_transformers.models.rwkv_v5 can't break candle_nn.group_norm.
Position
Below the diagonal: candle_transformers.models.rwkv_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.rwkv_v5 uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.rwkv_v5, while a change to candle_transformers.models.rwkv_v5 can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.rwkv_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.rwkv_v5 uses candle_transformers.models.t5, so a change to candle_transformers.models.t5 can break candle_transformers.models.rwkv_v5, while a change to candle_transformers.models.rwkv_v5 can't break candle_transformers.models.t5.
Position
Below the diagonal: candle_transformers.models.rwkv_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.rwkv_v5 uses candle_transformers.models.gemma4.audio, so a change to candle_transformers.models.gemma4.audio can break candle_transformers.models.rwkv_v5, while a change to candle_transformers.models.rwkv_v5 can't break candle_transformers.models.gemma4.audio.
Position
Below the diagonal: candle_transformers.models.rwkv_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.rwkv_v5 uses candle_transformers.models.beit, so a change to candle_transformers.models.beit can break candle_transformers.models.rwkv_v5, while a change to candle_transformers.models.rwkv_v5 can't break candle_transformers.models.beit.
Position
Below the diagonal: candle_transformers.models.rwkv_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.rwkv_v5 uses candle_transformers.models.chatglm, so a change to candle_transformers.models.chatglm can break candle_transformers.models.rwkv_v5, while a change to candle_transformers.models.rwkv_v5 can't break candle_transformers.models.chatglm.
Position
Below the diagonal: candle_transformers.models.rwkv_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.rwkv_v5 uses candle_transformers.models.based, so a change to candle_transformers.models.based can break candle_transformers.models.rwkv_v5, while a change to candle_transformers.models.rwkv_v5 can't break candle_transformers.models.based.
Position
Below the diagonal: candle_transformers.models.rwkv_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.rwkv_v5 uses candle_transformers.models.metavoice.transformer, so a change to candle_transformers.models.metavoice.transformer can break candle_transformers.models.rwkv_v5, while a change to candle_transformers.models.rwkv_v5 can't break candle_transformers.models.metavoice.transformer.
Position
Below the diagonal: candle_transformers.models.rwkv_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.dac uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.dac, while a change to candle_transformers.models.dac can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.dac uses a module listed above it, which is the healthy direction.
candle_transformers.models.dac uses candle_nn.conv, so a change to candle_nn.conv can break candle_transformers.models.dac, while a change to candle_transformers.models.dac can't break candle_nn.conv.
Position
Below the diagonal: candle_transformers.models.dac uses a module listed above it, which is the healthy direction.
candle_transformers.models.dac uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.dac, while a change to candle_transformers.models.dac can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.dac uses a module listed above it, which is the healthy direction.
candle_transformers.models.dac uses candle_transformers.models.chatglm, so a change to candle_transformers.models.chatglm can break candle_transformers.models.dac, while a change to candle_transformers.models.dac can't break candle_transformers.models.chatglm.
Position
Below the diagonal: candle_transformers.models.dac uses a module listed above it, which is the healthy direction.
candle_transformers.models.dac uses candle_transformers.models.based, so a change to candle_transformers.models.based can break candle_transformers.models.dac, while a change to candle_transformers.models.dac can't break candle_transformers.models.based.
Position
Below the diagonal: candle_transformers.models.dac uses a module listed above it, which is the healthy direction.
candle_transformers.models.dac uses candle_transformers.models.blip, so a change to candle_transformers.models.blip can break candle_transformers.models.dac, while a change to candle_transformers.models.dac can't break candle_transformers.models.blip.
Position
Below the diagonal: candle_transformers.models.dac uses a module listed above it, which is the healthy direction.
candle_transformers.models.encodec uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.encodec, while a change to candle_transformers.models.encodec can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.encodec uses a module listed above it, which is the healthy direction.
candle_transformers.models.encodec uses candle_metal_kernels, so a change to candle_metal_kernels can break candle_transformers.models.encodec, while a change to candle_transformers.models.encodec can't break candle_metal_kernels.
Position
Below the diagonal: candle_transformers.models.encodec uses a module listed above it, which is the healthy direction.
candle_transformers.models.encodec uses candle_nn.conv, so a change to candle_nn.conv can break candle_transformers.models.encodec, while a change to candle_transformers.models.encodec can't break candle_nn.conv.
Position
Below the diagonal: candle_transformers.models.encodec uses a module listed above it, which is the healthy direction.
candle_transformers.models.encodec uses candle_nn.group_norm, so a change to candle_nn.group_norm can break candle_transformers.models.encodec, while a change to candle_transformers.models.encodec can't break candle_nn.group_norm.
Position
Below the diagonal: candle_transformers.models.encodec uses a module listed above it, which is the healthy direction.
candle_transformers.models.encodec uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.encodec, while a change to candle_transformers.models.encodec can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.encodec uses a module listed above it, which is the healthy direction.
candle_transformers.models.encodec uses candle_transformers.models.chatglm, so a change to candle_transformers.models.chatglm can break candle_transformers.models.encodec, while a change to candle_transformers.models.encodec can't break candle_transformers.models.chatglm.
Position
Below the diagonal: candle_transformers.models.encodec uses a module listed above it, which is the healthy direction.
candle_transformers.models.encodec uses candle_transformers.models.based, so a change to candle_transformers.models.based can break candle_transformers.models.encodec, while a change to candle_transformers.models.encodec can't break candle_transformers.models.based.
Position
Below the diagonal: candle_transformers.models.encodec uses a module listed above it, which is the healthy direction.
candle_transformers.models.encodec uses candle_transformers.models.blip, so a change to candle_transformers.models.blip can break candle_transformers.models.encodec, while a change to candle_transformers.models.encodec can't break candle_transformers.models.blip.
Position
Below the diagonal: candle_transformers.models.encodec uses a module listed above it, which is the healthy direction.
candle_transformers.models.encodec uses candle_transformers.models.dac, so a change to candle_transformers.models.dac can break candle_transformers.models.encodec, while a change to candle_transformers.models.encodec can't break candle_transformers.models.dac.
Position
Below the diagonal: candle_transformers.models.encodec uses a module listed above it, which is the healthy direction.
candle_transformers.models.parler_tts uses candle_metal_kernels, so a change to candle_metal_kernels can break candle_transformers.models.parler_tts, while a change to candle_transformers.models.parler_tts can't break candle_metal_kernels.
Position
Below the diagonal: candle_transformers.models.parler_tts uses a module listed above it, which is the healthy direction.
candle_transformers.models.parler_tts uses candle_metal_kernels.metal.device, so a change to candle_metal_kernels.metal.device can break candle_transformers.models.parler_tts, while a change to candle_transformers.models.parler_tts can't break candle_metal_kernels.metal.device.
Position
Below the diagonal: candle_transformers.models.parler_tts uses a module listed above it, which is the healthy direction.
candle_transformers.models.parler_tts uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.parler_tts, while a change to candle_transformers.models.parler_tts can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.parler_tts uses a module listed above it, which is the healthy direction.
candle_transformers.models.parler_tts uses candle_transformers.models.t5, so a change to candle_transformers.models.t5 can break candle_transformers.models.parler_tts, while a change to candle_transformers.models.parler_tts can't break candle_transformers.models.t5.
Position
Below the diagonal: candle_transformers.models.parler_tts uses a module listed above it, which is the healthy direction.
candle_transformers.models.parler_tts uses candle_transformers.models.chinese_clip, so a change to candle_transformers.models.chinese_clip can break candle_transformers.models.parler_tts, while a change to candle_transformers.models.parler_tts can't break candle_transformers.models.chinese_clip.
Position
Below the diagonal: candle_transformers.models.parler_tts uses a module listed above it, which is the healthy direction.
candle_transformers.models.parler_tts uses candle_transformers.models.gemma4.audio, so a change to candle_transformers.models.gemma4.audio can break candle_transformers.models.parler_tts, while a change to candle_transformers.models.parler_tts can't break candle_transformers.models.gemma4.audio.
Position
Below the diagonal: candle_transformers.models.parler_tts uses a module listed above it, which is the healthy direction.
candle_transformers.models.parler_tts uses candle_transformers.models.beit, so a change to candle_transformers.models.beit can break candle_transformers.models.parler_tts, while a change to candle_transformers.models.parler_tts can't break candle_transformers.models.beit.
Position
Below the diagonal: candle_transformers.models.parler_tts uses a module listed above it, which is the healthy direction.
candle_transformers.models.parler_tts uses candle_transformers.models.chatglm, so a change to candle_transformers.models.chatglm can break candle_transformers.models.parler_tts, while a change to candle_transformers.models.parler_tts can't break candle_transformers.models.chatglm.
Position
Below the diagonal: candle_transformers.models.parler_tts uses a module listed above it, which is the healthy direction.
candle_transformers.models.parler_tts uses candle_transformers.models.based, so a change to candle_transformers.models.based can break candle_transformers.models.parler_tts, while a change to candle_transformers.models.parler_tts can't break candle_transformers.models.based.
Position
Below the diagonal: candle_transformers.models.parler_tts uses a module listed above it, which is the healthy direction.
candle_transformers.models.parler_tts uses candle_transformers.models.dac, so a change to candle_transformers.models.dac can break candle_transformers.models.parler_tts, while a change to candle_transformers.models.parler_tts can't break candle_transformers.models.dac.
Position
Below the diagonal: candle_transformers.models.parler_tts uses a module listed above it, which is the healthy direction.
candle_transformers.models.stella_en_v5 uses candle_kernels, so a change to candle_kernels can break candle_transformers.models.stella_en_v5, while a change to candle_transformers.models.stella_en_v5 can't break candle_kernels.
Position
Below the diagonal: candle_transformers.models.stella_en_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.stella_en_v5 uses candle_metal_kernels, so a change to candle_metal_kernels can break candle_transformers.models.stella_en_v5, while a change to candle_transformers.models.stella_en_v5 can't break candle_metal_kernels.
Position
Below the diagonal: candle_transformers.models.stella_en_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.stella_en_v5 uses candle_metal_kernels.metal.device, so a change to candle_metal_kernels.metal.device can break candle_transformers.models.stella_en_v5, while a change to candle_transformers.models.stella_en_v5 can't break candle_metal_kernels.metal.device.
Position
Below the diagonal: candle_transformers.models.stella_en_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.stella_en_v5 uses candle_transformers.quantized_var_builder, so a change to candle_transformers.quantized_var_builder can break candle_transformers.models.stella_en_v5, while a change to candle_transformers.models.stella_en_v5 can't break candle_transformers.quantized_var_builder.
Position
Below the diagonal: candle_transformers.models.stella_en_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.stella_en_v5 uses candle_transformers.models.t5, so a change to candle_transformers.models.t5 can break candle_transformers.models.stella_en_v5, while a change to candle_transformers.models.stella_en_v5 can't break candle_transformers.models.t5.
Position
Below the diagonal: candle_transformers.models.stella_en_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.stella_en_v5 uses candle_transformers.models.chinese_clip, so a change to candle_transformers.models.chinese_clip can break candle_transformers.models.stella_en_v5, while a change to candle_transformers.models.stella_en_v5 can't break candle_transformers.models.chinese_clip.
Position
Below the diagonal: candle_transformers.models.stella_en_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.stella_en_v5 uses candle_transformers.models.gemma, so a change to candle_transformers.models.gemma can break candle_transformers.models.stella_en_v5, while a change to candle_transformers.models.stella_en_v5 can't break candle_transformers.models.gemma.
Position
Below the diagonal: candle_transformers.models.stella_en_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.stella_en_v5 uses candle_transformers.models.gemma4.audio, so a change to candle_transformers.models.gemma4.audio can break candle_transformers.models.stella_en_v5, while a change to candle_transformers.models.stella_en_v5 can't break candle_transformers.models.gemma4.audio.
Position
Below the diagonal: candle_transformers.models.stella_en_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.stella_en_v5 uses candle_transformers.models.beit, so a change to candle_transformers.models.beit can break candle_transformers.models.stella_en_v5, while a change to candle_transformers.models.stella_en_v5 can't break candle_transformers.models.beit.
Position
Below the diagonal: candle_transformers.models.stella_en_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.stella_en_v5 uses candle_transformers.models.chatglm, so a change to candle_transformers.models.chatglm can break candle_transformers.models.stella_en_v5, while a change to candle_transformers.models.stella_en_v5 can't break candle_transformers.models.chatglm.
Position
Below the diagonal: candle_transformers.models.stella_en_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.stella_en_v5 uses candle_transformers.models.based, so a change to candle_transformers.models.based can break candle_transformers.models.stella_en_v5, while a change to candle_transformers.models.stella_en_v5 can't break candle_transformers.models.based.
Position
Below the diagonal: candle_transformers.models.stella_en_v5 uses a module listed above it, which is the healthy direction.
candle_transformers.models.stella_en_v5 uses candle_transformers.models.encodec, so a change to candle_transformers.models.encodec can break candle_transformers.models.stella_en_v5, while a change to candle_transformers.models.stella_en_v5 can't break candle_transformers.models.encodec.
Position
Below the diagonal: candle_transformers.models.stella_en_v5 uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 37% · Weak · gated by D2, D4, R1, R10 ·
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
A05:2025 — Injection
7
High / Critical
A03:2025 — Software Supply Chain Failures
3
Medium
Roadmap
Top priorities: Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video; Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href; Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
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.
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
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 — 43
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 — 2170
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 — 259
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 17
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 54 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.8, 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 — 54 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, 2456 of 2472 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.
D8 Code Coverage — 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. Coverage NOT MEASURED: the Rust half could not be measured — the Cargo suite in repository root did not build, so it was never run. Coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo.
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. Test source is present (.rs) and this repository declares a Cargo test suite (repository root, 73 test files), but it was not re-run: its build outgrew the 12 GB scratch ceiling (12.87 GB measured) and was stopped; its suite was not run. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
D14 License Compliance — 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. Not scored — this repository declares Cargo manifests but commits no Cargo.lock, so its dependency graph was closed from the manifests over the crates.io index, and part of it could not be read: no published release of tokio satisfies `1.*`. A licence verdict over part of a dependency graph is not a licence verdict. NOT a finding that this repository's licences are compliant: this dimension asserts nothing about its licensing in either direction.
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. D21's naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their 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 — 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. 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.
D44 Platform End-of-Life — 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 dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, a Rust toolchain file or Cargo.toml rust-version, a .go-version, .java-version, .ruby-version, .tool-versions or .sdkmanrc, a go.mod go directive, a Maven or Gradle Java level or toolchain, a Gemfile's ruby directive, a mix.exs elixir requirement, a rebar.config minimum_otp_vsn, a pubspec.yaml SDK constraint, a build.sbt scalaVersion, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (Package.swift, a Dockerfile) is simply not read here yet.
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 is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
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 no C#, F#, JavaScript/TypeScript, Dart, Ruby or Scala was found, and this repository's Python, Rust, c, cpp 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 no C#, JavaScript/TypeScript, Java, Dart, Ruby or Scala was found, and this repository's Python, Rust, c, cpp 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.
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 reads C# syntax, and JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala or Kotlin was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
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 reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala or PHP was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
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.
X5 Nullable reference types — 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 and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's C, Cpp, Python, Rust 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.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
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.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality 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.
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").
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
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.
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.
48 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was candle_onnx::eval::simple_eval_ at 345. A further 23 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 MetalStorage::unary_impl at 111 — they are counted neither in the figure above nor in this dimension's score. 7 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: candle-metal-kernels/src/kernels/sdpa.rs (candle_metal_kernels::kernels::sdpa::call_sdpa_vector_2pass at 38), candle-core/src/quantized/mod.rs (QStorage::from_data at 31), candle-core/src/safetensors.rs (Tensor::from_raw_buffer at 23), candle-core/src/sort.rs (ArgSort::metal_fwd at 23), candle-metal-kernels/src/kernels/quantized.rs (candle_metal_kernels::kernels::quantized::call_quantized_matmul_mv_t at 21), and 2 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.
+ 26 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 1 body over 120 down to 120 or less in Cyclomatic Complexity — start with candle_onnx::eval::simple_eval_ (cyclomatic 345). — Refactoring it lifts Cyclomatic Complexity from 4.7 to about 5.8/10.
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.
+ 64 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 1 body over 120 down to 120 or less in Cognitive Complexity — start with candle_onnx::eval::simple_eval_ (cognitive 754). — Refactoring it lifts Cognitive Complexity from 3.9 to about 5.8/10.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes7.6 / 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.
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 50 FileTooLong finding(s) in God Classes — start with mod.rs (5), lib.rs (3), text.rs (2). — One of this dimension's main actionable groups (50 warning-level).
Resolve the 32 MethodTooLong finding(s) in God Classes — start with mod.rs (9), lib.rs (4), backprop.rs (2). — One of this dimension's main actionable groups (32 warning-level).
Resolve the 30 FunctionTooLong finding(s) in God Classes — start with neon.rs (10), cutile.rs (2), varlen.rs (2). — One of this dimension's main actionable groups (30 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.
1075 duplicated block group(s) detected. 25.8 % of the production lines (40,298 of 155,929) are in a reported copy. A further 600 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 67 of the 1675 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.
+ 405 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 70 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with neon.rs (6), mod.rs (5), standard.rs (4). — One of this dimension's main actionable groups (70 warning-level).
Resolve the 69 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with mod.rs (5), neon.rs (5), blip_text.rs (4). — One of this dimension's main actionable groups (69 warning-level).
Resolve the 68 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with mod.rs (7), model.rs (7), neon.rs (5). — One of this dimension's main actionable groups (68 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling10.0 / 10Exemplary✓ 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.
13 production modules (Cargo+Python), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 2 module(s) off the main sequence, with abstractness counted on 11 of the 13 (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: candle-kernels · ×2
✓ On the Gold path — maintain.
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.
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.
4 outdated, 0 yanked direct Cargo dependencies. 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 Cargo.lock there.
Outdated: js-sys · ×4
✓ On the Gold path — maintain.
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Resolve the 1 Hotspot finding(s) in Churn × Complexity Hotspots — start with eval.rs. — One of this dimension's main actionable groups (1 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.7 / 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.
12 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is candle-core/src/quantized/repack.rs. Counted over 344 of the 419 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
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.
123 deducted task-comment markers across 155929 LoC (0.1/KLoC) → score 9.8. 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.
Resolve the 116 TodoComment finding(s) in Explicit Debt — start with main.rs (12), mod.rs (12), lib.rs (8). — One of this dimension's main actionable groups (116 warning-level).
Resolve the 4 XxxComment finding(s) in Explicit Debt — start with eval.rs (2), safetensors.rs (2). — One of this dimension's main actionable groups (4 warning-level).
Resolve the 2 HackComment finding(s) in Explicit Debt — start with eval.rs, npy.rs. — One of this dimension's main actionable groups (2 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.
1 of 1 documentation facets pass in full. 30 document(s) read across 1 unit(s).
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: 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.
2 of 12 build units (Cargo) 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).
7 finding(s): 0 critical, 4 high, 3 medium, 0 low. semgrep hit a parse error in 1 file(s) — `candle-examples/examples/moondream/main.rs` (line 275) — 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.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
What to do
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d29_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.
223 of 344 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is candle-transformers/src/models/debertav2.rs. Counted over 344 of the 419 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Most significant orphaned file · ×3candle-transformers/src/models/debertav2.rs:1
Concentrated knowledge decay
What to do
Resolve the 220 Orphaned file finding(s) in Knowledge Freshness — start with mod.rs (8), model.rs (6), lib.rs (4). — One of this dimension's main actionable groups (220 recommendation-level).
Resolve the 3 Most significant orphaned file finding(s) in Knowledge Freshness — start with debertav2.rs, text.rs, vision.rs. — One of this dimension's main actionable groups (3 recommendation-level).
Resolve the 1 Concentrated knowledge decay 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 1 Boundary-crossing change coupling finding(s) in Change Coupling — start with mod.rs. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Change coupling finding(s) in Change Coupling — start with backend.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.
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives1.0 / 10Critical✓ Tool-verified
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.
A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content. (×6) — candle-wasm-examples/blip/index.html:348, candle-wasm-examples/moondream/index.html:261, candle-wasm-examples/segment-anything/lib-example.html:532, …
An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative. (×15) — candle-wasm-examples/blip/index.html:377, candle-wasm-examples/blip/index.html:381, candle-wasm-examples/blip/index.html:385, …
What to do
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Do you agree with this assessment?
AC2 · Forms & labels6.6 / 10Strong✓ Tool-verified
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. (×6) — candle-wasm-examples/bert/lib-example.html:328, candle-wasm-examples/llama2-c/lib-example.html:229, candle-wasm-examples/moondream/index.html:89, …
A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one). (×2) — candle-wasm-examples/llama2-c/lib-example.html:235, REDACTED:442
What to do
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en"). (×10) — candle-wasm-examples/bert/lib-example.html:1, candle-wasm-examples/blip/index.html:2, candle-wasm-examples/llama2-c/lib-example.html:1, …
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. — candle-wasm-examples/quant-qwen3/index.html:2
Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one. — candle-wasm-examples/quant-qwen3/index.html:307
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".
A script attaches a click listener to this <div>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. (×4) — candle-wasm-examples/blip/index.html:371, candle-wasm-examples/moondream/index.html:286, candle-wasm-examples/segment-anything/lib-example.html:556, …
A script attaches a click listener to this <canvas>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. — candle-wasm-examples/segment-anything/lib-example.html:532
What to do
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.
Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.
Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
<input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×5) — candle-wasm-examples/bert/lib-example.html:308, candle-wasm-examples/bert/lib-example.html:328, candle-wasm-examples/llama2-c/lib-example.html:229, …
This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade. (×7) — candle-wasm-examples/bert/lib-example.html:349, candle-wasm-examples/blip/index.html:355, candle-wasm-examples/llama2-c/lib-example.html:339, …
<textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×2) — candle-wasm-examples/bert/lib-example.html:354, REDACTED:432
`.thinking-toggle` sets color: white on background-color: #667eea — 3.7:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — candle-wasm-examples/quant-qwen3/index.html:110
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
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.
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○ Nothing flagged
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.
Do you agree with this assessment?
P2 · Observability5.3 / 10Adequate✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Only 6/14 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `candle-wasm-examples/bert`, `candle-wasm-examples/blip`, `candle-wasm-examples/moondream`, `candle-wasm-examples/phi` and 3 more.
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
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.
`REDACTED` schedules updates, but no `package-ecosystem` entry covers `github-actions`, `pip`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entries to the `updates:` list. — REDACTED:2
What to do
Dependabot is configured but does not watch `github-actions`, `pip` — add those `package-ecosystem` entries to REDACTED so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
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 Safety0.0 / 10Critical✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
0 typed · 14 plain JS — the untyped files are candle-wasm-examples/bert/bertWorker.js, candle-wasm-examples/bert/utils.js, candle-wasm-examples/blip/blipWorker.js, candle-wasm-examples/llama2-c/llama2cWorker.js, REDACTED, candle-wasm-examples/moondream/moondreamWorker.js (+8 more).
What to do
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
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.
12 duplicated blocks under candle-wasm-examples/ have copies in at least two of the sibling directories bert, blip, llama2-c, moondream, phi, segment-anything (+3 more sibling(s) not listed) — 11 of them are reported below, and 1 is counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 12 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 12 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 12 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — candle-wasm-examples/moondream/moondreamWorker.js:6
candle-wasm-examples/moondream/moondreamWorker.js:6 · candle-wasm-examples/phi/phiWorker.js:4 — the two spans are one implementation copied and then locally edited — 652 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. — candle-wasm-examples/moondream/moondreamWorker.js:6
candle-wasm-examples/t5/T5ModelConditionalGeneration.js:2 · candle-wasm-examples/t5/T5ModelEncoderWorker.js:2 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — candle-wasm-examples/t5/T5ModelConditionalGeneration.js:2
candle-wasm-examples/bert/bertWorker.js:20 · candle-wasm-examples/t5/T5ModelEncoderWorker.js:27 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — candle-wasm-examples/bert/bertWorker.js:20
candle-wasm-examples/moondream/moondreamWorker.js:59 · candle-wasm-examples/segment-anything/samWorker.js:39 — the 2 copies are spread across 2 files, 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. — candle-wasm-examples/moondream/moondreamWorker.js:59
candle-wasm-examples/llama2-c/llama2cWorker.js:30 · candle-wasm-examples/phi/phiWorker.js:54 — the 2 copies are spread across 2 files, 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. — candle-wasm-examples/llama2-c/llama2cWorker.js:30
candle-wasm-examples/llama2-c/llama2cWorker.js:88 · candle-wasm-examples/moondream/moondreamWorker.js:176 · candle-wasm-examples/phi/phiWorker.js:130 — the 3 copies are spread across 3 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete. — candle-wasm-examples/llama2-c/llama2cWorker.js:88
candle-wasm-examples/blip/blipWorker.js:26 · candle-wasm-examples/t5/T5ModelConditionalGeneration.js:29 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — candle-wasm-examples/blip/blipWorker.js:26
candle-wasm-examples/bert/utils.js:12 · candle-wasm-examples/t5/utils.js:14 · candle-wasm-examples/t5/utils.js:48 — the 3 copies are spread across 2 files, 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. — candle-wasm-examples/bert/utils.js:12
candle-wasm-examples/llama2-c/llama2cWorker.js:71 · candle-wasm-examples/phi/phiWorker.js:105 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — candle-wasm-examples/llama2-c/llama2cWorker.js:71
candle-wasm-examples/bert/bertWorker.js:5 · candle-wasm-examples/blip/blipWorker.js:5 · candle-wasm-examples/llama2-c/llama2cWorker.js:4 · candle-wasm-examples/segment-anything/samWorker.js:7 · +4 more site(s) not listed — the 8 copies are spread across 7 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. There is one copy in each of 8 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete. — candle-wasm-examples/bert/bertWorker.js:5
candle-wasm-examples/t5/utils.js:10 · candle-wasm-examples/t5/utils.js:44 — 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. — candle-wasm-examples/t5/utils.js:10
candle-wasm-examples/llama2-c/llama2cWorker.js:3 · candle-wasm-examples/yolo/yoloWorker.js:4 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — candle-wasm-examples/llama2-c/llama2cWorker.js:3
candle-wasm-examples/moondream/moondreamWorker.js:128 · candle-wasm-examples/segment-anything/samWorker.js:127 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — candle-wasm-examples/moondream/moondreamWorker.js:128
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 · 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.
Do you agree with this assessment?
R3 · Large Files10.0 / 10Exemplary✓ 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.
Do you agree with this assessment?
R7 · Dead Code10.0 / 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.
14 file(s) (~1700 LoC) were excluded from dead-code analysis. This package's entry point(s) resolved, but the walk stopped one hop in: candle-wasm-examples/moondream/moondreamWorker.js imports './build/m.js', which is not in the scanned tree. That is usually a generated or build-output module, so reachability cannot see past it and no dead-code claim is made about this package. Nothing is necessarily wrong here.
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 · Security — Read from this repository's Rust source: cryptographic hygiene (weak hash or cipher, key material fixed in the source) and outbound TLS (certificate validation, protocol version) — facts about code that hold whether or not it serves anything itself. Markup this repository SHIPS is scored for third-party script integrity whether or not the repository serves it itself, since a page handed to a consumer runs in that consumer’s origin. The server controls — HTTPS enforcement, HSTS, cookie flags, input validation — are read from a Rust server this repository starts itself, and its production Rust starts none. What serves its HTTP is outside the Rust source, and only what this card names about it was assessed.
Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.
`https://cdn.tailwindcss.com` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. The URL also names no version, so it resolves to whatever that origin serves at fetch time — the executed bytes can change with nobody touching this repository. 10 such include(s) across the repository's markup. — candle-wasm-examples/bert/lib-example.html:21
What to do
Pin third-party scripts and verify them: name an exact version in the URL and add an `integrity="sha384-…"` hash alongside `crossorigin="anonymous"` (both are required — an integrity hash on a cross-origin script without `crossorigin` is not evaluated, it blocks the script). Where the vendor ships a continuously-updated loader and publishes no stable hash (tag managers, analytics, chat widgets), Subresource Integrity is not available: constrain it instead with a `Content-Security-Policy` that names the exact origins allowed to execute, and drop the script from the pages that do not need it. Where the page is shipped inside a package that others host, prefer vendoring the asset and serving it from the app’s own origin, so no consumer inherits a third-party dependency they did not choose.
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.
Do you agree with this assessment?
X15 · Unvalidated length from an untrusted reader2.4 / 10Weak✓ Tool-verified
Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.
Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.
`len` is read from the bytes being parsed at line 483 (`read_u32`), then used to size a `vec![…; n]` at line 484 — and nowhere in its scope is `len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: it reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB, and an allocation the allocator refuses aborts the process with `memory allocation of … bytes failed` — an abort, not a panic, so no `catch_unwind` intercepts it and the whole process dies; a 64-bit length past `isize::MAX` panics with `capacity overflow` instead, out of a parser whose failure path was written for malformed input, not for hostile input. Bound `len` against the bytes actually remaining and a maximum the format allows before allocating. — candle-core/src/pickle.rs:484
`len` is read from the bytes being parsed at line 110 (`read_u32`), then used to size a `vec![…; n]` at line 111 — and nowhere in its scope is `len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: it reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB, and an allocation the allocator refuses aborts the process with `memory allocation of … bytes failed` — an abort, not a panic, so no `catch_unwind` intercepts it and the whole process dies; a 64-bit length past `isize::MAX` panics with `capacity overflow` instead, out of a parser whose failure path was written for malformed input, not for hostile input. Bound `len` against the bytes actually remaining and a maximum the format allows before allocating. — candle-core/src/quantized/ggml_file.rs:111
`n_dims` is read from the bytes being parsed at line 196 (`read_u32`), then used to size a `vec![…; n]` at line 200 — and nowhere in its scope is `n_dims` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: it reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB, and an allocation the allocator refuses aborts the process with `memory allocation of … bytes failed` — an abort, not a panic, so no `catch_unwind` intercepts it and the whole process dies; a 64-bit length past `isize::MAX` panics with `capacity overflow` instead, out of a parser whose failure path was written for malformed input, not for hostile input. Bound `n_dims` against the bytes actually remaining and a maximum the format allows before allocating. — candle-core/src/quantized/ggml_file.rs:200
`name_len` is read from the bytes being parsed at line 197 (`read_u32`), then used to size a `vec![…; n]` at line 205 — and nowhere in its scope is `name_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: it reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB, and an allocation the allocator refuses aborts the process with `memory allocation of … bytes failed` — an abort, not a panic, so no `catch_unwind` intercepts it and the whole process dies; a 64-bit length past `isize::MAX` panics with `capacity overflow` instead, out of a parser whose failure path was written for malformed input, not for hostile input. Bound `name_len` against the bytes actually remaining and a maximum the format allows before allocating. — candle-core/src/quantized/ggml_file.rs:205
`len` is read from the bytes being parsed at line 42 (`read_i32`), then used to size a `vec![…; n]` at line 51 — and nowhere in its scope is `len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: it reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB, and an allocation the allocator refuses aborts the process with `memory allocation of … bytes failed` — an abort, not a panic, so no `catch_unwind` intercepts it and the whole process dies; a 64-bit length past `isize::MAX` panics with `capacity overflow` instead, out of a parser whose failure path was written for malformed input, not for hostile input. Bound `len` against the bytes actually remaining and a maximum the format allows before allocating. — candle-core/src/quantized/imatrix_file.rs:51
What to do
Each finding names the read that takes the length from the input and the site that spends it, and states that the value is never compared in between. Confirm from the two, then bound the length against the remaining stream before using it.
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?
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a `for` loop leaves the `RefCell` it is walking alone — safe Rust rejects a body that changes the collection its loop borrows at compile time, except through interior mutability: a `RefCell` borrowed in the loop's header stays borrowed until the loop ends, so a `borrow_mut()` of it inside the body panics with `already borrowed: BorrowMutError` and the remaining elements are never seen. Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. 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.
`warning` at line 18 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — candle-pyo3/py_src/candle/__init__.py:18
`warning` at line 24 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — candle-pyo3/py_src/candle/__init__.py:24
`warning` at line 40 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — candle-pyo3/py_src/candle/__init__.py:40
Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 2 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
X10 Duplicated predicate — 15 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 2 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.
P4 Deployment & Rollback — not evidenced — no deploy/rollback/approval signal in the repo; absence of evidence is not evidence of a manual release
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 70 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.
AC5 ARIA correctness — No ARIA usage found in the parsed markup — AC5 not applicable here.
AX1 Captive dependencies — Not applicable: this repository's JavaScript 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; 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.
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 — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AXB1 Runtime evidence locked — no reproducible boot — This repository has nothing the runtime tiers could boot or serve — 13 markup documents under demonstration, documentation or developer-tool trees (or modules the build marks non-production) but none in the product; no UI framework or web-server dependency, no UI component source, no native UI project and no API definition — those pages are demos or docs for the code, not something this tier can boot — so runtime a11y/egress/header evidence has no subject here. Not applicable: this is neither a gap in the scan nor a finding about your code.
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
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 — ~53008 lines of test source are present (.rs) 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.
D11 Test Reliability — Test reliability not included — the .rs suite was found but not re-run
D14 License Compliance — Crate licences not graded — the lock-less Cargo graph could not be read in full
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 — Naming consistency does not read html yet; not measured.
D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust surface was not measured.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only; comments in this repository's .py, .rs source were not judged.
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.
D30 Dependency Vulnerabilities — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Cargo manifest and a Python pyproject.toml/requirements.txt (pip/uv/Poetry) — not scanned yet).
D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
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.
D43 Malicious Dependencies — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Cargo manifest and a Python pyproject.toml/requirements.txt (pip/uv/Poetry) — not scanned yet).
D44 Platform End-of-Life — Platform end-of-life not assessed — this repository declares no platform this pass reads
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
D8 Code Coverage — Coverage not measured — Rust suite
DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (77 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 none of the 3 signals this lens looks for
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
P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the 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 not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
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.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
R4 Test Coverage — the JS/TS workspace (14 production file(s)) has no JavaScript/TypeScript test, but it is 2.31% of this repository's production source and the other 97.69% carries 53,008 line(s) of test code this pass cannot read — an incidental frontend's reachability is not the repository's test posture, so it is not scored as one
R5 Dependency Freshness — no package-lock.json — dependency freshness not measured (would require an npm lockfile); JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
R6 Tooling — no package.json in the repository — test/lint/typecheck wiring is read from package.json scripts (corroborated against CI), so this project's own toolchain isn't measured here
R8 Dependency Hygiene — Not measured — no package.json declares any dependency, so there is nothing to check imports against (imports may resolve through a host runtime rather than node).
X12 Unreachable branch — X12 reached only 4% of this repository's production lines — rust (153,398 lines), c (6,881 lines), cpp (3,906 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 — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
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
X16 Unfloored truncation loop — 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
X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X18 Disposal-pattern correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
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 — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
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
X28 Index access outside its own emptiness guard — 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 4% of this repository's production lines — rust (153,398 lines), c (6,881 lines), cpp (3,906 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.
X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X6 Hand-rolled structured-format parsing — 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.
Critical — 43 finding(s)
AC1 · Text alternatives· <img> without a text alternative · ×15
<img> without a text alternative candle-wasm-examples/blip/index.html:377— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative candle-wasm-examples/blip/index.html:381— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative candle-wasm-examples/blip/index.html:385— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative candle-wasm-examples/moondream/index.html:292— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative candle-wasm-examples/moondream/index.html:296— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative candle-wasm-examples/moondream/index.html:300— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative candle-wasm-examples/moondream/index.html:304— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative candle-wasm-examples/segment-anything/lib-example.html:541— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative candle-wasm-examples/segment-anything/lib-example.html:561— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative candle-wasm-examples/segment-anything/lib-example.html:564— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative candle-wasm-examples/segment-anything/lib-example.html:567— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative candle-wasm-examples/yolo/lib-example.html:471— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative candle-wasm-examples/yolo/lib-example.html:484— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative candle-wasm-examples/yolo/lib-example.html:488— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative candle-wasm-examples/yolo/lib-example.html:492— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<html> without a lang candle-wasm-examples/bert/lib-example.html:1— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang candle-wasm-examples/blip/index.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang candle-wasm-examples/llama2-c/lib-example.html:1— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang candle-wasm-examples/moondream/index.html:1— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang REDACTED:1— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang candle-wasm-examples/quant-qwen3/index.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang candle-wasm-examples/segment-anything/lib-example.html:1— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang candle-wasm-examples/t5/index.html:1— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang candle-wasm-examples/whisper/lib-example.html:1— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang candle-wasm-examples/yolo/lib-example.html:1— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
AC2 · Forms & labels· <input> without a programmatic label · ×4
<input> without a programmatic label candle-wasm-examples/bert/lib-example.html:328— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label candle-wasm-examples/llama2-c/lib-example.html:229— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label candle-wasm-examples/moondream/index.html:89— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label candle-wasm-examples/t5/index.html:201— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
AC4 · Keyboard semantics· Click handler on a non-interactive <div> · ×4
Click handler on a non-interactive <div> candle-wasm-examples/blip/index.html:371— A script attaches a click listener to this <div>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> candle-wasm-examples/moondream/index.html:286— A script attaches a click listener to this <div>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> candle-wasm-examples/segment-anything/lib-example.html:556— A script attaches a click listener to this <div>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> candle-wasm-examples/yolo/lib-example.html:478— A script attaches a click listener to this <div>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
AC2 · Forms & labels· <button> with no accessible text · ×2
<button> with no accessible text candle-wasm-examples/llama2-c/lib-example.html:235— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text REDACTED:442— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
AC2 · Forms & labels· <textarea> without a programmatic label · ×2
<textarea> without a programmatic label REDACTED:432— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label candle-wasm-examples/quant-qwen3/index.html:315— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
AC4 · Keyboard semantics· Click handler on a non-interactive <canvas> · ×1
Click handler on a non-interactive <canvas> candle-wasm-examples/segment-anything/lib-example.html:532— A script attaches a click listener to this <canvas>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Boundary-crossing change coupling: mod.rs ↔ tests.rs candle-core/src/metal_backend/mod.rs:1— `candle-core/src/metal_backend/mod.rs` (context candle-core) and `candle-metal-kernels/src/tests.rs` (context candle-metal-kernels) sit in DIFFERENT parts of the tree yet change together 67% of the time (34 of the 51 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 34 shared commits counted here, the most recent 3 are `4b46187c` [Metal] Improve ternary further (#3242); `e33d776d` [Metal] cast improvements (#3241); `73fd9c31` [Metal] further improve unary and binary (#3239) — run `git show` on any of them.
TodoComment candle-wasm-examples/whisper/src/worker.rs:213— // TODO: Besides suppress tokens, we should apply the heuristics from — 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 candle-examples/examples/whisper-microphone/main.rs:196— // TODO: Besides suppress tokens, we should apply the heuristics from — 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 candle-transformers/src/models/bert.rs:139— // 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 candle-transformers/src/models/trocr.rs:315— // 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 candle-examples/examples/musicgen/musicgen_model.rs:248— // 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 candle-transformers/src/models/bert.rs:193— // TODO: Proper absolute positions? — 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 candle-transformers/src/models/bert.rs:419— // TODO: Support cross-attention? — 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 candle-transformers/src/models/distilbert.rs:261— // TODO: Support cross-attention? — 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 candle-transformers/src/models/bert.rs:421— // TODO: Support something similar to `apply_chunking_to_forward`? — 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 candle-transformers/src/models/distilbert.rs:263— // TODO: Support something similar to `apply_chunking_to_forward`? — 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 candle-transformers/src/models/bigcode.rs:225— // TODO: we could trim the tensors to MAX_SEQ_LEN so that this would work for — 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 candle-transformers/src/models/falcon.rs:281— // TODO: we could trim the tensors to MAX_SEQ_LEN so that this would work for — 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 candle-transformers/src/models/bigcode.rs:266— // TODO: Add cross-attention? — 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 candle-transformers/src/models/debertav2.rs:873— // TODO: In order to fully test ConvLayer a model needs to be found has a configuration where `conv_kernel_size` exists and is > 0 — 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 candle-transformers/src/models/encodec.rs:538— // TODO: Apply dilations! — 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 candle-transformers/src/models/gemma2.rs:32— // TODO: Handle the sliding window in the attention mask. — 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 candle-transformers/src/models/granitemoehybrid.rs:552— // TODO: Not supprting Mamba layers (blocks) for now, — 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 candle-transformers/src/models/llama2_c_weights.rs:113— // TODO: As of 2023-08-04, gemm is slower than expected when multiplying a matrix of — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment candle-transformers/src/models/metavoice.rs:476— // TODO: causal mask — 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 candle-transformers/src/models/metavoice.rs:656— // TODO: speaker embs. — 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 candle-transformers/src/models/quantized_qwen3.rs:268— // TODO: b > 1 needs varlen CPU flash with interleaved cache support. — 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 candle-transformers/src/models/quantized_t5.rs:361— // TODO: Use flash_attn. — 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 candle-transformers/src/models/t5.rs:490— // TODO: Use flash_attn. — 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 candle-transformers/src/models/quantized_t5.rs:432— // TODO: position_bias_masked? — 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 candle-transformers/src/models/t5.rs:562— // TODO: position_bias_masked? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
Duplicated block (7 lines × 2) candle-core/src/accelerate.rs:355— candle-core/src/accelerate.rs:355-361 | candle-core/src/accelerate.rs:365-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. 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 `a` to `&[f32]` in one and `&[f64]` 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 × 2) candle-core/src/cpu_backend/mod.rs:348— candle-core/src/cpu_backend/mod.rs:348-354 | candle-core/src/cpu_backend/mod.rs:360-366 — both copies are in the same file, so extract the 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) candle-core/src/npy.rs:291— candle-core/src/npy.rs:291-297 | candle-core/src/npy.rs:315-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 `candle-core/src/npy.rs:291` 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) candle-core/src/quantized/cuda.rs:706— candle-core/src/quantized/cuda.rs:706-712 | candle-core/src/quantized/cuda.rs:734-740 — both copies are in the same file, so extract the 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) candle-core/src/quantized/cuda.rs:767— candle-core/src/quantized/cuda.rs:767-773 | candle-core/src/quantized/cuda.rs:791-797 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/cuda.rs:767` 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) candle-core/src/quantized/k_quants.rs:426— candle-core/src/quantized/k_quants.rs:426-432 | candle-core/src/quantized/k_quants.rs:532-538 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/k_quants.rs:426` 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, `candle-core/src/quantized/k_quants.rs:421` calls `vec_dot_unopt` and `candle-core/src/quantized/k_quants.rs:529` 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) candle-core/src/quantized/metal.rs:50— candle-core/src/quantized/metal.rs:50-56 | candle-core/src/quantized/metal.rs:449-455 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/metal.rs:50` 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) candle-core/src/quantized/neon.rs:366— candle-core/src/quantized/neon.rs:366-372 | candle-core/src/quantized/neon.rs:443-449 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:366` 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) candle-core/src/quantized/neon.rs:564— candle-core/src/quantized/neon.rs:564-570 | candle-core/src/quantized/neon.rs:2939-2945 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:564` 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) candle-core/src/quantized/neon.rs:1271— candle-core/src/quantized/neon.rs:1271-1277 | candle-core/src/quantized/neon.rs:2006-2012 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:1271` 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) candle-core/src/quantized/neon.rs:1845— candle-core/src/quantized/neon.rs:1845-1851 | candle-core/src/quantized/neon.rs:2632-2638 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:1845` 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) candle-core/src/quantized/neon.rs:1880— candle-core/src/quantized/neon.rs:1880-1886 | candle-core/src/quantized/neon.rs:2667-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. Read the line range as the matched WINDOW rather than a finished unit: at `candle-core/src/quantized/neon.rs:1880` 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) candle-core/src/quantized/repack.rs:521— candle-core/src/quantized/repack.rs:521-527 | candle-core/src/quantized/repack.rs:563-569 — both copies are in the same file, so extract the 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) candle-core/src/quantized/utils.rs:408— candle-core/src/quantized/utils.rs:408-414 | candle-core/src/quantized/utils.rs:449-455 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/utils.rs:408` 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) candle-nn/src/attention/cpu_flash/causal.rs:402— candle-nn/src/attention/cpu_flash/causal.rs:402-408 | candle-nn/src/attention/cpu_flash/causal.rs:474-480 — both copies are in the same file, so extract the 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) candle-nn/src/attention/cpu_flash/standard.rs:151— candle-nn/src/attention/cpu_flash/standard.rs:151-157 | candle-nn/src/attention/cpu_flash/standard.rs:223-229 — both copies are in the same file, so extract the 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) candle-nn/src/attention/cpu_flash/standard.rs:158— candle-nn/src/attention/cpu_flash/standard.rs:158-164 | candle-nn/src/attention/cpu_flash/standard.rs:239-245 — both copies are in the same file, so extract the 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 `candle-nn/src/attention/cpu_flash/standard.rs:158` 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) candle-nn/src/attention/cpu_flash/standard.rs:152— candle-nn/src/attention/cpu_flash/standard.rs:152-158 | candle-nn/src/attention/cpu_flash/standard.rs:322-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.
Duplicated block (7 lines × 2) candle-nn/src/attention/cpu_flash/standard.rs:321— candle-nn/src/attention/cpu_flash/standard.rs:321-327 | candle-nn/src/attention/cpu_flash/standard.rs:399-405 — both copies are in the same file, so extract the 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) candle-nn/src/rotary_emb.rs:361— candle-nn/src/rotary_emb.rs:361-367 | candle-nn/src/rotary_emb.rs:381-387 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `candle-nn/src/rotary_emb.rs:361` 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) candle-transformers/src/models/blip.rs:225— candle-transformers/src/models/blip.rs:225-231 | candle-transformers/src/models/quantized_blip.rs:186-192 — before extracting anything, compare `candle-transformers/src/models/blip.rs` and `candle-transformers/src/models/quantized_blip.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 128 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 `candle-transformers/src/models/blip.rs:225` 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) candle-transformers/src/models/fastvit.rs:277— candle-transformers/src/models/fastvit.rs:277-283 | candle-transformers/src/models/mobileone.rs:210-216 — before extracting anything, compare `candle-transformers/src/models/fastvit.rs` and `candle-transformers/src/models/mobileone.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 54 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 `candle-transformers/src/models/fastvit.rs:277` 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) candle-transformers/src/models/flux/autoencoder.rs:142— candle-transformers/src/models/flux/autoencoder.rs:142-148 | candle-transformers/src/models/z_image/vae.rs:215-221 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) candle-transformers/src/models/mixformer.rs:366— candle-transformers/src/models/mixformer.rs:366-372 | candle-transformers/src/models/quantized_mixformer.rs:281-287 — before extracting anything, compare `candle-transformers/src/models/mixformer.rs` and `candle-transformers/src/models/quantized_mixformer.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 136 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 (7 lines × 2) candle-transformers/src/models/nvembed_v2/embedding.rs:19— candle-transformers/src/models/nvembed_v2/embedding.rs:19-25 | candle-transformers/src/models/quantized_mistral.rs:34-40 — before extracting anything, compare `candle-transformers/src/models/nvembed_v2/embedding.rs` and `candle-transformers/src/models/quantized_mistral.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 173 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) candle-core/src/cpu_backend/mod.rs:688— candle-core/src/cpu_backend/mod.rs:688-693 | candle-core/src/cpu_backend/mod.rs:748-753 — both copies are in the same file, so extract the 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 `candle-core/src/cpu_backend/mod.rs:688` 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) candle-core/src/cpu_backend/mod.rs:914— candle-core/src/cpu_backend/mod.rs:914-919 | candle-core/src/cpu_backend/mod.rs:936-942 — both copies are in the same file, so extract the 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 `candle-core/src/cpu_backend/mod.rs:914` 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) candle-core/src/cuda_backend/mod.rs:2036— candle-core/src/cuda_backend/mod.rs:2036-2041 | candle-core/src/metal_backend/mod.rs:1161-1167 — 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 `candle-core/src/metal_backend/mod.rs:1161` 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) candle-core/src/quantized/k_quants.rs:469— candle-core/src/quantized/k_quants.rs:469-474 | candle-core/src/quantized/k_quants.rs:786-791 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/k_quants.rs:469` 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) candle-core/src/quantized/mod.rs:959— candle-core/src/quantized/mod.rs:959-964 | candle-core/src/quantized/mod.rs:1018-1023 — both copies are in the same file, so extract the 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) candle-core/src/quantized/neon.rs:1397— candle-core/src/quantized/neon.rs:1397-1402 | candle-core/src/quantized/neon.rs:2135-2140 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:1397` 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) candle-core/src/quantized/neon.rs:2825— candle-core/src/quantized/neon.rs:2825-2830 | candle-core/src/quantized/neon.rs:2857-2862 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:2825` 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) candle-core/src/quantized/neon.rs:3251— candle-core/src/quantized/neon.rs:3251-3256 | candle-core/src/quantized/neon.rs:3529-3534 — both copies are in the same file, so extract the 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, `candle-core/src/quantized/neon.rs:3249` calls `add`, `vld1q_u8_x4` and `candle-core/src/quantized/neon.rs:3528` 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 × 2) candle-core/src/quantized/neon.rs:3983— candle-core/src/quantized/neon.rs:3983-3988 | candle-core/src/quantized/neon.rs:3989-3994 — both copies are in the same file, so extract the 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) candle-core/src/quantized/repack_x86.rs:338— candle-core/src/quantized/repack_x86.rs:338-343 | candle-core/src/quantized/repack_x86.rs:385-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. Read the line range as the matched WINDOW rather than a finished unit: at `candle-core/src/quantized/repack_x86.rs:338` 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) candle-core/src/safetensors.rs:117— candle-core/src/safetensors.rs:117-122 | candle-core/src/safetensors.rs:147-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. Read the line range as the matched WINDOW rather than a finished unit: at `candle-core/src/safetensors.rs:117` 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) candle-core/src/scalar.rs:29— candle-core/src/scalar.rs:29-34 | candle-core/src/scalar.rs:47-52 — both copies are in the same file, so extract the 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 `candle-core/src/scalar.rs:29` 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) candle-core/src/tensor.rs:1991— candle-core/src/tensor.rs:1991-1996 | candle-core/src/tensor.rs:2022-2027 — both copies are in the same file, so extract the 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 `candle-core/src/tensor.rs:1991` 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) candle-flash-attn-v3/src/lib.rs:603— candle-flash-attn-v3/src/lib.rs:603-608 | candle-flash-attn/src/lib.rs:701-706 — before extracting anything, compare `candle-flash-attn-v3/src/lib.rs` and `candle-flash-attn/src/lib.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 174 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-flash-attn/src/lib.rs:697` calls `is_some` and `candle-flash-attn-v3/src/lib.rs:601` 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) candle-transformers/src/models/blip_text.rs:487— candle-transformers/src/models/blip_text.rs:487-492 | candle-transformers/src/models/quantized_blip_text.rs:483-488 — before extracting anything, compare `candle-transformers/src/models/blip_text.rs` and `candle-transformers/src/models/quantized_blip_text.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 222 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 `candle-transformers/src/models/blip_text.rs:487` 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) candle-transformers/src/models/dinov2.rs:382— candle-transformers/src/models/dinov2.rs:382-387 | candle-transformers/src/models/dinov2reg4.rs:297-302 — before extracting anything, compare `candle-transformers/src/models/dinov2.rs` and `candle-transformers/src/models/dinov2reg4.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 108 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `candle-transformers/src/models/dinov2.rs:388` calls `i`, `mean`, `cat` and `candle-transformers/src/models/dinov2reg4.rs:303` 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 × 2) candle-transformers/src/models/gemma4/text.rs:316— candle-transformers/src/models/gemma4/text.rs:316-321 | candle-transformers/src/models/qwen3_vl/text.rs:160-165 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-transformers/src/models/gemma4/text.rs:314` calls `forward` and `candle-transformers/src/models/qwen3_vl/text.rs:158` 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) candle-transformers/src/models/lfm2.rs:166— candle-transformers/src/models/lfm2.rs:166-171 | candle-transformers/src/models/voxtral/voxtral_llama.rs:91-97 — before extracting anything, compare `candle-transformers/src/models/lfm2.rs` and `candle-transformers/src/models/voxtral/voxtral_llama.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) candle-transformers/src/models/llama2_c_weights.rs:46— candle-transformers/src/models/llama2_c_weights.rs:46-51 | candle-wasm-examples/llama2-c/src/worker.rs:45-50 — before extracting anything, compare `candle-transformers/src/models/llama2_c_weights.rs` and `candle-wasm-examples/llama2-c/src/worker.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. 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 (6 lines × 2) candle-transformers/src/models/marian.rs:223— candle-transformers/src/models/marian.rs:223-228 | candle-transformers/src/models/quantized_qwen3.rs:112-117 — 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) candle-transformers/src/models/mimi/transformer.rs:151— candle-transformers/src/models/mimi/transformer.rs:151-157 | candle-transformers/src/models/mimi/transformer.rs:280-285 — both copies are in the same file, so extract the 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) candle-transformers/src/models/mixformer.rs:172— candle-transformers/src/models/mixformer.rs:172-177 | candle-transformers/src/models/quantized_mixformer.rs:84-89 — before extracting anything, compare `candle-transformers/src/models/mixformer.rs` and `candle-transformers/src/models/quantized_mixformer.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 136 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) candle-transformers/src/models/mixformer.rs:424— candle-transformers/src/models/mixformer.rs:424-429 | candle-transformers/src/models/quantized_mixformer.rs:339-344 — before extracting anything, compare `candle-transformers/src/models/mixformer.rs` and `candle-transformers/src/models/quantized_mixformer.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 136 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 `candle-transformers/src/models/mixformer.rs:424` 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) candle-transformers/src/models/paddleocr_vl/text.rs:96— candle-transformers/src/models/paddleocr_vl/text.rs:96-101 | candle-transformers/src/models/paddleocr_vl/text.rs:245-250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) candle-transformers/src/models/quantized_glm4.rs:113— candle-transformers/src/models/quantized_glm4.rs:113-118 | candle-transformers/src/models/quantized_qwen3.rs:105-110 — before extracting anything, compare `candle-transformers/src/models/quantized_glm4.rs` and `candle-transformers/src/models/quantized_qwen3.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 111 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 (5 lines × 2) candle-core/src/cpu_backend/mod.rs:1030— candle-core/src/cpu_backend/mod.rs:1030-1034 | candle-core/src/cpu_backend/mod.rs:1254-1259 — both copies are in the same file, so extract the 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) candle-core/src/cuda_backend/mod.rs:494— candle-core/src/cuda_backend/mod.rs:494-498 | candle-core/src/cuda_backend/mod.rs:549-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `candle-core/src/cuda_backend/mod.rs:500` calls `builder_arg` and `candle-core/src/cuda_backend/mod.rs:554` 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) candle-core/src/quantized/avx.rs:56— candle-core/src/quantized/avx.rs:56-60 | candle-core/src/quantized/avx.rs:77-81 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/avx.rs:56` 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 `xs` to `&[BlockQ4_0]` in one and `&[BlockQ8_0]` 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) candle-core/src/quantized/k_quants.rs:1021— candle-core/src/quantized/k_quants.rs:1021-1025 | candle-core/src/quantized/k_quants.rs:1399-1406 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/k_quants.rs:1021` 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) candle-core/src/quantized/mod.rs:898— candle-core/src/quantized/mod.rs:898-902 | candle-core/src/quantized/mod.rs:1326-1330 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `candle-core/src/quantized/mod.rs:898` 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) candle-core/src/quantized/mod.rs:1317— candle-core/src/quantized/mod.rs:1317-1321 | candle-transformers/src/models/t5.rs:87-91 — 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 `candle-core/src/quantized/mod.rs:1317` 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) candle-core/src/quantized/neon.rs:541— candle-core/src/quantized/neon.rs:541-545 | candle-core/src/quantized/neon.rs:2916-2920 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:541` 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 (5 lines × 2) candle-core/src/quantized/neon.rs:1822— candle-core/src/quantized/neon.rs:1822-1826 | candle-core/src/quantized/neon.rs:2609-2613 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:1822` 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 (5 lines × 2) candle-core/src/quantized/neon.rs:2012— candle-core/src/quantized/neon.rs:2012-2017 | candle-core/src/quantized/neon.rs:2165-2169 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:2012` 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, `candle-core/src/quantized/neon.rs:2019` calls `vdupq_n_s32` and `candle-core/src/quantized/neon.rs:2171` 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) candle-core/src/quantized/neon.rs:2548— candle-core/src/quantized/neon.rs:2548-2552 | candle-core/src/quantized/neon.rs:2554-2558 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:2548` 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) candle-core/src/quantized/repack_x86.rs:100— candle-core/src/quantized/repack_x86.rs:100-104 | candle-core/src/quantized/repack_x86.rs:143-147 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/repack_x86.rs:100` 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 (5 lines × 2) candle-metal-kernels/src/kernels/sdpa.rs:282— candle-metal-kernels/src/kernels/sdpa.rs:282-286 | candle-metal-kernels/src/kernels/sdpa.rs:427-431 — both copies are in the same file, so extract the 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) candle-nn/src/rotary_emb.rs:61— candle-nn/src/rotary_emb.rs:61-65 | candle-nn/src/rotary_emb.rs:78-82 — both copies are in the same file, so extract the 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 `candle-nn/src/rotary_emb.rs:61` 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) candle-transformers/src/models/glm4_new.rs:107— candle-transformers/src/models/glm4_new.rs:107-111 | candle-transformers/src/models/quantized_glm4.rs:85-89 — before extracting anything, compare `candle-transformers/src/models/glm4_new.rs` and `candle-transformers/src/models/quantized_glm4.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 78 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 `candle-transformers/src/models/glm4_new.rs:107` 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) candle-transformers/src/models/granitemoehybrid.rs:338— candle-transformers/src/models/granitemoehybrid.rs:338-343 | candle-transformers/src/models/stable_diffusion/attention.rs:193-197 — 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 `candle-transformers/src/models/granitemoehybrid.rs:338` 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 (5 lines × 2) candle-transformers/src/models/lfm2.rs:344— candle-transformers/src/models/lfm2.rs:344-349 | candle-transformers/src/models/quantized_lfm2.rs:142-146 — 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 `candle-transformers/src/models/lfm2.rs:344` 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) candle-transformers/src/models/paddleocr_vl/mod.rs:1018— candle-transformers/src/models/paddleocr_vl/mod.rs:1018-1022 | candle-transformers/src/models/paddleocr_vl/mod.rs:1067-1071 — both copies are in the same file, so extract the 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) candle-transformers/src/models/paddleocr_vl/vision.rs:545— candle-transformers/src/models/paddleocr_vl/vision.rs:545-550 | candle-transformers/src/models/qwen3_vl/vision.rs:166-170 — `candle-transformers/src/models/paddleocr_vl/vision.rs` and `candle-transformers/src/models/qwen3_vl/vision.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 81 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/paddleocr_vl/vision.rs:545` 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) candle-transformers/src/models/quantized_llama.rs:198— candle-transformers/src/models/quantized_llama.rs:198-203 | candle-transformers/src/models/quantized_qwen2.rs:86-90 — before extracting anything, compare `candle-transformers/src/models/quantized_llama.rs` and `candle-transformers/src/models/quantized_qwen2.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 124 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 (5 lines × 2) candle-transformers/src/models/quantized_llama.rs:485— candle-transformers/src/models/quantized_llama.rs:485-489 | candle-transformers/src/models/quantized_qwen2.rs:248-254 — before extracting anything, compare `candle-transformers/src/models/quantized_llama.rs` and `candle-transformers/src/models/quantized_qwen2.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 124 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 `candle-transformers/src/models/quantized_llama.rs:485` 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) candle-transformers/src/models/quantized_phi.rs:227— candle-transformers/src/models/quantized_phi.rs:227-231 | candle-transformers/src/models/quantized_phi3.rs:250-254 — before extracting anything, compare `candle-transformers/src/models/quantized_phi.rs` and `candle-transformers/src/models/quantized_phi3.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 70 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 `candle-transformers/src/models/quantized_phi.rs:227` 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) candle-transformers/src/models/whisper/model.rs:324— candle-transformers/src/models/whisper/model.rs:324-328 | candle-transformers/src/models/whisper/quantized_model.rs:328-332 — before extracting anything, compare `candle-transformers/src/models/whisper/model.rs` and `candle-transformers/src/models/whisper/quantized_model.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 201 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 (5 lines × 2) candle-transformers/src/models/blip_text.rs:172— candle-transformers/src/models/blip_text.rs:172-176 | candle-transformers/src/models/quantized_blip_text.rs:168-172 — before extracting anything, compare `candle-transformers/src/models/blip_text.rs` and `candle-transformers/src/models/quantized_blip_text.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 222 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 (5 lines × 2) candle-transformers/src/models/blip_text.rs:190— candle-transformers/src/models/blip_text.rs:190-194 | candle-transformers/src/models/quantized_blip_text.rs:186-190 — before extracting anything, compare `candle-transformers/src/models/blip_text.rs` and `candle-transformers/src/models/quantized_blip_text.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 222 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 (5 lines × 2) candle-transformers/src/models/blip_text.rs:242— candle-transformers/src/models/blip_text.rs:242-246 | candle-transformers/src/models/quantized_blip_text.rs:238-242 — before extracting anything, compare `candle-transformers/src/models/blip_text.rs` and `candle-transformers/src/models/quantized_blip_text.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 222 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) candle-core/src/accelerate.rs:417— candle-core/src/accelerate.rs:417-424 | candle-core/src/mkl.rs:370-377 — before extracting anything, compare `candle-core/src/accelerate.rs` and `candle-core/src/mkl.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 32 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 (8 lines × 2) candle-core/src/accelerate.rs:428— candle-core/src/accelerate.rs:428-435 | candle-core/src/mkl.rs:381-388 — before extracting anything, compare `candle-core/src/accelerate.rs` and `candle-core/src/mkl.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 32 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 (8 lines × 2) candle-core/src/cpu_backend/mod.rs:1124— candle-core/src/cpu_backend/mod.rs:1124-1131 | candle-core/src/cpu_backend/mod.rs:1189-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 `candle-core/src/cpu_backend/mod.rs:1124` 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) candle-core/src/cuda_backend/mod.rs:759— candle-core/src/cuda_backend/mod.rs:759-766 | candle-core/src/cuda_backend/mod.rs:802-809 — both copies are in the same file, so extract the 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 `candle-core/src/cuda_backend/mod.rs:759` 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) candle-core/src/metal_backend/device.rs:205— candle-core/src/metal_backend/device.rs:205-212 | candle-core/src/metal_backend/device.rs:287-295 — both copies are in the same file, so extract the 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) candle-core/src/metal_backend/mod.rs:1274— candle-core/src/metal_backend/mod.rs:1274-1281 | candle-core/src/metal_backend/mod.rs:1321-1328 — both copies are in the same file, so extract the 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 `candle-core/src/metal_backend/mod.rs:1274` 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 lines × 2) candle-core/src/quantized/k_quants.rs:1169— candle-core/src/quantized/k_quants.rs:1169-1176 | candle-core/src/quantized/k_quants.rs:1178-1185 — both copies are in the same file, so extract the 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) candle-core/src/quantized/k_quants.rs:1220— candle-core/src/quantized/k_quants.rs:1220-1227 | candle-core/src/quantized/k_quants.rs:1324-1331 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/k_quants.rs:1220` 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 lines × 2) candle-core/src/quantized/neon.rs:1209— candle-core/src/quantized/neon.rs:1209-1216 | candle-core/src/quantized/neon.rs:1418-1425 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:1209` 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) candle-core/src/quantized/neon.rs:3589— candle-core/src/quantized/neon.rs:3589-3596 | candle-core/src/quantized/neon.rs:3678-3685 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:3589` 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 lines × 2) candle-core/src/quantized/repack_x86.rs:963— candle-core/src/quantized/repack_x86.rs:963-970 | candle-core/src/quantized/repack_x86.rs:1013-1020 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/repack_x86.rs:963` 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) candle-core/src/tensor.rs:2007— candle-core/src/tensor.rs:2007-2014 | candle-core/src/tensor.rs:2048-2055 — both copies are in the same file, so extract the 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 `candle-core/src/tensor.rs:2007` 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, `candle-core/src/tensor.rs:2046` calls `push` and `candle-core/src/tensor.rs:2005` 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) candle-flash-attn-v3/src/lib.rs:192— candle-flash-attn-v3/src/lib.rs:192-199 | candle-flash-attn-v3/src/lib.rs:637-644 — both copies are in the same file, so extract the 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 `candle-flash-attn-v3/src/lib.rs:192` 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) candle-metal-kernels/src/kernels/random.rs:25— candle-metal-kernels/src/kernels/random.rs:25-32 | candle-metal-kernels/src/kernels/random.rs:56-63 — both copies are in the same file, so extract the 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) candle-nn/src/attention/cpu_flash/standard.rs:256— candle-nn/src/attention/cpu_flash/standard.rs:256-263 | candle-nn/src/attention/cpu_flash/standard.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. Read the line range as the matched WINDOW rather than a finished unit: at `candle-nn/src/attention/cpu_flash/standard.rs:256` 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) candle-nn/src/kv_cache.rs:124— candle-nn/src/kv_cache.rs:124-131 | candle-nn/src/kv_cache.rs:132-139 — both copies are in the same file, so extract the 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) candle-nn/src/ops.rs:300— candle-nn/src/ops.rs:300-307 | candle-nn/src/ops.rs:734-741 — both copies are in the same file, so extract the 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 `candle-nn/src/ops.rs:300` 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 lines × 2) candle-pyo3/src/lib.rs:1452— candle-pyo3/src/lib.rs:1452-1459 | candle-pyo3/src/lib.rs:1465-1472 — both copies are in the same file, so extract the 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 `candle-pyo3/src/lib.rs:1452` 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) candle-transformers/src/models/beit.rs:395— candle-transformers/src/models/beit.rs:395-402 | candle-transformers/src/models/eva2.rs:423-430 — before extracting anything, compare `candle-transformers/src/models/beit.rs` and `candle-transformers/src/models/eva2.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 93 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 (8 lines × 2) candle-transformers/src/models/blip.rs:181— candle-transformers/src/models/blip.rs:181-188 | candle-transformers/src/models/quantized_blip.rs:142-149 — before extracting anything, compare `candle-transformers/src/models/blip.rs` and `candle-transformers/src/models/quantized_blip.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 128 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 (8 lines × 2) candle-transformers/src/models/blip.rs:241— candle-transformers/src/models/blip.rs:241-248 | candle-transformers/src/models/quantized_blip.rs:202-209 — before extracting anything, compare `candle-transformers/src/models/blip.rs` and `candle-transformers/src/models/quantized_blip.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 128 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 (8 lines × 2) candle-transformers/src/models/blip_text.rs:309— candle-transformers/src/models/blip_text.rs:309-316 | candle-transformers/src/models/quantized_blip_text.rs:305-312 — before extracting anything, compare `candle-transformers/src/models/blip_text.rs` and `candle-transformers/src/models/quantized_blip_text.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 222 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 (8 lines × 2) candle-transformers/src/models/blip_text.rs:366— candle-transformers/src/models/blip_text.rs:366-373 | candle-transformers/src/models/quantized_blip_text.rs:362-369 — before extracting anything, compare `candle-transformers/src/models/blip_text.rs` and `candle-transformers/src/models/quantized_blip_text.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 222 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 (8 lines × 2) candle-transformers/src/models/chinese_clip/vision_model.rs:322— candle-transformers/src/models/chinese_clip/vision_model.rs:322-329 | candle-transformers/src/models/clip/text_model.rs:271-278 — before extracting anything, compare `candle-transformers/src/models/chinese_clip/vision_model.rs` and `candle-transformers/src/models/clip/text_model.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. 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 (8 lines × 2) candle-transformers/src/models/codegeex4_9b.rs:76— candle-transformers/src/models/codegeex4_9b.rs:76-83 | candle-transformers/src/models/glm4.rs:98-105 — before extracting anything, compare `candle-transformers/src/models/codegeex4_9b.rs` and `candle-transformers/src/models/glm4.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 459 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 (10 lines × 2) candle-core/src/cuda_backend/mod.rs:234— candle-core/src/cuda_backend/mod.rs:234-243 | candle-core/src/cuda_backend/mod.rs:287-296 — both copies are in the same file, so extract the 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 `candle-core/src/cuda_backend/mod.rs:234` 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) candle-core/src/error.rs:260— candle-core/src/error.rs:260-269 | candle-metal-kernels/src/err.rs:49-58 — 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 (10 lines × 2) candle-core/src/quantized/mod.rs:932— candle-core/src/quantized/mod.rs:932-941 | candle-core/src/quantized/mod.rs:989-998 — both copies are in the same file, so extract the 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 (10 lines × 2) candle-core/src/quantized/neon.rs:3336— candle-core/src/quantized/neon.rs:3336-3345 | candle-core/src/quantized/neon.rs:3718-3727 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:3336` 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) candle-core/src/tensor.rs:665— candle-core/src/tensor.rs:665-674 | candle-core/src/tensor.rs:1965-1974 — both copies are in the same file, so extract the 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 `candle-core/src/tensor.rs:665` 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) candle-flash-attn-v3/src/lib.rs:544— candle-flash-attn-v3/src/lib.rs:544-553 | candle-flash-attn/src/lib.rs:608-617 — before extracting anything, compare `candle-flash-attn-v3/src/lib.rs` and `candle-flash-attn/src/lib.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 174 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) candle-metal-kernels/src/metal/commands.rs:176— candle-metal-kernels/src/metal/commands.rs:176-185 | candle-metal-kernels/src/metal/commands.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. 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) candle-nn/src/attention/cpu_flash/causal.rs:827— candle-nn/src/attention/cpu_flash/causal.rs:827-836 | candle-nn/src/attention/cpu_flash/standard.rs:241-250 — before extracting anything, compare `candle-nn/src/attention/cpu_flash/causal.rs` and `candle-nn/src/attention/cpu_flash/standard.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 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 `candle-nn/src/attention/cpu_flash/causal.rs:827` 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) candle-nn/src/attention/cpu_flash/causal.rs:856— candle-nn/src/attention/cpu_flash/causal.rs:856-865 | candle-nn/src/attention/cpu_flash/causal.rs:943-952 — both copies are in the same file, so extract the 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 `candle-nn/src/attention/cpu_flash/causal.rs:856` 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) candle-nn/src/conv.rs:64— candle-nn/src/conv.rs:64-73 | candle-nn/src/conv.rs:135-144 — both copies are in the same file, so extract the 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 `candle-nn/src/conv.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 (10 lines × 2) candle-nn/src/conv.rs:226— candle-nn/src/conv.rs:226-235 | candle-nn/src/conv.rs:295-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. Read the line range as the matched WINDOW rather than a finished unit: at `candle-nn/src/conv.rs:226` 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) candle-nn/src/conv.rs:352— candle-nn/src/conv.rs:352-361 | candle-nn/src/conv.rs:373-382 — both copies are in the same file, so extract the 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) candle-nn/src/conv.rs:441— candle-nn/src/conv.rs:441-450 | candle-nn/src/conv.rs:462-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 (10 lines × 2) candle-nn/src/kv_cache.rs:59— candle-nn/src/kv_cache.rs:59-68 | candle-nn/src/kv_cache.rs:218-227 — both copies are in the same file, so extract the 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) candle-nn/src/moe/cutile.rs:65— candle-nn/src/moe/cutile.rs:65-74 | candle-nn/src/moe/cutile.rs:104-113 — both copies are in the same file, so extract the 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) candle-nn/src/rotary_emb.rs:505— candle-nn/src/rotary_emb.rs:505-514 | candle-nn/src/rotary_emb.rs:779-788 — both copies are in the same file, so extract the 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 `candle-nn/src/rotary_emb.rs:505` 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) candle-nn/src/var_builder.rs:371— candle-nn/src/var_builder.rs:371-380 | candle-nn/src/var_builder.rs:393-402 — both copies are in the same file, so extract the 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) candle-nn/src/var_builder.rs:440— candle-nn/src/var_builder.rs:440-449 | candle-nn/src/var_builder.rs:485-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. 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) candle-transformers/src/models/bert.rs:283— candle-transformers/src/models/bert.rs:283-292 | candle-transformers/src/models/bert.rs:372-381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/bert.rs:283` 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) candle-transformers/src/models/bert.rs:506— candle-transformers/src/models/bert.rs:506-515 | candle-transformers/src/models/chinese_clip/text_model.rs:511-520 — before extracting anything, compare `candle-transformers/src/models/bert.rs` and `candle-transformers/src/models/chinese_clip/text_model.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) candle-transformers/src/models/chinese_clip/text_model.rs:189— candle-transformers/src/models/chinese_clip/text_model.rs:189-198 | candle-transformers/src/models/chinese_clip/text_model.rs:356-366 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/chinese_clip/text_model.rs:189` 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) candle-transformers/src/models/chinese_clip/vision_model.rs:375— candle-transformers/src/models/chinese_clip/vision_model.rs:375-384 | candle-transformers/src/models/clip/vision_model.rs:161-170 — `candle-transformers/src/models/chinese_clip/vision_model.rs` and `candle-transformers/src/models/clip/vision_model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 32 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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) candle-transformers/src/models/llama2_c_weights.rs:120— candle-transformers/src/models/llama2_c_weights.rs:120-129 | candle-wasm-examples/llama2-c/src/worker.rs:194-203 — before extracting anything, compare `candle-transformers/src/models/llama2_c_weights.rs` and `candle-wasm-examples/llama2-c/src/worker.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) candle-transformers/src/models/mamba.rs:197— candle-transformers/src/models/mamba.rs:197-206 | candle-transformers/src/models/mamba2.rs:607-616 — 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 `candle-transformers/src/models/mamba.rs:197` 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 after the matched lines, `candle-transformers/src/models/mamba.rs:209` calls `dims1` and `candle-transformers/src/models/mamba2.rs:619` 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) candle-transformers/src/models/mixformer.rs:284— candle-transformers/src/models/mixformer.rs:284-293 | candle-transformers/src/models/quantized_mixformer.rs:204-213 — before extracting anything, compare `candle-transformers/src/models/mixformer.rs` and `candle-transformers/src/models/quantized_mixformer.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 136 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.
FileTooLong: quantized/neon.rs candle-core/src/quantized/neon.rs— FileTooLong — 3184 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 59 free functions. The bar is 500 significant lines; this is 2684 over it, 6.37× 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: cpu_backend/mod.rs candle-core/src/cpu_backend/mod.rs— FileTooLong — 2467 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 1967 over it, 4.93× 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: cuda_backend/mod.rs candle-core/src/cuda_backend/mod.rs— FileTooLong — 2185 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 1685 over it, 4.37× 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: metal_backend/mod.rs candle-core/src/metal_backend/mod.rs— FileTooLong — 1994 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 83% of them inside a single declaration: MetalStorage (3 blocks, 78-2019). The bar is 500 significant lines; this is 1494 over it, 3.99× 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: quantized/k_quants.rs candle-core/src/quantized/k_quants.rs— FileTooLong — 1983 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 1483 over it, 3.97× 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/eval.rs candle-onnx/src/eval.rs— FileTooLong — 1786 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 1286 over it, 3.57× 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/tensor.rs candle-core/src/tensor.rs— FileTooLong — 1714 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 90% of them inside a single declaration: Tensor (4 blocks, 47-3158). The bar is 500 significant lines; this is 1214 over it, 3.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: src/lib.rs candle-pyo3/src/lib.rs— FileTooLong — 1054 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 554 over it, 2.11× 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: models/debertav2.rs candle-transformers/src/models/debertav2.rs— FileTooLong — 1028 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 528 over it, 2.06× 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/ops.rs candle-nn/src/ops.rs— FileTooLong — 978 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 478 over it, 1.96× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: quantized/mod.rs candle-core/src/quantized/mod.rs— FileTooLong — 958 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 458 over it, 1.92× 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/op.rs candle-core/src/op.rs— FileTooLong — 908 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 408 over it, 1.82× 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: quantized/repack.rs candle-core/src/quantized/repack.rs— FileTooLong — 824 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 324 over it, 1.65× 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: models/deepseek2.rs candle-transformers/src/models/deepseek2.rs— FileTooLong — 788 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 288 over it, 1.58× 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: quantized/cuda.rs candle-core/src/quantized/cuda.rs— FileTooLong — 773 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 273 over it, 1.55× 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: quantized/repack_x86.rs candle-core/src/quantized/repack_x86.rs— FileTooLong — 771 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 271 over it, 1.54× 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: models/metavoice.rs candle-transformers/src/models/metavoice.rs— FileTooLong — 741 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 241 over it, 1.48× 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: paddleocr_vl/text.rs candle-transformers/src/models/paddleocr_vl/text.rs— FileTooLong — 728 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 228 over it, 1.46× 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: paddleocr_vl/vision.rs candle-transformers/src/models/paddleocr_vl/vision.rs— FileTooLong — 706 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 206 over it, 1.41× 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: cpu_flash/causal.rs candle-nn/src/attention/cpu_flash/causal.rs— FileTooLong — 695 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 195 over it, 1.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: src/rotary_emb.rs candle-nn/src/rotary_emb.rs— FileTooLong — 687 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 187 over it, 1.37× 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: z_image/transformer.rs candle-transformers/src/models/z_image/transformer.rs— FileTooLong — 686 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 186 over it, 1.37× 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: gemma4/audio.rs candle-transformers/src/models/gemma4/audio.rs— FileTooLong — 679 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 179 over it, 1.36× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: stable_diffusion/unet_2d_blocks.rs candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs— FileTooLong — 673 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 173 over it, 1.35× 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: models/t5.rs candle-transformers/src/models/t5.rs— FileTooLong — 673 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 173 over it, 1.35× 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.
Duplicated block (12 lines × 2) candle-core/src/cpu_backend/mod.rs:900— candle-core/src/cpu_backend/mod.rs:900-911 | candle-core/src/cpu_backend/mod.rs:921-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 `candle-core/src/cpu_backend/mod.rs:900` 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) candle-core/src/cpu_backend/mod.rs:1126— candle-core/src/cpu_backend/mod.rs:1126-1137 | candle-core/src/cpu_backend/mod.rs:1199-1210 — both copies are in the same file, so extract the 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 `candle-core/src/cpu_backend/mod.rs:1126` 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) candle-core/src/cpu_backend/mod.rs:1611— candle-core/src/cpu_backend/mod.rs:1611-1622 | candle-core/src/cpu_backend/mod.rs:1729-1740 — both copies are in the same file, so extract the 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 `candle-core/src/cpu_backend/mod.rs:1611` 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 lines × 2) candle-core/src/metal_backend/mod.rs:357— candle-core/src/metal_backend/mod.rs:357-368 | candle-core/src/metal_backend/mod.rs:416-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 `candle-core/src/metal_backend/mod.rs:357` 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) candle-core/src/quantized/neon.rs:3491— candle-core/src/quantized/neon.rs:3491-3502 | candle-core/src/quantized/neon.rs:3575-3586 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:3491` 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 `xs` to `&[BlockQ5K]` in one and `&[BlockQ4K]` 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, `candle-core/src/quantized/neon.rs:3489` calls `vdupq_n_u8` and `candle-core/src/quantized/neon.rs:3574` 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) candle-core/src/safetensors.rs:124— candle-core/src/safetensors.rs:124-135 | candle-core/src/safetensors.rs:155-166 — both copies are in the same file, so extract the 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 `candle-core/src/safetensors.rs:124` 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) candle-core/src/safetensors.rs:274— candle-core/src/safetensors.rs:274-285 | candle-core/src/safetensors.rs:375-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 `candle-core/src/safetensors.rs:274` 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) candle-flash-attn-v3/src/lib.rs:168— candle-flash-attn-v3/src/lib.rs:168-179 | candle-flash-attn-v3/src/lib.rs:612-623 — both copies are in the same file, so extract the 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 `candle-flash-attn-v3/src/lib.rs:168` 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) candle-flash-attn/src/lib.rs:890— candle-flash-attn/src/lib.rs:890-901 | candle-flash-attn/src/lib.rs:1058-1069 — both copies are in the same file, so extract the 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 `candle-flash-attn/src/lib.rs:890` 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) candle-nn/src/attention/cpu_flash/causal.rs:432— candle-nn/src/attention/cpu_flash/causal.rs:432-443 | candle-nn/src/attention/cpu_flash/causal.rs:513-524 — both copies are in the same file, so extract the 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 `candle-nn/src/attention/cpu_flash/causal.rs:432` 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, `candle-nn/src/attention/cpu_flash/causal.rs:526` calls `vec_dot`, `as_ptr` and `candle-nn/src/attention/cpu_flash/causal.rs:444` 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 × 2) candle-nn/src/attention/cpu_flash/causal.rs:531— candle-nn/src/attention/cpu_flash/causal.rs:531-542 | candle-nn/src/attention/cpu_flash/causal.rs:544-555 — both copies are in the same file, so extract the 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) candle-nn/src/attention/cpu_flash/varlen.rs:205— candle-nn/src/attention/cpu_flash/varlen.rs:205-216 | candle-nn/src/attention/cpu_flash/varlen.rs:297-308 — both copies are in the same file, so extract the 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 `candle-nn/src/attention/cpu_flash/varlen.rs:205` 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) candle-nn/src/moe.rs:121— candle-nn/src/moe.rs:121-132 | candle-nn/src/moe.rs:314-325 — both copies are in the same file, so extract the 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 `candle-nn/src/moe.rs:121` 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) candle-nn/src/ops.rs:590— candle-nn/src/ops.rs:590-601 | candle-nn/src/ops.rs:835-846 — both copies are in the same file, so extract the 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 `candle-nn/src/ops.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-nn/src/ops.rs:834` calls `arg` and `candle-nn/src/ops.rs:589` 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 × 2) candle-onnx/src/eval.rs:1919— candle-onnx/src/eval.rs:1919-1930 | candle-onnx/src/eval.rs:2129-2140 — both copies are in the same file, so extract the 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) candle-transformers/src/models/clip/text_model.rs:308— candle-transformers/src/models/clip/text_model.rs:308-319 | candle-transformers/src/models/stable_diffusion/clip.rs:368-379 — before extracting anything, compare `candle-transformers/src/models/clip/text_model.rs` and `candle-transformers/src/models/stable_diffusion/clip.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 82 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) candle-transformers/src/models/codegeex4_9b.rs:138— candle-transformers/src/models/codegeex4_9b.rs:138-149 | candle-transformers/src/models/glm4.rs:159-170 — before extracting anything, compare `candle-transformers/src/models/codegeex4_9b.rs` and `candle-transformers/src/models/glm4.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 459 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 `candle-transformers/src/models/codegeex4_9b.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 (12 lines × 2) candle-transformers/src/models/dac.rs:75— candle-transformers/src/models/dac.rs:75-86 | candle-transformers/src/models/snac.rs:283-294 — 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. 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) candle-transformers/src/models/dinov2.rs:281— candle-transformers/src/models/dinov2.rs:281-292 | candle-transformers/src/models/eva2.rs:318-329 — before extracting anything, compare `candle-transformers/src/models/dinov2.rs` and `candle-transformers/src/models/eva2.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 124 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 `candle-transformers/src/models/dinov2.rs:281` 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) candle-transformers/src/models/gemma.rs:181— candle-transformers/src/models/gemma.rs:181-192 | candle-transformers/src/models/helium.rs:178-189 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/helium.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 177 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 `candle-transformers/src/models/gemma.rs:181` 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) candle-transformers/src/models/metavoice.rs:890— candle-transformers/src/models/metavoice.rs:890-901 | candle-transformers/src/models/quantized_metavoice.rs:193-204 — before extracting anything, compare `candle-transformers/src/models/metavoice.rs` and `candle-transformers/src/models/quantized_metavoice.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 125 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 (12 lines × 2) candle-transformers/src/models/mpt.rs:272— candle-transformers/src/models/mpt.rs:272-283 | candle-transformers/src/models/quantized_mpt.rs:207-218 — before extracting anything, compare `candle-transformers/src/models/mpt.rs` and `candle-transformers/src/models/quantized_mpt.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 128 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 `candle-transformers/src/models/mpt.rs:272` 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) candle-transformers/src/models/nvembed_v2/model.rs:90— candle-transformers/src/models/nvembed_v2/model.rs:90-101 | candle-transformers/src/models/stable_diffusion/attention.rs:113-124 — before extracting anything, compare `candle-transformers/src/models/nvembed_v2/model.rs` and `candle-transformers/src/models/stable_diffusion/attention.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 32 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/nvembed_v2/model.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 (12 lines × 2) candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:141— candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:141-152 | candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:230-241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:141` 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 lines × 2) candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:153— candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:153-164 | candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:521-532 — both copies are in the same file, so extract the 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) candle-core/src/cpu_backend/mod.rs:689— candle-core/src/cpu_backend/mod.rs:689-697 | candle-core/src/cpu_backend/mod.rs:847-855 — both copies are in the same file, so extract the 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 `candle-core/src/cpu_backend/mod.rs:689` 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) candle-core/src/cuda_backend/cudnn.rs:63— candle-core/src/cuda_backend/cudnn.rs:63-73 | candle-core/src/cuda_backend/cudnn.rs:167-175 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `candle-core/src/cuda_backend/cudnn.rs:63` 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 (9 lines × 2) candle-core/src/cuda_backend/mod.rs:400— candle-core/src/cuda_backend/mod.rs:400-408 | candle-core/src/cuda_backend/mod.rs:413-421 — both copies are in the same file, so extract the 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) candle-core/src/quantized/k_quants.rs:247— candle-core/src/quantized/k_quants.rs:247-255 | candle-core/src/quantized/k_quants.rs:462-470 — both copies are in the same file, so extract the 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) candle-core/src/quantized/neon.rs:235— candle-core/src/quantized/neon.rs:235-243 | candle-core/src/quantized/neon.rs:246-254 — both copies are in the same file, so extract the 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) candle-core/src/quantized/neon.rs:1318— candle-core/src/quantized/neon.rs:1318-1326 | candle-core/src/quantized/neon.rs:1335-1343 — both copies are in the same file, so extract the 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) candle-core/src/quantized/neon.rs:1973— candle-core/src/quantized/neon.rs:1973-1981 | candle-core/src/quantized/neon.rs:2156-2164 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:1973` 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) candle-core/src/quantized/repack_x86.rs:354— candle-core/src/quantized/repack_x86.rs:354-362 | candle-core/src/quantized/repack_x86.rs:410-418 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/repack_x86.rs:354` 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) candle-core/src/tensor.rs:1356— candle-core/src/tensor.rs:1356-1364 | candle-core/src/tensor.rs:1394-1402 — both copies are in the same file, so extract the 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) candle-metal-kernels/src/kernels/unary.rs:53— candle-metal-kernels/src/kernels/unary.rs:53-61 | candle-metal-kernels/src/kernels/unary.rs:118-126 — both copies are in the same file, so extract the 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) candle-metal-kernels/src/metal/encoder.rs:293— candle-metal-kernels/src/metal/encoder.rs:293-301 | candle-metal-kernels/src/metal/encoder.rs:318-326 — both copies are in the same file, so extract the 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) candle-nn/src/attention/cpu_flash/causal.rs:342— candle-nn/src/attention/cpu_flash/causal.rs:342-350 | candle-nn/src/attention/cpu_flash/causal.rs:428-436 — both copies are in the same file, so extract the 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 `candle-nn/src/attention/cpu_flash/causal.rs:342` 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) candle-nn/src/attention/cpu_flash/causal.rs:957— candle-nn/src/attention/cpu_flash/causal.rs:957-965 | candle-nn/src/attention/cpu_flash/varlen.rs:266-274 — 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 `candle-nn/src/attention/cpu_flash/causal.rs:957` 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) candle-nn/src/conv.rs:317— candle-nn/src/conv.rs:317-325 | candle-nn/src/conv.rs:400-409 — both copies are in the same file, so extract the 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 `candle-nn/src/conv.rs:317` 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) candle-nn/src/var_map.rs:59— candle-nn/src/var_map.rs:59-67 | candle-nn/src/var_map.rs:81-89 — both copies are in the same file, so extract the 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) candle-transformers/src/models/blip_text.rs:449— candle-transformers/src/models/blip_text.rs:449-457 | candle-transformers/src/models/quantized_blip_text.rs:445-453 — before extracting anything, compare `candle-transformers/src/models/blip_text.rs` and `candle-transformers/src/models/quantized_blip_text.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 222 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 (9 lines × 2) candle-transformers/src/models/convnext.rs:189— candle-transformers/src/models/convnext.rs:189-197 | candle-transformers/src/models/convnext.rs:208-216 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/convnext.rs:189` 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) candle-transformers/src/models/gemma2.rs:124— candle-transformers/src/models/gemma2.rs:124-132 | candle-transformers/src/models/gemma3.rs:129-137 — before extracting anything, compare `candle-transformers/src/models/gemma2.rs` and `candle-transformers/src/models/gemma3.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 235 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 `candle-transformers/src/models/gemma2.rs:124` 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) candle-transformers/src/models/glm4_new.rs:312— candle-transformers/src/models/glm4_new.rs:312-320 | candle-transformers/src/models/qwen3.rs:421-429 — before extracting anything, compare `candle-transformers/src/models/glm4_new.rs` and `candle-transformers/src/models/qwen3.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 120 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 `candle-transformers/src/models/glm4_new.rs:312` 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) candle-transformers/src/models/mixformer.rs:355— candle-transformers/src/models/mixformer.rs:355-363 | candle-transformers/src/models/quantized_mixformer.rs:270-278 — before extracting anything, compare `candle-transformers/src/models/mixformer.rs` and `candle-transformers/src/models/quantized_mixformer.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 136 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 `candle-transformers/src/models/mixformer.rs:355` 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) candle-transformers/src/models/mixformer.rs:452— candle-transformers/src/models/mixformer.rs:452-460 | candle-transformers/src/models/quantized_mixformer.rs:367-375 — before extracting anything, compare `candle-transformers/src/models/mixformer.rs` and `candle-transformers/src/models/quantized_mixformer.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 136 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 `candle-transformers/src/models/mixformer.rs:452` 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) candle-transformers/src/models/mpt.rs:182— candle-transformers/src/models/mpt.rs:182-190 | candle-transformers/src/models/quantized_mpt.rs:155-163 — before extracting anything, compare `candle-transformers/src/models/mpt.rs` and `candle-transformers/src/models/quantized_mpt.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 128 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 `candle-transformers/src/models/mpt.rs:182` 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) candle-transformers/src/models/nomic_bert.rs:224— candle-transformers/src/models/nomic_bert.rs:224-232 | candle-transformers/src/models/snac.rs:191-199 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9 lines × 2) candle-transformers/src/models/paddleocr_vl/mod.rs:855— candle-transformers/src/models/paddleocr_vl/mod.rs:855-863 | candle-transformers/src/models/paddleocr_vl/mod.rs:873-881 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/paddleocr_vl/mod.rs:855` 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) candle-transformers/src/models/quantized_t5.rs:463— candle-transformers/src/models/quantized_t5.rs:463-471 | candle-transformers/src/models/t5.rs:593-601 — before extracting anything, compare `candle-transformers/src/models/quantized_t5.rs` and `candle-transformers/src/models/t5.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 390 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.
MethodTooLong: Tensor.backward candle-core/src/backprop.rs:165— MethodTooLong — backward runs 445 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 345 over it, 4.45× 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: CpuStorage.to_dtype candle-core/src/cpu_backend/mod.rs:1940— MethodTooLong — to_dtype runs 309 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 209 over it, 3.09× 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: ModelWeights.from_gguf candle-transformers/src/models/quantized_lfm2.rs:310— MethodTooLong — from_gguf runs 238 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 138 over it, 2.38× 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: FlashAttnVarLen.cuda_fwd_t candle-flash-attn/src/lib.rs:464— MethodTooLong — cuda_fwd_t runs 227 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 127 over it, 2.27× 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: Sdpa.metal_fwd candle-nn/src/ops.rs:1033— MethodTooLong — metal_fwd runs 190 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 90 over it, 1.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: Qwen3VLModel.forward candle-transformers/src/models/qwen3_vl/mod.rs:57— MethodTooLong — forward runs 172 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 72 over it, 1.72× 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: WDiffNeXt.new candle-transformers/src/models/wuerstchen/diffnext.rs:92— MethodTooLong — new runs 167 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 67 over it, 1.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.
MethodTooLong: UNet2DConditionModel.new candle-transformers/src/models/stable_diffusion/unet_2d.rs:104— MethodTooLong — new runs 162 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 62 over it, 1.62× 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: MetalStorage.unary_impl candle-core/src/metal_backend/mod.rs:668— MethodTooLong — unary_impl runs 153 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 53 over it, 1.53× 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: FlashAttnVarLen.cuda_fwd_t candle-flash-attn-v3/src/lib.rs:444— MethodTooLong — cuda_fwd_t runs 145 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 45 over it, 1.45× 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: CudaStorage.copy_strided_src candle-core/src/cuda_backend/mod.rs:2362— MethodTooLong — copy_strided_src runs 144 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 44 over it, 1.44× 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: ModelWeights.from_gguf candle-transformers/src/models/quantized_llama.rs:367— MethodTooLong — from_gguf runs 135 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 35 over it, 1.35× 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: Stack.read candle-core/src/pickle.rs:437— MethodTooLong — read runs 134 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 34 over it, 1.34× 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: ModelWeights.from_gguf candle-transformers/src/models/quantized_gemma3.rs:261— MethodTooLong — from_gguf runs 134 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 34 over it, 1.34× 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: QuantizedAttention.forward candle-transformers/src/models/smol/quantized_smollm3.rs:391— MethodTooLong — forward runs 133 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 33 over it, 1.33× 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: LLaVA.prepare_inputs_labels_for_multimodal candle-transformers/src/models/llava/mod.rs:238— MethodTooLong — prepare_inputs_labels_for_multimodal runs 132 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 32 over it, 1.32× 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: CpuStorage.concat candle-core/src/cpu_backend/mod.rs:1756— MethodTooLong — concat runs 130 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 30 over it, 1.30× 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: MetalStorage.reduce_op candle-core/src/metal_backend/mod.rs:298— MethodTooLong — reduce_op runs 125 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 25 over it, 1.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.
MethodTooLong: DebertaV2DisentangledSelfAttention.disentangled_attention_bias candle-transformers/src/models/debertav2.rs:540— MethodTooLong — disentangled_attention_bias runs 123 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 23 over it, 1.23× 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: QMetalStorage.indexed_moe_forward candle-core/src/quantized/metal/moe.rs:9— MethodTooLong — indexed_moe_forward runs 122 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 22 over it, 1.22× 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: FlashAttn.cuda_fwd_t candle-flash-attn-v3/src/lib.rs:30— MethodTooLong — cuda_fwd_t runs 122 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 22 over it, 1.22× 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: GGUFQWenMoE.from_gguf candle-transformers/src/models/quantized_qwen3_moe.rs:245— MethodTooLong — from_gguf runs 121 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 21 over it, 1.21× 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: CudaStorage.to_dtype candle-core/src/cuda_backend/mod.rs:1566— MethodTooLong — to_dtype runs 119 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 19 over it, 1.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: FlashAttn.cuda_fwd_t candle-flash-attn/src/lib.rs:21— MethodTooLong — cuda_fwd_t runs 112 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 12 over it, 1.12× 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: ConformerAttention.forward candle-transformers/src/models/gemma4/audio.rs:500— MethodTooLong — forward runs 110 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 10 over it, 1.10× 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.
candle_core::quantized::utils::make_qx_quants (cognitive 70) candle-core/src/quantized/utils.rs:62— candle_core::quantized::utils::make_qx_quants has cognitive complexity 70 (threshold 15). Drivers by points: if/else 24 (47 pts), loops 12 (20 pts), boolean chains 3 (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.
candle_core::cpu_backend::conv2d::conv2d_tiled (cognitive 44) candle-core/src/cpu_backend/conv2d.rs:126— candle_core::cpu_backend::conv2d::conv2d_tiled has cognitive complexity 44 (threshold 15). Drivers by points: loops 14 (33 pts), if/else 2 (9 pts), boolean chains 2 (nesting depth added 26). 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.
candle_core::cpu_backend::conv2d::conv2d_direct (cognitive 38) candle-core/src/cpu_backend/conv2d.rs:273— candle_core::cpu_backend::conv2d::conv2d_direct has cognitive complexity 38 (threshold 15). Drivers by points: loops 9 (25 pts), if/else 2 (11 pts), boolean chains 2 (nesting depth added 25). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
candle_core::quantized::utils::make_qkx3_quants (cognitive 36) candle-core/src/quantized/utils.rs:356— candle_core::quantized::utils::make_qkx3_quants has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 5 (8 pts), match/switch 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.
candle_core::quantized::repack_x86::pack_q4k_amx (cognitive 34) candle-core/src/quantized/repack_x86.rs:617— candle_core::quantized::repack_x86::pack_q4k_amx has cognitive complexity 34 (threshold 15). Drivers by points: loops 9 (34 pts) (nesting depth added 25). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
candle_core::quantized::utils::make_q3_quants (cognitive 34) candle-core/src/quantized/utils.rs:287— candle_core::quantized::utils::make_q3_quants has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 6 (11 pts), boolean chains 1 (nesting depth added 20). 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.
candle_core::pickle::read_pth_tensor_info (cognitive 32) candle-core/src/pickle.rs:670— candle_core::pickle::read_pth_tensor_info has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 4 (13 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
candle_core::quantized::neon::vec_dot_8_q6kx8_q8k_8x4 (cognitive 32) candle-core/src/quantized/neon.rs:2447— candle_core::quantized::neon::vec_dot_8_q6kx8_q8k_8x4 has cognitive complexity 32 (threshold 15). Drivers by points: loops 8 (22 pts), if/else 4 (10 pts) (nesting depth added 20). 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.
candle_core::quantized::neon::store_q5kx8_4x8_i8mm (cognitive 31) candle-core/src/quantized/neon.rs:1409— candle_core::quantized::neon::store_q5kx8_4x8_i8mm has cognitive complexity 31 (threshold 15). Drivers by points: loops 13 (31 pts) (nesting depth added 18). 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.
candle_core::quantized::repack_x86::amx::q4k_m32 (cognitive 31) candle-core/src/quantized/repack_x86.rs:724— candle_core::quantized::repack_x86::amx::q4k_m32 has cognitive complexity 31 (threshold 15). Drivers by points: loops 6 (16 pts), if/else 5 (15 pts) (nesting depth added 20). 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.
candle_core::quantized::neon::store_q4kx8_4x8_i8mm (cognitive 29) candle-core/src/quantized/neon.rs:970— candle_core::quantized::neon::store_q4kx8_4x8_i8mm has cognitive complexity 29 (threshold 15). Drivers by points: loops 12 (29 pts) (nesting depth added 17). 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.
candle_core::quantized::repack_x86::pack_q4k (cognitive 28) candle-core/src/quantized/repack_x86.rs:90— candle_core::quantized::repack_x86::pack_q4k has cognitive complexity 28 (threshold 15). Drivers by points: loops 8 (28 pts) (nesting depth added 20). 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. This shape REPEATS in the file: one other method here (candle_core::quantized::repack_x86::pack_q6k) 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.
candle_core::quantized::repack_x86::pack_q6k (cognitive 28) candle-core/src/quantized/repack_x86.rs:134— candle_core::quantized::repack_x86::pack_q6k has cognitive complexity 28 (threshold 15). Drivers by points: loops 8 (28 pts) (nesting depth added 20). 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. This shape REPEATS in the file: one other method here (candle_core::quantized::repack_x86::pack_q4k) 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.
candle_core::cpu_backend::utils::unary_map (cognitive 27) candle-core/src/cpu_backend/utils.rs:221— candle_core::cpu_backend::utils::unary_map has cognitive complexity 27 (threshold 15). Drivers by points: loops 6 (20 pts), if/else 4 (6 pts), 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.
candle_core::quantized::neon::store_q6kx8_4x8 (cognitive 27) candle-core/src/quantized/neon.rs:1964— candle_core::quantized::neon::store_q6kx8_4x8 has cognitive complexity 27 (threshold 15). Drivers by points: loops 8 (22 pts), if/else 1 (5 pts) (nesting depth added 18). 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.
candle_core::quantized::neon::vec_dot_8_q6kx8_q8k_8x8 (cognitive 27) candle-core/src/quantized/neon.rs:2310— candle_core::quantized::neon::vec_dot_8_q6kx8_q8k_8x8 has cognitive complexity 27 (threshold 15). Drivers by points: loops 7 (17 pts), if/else 4 (10 pts) (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.
candle_core::quantized::repack::try_indexed_gemv (cognitive 26) candle-core/src/quantized/repack.rs:989— candle_core::quantized::repack::try_indexed_gemv has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 4 (10 pts), boolean chains 4, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
candle_core::quantized::utils::make_qp_quants (cognitive 26) candle-core/src/quantized/utils.rs:470— candle_core::quantized::utils::make_qp_quants has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 5 (6 pts), boolean chains 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.
candle_core::quantized::neon::quantize_q8k_x4_interleaved (cognitive 24) candle-core/src/quantized/neon.rs:923— candle_core::quantized::neon::quantize_q8k_x4_interleaved has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (8 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.
candle_core::quantized::neon::store_q6kx8_4x8_i8mm (cognitive 23) candle-core/src/quantized/neon.rs:2147— candle_core::quantized::neon::store_q6kx8_4x8_i8mm has cognitive complexity 23 (threshold 15). Drivers by points: loops 8 (18 pts), if/else 1 (5 pts) (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.
candle_core::quantized::neon::store_q5kx8_4x8 (cognitive 22) candle-core/src/quantized/neon.rs:1200— candle_core::quantized::neon::store_q5kx8_4x8 has cognitive complexity 22 (threshold 15). Drivers by points: loops 10 (22 pts) (nesting depth added 12). 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.
candle_core::cuda_backend::gemm_config (cognitive 20) candle-core/src/cuda_backend/mod.rs:1402— candle_core::cuda_backend::gemm_config has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 12, if/else 6, match/switch 2. 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.
candle_core::quantized::k_quants::matmul (cognitive 20) candle-core/src/quantized/k_quants.rs:2421— candle_core::quantized::k_quants::matmul has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (10 pts), loops 5 (9 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
candle_core::quantized::neon::vec_dot_8_q5kx8_q8k_8x4 (cognitive 20) candle-core/src/quantized/neon.rs:1578— candle_core::quantized::neon::vec_dot_8_q5kx8_q8k_8x4 has cognitive complexity 20 (threshold 15). Drivers by points: loops 6 (15 pts), match/switch 1 (5 pts) (nesting depth added 13). 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.
candle_core::cpu_backend::utils::unary_map_vec (cognitive 19) candle-core/src/cpu_backend/utils.rs:279— candle_core::cpu_backend::utils::unary_map_vec has cognitive complexity 19 (threshold 15). Drivers by points: loops 4 (12 pts), if/else 4 (6 pts), 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.
FunctionTooLong: candle_onnx::eval::simple_eval_ candle-onnx/src/eval.rs:250— FunctionTooLong — candle_onnx::eval::simple_eval_ runs 1588 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 1488 over it, 15.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: candle_nn::moe::cutile::kernels::routed_grouped_matmul candle-nn/src/moe/cutile.rs:26— FunctionTooLong — candle_nn::moe::cutile::kernels::routed_grouped_matmul runs 251 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 151 over it, 2.51× 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: candle_nn::attention::cpu_flash::varlen::flash_attn_varlen_cpu candle-nn/src/attention/cpu_flash/varlen.rs:27— FunctionTooLong — candle_nn::attention::cpu_flash::varlen::flash_attn_varlen_cpu runs 232 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 132 over it, 2.32× 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: candle_metal_kernels::kernels::sdpa::call_sdpa_full candle-metal-kernels/src/kernels/sdpa.rs:22— FunctionTooLong — candle_metal_kernels::kernels::sdpa::call_sdpa_full runs 177 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 77 over it, 1.77× 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: candle_metal_kernels::kernels::mlx_gemm::call_mlx_gemm candle-metal-kernels/src/kernels/mlx_gemm.rs:453— FunctionTooLong — candle_metal_kernels::kernels::mlx_gemm::call_mlx_gemm 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: candle_core::quantized::neon::store_q5kx8_4x8 candle-core/src/quantized/neon.rs:1200— FunctionTooLong — candle_core::quantized::neon::store_q5kx8_4x8 runs 151 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 51 over it, 1.51× 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: candle_metal_kernels::kernels::mlx_gemm::call_mlx_gemv candle-metal-kernels/src/kernels/mlx_gemm.rs:261— FunctionTooLong — candle_metal_kernels::kernels::mlx_gemm::call_mlx_gemv runs 145 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 45 over it, 1.45× 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: candle_nn::moe::moe_gemm_gguf candle-nn/src/moe.rs:172— FunctionTooLong — candle_nn::moe::moe_gemm_gguf runs 134 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 34 over it, 1.34× 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: candle_core::quantized::neon::store_q6kx8_4x8 candle-core/src/quantized/neon.rs:1964— FunctionTooLong — candle_core::quantized::neon::store_q6kx8_4x8 runs 133 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 33 over it, 1.33× 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: candle_core::quantized::utils::make_qx_quants candle-core/src/quantized/utils.rs:62— FunctionTooLong — candle_core::quantized::utils::make_qx_quants runs 133 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 33 over it, 1.33× 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: candle_metal_kernels::kernels::sdpa::call_sdpa_vector_2pass candle-metal-kernels/src/kernels/sdpa.rs:373— FunctionTooLong — candle_metal_kernels::kernels::sdpa::call_sdpa_vector_2pass runs 129 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 29 over it, 1.29× 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: candle_core::quantized::neon::store_q5kx8_4x8_i8mm candle-core/src/quantized/neon.rs:1409— FunctionTooLong — candle_core::quantized::neon::store_q5kx8_4x8_i8mm runs 126 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 26 over it, 1.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: candle_core::quantized::neon::vec_dot_8_q4k_q8k candle-core/src/quantized/neon.rs:4099— FunctionTooLong — candle_core::quantized::neon::vec_dot_8_q4k_q8k runs 126 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 26 over it, 1.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: candle_nn::moe::cutile::routed_grouped_matmul_inner candle-nn/src/moe/cutile.rs:491— FunctionTooLong — candle_nn::moe::cutile::routed_grouped_matmul_inner runs 126 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 26 over it, 1.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: candle_metal_kernels::kernels::sort::multi_block_sort candle-metal-kernels/src/kernels/sort.rs:58— FunctionTooLong — candle_metal_kernels::kernels::sort::multi_block_sort runs 125 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 25 over it, 1.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: candle_core::quantized::fast_mmvq::try_fwd candle-core/src/quantized/fast_mmvq.rs:161— FunctionTooLong — candle_core::quantized::fast_mmvq::try_fwd runs 123 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 23 over it, 1.23× 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: candle_metal_kernels::kernels::quantized::call_quantized_matmul_mv_t candle-metal-kernels/src/kernels/quantized.rs:28— FunctionTooLong — candle_metal_kernels::kernels::quantized::call_quantized_matmul_mv_t runs 123 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 23 over it, 1.23× 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: candle_core::quantized::neon::vec_dot_4_q6k_q8k candle-core/src/quantized/neon.rs:3316— FunctionTooLong — candle_core::quantized::neon::vec_dot_4_q6k_q8k runs 117 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 17 over it, 1.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.
FunctionTooLong: candle_core::quantized::neon::store_q4kx8_4x8_i8mm candle-core/src/quantized/neon.rs:970— FunctionTooLong — candle_core::quantized::neon::store_q4kx8_4x8_i8mm runs 114 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 14 over it, 1.14× 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: candle_nn::moe::moe_gemm candle-nn/src/moe.rs:12— FunctionTooLong — candle_nn::moe::moe_gemm runs 113 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 13 over it, 1.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.
FunctionTooLong: candle_metal_kernels::kernels::quantized_moe::call_quantized_moe candle-metal-kernels/src/kernels/quantized_moe.rs:150— FunctionTooLong — candle_metal_kernels::kernels::quantized_moe::call_quantized_moe runs 112 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 12 over it, 1.12× 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: candle_core::quantized::neon::vec_dot_4_q4k_q8k candle-core/src/quantized/neon.rs:3644— FunctionTooLong — candle_core::quantized::neon::vec_dot_4_q4k_q8k runs 109 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 9 over it, 1.09× 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: candle_nn::attention::cpu_flash::causal::run_causal_attn_cpu candle-nn/src/attention/cpu_flash/causal.rs:54— FunctionTooLong — candle_nn::attention::cpu_flash::causal::run_causal_attn_cpu runs 108 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 8 over it, 1.08× 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: candle_core::quantized::fast_mmq::try_fwd candle-core/src/quantized/fast_mmq.rs:253— FunctionTooLong — candle_core::quantized::fast_mmq::try_fwd runs 105 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 5 over it, 1.05× 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: candle_core::quantized::k_quants::matmul candle-core/src/quantized/k_quants.rs:2421— FunctionTooLong — candle_core::quantized::k_quants::matmul runs 105 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 5 over it, 1.05× 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.
+ 5 more in this group — see findings.md.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×30
Members sharing a duplicated core (4 members, 50+ identical tokens) candle-core/src/cpu/avx.rs:335— candle-core/src/cpu/avx.rs:335-352 | candle-core/src/cpu/avx.rs:373-391 | candle-core/src/cpu/simd128.rs:224-241 | candle-core/src/cpu/simd128.rs:260-278 — 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) candle-core/src/cpu/neon.rs:58— candle-core/src/cpu/neon.rs:58-69 | candle-core/src/cpu/neon.rs:123-134 | candle-core/src/cpu/neon.rs:322-333 | candle-core/src/cpu/neon.rs:402-414 — 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) candle-core/src/cuda_backend/mod.rs:144— candle-core/src/cuda_backend/mod.rs:144-165 | candle-core/src/cuda_backend/mod.rs:175-195 | candle-core/src/cuda_backend/mod.rs:306-326 | candle-nn/src/ops.rs:90-135 — 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) candle-core/src/quantized/k_quants.rs:957— candle-core/src/quantized/k_quants.rs:957-1014 | candle-core/src/quantized/k_quants.rs:1279-1375 | candle-core/src/quantized/k_quants.rs:1619-1683 | candle-core/src/quantized/k_quants.rs:1900-1981 — 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) candle-core/src/quantized/mod.rs:547— candle-core/src/quantized/mod.rs:547-566 | candle-core/src/quantized/mod.rs:572-602 | candle-core/src/quantized/mod.rs:610-646 | candle-core/src/quantized/mod.rs:649-675 — 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) candle-core/src/quantized/neon.rs:365— candle-core/src/quantized/neon.rs:365-438 | candle-core/src/quantized/neon.rs:442-513 | candle-core/src/quantized/neon.rs:2824-2852 | candle-core/src/quantized/neon.rs:2856-2888 — 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) candle-core/src/tensor.rs:664— candle-core/src/tensor.rs:664-682 | candle-core/src/tensor.rs:1964-1986 | candle-core/src/tensor.rs:1989-2017 | candle-core/src/tensor.rs:2020-2058 — 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) candle-nn/src/attention/cpu_flash/causal.rs:65— candle-nn/src/attention/cpu_flash/causal.rs:65-186 | candle-nn/src/attention/cpu_flash/varlen.rs:40-369 | candle-transformers/src/models/quantized_qwen3.rs:238-378 | candle-transformers/src/models/smol/quantized_smollm3.rs:391-570 — 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) candle-nn/src/attention/cpu_flash/standard.rs:150— candle-nn/src/attention/cpu_flash/standard.rs:150-205 | candle-nn/src/attention/cpu_flash/standard.rs:222-306 | candle-nn/src/attention/cpu_flash/standard.rs:320-381 | candle-nn/src/attention/cpu_flash/standard.rs:398-488 — 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) candle-nn/src/rotary_emb.rs:290— candle-nn/src/rotary_emb.rs:290-308 | candle-transformers/src/models/llama2_c.rs:151-166 | candle-transformers/src/models/quantized_llama2_c.rs:38-53 | candle-wasm-examples/llama2-c/src/model.rs:74-89 — 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) candle-transformers/src/models/beit.rs:265— candle-transformers/src/models/beit.rs:265-278 | candle-transformers/src/models/dinov2.rs:216-229 | candle-transformers/src/models/dinov2reg4.rs:209-222 | candle-transformers/src/models/eva2.rs:249-262 — 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) candle-transformers/src/models/beit.rs:291— candle-transformers/src/models/beit.rs:291-307 | candle-transformers/src/models/dinov2.rs:243-266 | candle-transformers/src/models/dinov2reg4.rs:237-258 | candle-transformers/src/models/eva2.rs:276-296 — 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) candle-transformers/src/models/chinese_clip/mod.rs:191— candle-transformers/src/models/chinese_clip/mod.rs:191-203 | candle-transformers/src/models/clip/mod.rs:136-146 | candle-transformers/src/models/mobileclip.rs:85-95 | candle-transformers/src/models/siglip.rs:785-797 — 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) candle-transformers/src/models/flux/autoencoder.rs:50— candle-transformers/src/models/flux/autoencoder.rs:50-55 | candle-transformers/src/models/moondream.rs:58-63 | candle-transformers/src/models/quantized_moondream.rs:22-27 | candle-transformers/src/models/z_image/vae.rs:86-91 — 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) candle-transformers/src/models/gemma.rs:171— candle-transformers/src/models/gemma.rs:171-195 | candle-transformers/src/models/gemma2.rs:165-190 | candle-transformers/src/models/gemma3.rs:179-216 | candle-transformers/src/models/helium.rs:168-192 — 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) candle-transformers/src/models/gemma3.rs:398— candle-transformers/src/models/gemma3.rs:398-425 | candle-transformers/src/models/gemma4/text.rs:486-513 | candle-transformers/src/models/quantized_gemma3.rs:151-178 | candle-transformers/src/models/qwen3_vl/mod.rs:36-54 — 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) candle-transformers/src/models/glm4_new.rs:362— candle-transformers/src/models/glm4_new.rs:362-370 | candle-transformers/src/models/qwen3.rs:477-485 | candle-transformers/src/models/qwen3_moe.rs:332-340 | candle-transformers/src/models/smol/smollm3.rs:427-435 — 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) candle-transformers/src/models/mixformer.rs:35— candle-transformers/src/models/mixformer.rs:35-49 | candle-transformers/src/models/mixformer.rs:51-65 | candle-transformers/src/models/mixformer.rs:67-81 | candle-transformers/src/models/mixformer.rs:84-98 — 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) candle-transformers/src/models/mixtral.rs:299— candle-transformers/src/models/mixtral.rs:299-354 | candle-transformers/src/models/quantized_llama.rs:76-142 | candle-transformers/src/models/qwen2_moe.rs:262-322 | candle-transformers/src/models/qwen3_moe.rs:124-175 — 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) candle-transformers/src/models/mobilenetv4.rs:93— candle-transformers/src/models/mobilenetv4.rs:93-134 | candle-transformers/src/models/mobilenetv4.rs:136-186 | candle-transformers/src/models/mobilenetv4.rs:188-233 | candle-transformers/src/models/mobilenetv4.rs:235-290 — 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) candle-transformers/src/models/nomic_bert.rs:92— candle-transformers/src/models/nomic_bert.rs:92-109 | candle-transformers/src/models/quantized_lfm2.rs:102-115 | candle-transformers/src/models/quantized_phi3.rs:207-220 | candle-transformers/src/models/quantized_qwen2.rs:165-178 — 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) candle-transformers/src/models/paddleocr_vl/mod.rs:170— candle-transformers/src/models/paddleocr_vl/mod.rs:170-263 | candle-transformers/src/models/paddleocr_vl/mod.rs:281-380 | candle-transformers/src/models/paddleocr_vl/mod.rs:398-498 | candle-transformers/src/models/paddleocr_vl/mod.rs:707-797 — 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) candle-transformers/src/models/paddleocr_vl/vision.rs:992— candle-transformers/src/models/paddleocr_vl/vision.rs:992-1067 | candle-transformers/src/models/paddleocr_vl/vision.rs:1077-1108 | candle-transformers/src/models/paddleocr_vl/vision.rs:1118-1221 | candle-transformers/src/models/qwen3_vl/vision.rs:558-584 — 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) candle-transformers/src/models/quantized_gemma3.rs:265— candle-transformers/src/models/quantized_gemma3.rs:265-437 | candle-transformers/src/models/quantized_llama.rs:303-365 | candle-transformers/src/models/quantized_llama.rs:371-524 | candle-transformers/src/models/quantized_qwen2.rs:185-294 — 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) candle-transformers/src/models/quantized_qwen3.rs:436— candle-transformers/src/models/quantized_qwen3.rs:436-443 | candle-transformers/src/models/qwen3.rs:385-392 | candle-transformers/src/models/smol/smollm3.rs:336-343 | candle-transformers/src/models/z_image/text_encoder.rs:349-356 — 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.
+ 5 more in this group — see findings.md.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×29
Edited copy of a member (12 corresponding lines) candle-core/src/cpu/neon.rs:539— candle-core/src/cpu/neon.rs:539-558 | candle-core/src/cpu/neon.rs:596-611 — 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) candle-transformers/src/generation/mod.rs:84— candle-transformers/src/generation/mod.rs:84-95 | candle-transformers/src/generation/mod.rs:99-115 — 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) candle-core/src/npy.rs:403— candle-core/src/npy.rs:403-414 | candle-core/src/npy.rs:416-432 — 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) candle-transformers/src/models/quantized_t5.rs:189— candle-transformers/src/models/quantized_t5.rs:189-200 | candle-transformers/src/models/t5.rs:318-329 — 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) candle-core/src/quantized/ggml_file.rs:43— candle-core/src/quantized/ggml_file.rs:43-58 | candle-core/src/quantized/gguf_file.rs:59-70 — 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) candle-transformers/src/models/paligemma.rs:124— candle-transformers/src/models/paligemma.rs:124-135 | candle-transformers/src/models/paligemma.rs:154-165 — 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) candle-transformers/src/models/mpt.rs:175— candle-transformers/src/models/mpt.rs:175-190 | candle-transformers/src/models/quantized_mpt.rs:152-163 — 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) candle-pyo3/py_src/candle/nn/container.py:137— candle-pyo3/py_src/candle/nn/container.py:137-148 | candle-pyo3/py_src/candle/nn/container.py:154-165 — 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) candle-core/src/tensor.rs:1207— candle-core/src/tensor.rs:1207-1218 | candle-core/src/tensor.rs:1253-1271 — 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) candle-transformers/src/models/dac.rs:291— candle-transformers/src/models/dac.rs:291-302 | candle-transformers/src/models/snac.rs:610-621 — 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) candle-transformers/src/models/flux/model.rs:303— candle-transformers/src/models/flux/model.rs:303-314 | candle-transformers/src/models/flux/quantized_model.rs:142-153 — 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) candle-transformers/src/models/csm.rs:284— candle-transformers/src/models/csm.rs:284-295 | candle-transformers/src/models/phi3.rs:310-326 — 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) candle-core/src/accelerate.rs:440— candle-core/src/accelerate.rs:440-465 | candle-core/src/mkl.rs:393-407 — 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) candle-core/src/accelerate.rs:440— candle-core/src/accelerate.rs:440-466 | candle-core/src/mkl.rs:393-408 — 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) candle-core/src/accelerate.rs:440— candle-core/src/accelerate.rs:440-467 | candle-core/src/mkl.rs:393-409 — 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) candle-core/src/accelerate.rs:440— candle-core/src/accelerate.rs:440-468 | candle-core/src/mkl.rs:393-410 — 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) candle-core/src/accelerate.rs:440— candle-core/src/accelerate.rs:440-471 | candle-core/src/mkl.rs:393-413 — 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) candle-core/src/accelerate.rs:440— candle-core/src/accelerate.rs:440-472 | candle-core/src/mkl.rs:393-414 — 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) candle-core/src/accelerate.rs:440— candle-core/src/accelerate.rs:440-473 | candle-core/src/mkl.rs:393-415 — 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) candle-core/src/accelerate.rs:440— candle-core/src/accelerate.rs:440-474 | candle-core/src/mkl.rs:393-416 — 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) candle-core/src/accelerate.rs:440— candle-core/src/accelerate.rs:440-475 | candle-core/src/mkl.rs:393-417 — 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) candle-core/src/accelerate.rs:440— candle-core/src/accelerate.rs:440-476 | candle-core/src/mkl.rs:393-418 — 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) candle-core/src/accelerate.rs:440— candle-core/src/accelerate.rs:440-469 | candle-core/src/mkl.rs:393-411 — 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) candle-core/src/accelerate.rs:440— candle-core/src/accelerate.rs:440-470 | candle-core/src/mkl.rs:393-412 — 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) candle-core/src/cuda_backend/mod.rs:2151— candle-core/src/cuda_backend/mod.rs:2151-2162 | candle-core/src/cuda_backend/mod.rs:2164-2175 — 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.
Duplicated block (11 lines × 2) candle-core/src/cuda_backend/mod.rs:501— candle-core/src/cuda_backend/mod.rs:501-511 | candle-core/src/cuda_backend/mod.rs:554-564 — both copies are in the same file, so extract the 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 `candle-core/src/cuda_backend/mod.rs:501` 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, `candle-core/src/cuda_backend/mod.rs:500` calls `builder_arg` and `candle-core/src/cuda_backend/mod.rs:553` 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 (11 lines × 2) candle-core/src/quantized/avx.rs:302— candle-core/src/quantized/avx.rs:302-312 | candle-core/src/quantized/avx.rs:438-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 `candle-core/src/quantized/avx.rs:302` 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) candle-metal-kernels/src/kernels/mlx_gemm.rs:296— candle-metal-kernels/src/kernels/mlx_gemm.rs:296-306 | candle-metal-kernels/src/kernels/mlx_gemm.rs:504-514 — both copies are in the same file, so extract the 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 `candle-metal-kernels/src/kernels/mlx_gemm.rs:296` 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.
Duplicated block (11 lines × 2) candle-metal-kernels/src/kernels/reduce.rs:20— candle-metal-kernels/src/kernels/reduce.rs:20-30 | candle-metal-kernels/src/kernels/reduce.rs:78-88 — both copies are in the same file, so extract the 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 `candle-metal-kernels/src/kernels/reduce.rs:20` 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, `candle-metal-kernels/src/kernels/reduce.rs:93` calls `iter`, `collect` and `candle-metal-kernels/src/kernels/reduce.rs:35` 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 (11 lines × 2) candle-nn/src/attention/cpu_flash/standard.rs:165— candle-nn/src/attention/cpu_flash/standard.rs:165-175 | candle-nn/src/attention/cpu_flash/standard.rs:252-262 — both copies are in the same file, so extract the 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 `candle-nn/src/attention/cpu_flash/standard.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 (11 lines × 2) candle-nn/src/attention/cpu_flash/standard.rs:341— candle-nn/src/attention/cpu_flash/standard.rs:341-351 | candle-nn/src/attention/cpu_flash/standard.rs:434-444 — both copies are in the same file, so extract the 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 `candle-nn/src/attention/cpu_flash/standard.rs:341` 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) candle-nn/src/conv.rs:58— candle-nn/src/conv.rs:58-68 | candle-nn/src/conv.rs:220-230 — both copies are in the same file, so extract the 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 `candle-nn/src/conv.rs:58` 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) candle-transformers/src/models/bert.rs:225— candle-transformers/src/models/bert.rs:225-235 | candle-transformers/src/models/chinese_clip/text_model.rs:233-243 — before extracting anything, compare `candle-transformers/src/models/bert.rs` and `candle-transformers/src/models/chinese_clip/text_model.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/bert.rs:225` 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 `config` to `&Config` in one and `&ChineseClipTextConfig` 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) candle-transformers/src/models/gemma2.rs:377— candle-transformers/src/models/gemma2.rs:377-387 | candle-transformers/src/models/gemma3.rs:457-467 — before extracting anything, compare `candle-transformers/src/models/gemma2.rs` and `candle-transformers/src/models/gemma3.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 235 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 `candle-transformers/src/models/gemma2.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.
Duplicated block (11 lines × 2) candle-transformers/src/models/llama2_c.rs:238— candle-transformers/src/models/llama2_c.rs:238-248 | candle-transformers/src/models/quantized_llama2_c.rs:125-135 — before extracting anything, compare `candle-transformers/src/models/llama2_c.rs` and `candle-transformers/src/models/quantized_llama2_c.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 141 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 `candle-transformers/src/models/llama2_c.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 (11 lines × 2) candle-transformers/src/models/llama2_c.rs:362— candle-transformers/src/models/llama2_c.rs:362-372 | candle-transformers/src/models/quantized_llama2_c.rs:249-259 — before extracting anything, compare `candle-transformers/src/models/llama2_c.rs` and `candle-transformers/src/models/quantized_llama2_c.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 141 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 `candle-transformers/src/models/llama2_c.rs:362` 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) candle-transformers/src/models/mamba2.rs:514— candle-transformers/src/models/mamba2.rs:514-524 | candle-transformers/src/models/mamba2.rs:527-537 — both copies are in the same file, so extract the 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) candle-transformers/src/models/marian.rs:489— candle-transformers/src/models/marian.rs:489-499 | candle-transformers/src/models/marian.rs:549-559 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/marian.rs:489` 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) candle-transformers/src/models/mmdit/blocks.rs:64— candle-transformers/src/models/mmdit/blocks.rs:64-74 | candle-transformers/src/models/mmdit/blocks.rs:168-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 `candle-transformers/src/models/mmdit/blocks.rs:64` 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, `candle-transformers/src/models/mmdit/blocks.rs:180` calls `modulate`, `pre_attention` and `candle-transformers/src/models/mmdit/blocks.rs:76` 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 (11 lines × 2) candle-transformers/src/models/modernbert.rs:289— candle-transformers/src/models/modernbert.rs:289-299 | candle-transformers/src/models/xlm_roberta.rs:517-527 — 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 (11 lines × 2) candle-transformers/src/models/quantized_t5.rs:518— candle-transformers/src/models/quantized_t5.rs:518-528 | candle-transformers/src/models/t5.rs:648-658 — before extracting anything, compare `candle-transformers/src/models/quantized_t5.rs` and `candle-transformers/src/models/t5.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 390 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 (11 lines × 2) candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:620— candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:620-630 | candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:827-837 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:620` 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) candle-metal-kernels/src/kernels/indexing.rs:24— candle-metal-kernels/src/kernels/indexing.rs:24-34 | candle-metal-kernels/src/kernels/indexing.rs:73-83 — both copies are in the same file, so extract the 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) candle-nn/src/moe.rs:80— candle-nn/src/moe.rs:80-90 | candle-nn/src/moe.rs:228-238 — both copies are in the same file, so extract the 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) candle-transformers/src/models/granite.rs:296— candle-transformers/src/models/granite.rs:296-306 | candle-transformers/src/models/granitemoehybrid.rs:346-356 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 `candle-transformers/src/models/granite.rs:296` 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) candle-transformers/src/models/llama2_c.rs:324— candle-transformers/src/models/llama2_c.rs:324-334 | candle-wasm-examples/llama2-c/src/model.rs:231-241 — before extracting anything, compare `candle-transformers/src/models/llama2_c.rs` and `candle-wasm-examples/llama2-c/src/model.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/llama2_c.rs:324` 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) candle-transformers/src/models/metavoice.rs:735— candle-transformers/src/models/metavoice.rs:735-745 | candle-transformers/src/models/quantized_metavoice.rs:38-48 — before extracting anything, compare `candle-transformers/src/models/metavoice.rs` and `candle-transformers/src/models/quantized_metavoice.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 125 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 (11 lines × 2) candle-core/src/quantized/neon.rs:1588— candle-core/src/quantized/neon.rs:1588-1598 | candle-core/src/quantized/neon.rs:1705-1715 — both copies are in the same file, so extract the 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) candle-core/src/quantized/neon.rs:3423— candle-core/src/quantized/neon.rs:3423-3433 | candle-core/src/quantized/neon.rs:3446-3456 — both copies are in the same file, so extract the 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) candle-core/src/quantized/k_quants.rs:1690— candle-core/src/quantized/k_quants.rs:1690-1700 | candle-core/src/quantized/k_quants.rs:1992-2002 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/k_quants.rs:1690` 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.
+ 4 more in this group — see findings.md.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×28
Edited copy of a member (8 corresponding lines) candle-transformers/src/models/deepseek2.rs:488— candle-transformers/src/models/deepseek2.rs:488-498 | candle-transformers/src/models/phi3.rs:158-165 — 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) candle-core/src/cpu_backend/mod.rs:2952— candle-core/src/cpu_backend/mod.rs:2952-2959 | candle-core/src/cpu_backend/mod.rs:2961-2968 — 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) candle-transformers/src/models/paddleocr_vl/vision.rs:290— candle-transformers/src/models/paddleocr_vl/vision.rs:290-297 | candle-transformers/src/models/qwen3_vl/vision.rs:95-102 — 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) candle-transformers/src/models/gemma4/audio.rs:56— candle-transformers/src/models/gemma4/audio.rs:56-64 | candle-transformers/src/models/gemma4/multimodal_embedding.rs:21-28 — 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) candle-core/src/tensor.rs:2500— candle-core/src/tensor.rs:2500-2511 | candle-core/src/tensor.rs:2514-2521 — 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) candle-core/src/quantized/k_quants.rs:710— candle-core/src/quantized/k_quants.rs:710-717 | candle-core/src/quantized/k_quants.rs:1467-1474 — 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) candle-pyo3/py_src/candle/nn/container.py:94— candle-pyo3/py_src/candle/nn/container.py:94-102 | candle-pyo3/py_src/candle/nn/container.py:263-270 — 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) candle-transformers/src/models/quantized_t5.rs:204— candle-transformers/src/models/quantized_t5.rs:204-211 | candle-transformers/src/models/t5.rs:333-340 — 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) candle-transformers/src/models/clip/text_model.rs:323— candle-transformers/src/models/clip/text_model.rs:323-332 | candle-transformers/src/models/stable_diffusion/clip.rs:383-390 — 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) candle-core/src/tensor.rs:187— candle-core/src/tensor.rs:187-194 | candle-core/src/tensor.rs:446-453 — 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) candle-transformers/src/models/encodec.rs:279— candle-transformers/src/models/encodec.rs:279-286 | candle-transformers/src/models/mimi/quantization.rs:136-144 — 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) candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:348— candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:348-355 | candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:456-463 — 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) candle-transformers/src/models/mmdit/embedding.rs:127— candle-transformers/src/models/mmdit/embedding.rs:127-141 | candle-transformers/src/models/mmdit/embedding.rs:183-190 — 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) candle-core/src/accelerate.rs:354— candle-core/src/accelerate.rs:354-361 | candle-core/src/accelerate.rs:364-371 — 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) candle-nn/src/embedding.rs:29— candle-nn/src/embedding.rs:29-36 | candle-transformers/src/models/mimi/quantization.rs:146-155 — 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) candle-nn/src/ops.rs:22— candle-nn/src/ops.rs:22-29 | candle-nn/src/ops.rs:31-38 — 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) candle-transformers/src/models/mamba.rs:208— candle-transformers/src/models/mamba.rs:208-216 | candle-transformers/src/models/mamba2.rs:618-625 — 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) candle-transformers/src/models/qwen3_moe.rs:250— candle-transformers/src/models/qwen3_moe.rs:250-257 | candle-transformers/src/models/yi.rs:282-290 — 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) candle-transformers/src/models/mimi/seanet.rs:279— candle-transformers/src/models/mimi/seanet.rs:279-286 | candle-transformers/src/models/mimi/seanet.rs:440-447 — 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) candle-core/src/mkl.rs:284— candle-core/src/mkl.rs:284-291 | candle-core/src/mkl.rs:294-301 — 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) candle-transformers/src/models/qwen3.rs:81— candle-transformers/src/models/qwen3.rs:81-88 | candle-transformers/src/models/glm4_new.rs:88-98 — 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) candle-transformers/src/models/bert.rs:341— candle-transformers/src/models/bert.rs:341-348 | candle-transformers/src/models/chinese_clip/text_model.rs:318-329 — 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) candle-transformers/src/models/flux/autoencoder.rs:162— candle-transformers/src/models/flux/autoencoder.rs:162-169 | candle-transformers/src/models/z_image/vae.rs:238-246 — 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) candle-transformers/src/models/flux/autoencoder.rs:186— candle-transformers/src/models/flux/autoencoder.rs:186-193 | candle-transformers/src/models/z_image/vae.rs:323-330 — 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) candle-transformers/src/models/flux/model.rs:180— candle-transformers/src/models/flux/model.rs:180-187 | candle-transformers/src/models/flux/quantized_model.rs:19-26 — 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.
+ 3 more in this group — see findings.md.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×26
Edited copy of a member (18 corresponding lines) candle-transformers/src/models/rwkv_v5.rs:228— candle-transformers/src/models/rwkv_v5.rs:228-245 | candle-transformers/src/models/rwkv_v6.rs:202-219 — 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) candle-transformers/src/models/glm4_new.rs:194— candle-transformers/src/models/glm4_new.rs:194-230 | candle-transformers/src/models/paddleocr_vl/text.rs:794-826 — 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) candle-transformers/src/models/qwen3.rs:192— candle-transformers/src/models/qwen3.rs:192-241 | candle-transformers/src/models/starcoder2.rs:163-210 — 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) candle-transformers/src/models/qwen3.rs:192— candle-transformers/src/models/qwen3.rs:192-241 | candle-transformers/src/models/yi.rs:199-248 — 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) candle-transformers/src/models/paddleocr_vl/text.rs:794— candle-transformers/src/models/paddleocr_vl/text.rs:794-826 | candle-transformers/src/models/quantized_qwen3.rs:238-378 — 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) candle-transformers/src/models/paddleocr_vl/text.rs:794— candle-transformers/src/models/paddleocr_vl/text.rs:794-826 | candle-transformers/src/models/paddleocr_vl/text.rs:893-990 — 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) candle-transformers/src/models/paddleocr_vl/text.rs:893— candle-transformers/src/models/paddleocr_vl/text.rs:893-990 | candle-transformers/src/models/qwen3.rs:192-241 — 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) candle-core/src/cuda_backend/utils.rs:18— candle-core/src/cuda_backend/utils.rs:18-35 | candle-core/src/cuda_backend/utils.rs:150-167 — 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) candle-core/src/storage.rs:233— candle-core/src/storage.rs:233-250 | candle-core/src/storage.rs:260-278 — 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) candle-transformers/src/models/mixformer.rs:443— candle-transformers/src/models/mixformer.rs:443-460 | candle-transformers/src/models/quantized_mixformer.rs:358-375 — 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) candle-core/src/quantized/mod.rs:1154— candle-core/src/quantized/mod.rs:1154-1171 | candle-core/src/quantized/mod.rs:1173-1190 — 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) candle-transformers/src/models/segment_anything/tiny_vit.rs:72— candle-transformers/src/models/segment_anything/tiny_vit.rs:72-89 | candle-transformers/src/models/segment_anything/tiny_vit.rs:121-140 — 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) candle-transformers/src/models/mixformer.rs:261— candle-transformers/src/models/mixformer.rs:261-281 | candle-transformers/src/models/quantized_mixformer.rs:184-201 — 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) candle-core/src/quantized/k_quants.rs:284— candle-core/src/quantized/k_quants.rs:284-301 | candle-core/src/quantized/k_quants.rs:313-341 — 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) candle-transformers/src/models/metavoice.rs:770— candle-transformers/src/models/metavoice.rs:770-787 | candle-transformers/src/models/quantized_metavoice.rs:73-90 — 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) candle-core/src/tensor.rs:2299— candle-core/src/tensor.rs:2299-2316 | candle-core/src/tensor.rs:2329-2352 — 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) candle-transformers/src/models/efficientvit.rs:124— candle-transformers/src/models/efficientvit.rs:124-142 | candle-transformers/src/models/efficientvit.rs:331-348 — 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) candle-transformers/src/models/quantized_t5.rs:549— candle-transformers/src/models/quantized_t5.rs:549-566 | candle-transformers/src/models/t5.rs:679-696 — 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) candle-core/src/metal_backend/device.rs:202— candle-core/src/metal_backend/device.rs:202-219 | candle-core/src/metal_backend/device.rs:285-302 — 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) candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:542— candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:542-559 | candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:645-663 — 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) candle-metal-kernels/src/kernels/unary.rs:88— candle-metal-kernels/src/kernels/unary.rs:88-105 | candle-metal-kernels/src/kernels/unary.rs:169-195 — 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) candle-transformers/src/models/llama.rs:67— candle-transformers/src/models/llama.rs:67-84 | candle-transformers/src/models/llava/config.rs:66-83 — 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) candle-datasets/src/batcher.rs:72— candle-datasets/src/batcher.rs:72-89 | candle-datasets/src/batcher.rs:121-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.
Edited copy of a member (18 corresponding lines) candle-transformers/src/models/stella_en_v5.rs:96— candle-transformers/src/models/stella_en_v5.rs:96-114 | candle-transformers/src/models/stella_en_v5.rs:117-134 — 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) candle-transformers/src/models/mixtral.rs:48— candle-transformers/src/models/mixtral.rs:48-65 | candle-transformers/src/models/stable_lm.rs:44-61 — 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.
Duplicated block (13 lines × 2) candle-core/src/backprop.rs:238— candle-core/src/backprop.rs:238-250 | candle-core/src/backprop.rs:277-289 — both copies are in the same file, so extract the 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 `candle-core/src/backprop.rs:238` 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 (13 lines × 2) candle-core/src/cpu_backend/mod.rs:595— candle-core/src/cpu_backend/mod.rs:595-607 | candle-core/src/cpu_backend/mod.rs:610-622 — both copies are in the same file, so extract the 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) candle-core/src/cuda_backend/device.rs:466— candle-core/src/cuda_backend/device.rs:466-478 | candle-core/src/cuda_backend/device.rs:620-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 `candle-core/src/cuda_backend/device.rs:466` 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) candle-core/src/metal_backend/mod.rs:208— candle-core/src/metal_backend/mod.rs:208-220 | candle-core/src/metal_backend/mod.rs:264-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 `candle-core/src/metal_backend/mod.rs:208` 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 (13 lines × 2) candle-core/src/quantized/metal.rs:311— candle-core/src/quantized/metal.rs:311-323 | candle-core/src/quantized/metal.rs:378-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 (13 lines × 2) candle-core/src/quantized/neon.rs:547— candle-core/src/quantized/neon.rs:547-559 | candle-core/src/quantized/neon.rs:2922-2934 — both copies are in the same file, so extract the 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) candle-core/src/quantized/neon.rs:1828— candle-core/src/quantized/neon.rs:1828-1840 | candle-core/src/quantized/neon.rs:2615-2627 — both copies are in the same file, so extract the 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) candle-metal-kernels/src/kernels/reduce.rs:329— candle-metal-kernels/src/kernels/reduce.rs:329-341 | candle-metal-kernels/src/kernels/reduce.rs:415-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 `candle-metal-kernels/src/kernels/reduce.rs:329` 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) candle-transformers/src/models/bert.rs:521— candle-transformers/src/models/bert.rs:521-533 | candle-transformers/src/models/chinese_clip/text_model.rs:532-544 — before extracting anything, compare `candle-transformers/src/models/bert.rs` and `candle-transformers/src/models/chinese_clip/text_model.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. 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 (13 lines × 2) candle-transformers/src/models/blip.rs:133— candle-transformers/src/models/blip.rs:133-145 | candle-transformers/src/models/quantized_blip.rs:94-106 — before extracting anything, compare `candle-transformers/src/models/blip.rs` and `candle-transformers/src/models/quantized_blip.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 128 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 (13 lines × 2) candle-transformers/src/models/gemma2.rs:436— candle-transformers/src/models/gemma2.rs:436-448 | candle-transformers/src/models/gemma3.rs:517-529 — before extracting anything, compare `candle-transformers/src/models/gemma2.rs` and `candle-transformers/src/models/gemma3.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 235 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 `candle-transformers/src/models/gemma2.rs:436` 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) candle-transformers/src/models/gemma4/mod.rs:104— candle-transformers/src/models/gemma4/mod.rs:104-116 | candle-transformers/src/models/gemma4/mod.rs:154-166 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/gemma4/mod.rs:104` 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) candle-transformers/src/models/llama2_c_weights.rs:160— candle-transformers/src/models/llama2_c_weights.rs:160-172 | candle-wasm-examples/llama2-c/src/worker.rs:234-246 — before extracting anything, compare `candle-transformers/src/models/llama2_c_weights.rs` and `candle-wasm-examples/llama2-c/src/worker.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/llama2_c_weights.rs:160` 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) candle-transformers/src/models/mimi/seanet.rs:175— candle-transformers/src/models/mimi/seanet.rs:175-187 | candle-transformers/src/models/mimi/seanet.rs:333-345 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/mimi/seanet.rs:175` 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 (13 lines × 2) candle-transformers/src/models/mimi/transformer.rs:200— candle-transformers/src/models/mimi/transformer.rs:200-212 | candle-transformers/src/models/mimi/transformer.rs:300-312 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) candle-transformers/src/models/moondream.rs:204— candle-transformers/src/models/moondream.rs:204-216 | candle-transformers/src/models/quantized_moondream.rs:134-146 — before extracting anything, compare `candle-transformers/src/models/moondream.rs` and `candle-transformers/src/models/quantized_moondream.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 84 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 `candle-transformers/src/models/moondream.rs:204` 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) candle-transformers/src/models/mpt.rs:73— candle-transformers/src/models/mpt.rs:73-85 | candle-transformers/src/models/quantized_mpt.rs:50-62 — before extracting anything, compare `candle-transformers/src/models/mpt.rs` and `candle-transformers/src/models/quantized_mpt.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 128 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 `candle-transformers/src/models/mpt.rs:73` 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) candle-transformers/src/models/mpt.rs:130— candle-transformers/src/models/mpt.rs:130-142 | candle-transformers/src/models/quantized_mpt.rs:107-119 — before extracting anything, compare `candle-transformers/src/models/mpt.rs` and `candle-transformers/src/models/quantized_mpt.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 128 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 `candle-transformers/src/models/mpt.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 (13 lines × 2) candle-transformers/src/models/smol/quantized_smollm3.rs:29— candle-transformers/src/models/smol/quantized_smollm3.rs:29-41 | candle-transformers/src/models/smol/quantized_smollm3.rs:48-60 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/smol/quantized_smollm3.rs:29` 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) candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:310— candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:310-322 | candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:404-416 — both copies are in the same file, so extract the 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) candle-transformers/src/models/paddleocr_vl/vision.rs:960— candle-transformers/src/models/paddleocr_vl/vision.rs:960-972 | candle-transformers/src/models/qwen3_vl/vision.rs:544-556 — `candle-transformers/src/models/paddleocr_vl/vision.rs` and `candle-transformers/src/models/qwen3_vl/vision.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 81 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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) candle-transformers/src/models/quantized_qwen3.rs:336— candle-transformers/src/models/quantized_qwen3.rs:336-348 | candle-transformers/src/models/smol/quantized_smollm3.rs:523-535 — before extracting anything, compare `candle-transformers/src/models/quantized_qwen3.rs` and `candle-transformers/src/models/smol/quantized_smollm3.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/quantized_qwen3.rs:336` 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) candle-onnx/src/eval.rs:473— candle-onnx/src/eval.rs:473-485 | candle-onnx/src/eval.rs:508-520 — both copies are in the same file, so extract the 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 `candle-onnx/src/eval.rs:473` 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) candle-transformers/src/models/clip/text_model.rs:45— candle-transformers/src/models/clip/text_model.rs:45-57 | candle-transformers/src/models/stable_diffusion/clip.rs:46-58 — before extracting anything, compare `candle-transformers/src/models/clip/text_model.rs` and `candle-transformers/src/models/stable_diffusion/clip.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 82 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) candle-core/src/cuda_backend/device.rs:738— candle-core/src/cuda_backend/device.rs:738-750 | candle-core/src/cuda_backend/device.rs:797-809 — both copies are in the same file, so extract the 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 `candle-core/src/cuda_backend/device.rs:738` 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 `storage` to `&CpuStorage` in one and `CpuStorage` 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) candle-core/src/conv.rs:195— candle-core/src/conv.rs:195-200 | candle-core/src/conv.rs:261-266 | candle-core/src/conv.rs:331-336 — 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 `candle-core/src/conv.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 (6 lines × 3) candle-core/src/cpu_backend/mod.rs:1460— candle-core/src/cpu_backend/mod.rs:1460-1465 | candle-core/src/cpu_backend/mod.rs:1541-1546 | candle-core/src/cpu_backend/mod.rs:1632-1637 — 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) candle-core/src/cuda_backend/mod.rs:590— candle-core/src/cuda_backend/mod.rs:590-595 | candle-core/src/cuda_backend/mod.rs:644-649 | candle-core/src/cuda_backend/mod.rs:696-701 — 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 `candle-core/src/cuda_backend/mod.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 (6 lines × 3) candle-core/src/cuda_backend/mod.rs:958— candle-core/src/cuda_backend/mod.rs:958-963 | candle-core/src/cuda_backend/mod.rs:1003-1008 | candle-core/src/cuda_backend/mod.rs:1049-1054 — 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 `candle-core/src/cuda_backend/mod.rs:958` 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 × 3) candle-core/src/quantized/k_quants.rs:1520— candle-core/src/quantized/k_quants.rs:1520-1525 | candle-core/src/quantized/k_quants.rs:1785-1790 | candle-core/src/quantized/simd128.rs:225-230 — before extracting anything, compare `candle-core/src/quantized/k_quants.rs` and `candle-core/src/quantized/simd128.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) candle-metal-kernels/src/kernels/affine.rs:50— candle-metal-kernels/src/kernels/affine.rs:50-55 | candle-metal-kernels/src/kernels/affine.rs:117-122 | candle-metal-kernels/src/kernels/affine.rs:183-188 — 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) candle-nn/src/ops.rs:354— candle-nn/src/ops.rs:354-359 | candle-nn/src/ops.rs:573-578 | candle-nn/src/ops.rs:816-821 — 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 `candle-nn/src/ops.rs:354` 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 × 3) candle-transformers/src/models/chinese_clip/mod.rs:198— candle-transformers/src/models/chinese_clip/mod.rs:198-203 | candle-transformers/src/models/clip/mod.rs:141-146 | candle-transformers/src/models/mobileclip.rs:90-95 — 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 `candle-transformers/src/models/chinese_clip/mod.rs:198` 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 × 3) candle-transformers/src/models/clip/mod.rs:137— candle-transformers/src/models/clip/mod.rs:137-142 | candle-transformers/src/models/mobileclip.rs:86-91 | candle-transformers/src/models/siglip.rs:786-791 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (6 lines × 3) candle-transformers/src/models/paddleocr_vl/mod.rs:358— candle-transformers/src/models/paddleocr_vl/mod.rs:358-363 | candle-transformers/src/models/paddleocr_vl/mod.rs:476-481 | candle-transformers/src/models/paddleocr_vl/mod.rs:765-770 — 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 `candle-transformers/src/models/paddleocr_vl/mod.rs:358` 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 × 3) candle-transformers/src/models/paddleocr_vl/text.rs:298— candle-transformers/src/models/paddleocr_vl/text.rs:298-303 | candle-transformers/src/models/paddleocr_vl/text.rs:433-439 | candle-transformers/src/models/paddleocr_vl/text.rs:558-563 — 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 `candle-transformers/src/models/paddleocr_vl/text.rs:298` 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 × 3) candle-transformers/src/models/deepseek2.rs:354— candle-transformers/src/models/deepseek2.rs:354-360 | candle-transformers/src/models/paddleocr_vl/text.rs:50-55 | candle-transformers/src/models/qwen3_vl/text.rs:34-39 — before extracting anything, compare `candle-transformers/src/models/deepseek2.rs` and `candle-transformers/src/models/paddleocr_vl/text.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/deepseek2.rs:354` 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, `candle-transformers/src/models/deepseek2.rs:354` calls `matmul` and `candle-transformers/src/models/paddleocr_vl/text.rs:50` 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 × 3) candle-core/src/cpu_backend/mod.rs:408— candle-core/src/cpu_backend/mod.rs:408-413 | candle-core/src/cpu_backend/mod.rs:447-452 | candle-core/src/cpu_backend/mod.rs:524-529 — 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 `candle-core/src/cpu_backend/mod.rs:408` 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, `candle-core/src/cpu_backend/mod.rs:407` calls `from_f64` and `candle-core/src/cpu_backend/mod.rs:446` 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 × 3) candle-transformers/src/models/dinov2.rs:269— candle-transformers/src/models/dinov2.rs:269-274 | candle-transformers/src/models/dinov2reg4.rs:261-266 | candle-transformers/src/models/eva2.rs:305-310 — before extracting anything, compare `candle-transformers/src/models/dinov2.rs` and `candle-transformers/src/models/dinov2reg4.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 108 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. 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 × 3) candle-transformers/src/models/granite.rs:304— candle-transformers/src/models/granite.rs:304-309 | candle-transformers/src/models/granitemoehybrid.rs:354-359 | candle-transformers/src/models/llama.rs:351-356 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 `candle-transformers/src/models/granite.rs:304` 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 × 3) candle-core/src/cuda_backend/device.rs:20— candle-core/src/cuda_backend/device.rs:20-25 | candle-core/src/metal_backend/device.rs:22-27 | candle-core/src/tensor.rs:17-22 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (6 lines × 3) candle-transformers/src/models/beit.rs:185— candle-transformers/src/models/beit.rs:185-190 | candle-transformers/src/models/dinov2.rs:127-132 | candle-transformers/src/models/dinov2reg4.rs:120-125 — before extracting anything, compare `candle-transformers/src/models/beit.rs` and `candle-transformers/src/models/dinov2.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) candle-transformers/src/models/bert.rs:324— candle-transformers/src/models/bert.rs:324-329 | candle-transformers/src/models/chinese_clip/text_model.rs:299-304 | candle-transformers/src/models/jina_bert.rs:236-241 — before extracting anything, compare `candle-transformers/src/models/bert.rs` and `candle-transformers/src/models/chinese_clip/text_model.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) candle-transformers/src/models/quantized_llama.rs:57— candle-transformers/src/models/quantized_llama.rs:57-62 | candle-transformers/src/models/quantized_qwen2.rs:32-37 | candle-transformers/src/models/quantized_qwen3_moe.rs:20-25 — before extracting anything, compare `candle-transformers/src/models/quantized_llama.rs` and `candle-transformers/src/models/quantized_qwen2.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) candle-nn/src/ops.rs:364— candle-nn/src/ops.rs:364-369 | candle-nn/src/ops.rs:584-589 | candle-nn/src/ops.rs:827-833 — 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 `candle-nn/src/ops.rs:364` 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 × 3) candle-transformers/src/models/quantized_phi.rs:206— candle-transformers/src/models/quantized_phi.rs:206-212 | candle-transformers/src/models/quantized_phi3.rs:229-235 | candle-transformers/src/models/quantized_qwen2.rs:186-191 — before extracting anything, compare `candle-transformers/src/models/quantized_phi.rs` and `candle-transformers/src/models/quantized_phi3.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) candle-metal-kernels/src/kernels/affine.rs:21— candle-metal-kernels/src/kernels/affine.rs:21-26 | candle-metal-kernels/src/kernels/affine.rs:89-94 | candle-metal-kernels/src/kernels/affine.rs:155-160 — 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) candle-onnx/src/eval.rs:766— candle-onnx/src/eval.rs:766-771 | candle-onnx/src/eval.rs:854-859 | candle-onnx/src/eval.rs:1802-1807 — 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 `candle-onnx/src/eval.rs:766` 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 × 3) candle-core/src/cuda_backend/mod.rs:795— candle-core/src/cuda_backend/mod.rs:795-800 | candle-core/src/cuda_backend/mod.rs:866-871 | candle-core/src/cuda_backend/mod.rs:914-919 — 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 `candle-core/src/cuda_backend/mod.rs:795` 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 × 3) candle-transformers/src/models/mistral.rs:145— candle-transformers/src/models/mistral.rs:145-150 | candle-transformers/src/models/nvembed_v2/embedding.rs:45-50 | candle-transformers/src/models/quantized_mistral.rs:60-65 — before extracting anything, compare `candle-transformers/src/models/mistral.rs` and `candle-transformers/src/models/nvembed_v2/embedding.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/mistral.rs:145` 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 (14 lines × 2) candle-core/src/metal_backend/mod.rs:227— candle-core/src/metal_backend/mod.rs:227-240 | candle-core/src/metal_backend/mod.rs:283-296 — both copies are in the same file, so extract the 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 `candle-core/src/metal_backend/mod.rs:227` 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 (14 lines × 2) candle-core/src/quantized/k_quants.rs:665— candle-core/src/quantized/k_quants.rs:665-678 | candle-core/src/quantized/k_quants.rs:774-787 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/k_quants.rs:665` 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) candle-core/src/quantized/neon.rs:2043— candle-core/src/quantized/neon.rs:2043-2056 | candle-core/src/quantized/neon.rs:2065-2078 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) candle-nn/src/attention/cpu_flash/causal.rs:605— candle-nn/src/attention/cpu_flash/causal.rs:605-618 | candle-nn/src/attention/cpu_flash/causal.rs:719-732 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) candle-nn/src/ops.rs:561— candle-nn/src/ops.rs:561-574 | candle-nn/src/ops.rs:800-813 — both copies are in the same file, so extract the 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 `candle-nn/src/ops.rs:561` 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) candle-nn/src/var_builder.rs:420— candle-nn/src/var_builder.rs:420-433 | candle-nn/src/var_builder.rs:465-478 — both copies are in the same file, so extract the 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 `candle-nn/src/var_builder.rs:420` 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) candle-transformers/src/models/flux/model.rs:244— candle-transformers/src/models/flux/model.rs:244-257 | candle-transformers/src/models/flux/quantized_model.rs:83-96 — before extracting anything, compare `candle-transformers/src/models/flux/model.rs` and `candle-transformers/src/models/flux/quantized_model.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 209 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 (14 lines × 2) candle-transformers/src/models/flux/model.rs:461— candle-transformers/src/models/flux/model.rs:461-474 | candle-transformers/src/models/flux/quantized_model.rs:300-313 — before extracting anything, compare `candle-transformers/src/models/flux/model.rs` and `candle-transformers/src/models/flux/quantized_model.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 209 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 `candle-transformers/src/models/flux/model.rs:461` 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 (14 lines × 2) candle-transformers/src/models/granite.rs:66— candle-transformers/src/models/granite.rs:66-79 | candle-transformers/src/models/llama.rs:68-81 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/llama.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 309 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 `candle-transformers/src/models/granite.rs:66` 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, `candle-transformers/src/models/llama.rs:82` calls `unwrap_or` and `candle-transformers/src/models/granite.rs:80` 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 (14 lines × 2) candle-transformers/src/models/granite.rs:325— candle-transformers/src/models/granite.rs:325-338 | candle-transformers/src/models/llama.rs:372-385 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/llama.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 309 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 `candle-transformers/src/models/granite.rs:325` 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 (14 lines × 2) candle-transformers/src/models/marian.rs:473— candle-transformers/src/models/marian.rs:473-486 | candle-transformers/src/models/marian.rs:527-540 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/marian.rs:473` 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 (14 lines × 2) candle-transformers/src/models/mimi/conv.rs:81— candle-transformers/src/models/mimi/conv.rs:81-94 | candle-transformers/src/models/mimi/conv.rs:163-176 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/mimi/conv.rs:81` 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) candle-transformers/src/models/olmo.rs:295— candle-transformers/src/models/olmo.rs:295-308 | candle-transformers/src/models/olmo2.rs:290-303 — before extracting anything, compare `candle-transformers/src/models/olmo.rs` and `candle-transformers/src/models/olmo2.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 205 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 `candle-transformers/src/models/olmo.rs:295` 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 (14 lines × 2) candle-transformers/src/models/quantized_llama.rs:574— candle-transformers/src/models/quantized_llama.rs:574-587 | candle-transformers/src/models/quantized_qwen2.rs:323-336 — before extracting anything, compare `candle-transformers/src/models/quantized_llama.rs` and `candle-transformers/src/models/quantized_qwen2.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 124 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 `candle-transformers/src/models/quantized_llama.rs:574` 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) candle-datasets/src/vision/cifar.rs:104— candle-datasets/src/vision/cifar.rs:104-117 | candle-datasets/src/vision/mnist.rs:104-117 — 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 `candle-datasets/src/vision/cifar.rs:104` 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 (14 lines × 2) candle-transformers/src/models/metavoice.rs:771— candle-transformers/src/models/metavoice.rs:771-784 | candle-transformers/src/models/quantized_metavoice.rs:74-87 — before extracting anything, compare `candle-transformers/src/models/metavoice.rs` and `candle-transformers/src/models/quantized_metavoice.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 125 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 `candle-transformers/src/models/metavoice.rs:771` 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) candle-transformers/src/models/mixformer.rs:304— candle-transformers/src/models/mixformer.rs:304-317 | candle-transformers/src/models/quantized_mixformer.rs:221-234 — before extracting anything, compare `candle-transformers/src/models/mixformer.rs` and `candle-transformers/src/models/quantized_mixformer.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 136 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 `candle-transformers/src/models/mixformer.rs:304` 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) candle-metal-kernels/src/kernels/convolution.rs:240— candle-metal-kernels/src/kernels/convolution.rs:240-253 | candle-metal-kernels/src/kernels/convolution.rs:287-303 — both copies are in the same file, so extract the 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 `candle-metal-kernels/src/kernels/convolution.rs:240` 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) candle-core/src/tensor.rs:1836— candle-core/src/tensor.rs:1836-1849 | candle-core/src/tensor.rs:1898-1912 — both copies are in the same file, so extract the 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 `candle-core/src/tensor.rs:1836` 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 (14 lines × 2) candle-transformers/src/models/depth_anything_v2.rs:121— candle-transformers/src/models/depth_anything_v2.rs:121-134 | candle-transformers/src/models/depth_anything_v2.rs:206-219 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/depth_anything_v2.rs:121` 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) candle-onnx/src/eval.rs:935— candle-onnx/src/eval.rs:935-948 | candle-onnx/src/eval.rs:951-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. Read the line range as the matched WINDOW rather than a finished unit: at `candle-onnx/src/eval.rs:935` 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) candle-transformers/src/models/whisper/model.rs:210— candle-transformers/src/models/whisper/model.rs:210-223 | candle-transformers/src/models/whisper/quantized_model.rs:206-219 — before extracting anything, compare `candle-transformers/src/models/whisper/model.rs` and `candle-transformers/src/models/whisper/quantized_model.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 201 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 (14 lines × 2) candle-examples/src/token_output_stream.rs:54— candle-examples/src/token_output_stream.rs:54-67 | candle-wasm-examples/blip/src/token_output_stream.rs:54-67 — before extracting anything, compare `candle-examples/src/token_output_stream.rs` and `candle-wasm-examples/blip/src/token_output_stream.rs` as WHOLE FILES: 98% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 3 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. 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.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×21
Edited copy of a member (16 corresponding lines) candle-transformers/src/models/dinov2.rs:84— candle-transformers/src/models/dinov2.rs:84-99 | candle-transformers/src/models/dinov2reg4.rs:77-92 — 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) candle-transformers/src/models/efficientvit.rs:382— candle-transformers/src/models/efficientvit.rs:382-397 | candle-transformers/src/models/hiera.rs:183-213 — 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) candle-transformers/src/models/resnet.rs:42— candle-transformers/src/models/resnet.rs:42-57 | candle-transformers/src/models/resnet.rs:148-169 — 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) candle-transformers/src/models/moondream.rs:136— candle-transformers/src/models/moondream.rs:136-152 | candle-transformers/src/models/quantized_moondream.rs:69-84 — 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) candle-transformers/src/models/convmixer.rs:18— candle-transformers/src/models/convmixer.rs:18-37 | candle-transformers/src/models/efficientnet.rs:124-139 — 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) candle-transformers/src/models/gemma4/text.rs:116— candle-transformers/src/models/gemma4/text.rs:116-136 | candle-transformers/src/models/qwen3_vl/text.rs:24-39 — 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) candle-transformers/src/models/mixformer.rs:406— candle-transformers/src/models/mixformer.rs:406-421 | candle-transformers/src/models/quantized_mixformer.rs:321-336 — 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) candle-transformers/src/models/whisper/model.rs:183— candle-transformers/src/models/whisper/model.rs:183-199 | candle-transformers/src/models/whisper/quantized_model.rs:180-195 — 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) candle-transformers/src/models/mimi/seanet.rs:421— candle-transformers/src/models/mimi/seanet.rs:421-436 | candle-transformers/src/models/mimi/seanet.rs:449-464 — 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) candle-core/src/quantized/metal.rs:136— candle-core/src/quantized/metal.rs:136-151 | candle-core/src/quantized/metal.rs:158-173 — 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) candle-transformers/src/models/segment_anything/image_encoder.rs:467— candle-transformers/src/models/segment_anything/image_encoder.rs:467-482 | candle-transformers/src/models/segment_anything/tiny_vit.rs:606-621 — 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) candle-transformers/src/models/dac.rs:334— candle-transformers/src/models/dac.rs:334-349 | candle-transformers/src/models/snac.rs:704-720 — 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) candle-transformers/src/models/gemma.rs:296— candle-transformers/src/models/gemma.rs:296-312 | candle-transformers/src/models/smol/smollm3.rs:319-334 — 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) candle-transformers/src/models/marian.rs:488— candle-transformers/src/models/marian.rs:488-503 | candle-transformers/src/models/marian.rs:548-563 — 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) candle-transformers/src/models/distilbert.rs:102— candle-transformers/src/models/distilbert.rs:102-117 | candle-transformers/src/models/jina_bert.rs:99-114 — 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) candle-transformers/src/models/mmdit/blocks.rs:223— candle-transformers/src/models/mmdit/blocks.rs:223-238 | candle-transformers/src/models/mmdit/blocks.rs:263-281 — 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) candle-transformers/src/models/flux/model.rs:23— candle-transformers/src/models/flux/model.rs:23-38 | candle-transformers/src/models/flux/model.rs:41-56 — 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) candle-transformers/src/models/xlm_roberta.rs:305— candle-transformers/src/models/xlm_roberta.rs:305-320 | candle-transformers/src/models/debertav2.rs:854-870 — 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) candle-wasm-examples/blip/src/bin/m.rs:125— candle-wasm-examples/blip/src/bin/m.rs:125-143 | candle-wasm-examples/moondream/src/bin/m.rs:197-212 — 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) candle-examples/src/lib.rs:84— candle-examples/src/lib.rs:84-99 | candle-examples/src/lib.rs:106-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) candle-wasm-examples/yolo/src/worker.rs:95— candle-wasm-examples/yolo/src/worker.rs:95-110 | candle-wasm-examples/yolo/src/worker.rs:174-189 — 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.
Duplicated block (16 lines × 2) candle-core/src/quantized/cuda.rs:819— candle-core/src/quantized/cuda.rs:819-834 | candle-core/src/quantized/metal.rs:238-253 — before extracting anything, compare `candle-core/src/quantized/cuda.rs` and `candle-core/src/quantized/metal.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 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 (16 lines × 2) candle-core/src/quantized/k_quants.rs:1602— candle-core/src/quantized/k_quants.rs:1602-1617 | candle-core/src/quantized/k_quants.rs:1668-1683 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/k_quants.rs:1602` 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) candle-core/src/quantized/neon.rs:1250— candle-core/src/quantized/neon.rs:1250-1265 | candle-core/src/quantized/neon.rs:1997-2012 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:1250` 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) candle-core/src/quantized/simd128.rs:36— candle-core/src/quantized/simd128.rs:36-51 | candle-core/src/quantized/simd128.rs:76-91 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/simd128.rs:36` 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) candle-core/src/tensor.rs:1639— candle-core/src/tensor.rs:1639-1654 | candle-core/src/tensor.rs:1828-1843 — both copies are in the same file, so extract the 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 `candle-core/src/tensor.rs:1639` 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 (16 lines × 2) candle-flash-attn/src/lib.rs:893— candle-flash-attn/src/lib.rs:893-908 | candle-flash-attn/src/lib.rs:950-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 `candle-flash-attn/src/lib.rs:893` 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) candle-flash-attn/src/lib.rs:1061— candle-flash-attn/src/lib.rs:1061-1076 | candle-flash-attn/src/lib.rs:1120-1135 — both copies are in the same file, so extract the 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 `candle-flash-attn/src/lib.rs:1061` 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) candle-nn/src/attention/cpu_flash/standard.rs:224— candle-nn/src/attention/cpu_flash/standard.rs:224-239 | candle-nn/src/attention/cpu_flash/standard.rs:400-415 — both copies are in the same file, so extract the 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) candle-onnx/src/eval.rs:157— candle-onnx/src/eval.rs:157-172 | candle-onnx/src/eval.rs:175-190 — both copies are in the same file, so extract the 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 `candle-onnx/src/eval.rs:157` 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) candle-transformers/src/models/bert.rs:483— candle-transformers/src/models/bert.rs:483-498 | candle-transformers/src/models/distilbert.rs:322-337 — 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 `candle-transformers/src/models/bert.rs:483` 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) candle-transformers/src/models/encodec.rs:498— candle-transformers/src/models/encodec.rs:498-513 | candle-transformers/src/models/mimi/conv.rs:295-310 — 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 (16 lines × 2) candle-transformers/src/models/llama2_c_weights.rs:57— candle-transformers/src/models/llama2_c_weights.rs:57-72 | candle-wasm-examples/llama2-c/src/worker.rs:116-131 — before extracting anything, compare `candle-transformers/src/models/llama2_c_weights.rs` and `candle-wasm-examples/llama2-c/src/worker.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/llama2_c_weights.rs:57` 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) candle-transformers/src/models/mixformer.rs:389— candle-transformers/src/models/mixformer.rs:389-404 | candle-transformers/src/models/quantized_mixformer.rs:304-319 — before extracting anything, compare `candle-transformers/src/models/mixformer.rs` and `candle-transformers/src/models/quantized_mixformer.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 136 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 (16 lines × 2) candle-transformers/src/models/stable_diffusion/mod.rs:342— candle-transformers/src/models/stable_diffusion/mod.rs:342-357 | candle-transformers/src/models/stable_diffusion/mod.rs:437-452 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/stable_diffusion/mod.rs:342` 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 (16 lines × 2) candle-transformers/src/models/mmdit/blocks.rs:41— candle-transformers/src/models/mmdit/blocks.rs:41-56 | candle-transformers/src/models/mmdit/blocks.rs:127-142 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/mmdit/blocks.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 (16 lines × 2) candle-transformers/src/models/paddleocr_vl/text.rs:1007— candle-transformers/src/models/paddleocr_vl/text.rs:1007-1022 | candle-transformers/src/models/qwen3_vl/text.rs:214-229 — `candle-transformers/src/models/paddleocr_vl/text.rs` and `candle-transformers/src/models/qwen3_vl/text.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 35 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 (16 lines × 2) candle-core/src/cpu/avx.rs:126— candle-core/src/cpu/avx.rs:126-141 | candle-core/src/cpu/avx.rs:203-218 — both copies are in the same file, so extract the 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 `candle-core/src/cpu/avx.rs:126` 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) candle-transformers/src/models/wuerstchen/diffnext.rs:286— candle-transformers/src/models/wuerstchen/diffnext.rs:286-301 | candle-transformers/src/models/wuerstchen/prior.rs:70-85 — 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. 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 (16 lines × 2) candle-metal-kernels/src/kernels/indexing.rs:80— candle-metal-kernels/src/kernels/indexing.rs:80-95 | candle-metal-kernels/src/kernels/indexing.rs:127-142 — both copies are in the same file, so extract the 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 `candle-metal-kernels/src/kernels/indexing.rs:80` 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 (16 lines × 2) candle-transformers/src/models/flux/model.rs:477— candle-transformers/src/models/flux/model.rs:477-492 | candle-transformers/src/models/flux/quantized_model.rs:316-331 — before extracting anything, compare `candle-transformers/src/models/flux/model.rs` and `candle-transformers/src/models/flux/quantized_model.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 209 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 (5 lines × 3) candle-core/src/quantized/k_quants.rs:2605— candle-core/src/quantized/k_quants.rs:2605-2609 | candle-core/src/quantized/neon.rs:1828-1832 | candle-core/src/quantized/neon.rs:2615-2619 — 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 `candle-core/src/quantized/k_quants.rs:2605` 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) candle-core/src/quantized/neon.rs:1139— candle-core/src/quantized/neon.rs:1139-1143 | candle-core/src/quantized/neon.rs:1888-1892 | candle-core/src/quantized/neon.rs:2675-2679 — 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 `candle-core/src/quantized/neon.rs:1139` 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 (5 lines × 3) candle-core/src/quantized/neon.rs:3977— candle-core/src/quantized/neon.rs:3977-3982 | candle-core/src/quantized/neon.rs:3984-3988 | candle-core/src/quantized/neon.rs:3990-3994 — 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 `candle-core/src/quantized/neon.rs:3977` 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 × 3) candle-core/src/tensor.rs:1641— candle-core/src/tensor.rs:1641-1645 | candle-core/src/tensor.rs:1830-1834 | candle-core/src/tensor.rs:1892-1896 — 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 `candle-core/src/tensor.rs:1641` 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) candle-nn/src/ops.rs:299— candle-nn/src/ops.rs:299-303 | candle-nn/src/ops.rs:479-483 | candle-nn/src/ops.rs:733-737 — 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 `candle-nn/src/ops.rs:299` 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 (5 lines × 3) candle-nn/src/ops.rs:412— candle-nn/src/ops.rs:412-416 | candle-nn/src/ops.rs:634-638 | candle-nn/src/ops.rs:883-887 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) candle-transformers/src/models/blip.rs:223— candle-transformers/src/models/blip.rs:223-228 | candle-transformers/src/models/quantized_blip.rs:184-189 | candle-transformers/src/models/siglip.rs:498-502 — before extracting anything, compare `candle-transformers/src/models/blip.rs` and `candle-transformers/src/models/quantized_blip.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 128 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 (5 lines × 3) candle-transformers/src/models/paddleocr_vl/text.rs:407— candle-transformers/src/models/paddleocr_vl/text.rs:407-411 | candle-transformers/src/models/paddleocr_vl/text.rs:498-502 | candle-transformers/src/models/paddleocr_vl/text.rs:658-662 — 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 `candle-transformers/src/models/paddleocr_vl/text.rs:407` 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 × 3) candle-transformers/src/models/parler_tts.rs:138— candle-transformers/src/models/parler_tts.rs:138-142 | candle-transformers/src/models/quantized_stable_lm.rs:155-159 | candle-transformers/src/models/stable_lm.rs:278-282 — before extracting anything, compare `candle-transformers/src/models/quantized_stable_lm.rs` and `candle-transformers/src/models/stable_lm.rs` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 239 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 `candle-transformers/src/models/parler_tts.rs:138` 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 × 3) candle-nn/src/attention/cpu_flash/standard.rs:32— candle-nn/src/attention/cpu_flash/standard.rs:32-37 | candle-nn/src/attention/cpu_flash/standard.rs:38-42 | candle-nn/src/attention/cpu_flash/standard.rs:45-49 — 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 `candle-nn/src/attention/cpu_flash/standard.rs:32` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `candle-nn/src/attention/cpu_flash/standard.rs:42` calls `start_offset` and `candle-nn/src/attention/cpu_flash/standard.rs:37` 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 (5 lines × 3) candle-transformers/src/models/quantized_gemma3.rs:327— candle-transformers/src/models/quantized_gemma3.rs:327-333 | candle-transformers/src/models/quantized_llama.rs:442-446 | candle-transformers/src/models/quantized_qwen2.rs:221-225 — before extracting anything, compare `candle-transformers/src/models/quantized_gemma3.rs` and `candle-transformers/src/models/quantized_llama.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 74 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 `candle-transformers/src/models/quantized_gemma3.rs:327` 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 × 3) candle-transformers/src/models/chatglm.rs:363— candle-transformers/src/models/chatglm.rs:363-367 | candle-transformers/src/models/codegeex4_9b.rs:384-388 | candle-transformers/src/models/glm4.rs:405-409 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 (5 lines × 3) candle-transformers/src/models/chinese_clip/vision_model.rs:165— candle-transformers/src/models/chinese_clip/vision_model.rs:165-169 | candle-transformers/src/models/clip/text_model.rs:131-135 | candle-transformers/src/models/stable_diffusion/clip.rs:212-216 — before extracting anything, compare `candle-transformers/src/models/chinese_clip/vision_model.rs` and `candle-transformers/src/models/clip/text_model.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 3) candle-transformers/src/models/granite.rs:357— candle-transformers/src/models/granite.rs:357-361 | candle-transformers/src/models/llama.rs:404-408 | candle-transformers/src/models/voxtral/voxtral_llama.rs:328-332 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/llama.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 309 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 (5 lines × 3) candle-metal-kernels/src/kernels/unary.rs:27— candle-metal-kernels/src/kernels/unary.rs:27-31 | candle-metal-kernels/src/kernels/unary.rs:90-96 | candle-metal-kernels/src/kernels/unary.rs:171-177 — 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 `candle-metal-kernels/src/kernels/unary.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. 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) candle-nn/src/attention/cpu_flash/causal.rs:136— candle-nn/src/attention/cpu_flash/causal.rs:136-140 | candle-nn/src/attention/cpu_flash/causal.rs:141-145 | candle-nn/src/attention/cpu_flash/causal.rs:146-150 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) candle-transformers/src/models/chatglm.rs:76— candle-transformers/src/models/chatglm.rs:76-80 | candle-transformers/src/models/codegeex4_9b.rs:88-92 | candle-transformers/src/models/glm4.rs:109-113 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 `candle-transformers/src/models/chatglm.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 (5 lines × 3) candle-transformers/src/models/granite.rs:218— candle-transformers/src/models/granite.rs:218-222 | candle-transformers/src/models/granitemoehybrid.rs:267-271 | candle-transformers/src/models/llama.rs:264-268 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 `candle-transformers/src/models/granite.rs:218` 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 × 3) candle-transformers/src/models/quantized_lfm2.rs:120— candle-transformers/src/models/quantized_lfm2.rs:120-124 | candle-transformers/src/models/quantized_phi3.rs:101-105 | candle-transformers/src/models/quantized_qwen2.rs:73-77 — before extracting anything, compare `candle-transformers/src/models/quantized_lfm2.rs` and `candle-transformers/src/models/quantized_phi3.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 58 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 `candle-transformers/src/models/quantized_lfm2.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 (5 lines × 3) candle-wasm-examples/llama2-c/src/app.rs:63— candle-wasm-examples/llama2-c/src/app.rs:63-67 | candle-wasm-examples/whisper/src/app.rs:104-108 | candle-wasm-examples/yolo/src/app.rs:62-66 — before extracting anything, compare `candle-wasm-examples/llama2-c/src/app.rs` and `candle-wasm-examples/whisper/src/app.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×19
Edited copy of a member (10 corresponding lines) candle-transformers/src/models/glm4_new.rs:102— candle-transformers/src/models/glm4_new.rs:102-111 | candle-transformers/src/models/quantized_glm4.rs:78-89 — 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) candle-core/src/quantized/mod.rs:893— candle-core/src/quantized/mod.rs:893-902 | candle-transformers/src/models/t5.rs:82-91 — 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) candle-core/src/custom_op.rs:201— candle-core/src/custom_op.rs:201-210 | candle-core/src/custom_op.rs:222-235 — 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) candle-transformers/src/models/dinov2reg4.rs:283— candle-transformers/src/models/dinov2reg4.rs:283-292 | candle-transformers/src/models/eva2.rs:331-340 — 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) candle-transformers/src/models/gemma.rs:417— candle-transformers/src/models/gemma.rs:417-426 | candle-transformers/src/models/mistral.rs:451-460 — 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) candle-transformers/src/models/blip.rs:222— candle-transformers/src/models/blip.rs:222-231 | candle-transformers/src/models/quantized_blip.rs:183-192 — 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) candle-core/src/quantized/repack_x86.rs:79— candle-core/src/quantized/repack_x86.rs:79-88 | candle-core/src/quantized/utils.rs:50-60 — 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) candle-transformers/src/models/convnext.rs:160— candle-transformers/src/models/convnext.rs:160-169 | candle-transformers/src/models/convnext.rs:172-181 — 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) candle-transformers/src/models/paddleocr_vl/vision.rs:260— candle-transformers/src/models/paddleocr_vl/vision.rs:260-269 | candle-transformers/src/models/qwen3_vl/vision.rs:288-297 — 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) candle-transformers/src/models/quantized_t5.rs:157— candle-transformers/src/models/quantized_t5.rs:157-166 | candle-transformers/src/models/t5.rs:286-295 — 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) candle-transformers/src/models/chinese_clip/vision_model.rs:221— candle-transformers/src/models/chinese_clip/vision_model.rs:221-238 | candle-transformers/src/models/clip/text_model.rs:187-196 — 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) candle-transformers/src/models/flux/model.rs:503— candle-transformers/src/models/flux/model.rs:503-512 | candle-transformers/src/models/flux/quantized_model.rs:342-351 — 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) candle-transformers/src/models/paddleocr_vl/text.rs:673— candle-transformers/src/models/paddleocr_vl/text.rs:673-685 | candle-transformers/src/models/starcoder2.rs:98-107 — 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) candle-transformers/src/models/modernbert.rs:413— candle-transformers/src/models/modernbert.rs:413-422 | candle-transformers/src/models/modernbert.rs:471-485 — 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) candle-transformers/src/models/mamba2.rs:58— candle-transformers/src/models/mamba2.rs:58-67 | candle-transformers/src/models/mamba2.rs:69-78 — 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) candle-transformers/src/models/flux/model.rs:203— candle-transformers/src/models/flux/model.rs:203-212 | candle-transformers/src/models/flux/quantized_model.rs:42-51 — 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) candle-transformers/src/models/moondream.rs:122— candle-transformers/src/models/moondream.rs:122-132 | candle-transformers/src/models/quantized_moondream.rs:56-65 — 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) candle-transformers/src/models/beit.rs:251— candle-transformers/src/models/beit.rs:251-261 | candle-transformers/src/models/segment_anything/image_encoder.rs:18-27 — 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) candle-flash-attn-v3/src/lib.rs:420— candle-flash-attn-v3/src/lib.rs:420-429 | candle-flash-attn/src/lib.rs:392-401 — 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.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×19
Edited copy of a member (7 corresponding lines) candle-transformers/src/models/dac.rs:34— candle-transformers/src/models/dac.rs:34-40 | candle-transformers/src/models/snac.rs:235-241 — 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) candle-transformers/src/models/falcon.rs:121— candle-transformers/src/models/falcon.rs:121-127 | candle-transformers/src/models/paddleocr_vl/text.rs:194-209 — 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) candle-transformers/src/models/phi3.rs:292— candle-transformers/src/models/phi3.rs:292-298 | candle-transformers/src/models/quantized_phi3.rs:58-64 — 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) candle-transformers/src/models/moondream.rs:181— candle-transformers/src/models/moondream.rs:181-188 | candle-transformers/src/models/quantized_moondream.rs:111-117 — 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) candle-transformers/src/models/blip_text.rs:391— candle-transformers/src/models/blip_text.rs:391-397 | candle-transformers/src/models/quantized_blip_text.rs:387-393 — 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) candle-transformers/src/models/paddleocr_vl/vision.rs:607— candle-transformers/src/models/paddleocr_vl/vision.rs:607-613 | candle-transformers/src/models/qwen3_vl/vision.rs:214-220 — 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) candle-transformers/src/models/encodec.rs:110— candle-transformers/src/models/encodec.rs:110-116 | candle-transformers/src/models/mimi/conv.rs:215-221 — 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) candle-transformers/src/models/blip_text.rs:58— candle-transformers/src/models/blip_text.rs:58-64 | candle-transformers/src/models/quantized_blip_text.rs:54-60 — 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) candle-transformers/src/models/bigcode.rs:33— candle-transformers/src/models/bigcode.rs:33-39 | candle-transformers/src/models/falcon.rs:430-436 — 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) candle-transformers/src/models/gemma4/text.rs:45— candle-transformers/src/models/gemma4/text.rs:45-51 | candle-transformers/src/models/gemma4/vision.rs:44-50 — 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) candle-transformers/src/models/efficientvit.rs:438— candle-transformers/src/models/efficientvit.rs:438-444 | candle-transformers/src/models/hiera.rs:259-265 — 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) candle-transformers/src/models/llama2_c_weights.rs:45— candle-transformers/src/models/llama2_c_weights.rs:45-51 | candle-wasm-examples/llama2-c/src/worker.rs:44-50 — 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) candle-core/src/cpu/simd128.rs:106— candle-core/src/cpu/simd128.rs:106-112 | candle-core/src/cpu/simd128.rs:156-162 — 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) candle-transformers/src/models/moondream.rs:226— candle-transformers/src/models/moondream.rs:226-233 | candle-transformers/src/models/quantized_moondream.rs:155-161 — 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) candle-core/src/quantized/mod.rs:155— candle-core/src/quantized/mod.rs:155-161 | candle-core/src/storage.rs:36-42 — 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) candle-transformers/src/models/dac.rs:140— candle-transformers/src/models/dac.rs:140-146 | candle-transformers/src/models/snac.rs:438-444 — 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) candle-transformers/src/models/snac.rs:370— candle-transformers/src/models/snac.rs:370-377 | candle-transformers/src/models/dac.rs:224-230 — 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) candle-transformers/src/models/chinese_clip/mod.rs:39— candle-transformers/src/models/chinese_clip/mod.rs:39-46 | candle-transformers/src/models/stable_diffusion/clip.rs:19-25 — 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) candle-nn/src/sequential.rs:29— candle-nn/src/sequential.rs:29-35 | candle-transformers/src/models/openclip/text_model.rs:218-224 — 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 (11 lines × 3) candle-core/src/quantized/neon.rs:1145— candle-core/src/quantized/neon.rs:1145-1155 | candle-core/src/quantized/neon.rs:1894-1904 | candle-core/src/quantized/neon.rs:2681-2691 — 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 `candle-core/src/quantized/neon.rs:1145` 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 × 3) candle-nn/src/attention/cpu_flash/causal.rs:221— candle-nn/src/attention/cpu_flash/causal.rs:221-231 | candle-nn/src/attention/cpu_flash/causal.rs:314-324 | candle-nn/src/attention/cpu_flash/causal.rs:403-413 — 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, `candle-nn/src/attention/cpu_flash/causal.rs:232` calls `as_ptr` and `candle-nn/src/attention/cpu_flash/causal.rs:415` 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 × 3) candle-nn/src/rotary_emb.rs:214— candle-nn/src/rotary_emb.rs:214-224 | candle-nn/src/rotary_emb.rs:519-529 | candle-nn/src/rotary_emb.rs:793-803 — 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 `candle-nn/src/rotary_emb.rs:214` 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 × 3) candle-nn/src/var_builder.rs:510— candle-nn/src/var_builder.rs:510-520 | candle-nn/src/var_builder.rs:540-550 | candle-nn/src/var_builder.rs:570-580 — 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 (11 lines × 3) candle-transformers/src/models/beit.rs:231— candle-transformers/src/models/beit.rs:231-241 | candle-transformers/src/models/dinov2.rs:173-183 | candle-transformers/src/models/dinov2reg4.rs:166-176 — before extracting anything, compare `candle-transformers/src/models/beit.rs` and `candle-transformers/src/models/dinov2.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 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 (11 lines × 3) candle-transformers/src/models/chatglm.rs:153— candle-transformers/src/models/chatglm.rs:153-163 | candle-transformers/src/models/codegeex4_9b.rs:170-180 | candle-transformers/src/models/glm4.rs:191-201 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 `candle-transformers/src/models/chatglm.rs:153` 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 × 3) candle-transformers/src/models/chatglm.rs:579— candle-transformers/src/models/chatglm.rs:579-589 | candle-transformers/src/models/codegeex4_9b.rs:601-611 | candle-transformers/src/models/glm4.rs:622-632 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 (11 lines × 3) candle-transformers/src/models/granite.rs:160— candle-transformers/src/models/granite.rs:160-170 | candle-transformers/src/models/granitemoehybrid.rs:203-213 | candle-transformers/src/models/llama.rs:206-216 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 `candle-transformers/src/models/granite.rs:160` 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) candle-transformers/src/models/granite.rs:450— candle-transformers/src/models/granite.rs:450-460 | candle-transformers/src/models/llama.rs:523-533 | candle-transformers/src/models/voxtral/voxtral_llama.rs:458-468 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/llama.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 309 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 `candle-transformers/src/models/granite.rs:450` 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 `cfg` to `&Config` in one and `&VoxtralLlamaConfig` 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 × 3) candle-transformers/src/models/helium.rs:374— candle-transformers/src/models/helium.rs:374-384 | candle-transformers/src/models/mistral.rs:430-440 | candle-transformers/src/models/quantized_mistral.rs:315-325 — before extracting anything, compare `candle-transformers/src/models/helium.rs` and `candle-transformers/src/models/mistral.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 220 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `candle-transformers/src/models/quantized_mistral.rs:327` calls `contiguous` and `candle-transformers/src/models/helium.rs:386` 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 (11 lines × 3) candle-transformers/src/models/mistral.rs:385— candle-transformers/src/models/mistral.rs:385-395 | candle-transformers/src/models/mixtral.rs:426-436 | candle-transformers/src/models/qwen2_moe.rs:421-431 — before extracting anything, compare `candle-transformers/src/models/mistral.rs` and `candle-transformers/src/models/mixtral.rs` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 175 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 `candle-transformers/src/models/mistral.rs:385` 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) candle-transformers/src/models/mmdit/blocks.rs:44— candle-transformers/src/models/mmdit/blocks.rs:44-54 | candle-transformers/src/models/mmdit/blocks.rs:130-140 | candle-transformers/src/models/mmdit/blocks.rs:226-236 — 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 `candle-transformers/src/models/mmdit/blocks.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 (11 lines × 3) candle-core/src/quantized/k_quants.rs:972— candle-core/src/quantized/k_quants.rs:972-982 | candle-core/src/quantized/k_quants.rs:1635-1645 | candle-core/src/quantized/k_quants.rs:1916-1926 — 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 `candle-core/src/quantized/k_quants.rs:972` 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 × 3) candle-core/src/quantized/k_quants.rs:1597— candle-core/src/quantized/k_quants.rs:1597-1607 | candle-core/src/quantized/k_quants.rs:1663-1673 | candle-core/src/quantized/k_quants.rs:1944-1954 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) candle-transformers/src/models/beit.rs:142— candle-transformers/src/models/beit.rs:142-152 | candle-transformers/src/models/dinov2.rs:85-95 | candle-transformers/src/models/dinov2reg4.rs:78-88 — before extracting anything, compare `candle-transformers/src/models/beit.rs` and `candle-transformers/src/models/dinov2.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 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 × 3) candle-transformers/src/models/chatglm.rs:518— candle-transformers/src/models/chatglm.rs:518-528 | candle-transformers/src/models/codegeex4_9b.rs:539-549 | candle-transformers/src/models/glm4.rs:560-570 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 × 3) candle-wasm-examples/yolo/src/model.rs:264— candle-wasm-examples/yolo/src/model.rs:264-274 | candle-wasm-examples/yolo/src/model.rs:279-289 | candle-wasm-examples/yolo/src/model.rs:294-304 — 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 `candle-wasm-examples/yolo/src/model.rs:264` 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.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×16
Edited copy of a member (19 corresponding lines) candle-transformers/src/models/paddleocr_vl/text.rs:794— candle-transformers/src/models/paddleocr_vl/text.rs:794-826 | candle-transformers/src/models/qwen2.rs:160-210 — 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) candle-transformers/src/models/paddleocr_vl/text.rs:794— candle-transformers/src/models/paddleocr_vl/text.rs:794-826 | candle-transformers/src/models/qwen2_moe.rs:167-217 — 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) candle-transformers/src/models/paddleocr_vl/text.rs:794— candle-transformers/src/models/paddleocr_vl/text.rs:794-826 | candle-transformers/src/models/starcoder2.rs:163-210 — 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) candle-transformers/src/models/paddleocr_vl/text.rs:794— candle-transformers/src/models/paddleocr_vl/text.rs:794-826 | candle-transformers/src/models/yi.rs:199-248 — 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) candle-transformers/src/models/paddleocr_vl/text.rs:794— candle-transformers/src/models/paddleocr_vl/text.rs:794-826 | candle-transformers/src/models/smol/smollm3.rs:242-298 — 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) candle-transformers/src/models/paddleocr_vl/text.rs:794— candle-transformers/src/models/paddleocr_vl/text.rs:794-826 | candle-transformers/src/models/qwen3.rs:192-241 — 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) candle-transformers/src/models/paddleocr_vl/text.rs:794— candle-transformers/src/models/paddleocr_vl/text.rs:794-826 | candle-transformers/src/models/z_image/text_encoder.rs:271-318 — 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) candle-core/src/cpu_backend/utils.rs:10— candle-core/src/cpu_backend/utils.rs:10-28 | candle-core/src/cpu_backend/utils.rs:34-52 — 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) candle-transformers/src/models/mixtral.rs:82— candle-transformers/src/models/mixtral.rs:82-100 | candle-transformers/src/models/yi.rs:83-101 — 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) candle-transformers/src/models/llama.rs:515— candle-transformers/src/models/llama.rs:515-533 | candle-transformers/src/models/voxtral/voxtral_llama.rs:450-468 — 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) candle-core/src/cuda_backend/device.rs:319— candle-core/src/cuda_backend/device.rs:319-337 | candle-core/src/cuda_backend/device.rs:339-357 — 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) candle-transformers/src/models/wuerstchen/common.rs:123— candle-transformers/src/models/wuerstchen/common.rs:123-141 | candle-transformers/src/models/wuerstchen/diffnext.rs:15-33 — 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) candle-metal-kernels/src/kernels/random.rs:19— candle-metal-kernels/src/kernels/random.rs:19-42 | candle-metal-kernels/src/kernels/random.rs:55-73 — 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) candle-nn/src/var_builder.rs:419— candle-nn/src/var_builder.rs:419-437 | candle-nn/src/var_builder.rs:464-482 — 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) candle-core/src/tensor.rs:1694— candle-core/src/tensor.rs:1694-1712 | candle-core/src/tensor.rs:1736-1754 — 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) candle-transformers/src/models/llama2_c_weights.rs:54— candle-transformers/src/models/llama2_c_weights.rs:54-72 | candle-wasm-examples/llama2-c/src/worker.rs:113-131 — 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 copy of a member (21 corresponding lines) · ×15
Edited copy of a member (21 corresponding lines) candle-transformers/src/models/stable_diffusion/attention.rs:173— candle-transformers/src/models/stable_diffusion/attention.rs:173-206 | candle-transformers/src/models/wuerstchen/attention_processor.rs:77-117 — 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) candle-transformers/src/models/qwen3.rs:192— candle-transformers/src/models/qwen3.rs:192-241 | candle-transformers/src/models/smol/smollm3.rs:242-298 — 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) candle-transformers/src/models/segment_anything/sam.rs:49— candle-transformers/src/models/segment_anything/sam.rs:49-92 | candle-transformers/src/models/segment_anything/sam.rs:94-123 — 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) candle-core/src/tensor.rs:1672— candle-core/src/tensor.rs:1672-1692 | candle-core/src/tensor.rs:1714-1734 — 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) candle-transformers/src/models/nvembed_v2/model.rs:83— candle-transformers/src/models/nvembed_v2/model.rs:83-103 | candle-transformers/src/models/stable_diffusion/attention.rs:105-129 — 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) candle-datasets/src/batcher.rs:95— candle-datasets/src/batcher.rs:95-115 | candle-datasets/src/batcher.rs:145-170 — 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) candle-core/src/cuda_backend/cutile.rs:72— candle-core/src/cuda_backend/cutile.rs:72-92 | candle-core/src/cuda_backend/cutile.rs:99-119 — 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) candle-transformers/src/models/mmdit/blocks.rs:38— candle-transformers/src/models/mmdit/blocks.rs:38-58 | candle-transformers/src/models/mmdit/blocks.rs:123-145 — 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) candle-metal-kernels/src/kernel.rs:113— candle-metal-kernels/src/kernel.rs:113-133 | candle-metal-kernels/src/kernel.rs:157-177 — 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) candle-transformers/src/models/csm.rs:165— candle-transformers/src/models/csm.rs:165-185 | candle-transformers/src/models/parler_tts.rs:75-99 — 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) candle-core/src/quantized/k_quants.rs:207— candle-core/src/quantized/k_quants.rs:207-227 | candle-core/src/quantized/k_quants.rs:382-402 — 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) candle-metal-kernels/src/metal/encoder.rs:292— candle-metal-kernels/src/metal/encoder.rs:292-315 | candle-metal-kernels/src/metal/encoder.rs:317-337 — 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) candle-transformers/src/models/falcon.rs:50— candle-transformers/src/models/falcon.rs:50-70 | candle-transformers/src/models/falcon.rs:88-110 — 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) candle-examples/src/lib.rs:129— candle-examples/src/lib.rs:129-150 | candle-examples/src/lib.rs:155-175 — 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) candle-wasm-examples/llama2-c/src/worker.rs:299— candle-wasm-examples/llama2-c/src/worker.rs:299-325 | candle-wasm-examples/yolo/src/worker.rs:225-245 — 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 (9 corresponding lines) · ×15
Edited copy of a member (9 corresponding lines) candle-transformers/src/models/phi.rs:80— candle-transformers/src/models/phi.rs:80-88 | candle-transformers/src/models/quantized_phi.rs:94-103 — 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) candle-transformers/src/models/flux/model.rs:514— candle-transformers/src/models/flux/model.rs:514-522 | candle-transformers/src/models/flux/quantized_model.rs:353-361 — 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) candle-transformers/src/models/mmdit/blocks.rs:240— candle-transformers/src/models/mmdit/blocks.rs:240-248 | candle-transformers/src/models/mmdit/blocks.rs:283-293 — 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) candle-transformers/src/models/blip_text.rs:291— candle-transformers/src/models/blip_text.rs:291-299 | candle-transformers/src/models/quantized_blip_text.rs:287-295 — 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) candle-transformers/src/models/encodec.rs:269— candle-transformers/src/models/encodec.rs:269-277 | candle-transformers/src/models/mimi/quantization.rs:125-134 — 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) candle-transformers/src/models/efficientvit.rs:367— candle-transformers/src/models/efficientvit.rs:367-375 | candle-transformers/src/models/fastvit.rs:449-457 — 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) candle-transformers/src/models/quantized_recurrent_gemma.rs:339— candle-transformers/src/models/quantized_recurrent_gemma.rs:339-347 | candle-transformers/src/models/recurrent_gemma.rs:572-580 — 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) candle-core/src/shape.rs:312— candle-core/src/shape.rs:312-320 | candle-core/src/shape.rs:322-330 — 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) candle-pyo3/src/lib.rs:1192— candle-pyo3/src/lib.rs:1192-1200 | candle-pyo3/src/lib.rs:1211-1219 — 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) candle-transformers/src/models/quantized_t5.rs:478— candle-transformers/src/models/quantized_t5.rs:478-486 | candle-transformers/src/models/t5.rs:608-616 — 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) candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:25— candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:25-43 | candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:73-81 — 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) candle-transformers/src/models/whisper/model.rs:357— candle-transformers/src/models/whisper/model.rs:357-365 | candle-transformers/src/models/whisper/quantized_model.rs:361-369 — 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) candle-transformers/src/models/z_image/vae.rs:497— candle-transformers/src/models/z_image/vae.rs:497-506 | candle-transformers/src/models/z_image/vae.rs:586-594 — 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) candle-transformers/src/models/bert.rs:314— candle-transformers/src/models/bert.rs:314-322 | candle-transformers/src/models/bert.rs:404-414 — 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) candle-core/src/test_utils.rs:49— candle-core/src/test_utils.rs:49-57 | candle-core/src/test_utils.rs:59-71 — 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.
Duplicated block (15 lines × 2) candle-core/src/cuda_backend/cudnn.rs:38— candle-core/src/cuda_backend/cudnn.rs:38-52 | candle-core/src/cuda_backend/cudnn.rs:137-151 — both copies are in the same file, so extract the 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 `candle-core/src/cuda_backend/cudnn.rs:38` 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 (15 lines × 2) candle-datasets/src/batcher.rs:73— candle-datasets/src/batcher.rs:73-87 | candle-datasets/src/batcher.rs:122-136 — both copies are in the same file, so extract the 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) candle-transformers/src/fused_moe.rs:96— candle-transformers/src/fused_moe.rs:96-110 | candle-transformers/src/fused_moe.rs:233-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 (15 lines × 2) candle-transformers/src/models/blip_text.rs:263— candle-transformers/src/models/blip_text.rs:263-277 | candle-transformers/src/models/quantized_blip_text.rs:259-273 — before extracting anything, compare `candle-transformers/src/models/blip_text.rs` and `candle-transformers/src/models/quantized_blip_text.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 222 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 (15 lines × 2) candle-transformers/src/models/paddleocr_vl/text.rs:393— candle-transformers/src/models/paddleocr_vl/text.rs:393-407 | candle-transformers/src/models/paddleocr_vl/text.rs:644-658 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/paddleocr_vl/text.rs:393` 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) tensor-tools/src/main.rs:185— tensor-tools/src/main.rs:185-199 | tensor-tools/src/main.rs:305-319 — both copies are in the same file, so extract the 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 `tensor-tools/src/main.rs:185` 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 (15 lines × 2) candle-transformers/src/models/moondream.rs:138— candle-transformers/src/models/moondream.rs:138-152 | candle-transformers/src/models/quantized_moondream.rs:70-84 — before extracting anything, compare `candle-transformers/src/models/moondream.rs` and `candle-transformers/src/models/quantized_moondream.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 84 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 `candle-transformers/src/models/moondream.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-transformers/src/models/moondream.rs:137` calls `enter` and `candle-transformers/src/models/quantized_moondream.rs:69` 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 (15 lines × 2) candle-transformers/src/models/quantized_t5.rs:616— candle-transformers/src/models/quantized_t5.rs:616-630 | candle-transformers/src/models/t5.rs:746-760 — before extracting anything, compare `candle-transformers/src/models/quantized_t5.rs` and `candle-transformers/src/models/t5.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 390 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 (15 lines × 2) candle-flash-attn-v3/src/lib.rs:76— candle-flash-attn-v3/src/lib.rs:76-90 | candle-flash-attn/src/lib.rs:67-81 — before extracting anything, compare `candle-flash-attn-v3/src/lib.rs` and `candle-flash-attn/src/lib.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 174 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-flash-attn-v3/src/lib.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 (15 lines × 2) candle-transformers/src/models/segment_anything/transformer.rs:48— candle-transformers/src/models/segment_anything/transformer.rs:48-62 | candle-transformers/src/models/siglip.rs:333-347 — 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 (15 lines × 2) candle-core/src/quantized/fast_mmq.rs:23— candle-core/src/quantized/fast_mmq.rs:23-37 | candle-core/src/quantized/fast_mmvq.rs:22-36 — 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 (15 lines × 2) candle-core/src/cpu_backend/mod.rs:3193— candle-core/src/cpu_backend/mod.rs:3193-3207 | candle-core/src/cpu_backend/mod.rs:3256-3270 — both copies are in the same file, so extract the 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 `candle-core/src/cpu_backend/mod.rs:3193` 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 (15 lines × 2) candle-metal-kernels/src/kernels/reduce.rs:198— candle-metal-kernels/src/kernels/reduce.rs:198-212 | candle-metal-kernels/src/kernels/reduce.rs:259-273 — both copies are in the same file, so extract the 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 `candle-metal-kernels/src/kernels/reduce.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 (15 lines × 2) candle-metal-kernels/src/kernels/indexing.rs:31— candle-metal-kernels/src/kernels/indexing.rs:31-45 | candle-metal-kernels/src/kernels/indexing.rs:175-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 `candle-metal-kernels/src/kernels/indexing.rs:31` 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 (15 lines × 2) candle-wasm-examples/moondream/src/bin/m.rs:247— candle-wasm-examples/moondream/src/bin/m.rs:247-261 | candle-wasm-examples/phi/src/bin/m.rs:134-148 — before extracting anything, compare `candle-wasm-examples/moondream/src/bin/m.rs` and `candle-wasm-examples/phi/src/bin/m.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-wasm-examples/moondream/src/bin/m.rs:247` 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.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×14
Edited copy of a member (6 corresponding lines) candle-core/src/tensor.rs:1054— candle-core/src/tensor.rs:1054-1059 | candle-core/src/tensor.rs:1064-1069 — 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) candle-transformers/src/models/metavoice.rs:862— candle-transformers/src/models/metavoice.rs:862-867 | candle-transformers/src/models/quantized_metavoice.rs:165-170 — 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) candle-transformers/src/models/mixtral.rs:251— candle-transformers/src/models/mixtral.rs:251-263 | candle-transformers/src/models/z_image/transformer.rs:224-229 — 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) candle-transformers/src/models/quantized_stable_lm.rs:53— candle-transformers/src/models/quantized_stable_lm.rs:53-58 | candle-transformers/src/models/stable_lm.rs:157-162 — 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) candle-transformers/src/models/mpt.rs:152— candle-transformers/src/models/mpt.rs:152-157 | candle-transformers/src/models/quantized_mpt.rs:129-134 — 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) candle-transformers/src/models/colpali.rs:32— candle-transformers/src/models/colpali.rs:32-39 | candle-transformers/src/models/colpali.rs:41-46 — 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) candle-transformers/src/models/debertav2.rs:798— candle-transformers/src/models/debertav2.rs:798-815 | candle-transformers/src/models/xlm_roberta.rs:244-249 — 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) candle-transformers/src/models/bert.rs:386— candle-transformers/src/models/bert.rs:386-391 | candle-transformers/src/models/chinese_clip/text_model.rs:371-376 — 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) candle-transformers/src/quantized_nn.rs:19— candle-transformers/src/quantized_nn.rs:19-24 | candle-transformers/src/models/with_tracing.rs:17-22 — 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) candle-transformers/src/models/chinese_clip/text_model.rs:442— candle-transformers/src/models/chinese_clip/text_model.rs:442-447 | candle-transformers/src/models/xlm_roberta.rs:473-481 — 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) candle-transformers/src/models/distilbert.rs:339— candle-transformers/src/models/distilbert.rs:339-346 | candle-transformers/src/models/jina_bert.rs:400-405 — 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) candle-transformers/src/models/quantized_qwen3_moe.rs:34— candle-transformers/src/models/quantized_qwen3_moe.rs:34-39 | candle-transformers/src/models/qwen3_moe.rs:187-193 — 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) candle-wasm-examples/yolo/src/model.rs:661— candle-wasm-examples/yolo/src/model.rs:661-666 | candle-wasm-examples/yolo/src/model.rs:690-695 — 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) candle-wasm-examples/yolo/src/model.rs:124— candle-wasm-examples/yolo/src/model.rs:124-131 | candle-wasm-examples/yolo/src/model.rs:190-195 — 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.
candle_nn::attention::cpu_flash::varlen::flash_attn_varlen_cpu (cognitive 83) candle-nn/src/attention/cpu_flash/varlen.rs:27— candle_nn::attention::cpu_flash::varlen::flash_attn_varlen_cpu has cognitive complexity 83 (threshold 15). Drivers by points: if/else 31 (46 pts), loops 10 (20 pts), match/switch 8 (11 pts), boolean chains 6 (nesting depth added 28). Of this number, 76 points are the body's own statements and 7 belong to 2 function items inside it that branch. 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.
candle_nn::attention::cpu_flash::causal::causal_prefill_f32 (cognitive 30) candle-nn/src/attention/cpu_flash/causal.rs:573— candle_nn::attention::cpu_flash::causal::causal_prefill_f32 has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 3 (6 pts), boolean chains 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.
candle_nn::attention::cpu_flash::standard::flash_attn_decode (cognitive 24) candle-nn/src/attention/cpu_flash/standard.rs:208— candle_nn::attention::cpu_flash::standard::flash_attn_decode has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 4 (8 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. This shape REPEATS in the file: one other method here (candle_nn::attention::cpu_flash::standard::flash_attn_prefill) 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.
candle_nn::attention::cpu_flash::standard::flash_attn_prefill (cognitive 24) candle-nn/src/attention/cpu_flash/standard.rs:384— candle_nn::attention::cpu_flash::standard::flash_attn_prefill has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 4 (8 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. This shape REPEATS in the file: one other method here (candle_nn::attention::cpu_flash::standard::flash_attn_decode) 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.
candle_nn::attention::cpu_flash::causal::causal_decode_f32 (cognitive 23) candle-nn/src/attention/cpu_flash/causal.rs:192— candle_nn::attention::cpu_flash::causal::causal_decode_f32 has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (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.
candle_nn::attention::cpu_flash::causal::causal_decode_f32_interleaved_gqa2 (cognitive 21) candle-nn/src/attention/cpu_flash/causal.rs:465— candle_nn::attention::cpu_flash::causal::causal_decode_f32_interleaved_gqa2 has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 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.
candle_nn::attention::varlen::flash_attn_varlen_unfused (cognitive 20) candle-nn/src/attention/varlen.rs:25— candle_nn::attention::varlen::flash_attn_varlen_unfused has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, loops 2 (nesting depth added 6). 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.
candle_nn::attention::cpu_flash::causal::run_causal_attn_cpu (cognitive 18) candle-nn/src/attention/cpu_flash/causal.rs:54— candle_nn::attention::cpu_flash::causal::run_causal_attn_cpu has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 6 (9 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.
candle_nn::moe::moe_gemm_gguf::cuda_fwd (cognitive 18) candle-nn/src/moe.rs:188— candle_nn::moe::moe_gemm_gguf::cuda_fwd has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 6 (9 pts) (nesting depth added 5). 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.
candle_nn::moe::cutile::routed_grouped_matmul_inner (cognitive 18) candle-nn/src/moe/cutile.rs:491— candle_nn::moe::cutile::routed_grouped_matmul_inner has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 2, match/switch 1 (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.
candle_nn::attention::cpu_flash::standard::run_flash_attn_cpu (cognitive 17) candle-nn/src/attention/cpu_flash/standard.rs:12— candle_nn::attention::cpu_flash::standard::run_flash_attn_cpu has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 1 (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.
candle_nn::attention::cpu_flash::causal::causal_decode_f32_lean (cognitive 16) candle-nn/src/attention/cpu_flash/causal.rs:300— candle_nn::attention::cpu_flash::causal::causal_decode_f32_lean has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (6 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. This shape REPEATS in the file: one other method here (candle_nn::attention::cpu_flash::causal::causal_prefill_f32_lean) 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.
candle_nn::attention::cpu_flash::causal::causal_prefill_f32_lean (cognitive 16) candle-nn/src/attention/cpu_flash/causal.rs:704— candle_nn::attention::cpu_flash::causal::causal_prefill_f32_lean has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (6 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. This shape REPEATS in the file: one other method here (candle_nn::attention::cpu_flash::causal::causal_decode_f32_lean) 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.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×13
Edited copy of a member (15 corresponding lines) candle-transformers/src/models/olmo.rs:315— candle-transformers/src/models/olmo.rs:315-329 | candle-transformers/src/models/olmo2.rs:310-324 — 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) candle-core/src/storage.rs:812— candle-core/src/storage.rs:812-826 | candle-core/src/storage.rs:838-854 — 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) candle-transformers/src/models/resnet.rs:65— candle-transformers/src/models/resnet.rs:65-79 | candle-transformers/src/models/resnet.rs:177-191 — 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) candle-transformers/src/models/mpt.rs:245— candle-transformers/src/models/mpt.rs:245-263 | candle-transformers/src/models/quantized_mpt.rs:184-198 — 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) candle-transformers/src/models/csm.rs:368— candle-transformers/src/models/csm.rs:368-382 | candle-transformers/src/models/quantized_mistral.rs:314-330 — 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) candle-metal-kernels/src/metal/encoder.rs:119— candle-metal-kernels/src/metal/encoder.rs:119-133 | candle-metal-kernels/src/metal/encoder.rs:135-149 — 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) candle-transformers/src/models/clip/text_model.rs:307— candle-transformers/src/models/clip/text_model.rs:307-321 | candle-transformers/src/models/stable_diffusion/clip.rs:367-381 — 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) candle-core/src/metal_backend/mod.rs:2003— candle-core/src/metal_backend/mod.rs:2003-2018 | candle-core/src/quantized/metal.rs:443-457 — 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) candle-transformers/src/models/modernbert.rs:288— candle-transformers/src/models/modernbert.rs:288-302 | candle-transformers/src/models/nvembed_v2/embedding.rs:272-286 — 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) candle-pyo3/src/lib.rs:170— candle-pyo3/src/lib.rs:170-184 | candle-pyo3/src/lib.rs:186-200 — 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) candle-transformers/src/models/phi.rs:279— candle-transformers/src/models/phi.rs:279-293 | candle-transformers/src/models/starcoder2.rs:226-242 — 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) candle-core/src/quantized/utils.rs:11— candle-core/src/quantized/utils.rs:11-25 | candle-core/src/quantized/utils.rs:33-48 — 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) candle-wasm-examples/whisper/src/app.rs:114— candle-wasm-examples/whisper/src/app.rs:114-128 | candle-wasm-examples/yolo/src/app.rs:116-130 — 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.
D4 · Code Duplication· Edited copy of a member (5 corresponding lines) · ×13
Edited copy of a member (5 corresponding lines) candle-core/src/cpu_backend/mod.rs:1151— candle-core/src/cpu_backend/mod.rs:1151-1155 | candle-core/src/cuda_backend/mod.rs:257-261 — 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) candle-transformers/src/models/whisper/quantized_model.rs:13— candle-transformers/src/models/whisper/quantized_model.rs:13-19 | candle-transformers/src/quantized_nn.rs:84-88 — 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) candle-transformers/src/models/mixformer.rs:230— candle-transformers/src/models/mixformer.rs:230-234 | candle-transformers/src/models/quantized_mixformer.rs:155-159 — 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) candle-transformers/src/models/moondream.rs:269— candle-transformers/src/models/moondream.rs:269-278 | candle-transformers/src/models/quantized_moondream.rs:196-200 — 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) candle-transformers/src/models/deepseek2.rs:726— candle-transformers/src/models/deepseek2.rs:726-730 | candle-transformers/src/models/gemma4/vision.rs:303-307 — 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) candle-transformers/src/models/flux/model.rs:342— candle-transformers/src/models/flux/model.rs:342-346 | candle-transformers/src/models/flux/quantized_model.rs:181-185 — 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) candle-transformers/src/models/segformer.rs:230— candle-transformers/src/models/segformer.rs:230-240 | candle-transformers/src/models/vit.rs:271-275 — 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) candle-transformers/src/models/nvembed_v2/model.rs:17— candle-transformers/src/models/nvembed_v2/model.rs:17-21 | candle-transformers/src/models/stable_diffusion/attention.rs:13-17 — 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) candle-transformers/src/models/t5.rs:74— candle-transformers/src/models/t5.rs:74-79 | candle-transformers/src/models/with_tracing.rs:50-54 — 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) candle-nn/src/conv.rs:335— candle-nn/src/conv.rs:335-343 | candle-nn/src/linear.rs:97-101 — 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) candle-transformers/src/models/bigcode.rs:27— candle-transformers/src/models/bigcode.rs:27-31 | candle-transformers/src/models/whisper/model.rs:12-16 — 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) candle-wasm-examples/yolo/src/model.rs:670— candle-wasm-examples/yolo/src/model.rs:670-674 | candle-wasm-examples/yolo/src/model.rs:699-703 — 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) candle-wasm-examples/llama2-c/src/bin/app.rs:1— candle-wasm-examples/llama2-c/src/bin/app.rs:1-5 | candle-wasm-examples/yolo/src/bin/app.rs:1-5 — 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.
D4 · Code Duplication· Edited copy of a member (4 corresponding lines) · ×13
Edited copy of a member (4 corresponding lines) candle-transformers/src/models/flux/autoencoder.rs:197— candle-transformers/src/models/flux/autoencoder.rs:197-200 | candle-transformers/src/models/z_image/vae.rs:334-337 — 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.
Edited copy of a member (4 corresponding lines) candle-transformers/src/models/flux/model.rs:329— candle-transformers/src/models/flux/model.rs:329-332 | candle-transformers/src/models/flux/quantized_model.rs:168-171 — 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.
Edited copy of a member (4 corresponding lines) candle-transformers/src/models/mixformer.rs:217— candle-transformers/src/models/mixformer.rs:217-220 | candle-transformers/src/models/moondream.rs:282-285 — 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.
Edited copy of a member (4 corresponding lines) candle-transformers/src/models/flux/autoencoder.rs:426— candle-transformers/src/models/flux/autoencoder.rs:426-429 | candle-transformers/src/models/z_image/vae.rs:656-659 — 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.
Edited copy of a member (4 corresponding lines) candle-transformers/src/models/quantized_glm4.rs:28— candle-transformers/src/models/quantized_glm4.rs:28-31 | candle-transformers/src/models/quantized_qwen3.rs:31-34 — 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.
Edited copy of a member (4 corresponding lines) candle-transformers/src/models/quantized_glm4.rs:33— candle-transformers/src/models/quantized_glm4.rs:33-36 | candle-transformers/src/models/quantized_qwen3.rs:36-39 — 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.
Edited copy of a member (4 corresponding lines) candle-transformers/src/models/quantized_recurrent_gemma.rs:25— candle-transformers/src/models/quantized_recurrent_gemma.rs:25-28 | candle-transformers/src/quantized_nn.rs:90-93 — 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.
Edited copy of a member (4 corresponding lines) candle-nn/src/ops.rs:44— candle-nn/src/ops.rs:44-47 | candle-transformers/src/models/based.rs:78-81 — 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.
Edited copy of a member (4 corresponding lines) candle-transformers/src/models/mixformer.rs:124— candle-transformers/src/models/mixformer.rs:124-127 | candle-transformers/src/models/quantized_mixformer.rs:29-32 — 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.
Edited copy of a member (4 corresponding lines) candle-transformers/src/models/flux/model.rs:59— candle-transformers/src/models/flux/model.rs:59-62 | candle-transformers/src/models/flux/quantized_model.rs:7-10 — 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.
Edited copy of a member (4 corresponding lines) candle-transformers/src/models/flux/autoencoder.rs:430— candle-transformers/src/models/flux/autoencoder.rs:430-433 | candle-transformers/src/models/z_image/vae.rs:664-667 — 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.
Edited copy of a member (4 corresponding lines) candle-transformers/src/models/quantized_t5.rs:600— candle-transformers/src/models/quantized_t5.rs:600-603 | candle-transformers/src/models/t5.rs:730-733 — 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.
Edited copy of a member (4 corresponding lines) candle-examples/src/chat_template.rs:395— candle-examples/src/chat_template.rs:395-398 | candle-wasm-examples/chat-template/src/lib.rs:545-548 — 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.
Duplicated block (7 lines × 3) candle-core/src/cpu_backend/mod.rs:1125— candle-core/src/cpu_backend/mod.rs:1125-1131 | candle-core/src/cpu_backend/mod.rs:1190-1196 | candle-core/src/cpu_backend/mod.rs:1198-1204 — 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 `candle-core/src/cpu_backend/mod.rs:1125` 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) candle-core/src/quantized/neon.rs:1111— candle-core/src/quantized/neon.rs:1111-1117 | candle-core/src/quantized/neon.rs:1565-1571 | candle-core/src/quantized/neon.rs:2271-2277 — 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 `candle-core/src/quantized/neon.rs:1111` 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) candle-nn/src/attention/cpu_flash/causal.rs:638— candle-nn/src/attention/cpu_flash/causal.rs:638-645 | candle-nn/src/attention/cpu_flash/causal.rs:832-838 | candle-nn/src/attention/cpu_flash/causal.rs:919-925 — 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) candle-transformers/src/models/csm.rs:360— candle-transformers/src/models/csm.rs:360-366 | candle-transformers/src/models/helium.rs:361-367 | candle-transformers/src/models/mistral.rs:417-423 — before extracting anything, compare `candle-transformers/src/models/csm.rs` and `candle-transformers/src/models/helium.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 104 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 `candle-transformers/src/models/csm.rs:360` 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 × 3) candle-transformers/src/models/mimi/transformer.rs:65— candle-transformers/src/models/mimi/transformer.rs:65-71 | candle-transformers/src/models/quantized_mistral.rs:43-49 | candle-transformers/src/models/quantized_mixformer.rs:69-75 — before extracting anything, compare `candle-transformers/src/models/quantized_mistral.rs` and `candle-transformers/src/models/quantized_mixformer.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 42 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 `candle-transformers/src/models/mimi/transformer.rs:65` 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) candle-onnx/src/eval.rs:477— candle-onnx/src/eval.rs:477-483 | candle-onnx/src/eval.rs:512-518 | candle-onnx/src/eval.rs:876-882 — 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 before the matched lines, `candle-onnx/src/eval.rs:874` calls `copied`, `unwrap_or` and `candle-onnx/src/eval.rs:475` 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) candle-transformers/src/models/chinese_clip/vision_model.rs:204— candle-transformers/src/models/chinese_clip/vision_model.rs:204-210 | candle-transformers/src/models/clip/text_model.rs:170-176 | candle-transformers/src/models/stable_diffusion/clip.rs:245-251 — before extracting anything, compare `candle-transformers/src/models/chinese_clip/vision_model.rs` and `candle-transformers/src/models/clip/text_model.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/chinese_clip/vision_model.rs:204` 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 × 3) candle-transformers/src/models/blip.rs:250— candle-transformers/src/models/blip.rs:250-256 | candle-transformers/src/models/quantized_blip.rs:211-217 | candle-transformers/src/models/siglip.rs:525-531 — before extracting anything, compare `candle-transformers/src/models/blip.rs` and `candle-transformers/src/models/quantized_blip.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 128 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 (7 lines × 3) candle-transformers/src/models/blip_text.rs:220— candle-transformers/src/models/blip_text.rs:220-226 | candle-transformers/src/models/quantized_blip_text.rs:216-222 | candle-transformers/src/models/vit.rs:291-297 — before extracting anything, compare `candle-transformers/src/models/blip_text.rs` and `candle-transformers/src/models/quantized_blip_text.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 222 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 (7 lines × 3) candle-transformers/src/models/chinese_clip/vision_model.rs:308— candle-transformers/src/models/chinese_clip/vision_model.rs:308-314 | candle-transformers/src/models/clip/text_model.rs:258-264 | candle-transformers/src/models/stable_diffusion/clip.rs:331-337 — before extracting anything, compare `candle-transformers/src/models/chinese_clip/vision_model.rs` and `candle-transformers/src/models/clip/text_model.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `causal_attention_mask` to `Option<&Tensor>` in one and `&Tensor` 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 × 3) candle-transformers/src/models/granite.rs:111— candle-transformers/src/models/granite.rs:111-117 | candle-transformers/src/models/granitemoehybrid.rs:149-155 | candle-transformers/src/models/llama.rs:155-161 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 first that the copies are not typed on the same thing: the declarations holding them bind `cfg` to `&Config` in one and `&GraniteMoeHybridInternalConfig` 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 × 3) candle-transformers/src/models/glm4_new.rs:313— candle-transformers/src/models/glm4_new.rs:313-319 | candle-transformers/src/models/qwen3.rs:422-428 | candle-transformers/src/models/z_image/text_encoder.rs:385-395 — before extracting anything, compare `candle-transformers/src/models/glm4_new.rs` and `candle-transformers/src/models/qwen3.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 120 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 `candle-transformers/src/models/glm4_new.rs:313` 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 `cfg` to `&Config` in one and `&TextEncoderConfig` 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 × 3) candle-transformers/src/models/llama2_c.rs:280— candle-transformers/src/models/llama2_c.rs:280-286 | candle-transformers/src/models/quantized_llama2_c.rs:167-173 | candle-wasm-examples/llama2-c/src/model.rs:194-200 — before extracting anything, compare `candle-transformers/src/models/llama2_c.rs` and `candle-transformers/src/models/quantized_llama2_c.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 141 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.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×12
Edited copy of a member (22 corresponding lines) candle-transformers/src/models/quantized_rwkv_v5.rs:177— candle-transformers/src/models/quantized_rwkv_v5.rs:177-198 | candle-transformers/src/models/quantized_rwkv_v6.rs:224-245 — 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) candle-core/src/quantized/repack_x86.rs:294— candle-core/src/quantized/repack_x86.rs:294-315 | candle-core/src/quantized/repack_x86.rs:1058-1093 — 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) candle-core/src/quantized/repack_x86.rs:262— candle-core/src/quantized/repack_x86.rs:262-283 | candle-core/src/quantized/repack_x86.rs:1012-1047 — 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) candle-core/src/quantized/cuda.rs:704— candle-core/src/quantized/cuda.rs:704-725 | candle-core/src/quantized/cuda.rs:732-753 — 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) candle-core/src/quantized/k_quants.rs:424— candle-core/src/quantized/k_quants.rs:424-445 | candle-core/src/quantized/k_quants.rs:520-552 — 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) candle-transformers/src/models/dac.rs:155— candle-transformers/src/models/dac.rs:155-181 | candle-transformers/src/models/dac.rs:248-269 — 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) candle-transformers/src/models/quantized_recurrent_gemma.rs:311— candle-transformers/src/models/quantized_recurrent_gemma.rs:311-332 | candle-transformers/src/models/recurrent_gemma.rs:544-565 — 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) candle-core/src/device.rs:361— candle-core/src/device.rs:361-382 | candle-core/src/device.rs:399-420 — 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) candle-transformers/src/models/quantized_recurrent_gemma.rs:61— candle-transformers/src/models/quantized_recurrent_gemma.rs:61-82 | candle-transformers/src/models/recurrent_gemma.rs:200-221 — 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) candle-transformers/src/models/moondream.rs:201— candle-transformers/src/models/moondream.rs:201-222 | candle-transformers/src/models/quantized_moondream.rs:129-151 — 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) candle-transformers/src/models/z_image/vae.rs:272— candle-transformers/src/models/z_image/vae.rs:272-299 | candle-transformers/src/models/z_image/vae.rs:354-375 — 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) candle-transformers/src/models/paligemma.rs:29— candle-transformers/src/models/paligemma.rs:29-51 | candle-transformers/src/models/paligemma.rs:53-74 — 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 (17 corresponding lines) · ×12
Edited copy of a member (17 corresponding lines) candle-transformers/src/models/paddleocr_vl/text.rs:794— candle-transformers/src/models/paddleocr_vl/text.rs:794-826 | candle-transformers/src/models/quantized_stable_lm.rs:117-177 — 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) candle-transformers/src/models/paddleocr_vl/text.rs:794— candle-transformers/src/models/paddleocr_vl/text.rs:794-826 | candle-transformers/src/models/stable_lm.rs:240-307 — 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) candle-transformers/src/models/qwen3.rs:192— candle-transformers/src/models/qwen3.rs:192-241 | candle-transformers/src/models/stable_lm.rs:240-307 — 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) candle-transformers/src/models/mamba.rs:189— candle-transformers/src/models/mamba.rs:189-206 | candle-transformers/src/models/mamba2.rs:600-616 — 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) candle-core/src/scalar.rs:28— candle-core/src/scalar.rs:28-44 | candle-core/src/scalar.rs:46-62 — 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) candle-core/src/quantized/avx.rs:52— candle-core/src/quantized/avx.rs:52-70 | candle-core/src/quantized/avx.rs:73-89 — 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) candle-core/src/tensor.rs:943— candle-core/src/tensor.rs:943-960 | candle-core/src/tensor.rs:962-978 — 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) candle-transformers/src/models/wuerstchen/common.rs:143— candle-transformers/src/models/wuerstchen/common.rs:143-160 | candle-transformers/src/models/wuerstchen/diffnext.rs:35-51 — 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) candle-transformers/src/models/beit.rs:42— candle-transformers/src/models/beit.rs:42-62 | candle-transformers/src/models/eva2.rs:63-79 — 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) candle-transformers/src/models/paddleocr_vl/vision.rs:583— candle-transformers/src/models/paddleocr_vl/vision.rs:583-599 | candle-transformers/src/models/qwen3_vl/vision.rs:186-206 — 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) candle-flash-attn/src/lib.rs:1057— candle-flash-attn/src/lib.rs:1057-1076 | candle-flash-attn/src/lib.rs:1119-1135 — 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) candle-flash-attn/src/lib.rs:889— candle-flash-attn/src/lib.rs:889-908 | candle-flash-attn/src/lib.rs:949-965 — 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 (9 lines × 3) candle-core/src/cpu_backend/mod.rs:2903— candle-core/src/cpu_backend/mod.rs:2903-2915 | candle-core/src/cuda_backend/mod.rs:1981-1993 | candle-core/src/metal_backend/mod.rs:1027-1035 — `candle-core/src/cpu_backend/mod.rs` and `candle-core/src/cuda_backend/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 65 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `candle-core/src/cpu_backend/mod.rs:2903` 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 (9 lines × 3) candle-nn/src/attention/cpu_flash/causal.rs:248— candle-nn/src/attention/cpu_flash/causal.rs:248-256 | candle-nn/src/attention/cpu_flash/causal.rs:340-348 | candle-nn/src/attention/cpu_flash/causal.rs:837-845 — 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 `candle-nn/src/attention/cpu_flash/causal.rs:248` 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 × 3) candle-transformers/src/models/chatglm.rs:500— candle-transformers/src/models/chatglm.rs:500-508 | candle-transformers/src/models/codegeex4_9b.rs:521-529 | candle-transformers/src/models/glm4.rs:542-550 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 (9 lines × 3) candle-transformers/src/models/modernbert.rs:291— candle-transformers/src/models/modernbert.rs:291-299 | candle-transformers/src/models/nvembed_v2/embedding.rs:275-283 | candle-transformers/src/models/xlm_roberta.rs:519-527 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (9 lines × 3) candle-core/src/cuda_backend/mod.rs:784— candle-core/src/cuda_backend/mod.rs:784-792 | candle-core/src/cuda_backend/mod.rs:855-863 | candle-core/src/cuda_backend/mod.rs:903-911 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) candle-transformers/src/models/dinov2.rs:277— candle-transformers/src/models/dinov2.rs:277-285 | candle-transformers/src/models/dinov2reg4.rs:268-276 | candle-transformers/src/models/eva2.rs:314-322 — before extracting anything, compare `candle-transformers/src/models/dinov2.rs` and `candle-transformers/src/models/dinov2reg4.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 108 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) candle-transformers/src/models/gemma.rs:128— candle-transformers/src/models/gemma.rs:128-136 | candle-transformers/src/models/gemma2.rs:121-129 | candle-transformers/src/models/gemma3.rs:126-134 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 240 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 `candle-transformers/src/models/gemma.rs:128` 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 × 3) candle-nn/src/rotary_emb.rs:200— candle-nn/src/rotary_emb.rs:200-208 | candle-nn/src/rotary_emb.rs:505-513 | candle-nn/src/rotary_emb.rs:779-787 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) candle-transformers/src/models/blip.rs:269— candle-transformers/src/models/blip.rs:269-277 | candle-transformers/src/models/quantized_blip.rs:230-238 | candle-transformers/src/models/trocr.rs:415-423 — before extracting anything, compare `candle-transformers/src/models/blip.rs` and `candle-transformers/src/models/quantized_blip.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 128 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 `candle-transformers/src/models/blip.rs:269` 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 `cfg` to `&VisionConfig` in one and `&Config` 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 (9 lines × 3) candle-metal-kernels/src/kernels/convolution.rs:24— candle-metal-kernels/src/kernels/convolution.rs:24-32 | candle-metal-kernels/src/kernels/convolution.rs:66-74 | candle-metal-kernels/src/kernels/convolution.rs:109-117 — 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 `candle-metal-kernels/src/kernels/convolution.rs:24` 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 × 3) candle-core/src/quantized/k_quants.rs:958— candle-core/src/quantized/k_quants.rs:958-966 | candle-core/src/quantized/k_quants.rs:1620-1628 | candle-core/src/quantized/k_quants.rs:1901-1909 — 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 `candle-core/src/quantized/k_quants.rs:958` 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 × 3) candle-wasm-examples/bert/src/bin/m.rs:73— candle-wasm-examples/bert/src/bin/m.rs:73-81 | candle-wasm-examples/t5/src/bin/m-quantized.rs:160-168 | candle-wasm-examples/t5/src/bin/m.rs:158-166 — before extracting anything, compare `candle-wasm-examples/t5/src/bin/m-quantized.rs` and `candle-wasm-examples/t5/src/bin/m.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 138 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) candle-core/src/quantized/avx.rs:367— candle-core/src/quantized/avx.rs:367-374 | candle-core/src/quantized/avx.rs:375-382 | candle-core/src/quantized/avx.rs:383-390 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) candle-core/src/quantized/k_quants.rs:1184— candle-core/src/quantized/k_quants.rs:1184-1191 | candle-core/src/quantized/k_quants.rs:1544-1551 | candle-core/src/quantized/k_quants.rs:1809-1816 — 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 `candle-core/src/quantized/k_quants.rs:1184` 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 lines × 3) candle-transformers/src/models/gemma2.rs:337— candle-transformers/src/models/gemma2.rs:337-344 | candle-transformers/src/models/gemma3.rs:377-384 | candle-transformers/src/models/gemma4/text.rs:463-470 — before extracting anything, compare `candle-transformers/src/models/gemma2.rs` and `candle-transformers/src/models/gemma3.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 235 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 `candle-transformers/src/models/gemma2.rs:337` 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 × 3) candle-transformers/src/models/marian.rs:329— candle-transformers/src/models/marian.rs:329-336 | candle-transformers/src/models/parler_tts.rs:145-152 | candle-transformers/src/models/trocr.rs:243-250 — before extracting anything, compare `candle-transformers/src/models/marian.rs` and `candle-transformers/src/models/trocr.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 77 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) candle-transformers/src/models/mixtral.rs:333— candle-transformers/src/models/mixtral.rs:333-340 | candle-transformers/src/models/qwen2_moe.rs:295-302 | candle-transformers/src/models/qwen3_moe.rs:156-163 — before extracting anything, compare `candle-transformers/src/models/mixtral.rs` and `candle-transformers/src/models/qwen2_moe.rs` as WHOLE FILES: this scan already matched 30 separate duplicated blocks between them, totalling at least 277 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 `candle-transformers/src/models/mixtral.rs:333` 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) candle-transformers/src/models/nvembed_v2/embedding.rs:163— candle-transformers/src/models/nvembed_v2/embedding.rs:163-171 | candle-transformers/src/models/smol/quantized_smollm3.rs:560-569 | candle-transformers/src/models/starcoder2.rs:203-210 — before extracting anything, compare `candle-transformers/src/models/nvembed_v2/embedding.rs` and `candle-transformers/src/models/starcoder2.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/nvembed_v2/embedding.rs:163` 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, `candle-transformers/src/models/starcoder2.rs:212` calls `clear_kv_cache` and `candle-transformers/src/models/nvembed_v2/embedding.rs:172` 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 × 3) candle-transformers/src/models/nvembed_v2/embedding.rs:160— candle-transformers/src/models/nvembed_v2/embedding.rs:160-168 | candle-transformers/src/models/parler_tts.rs:146-153 | candle-transformers/src/models/starcoder2.rs:200-207 — before extracting anything, compare `candle-transformers/src/models/nvembed_v2/embedding.rs` and `candle-transformers/src/models/starcoder2.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 3) candle-transformers/src/models/fastvit.rs:182— candle-transformers/src/models/fastvit.rs:182-189 | candle-transformers/src/models/mobileone.rs:110-117 | candle-transformers/src/models/repvgg.rs:126-133 — before extracting anything, compare `candle-transformers/src/models/fastvit.rs` and `candle-transformers/src/models/mobileone.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 54 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 `candle-transformers/src/models/fastvit.rs:182` 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 × 3) candle-transformers/src/models/llama2_c.rs:195— candle-transformers/src/models/llama2_c.rs:195-202 | candle-transformers/src/models/quantized_llama2_c.rs:82-89 | candle-wasm-examples/llama2-c/src/model.rs:113-120 — before extracting anything, compare `candle-transformers/src/models/llama2_c.rs` and `candle-transformers/src/models/quantized_llama2_c.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 141 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) candle-transformers/src/models/chatglm.rs:532— candle-transformers/src/models/chatglm.rs:532-539 | candle-transformers/src/models/codegeex4_9b.rs:553-560 | candle-transformers/src/models/glm4.rs:574-581 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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) candle-transformers/src/models/llama2_c.rs:175— candle-transformers/src/models/llama2_c.rs:175-182 | candle-transformers/src/models/quantized_llama2_c.rs:62-69 | candle-wasm-examples/llama2-c/src/model.rs:92-99 — before extracting anything, compare `candle-transformers/src/models/llama2_c.rs` and `candle-transformers/src/models/quantized_llama2_c.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 141 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) candle-wasm-examples/llama2-c/src/app.rs:74— candle-wasm-examples/llama2-c/src/app.rs:74-81 | candle-wasm-examples/whisper/src/app.rs:115-122 | candle-wasm-examples/yolo/src/app.rs:117-124 — before extracting anything, compare `candle-wasm-examples/llama2-c/src/app.rs` and `candle-wasm-examples/whisper/src/app.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-wasm-examples/llama2-c/src/app.rs:74` 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.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×11
Edited copy of a member (11 corresponding lines) candle-transformers/src/models/flux/model.rs:316— candle-transformers/src/models/flux/model.rs:316-326 | candle-transformers/src/models/flux/quantized_model.rs:155-165 — 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) candle-transformers/src/models/mmdit/blocks.rs:92— candle-transformers/src/models/mmdit/blocks.rs:92-102 | candle-transformers/src/models/mmdit/blocks.rs:202-213 — 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) candle-transformers/src/models/mmdit/blocks.rs:334— candle-transformers/src/models/mmdit/blocks.rs:334-344 | candle-transformers/src/models/mmdit/blocks.rs:374-387 — 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) candle-transformers/src/models/clip/text_model.rs:336— candle-transformers/src/models/clip/text_model.rs:336-346 | candle-transformers/src/models/openclip/text_model.rs:255-265 — 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) candle-transformers/src/models/quantized_t5.rs:135— candle-transformers/src/models/quantized_t5.rs:135-145 | candle-transformers/src/models/t5.rs:264-274 — 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) candle-transformers/src/models/mimi/seanet.rs:108— candle-transformers/src/models/mimi/seanet.rs:108-118 | candle-transformers/src/models/mimi/seanet.rs:131-141 — 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) candle-transformers/src/models/lfm2.rs:238— candle-transformers/src/models/lfm2.rs:238-251 | candle-transformers/src/models/mixformer.rs:203-213 — 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) candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:176— candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:176-186 | candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:260-270 — 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) candle-transformers/src/models/segment_anything/mod.rs:97— candle-transformers/src/models/segment_anything/mod.rs:97-107 | candle-transformers/src/models/segment_anything/tiny_vit.rs:224-235 — 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) candle-transformers/src/models/stable_diffusion/ddim.rs:39— candle-transformers/src/models/stable_diffusion/ddim.rs:39-50 | candle-transformers/src/models/stable_diffusion/euler_ancestral_discrete.rs:36-46 — 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) candle-wasm-examples/t5/src/bin/m-quantized.rs:32— candle-wasm-examples/t5/src/bin/m-quantized.rs:32-46 | candle-wasm-examples/t5/src/bin/m-quantized.rs:129-139 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×11
Edited copy of a member (20 corresponding lines) candle-transformers/src/models/encodec.rs:493— candle-transformers/src/models/encodec.rs:493-519 | candle-transformers/src/models/mimi/conv.rs:289-312 — 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) candle-nn/src/rnn.rs:210— candle-nn/src/rnn.rs:210-233 | candle-nn/src/rnn.rs:363-382 — 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) candle-core/src/tensor.rs:1355— candle-core/src/tensor.rs:1355-1374 | candle-core/src/tensor.rs:1393-1412 — 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) candle-transformers/src/models/mpt.rs:66— candle-transformers/src/models/mpt.rs:66-85 | candle-transformers/src/models/quantized_mpt.rs:43-62 — 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) candle-transformers/src/models/dac.rs:99— candle-transformers/src/models/dac.rs:99-118 | candle-transformers/src/models/snac.rs:396-416 — 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) candle-transformers/src/models/flux/model.rs:455— candle-transformers/src/models/flux/model.rs:455-474 | candle-transformers/src/models/flux/quantized_model.rs:294-313 — 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) candle-core/src/npy.rs:282— candle-core/src/npy.rs:282-301 | candle-core/src/npy.rs:304-325 — 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) candle-transformers/src/models/marian.rs:405— candle-transformers/src/models/marian.rs:405-424 | candle-transformers/src/models/parler_tts.rs:176-199 — 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) candle-transformers/src/models/segment_anything/tiny_vit.rs:179— candle-transformers/src/models/segment_anything/tiny_vit.rs:179-198 | candle-transformers/src/models/segment_anything/tiny_vit.rs:479-504 — 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) candle-transformers/src/models/marian.rs:467— candle-transformers/src/models/marian.rs:467-486 | candle-transformers/src/models/marian.rs:521-540 — 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) candle-core/src/quantized/metal.rs:180— candle-core/src/quantized/metal.rs:180-199 | candle-core/src/quantized/metal.rs:201-220 — 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.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×11
Edited copy of a member (13 corresponding lines) candle-transformers/src/models/snac.rs:52— candle-transformers/src/models/snac.rs:52-65 | candle-transformers/src/models/snac.rs:73-85 — 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) candle-transformers/src/models/fastvit.rs:291— candle-transformers/src/models/fastvit.rs:291-303 | candle-transformers/src/models/fastvit.rs:305-317 — 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) candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:752— candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:752-764 | candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:854-867 — 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) candle-transformers/src/models/nvembed_v2/model.rs:40— candle-transformers/src/models/nvembed_v2/model.rs:40-52 | candle-transformers/src/models/stable_diffusion/attention.rs:41-53 — 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) candle-transformers/src/models/gemma2.rs:120— candle-transformers/src/models/gemma2.rs:120-132 | candle-transformers/src/models/gemma3.rs:125-137 — 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) candle-transformers/src/models/flux/autoencoder.rs:141— candle-transformers/src/models/flux/autoencoder.rs:141-153 | candle-transformers/src/models/z_image/vae.rs:214-227 — 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) candle-nn/src/var_map.rs:57— candle-nn/src/var_map.rs:57-69 | candle-nn/src/var_map.rs:78-92 — 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) candle-transformers/src/models/bert.rs:505— candle-transformers/src/models/bert.rs:505-517 | candle-transformers/src/models/nomic_bert.rs:447-459 — 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) candle-core/src/storage.rs:22— candle-core/src/storage.rs:22-34 | candle-core/src/storage.rs:326-341 — 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) candle-core/src/shape.rs:153— candle-core/src/shape.rs:153-165 | candle-core/src/shape.rs:168-180 — 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) candle-flash-attn-v3/src/lib.rs:298— candle-flash-attn-v3/src/lib.rs:298-310 | candle-flash-attn/src/lib.rs:276-288 — 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.
Duplicated block (19 lines × 2) candle-core/src/metal_backend/mod.rs:2290— candle-core/src/metal_backend/mod.rs:2290-2308 | candle-core/src/metal_backend/mod.rs:2330-2348 — both copies are in the same file, so extract the 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 `candle-core/src/metal_backend/mod.rs:2290` 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 lines × 2) candle-core/src/quantized/fast_mmq.rs:259— candle-core/src/quantized/fast_mmq.rs:259-277 | candle-core/src/quantized/fast_mmvq.rs:170-188 — 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 (19 lines × 2) candle-transformers/src/models/bert.rs:80— candle-transformers/src/models/bert.rs:80-98 | candle-transformers/src/models/bert.rs:104-122 — both copies are in the same file, so extract the 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 (19 lines × 2) candle-transformers/src/models/chinese_clip/text_model.rs:48— candle-transformers/src/models/chinese_clip/text_model.rs:48-66 | candle-transformers/src/models/chinese_clip/text_model.rs:72-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. 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 (19 lines × 2) candle-transformers/src/models/quantized_glm4.rs:218— candle-transformers/src/models/quantized_glm4.rs:218-236 | candle-transformers/src/models/quantized_qwen3_moe.rs:137-155 — before extracting anything, compare `candle-transformers/src/models/quantized_glm4.rs` and `candle-transformers/src/models/quantized_qwen3_moe.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 (19 lines × 2) candle-transformers/src/models/quantized_recurrent_gemma.rs:410— candle-transformers/src/models/quantized_recurrent_gemma.rs:410-428 | candle-transformers/src/models/recurrent_gemma.rs:641-659 — before extracting anything, compare `candle-transformers/src/models/quantized_recurrent_gemma.rs` and `candle-transformers/src/models/recurrent_gemma.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 219 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 (19 lines × 2) candle-transformers/src/models/resnet.rs:99— candle-transformers/src/models/resnet.rs:99-117 | candle-transformers/src/models/resnet.rs:211-229 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/resnet.rs:99` 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) candle-transformers/src/models/stable_diffusion/attention.rs:175— candle-transformers/src/models/stable_diffusion/attention.rs:175-193 | candle-transformers/src/models/wuerstchen/attention_processor.rs:89-107 — 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 `candle-transformers/src/models/stable_diffusion/attention.rs:175` 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 (19 lines × 2) candle-transformers/src/models/gemma3.rs:399— candle-transformers/src/models/gemma3.rs:399-417 | candle-transformers/src/models/gemma4/text.rs:487-505 — before extracting anything, compare `candle-transformers/src/models/gemma3.rs` and `candle-transformers/src/models/gemma4/text.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 165 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/gemma3.rs:399` 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 (19 lines × 2) candle-transformers/src/models/whisper/model.rs:40— candle-transformers/src/models/whisper/model.rs:40-58 | candle-transformers/src/models/whisper/quantized_model.rs:37-55 — before extracting anything, compare `candle-transformers/src/models/whisper/model.rs` and `candle-transformers/src/models/whisper/quantized_model.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 201 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 (19 lines × 2) candle-transformers/src/models/whisper/model.rs:282— candle-transformers/src/models/whisper/model.rs:282-300 | candle-transformers/src/models/whisper/quantized_model.rs:278-296 — before extracting anything, compare `candle-transformers/src/models/whisper/model.rs` and `candle-transformers/src/models/whisper/quantized_model.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 201 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 (17 lines × 2) candle-core/src/cpu/avx.rs:336— candle-core/src/cpu/avx.rs:336-352 | candle-core/src/cpu/simd128.rs:225-241 — before extracting anything, compare `candle-core/src/cpu/avx.rs` and `candle-core/src/cpu/simd128.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 106 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 (17 lines × 2) candle-metal-kernels/src/kernels/affine.rs:125— candle-metal-kernels/src/kernels/affine.rs:125-141 | candle-metal-kernels/src/kernels/affine.rs:191-207 — both copies are in the same file, so extract the 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 `candle-metal-kernels/src/kernels/affine.rs:125` 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) candle-transformers/src/models/blip_text.rs:40— candle-transformers/src/models/blip_text.rs:40-56 | candle-transformers/src/models/quantized_blip_text.rs:36-52 — before extracting anything, compare `candle-transformers/src/models/blip_text.rs` and `candle-transformers/src/models/quantized_blip_text.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 222 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 (17 lines × 2) candle-transformers/src/models/quantized_t5.rs:431— candle-transformers/src/models/quantized_t5.rs:431-447 | candle-transformers/src/models/t5.rs:561-577 — before extracting anything, compare `candle-transformers/src/models/quantized_t5.rs` and `candle-transformers/src/models/t5.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 390 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 `candle-transformers/src/models/quantized_t5.rs:431` 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) candle-transformers/src/models/stable_diffusion/uni_pc.rs:394— candle-transformers/src/models/stable_diffusion/uni_pc.rs:394-410 | candle-transformers/src/models/stable_diffusion/uni_pc.rs:507-523 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/stable_diffusion/uni_pc.rs:394` 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.
Duplicated block (17 lines × 2) candle-transformers/src/models/quantized_rwkv_v5.rs:51— candle-transformers/src/models/quantized_rwkv_v5.rs:51-67 | candle-transformers/src/models/quantized_rwkv_v6.rs:58-74 — before extracting anything, compare `candle-transformers/src/models/quantized_rwkv_v5.rs` and `candle-transformers/src/models/quantized_rwkv_v6.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 168 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) candle-core/src/quantized/neon.rs:979— candle-core/src/quantized/neon.rs:979-995 | candle-core/src/quantized/neon.rs:1420-1436 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:979` 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, `candle-core/src/quantized/neon.rs:1418` calls `vdupq_n_u8` and `candle-core/src/quantized/neon.rs:978` 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 (17 lines × 2) candle-metal-kernels/src/kernels/convolution.rs:287— candle-metal-kernels/src/kernels/convolution.rs:287-304 | candle-metal-kernels/src/kernels/indexing.rs:31-47 — 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 `candle-metal-kernels/src/kernels/convolution.rs:287` 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, `candle-metal-kernels/src/kernels/convolution.rs:286` calls `linear_split` and `candle-metal-kernels/src/kernels/indexing.rs:29` 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 (17 lines × 2) candle-metal-kernels/src/kernels/convolution.rs:69— candle-metal-kernels/src/kernels/convolution.rs:69-85 | candle-metal-kernels/src/kernels/convolution.rs:155-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-metal-kernels/src/kernels/convolution.rs:68` calls `linear_split` and `candle-metal-kernels/src/kernels/convolution.rs:154` 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 (17 lines × 2) candle-wasm-examples/llama2-c/src/app.rs:161— candle-wasm-examples/llama2-c/src/app.rs:161-177 | candle-wasm-examples/yolo/src/app.rs:215-231 — before extracting anything, compare `candle-wasm-examples/llama2-c/src/app.rs` and `candle-wasm-examples/yolo/src/app.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 108 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-wasm-examples/llama2-c/src/app.rs:161` 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) candle-wasm-examples/llama2-c/src/app.rs:224— candle-wasm-examples/llama2-c/src/app.rs:224-240 | candle-wasm-examples/yolo/src/app.rs:244-260 — before extracting anything, compare `candle-wasm-examples/llama2-c/src/app.rs` and `candle-wasm-examples/yolo/src/app.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 108 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-wasm-examples/llama2-c/src/app.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.
ClassTooLong: MetalStorage candle-core/src/metal_backend/mod.rs:78— ClassTooLong — 1655 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 4 methods, 3 blocks, lines 78-2019. The bar is 400 significant lines; this is 1255 over it, 4.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: Tensor candle-core/src/tensor.rs:70— ClassTooLong — 1540 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 212 methods, 4 blocks, lines 47-3158. The bar is 400 significant lines; this is 1140 over it, 3.85× 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: CpuStorage candle-core/src/cpu_backend/mod.rs:23— ClassTooLong — 1074 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 2 methods, 3 blocks, lines 23-3155. The bar is 400 significant lines; this is 674 over it, 2.69× 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: CudaStorage candle-core/src/cuda_backend/mod.rs:1251— ClassTooLong — 915 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 4 methods, 3 blocks, lines 1251-2539. The bar is 400 significant lines; this is 515 over it, 2.29× 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: Storage candle-core/src/storage.rs:12— 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), 36 methods, 2 blocks, lines 12-855. 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: PaddleOCRVLModel candle-transformers/src/models/paddleocr_vl/mod.rs:47— ClassTooLong — 592 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 17 methods, 2 blocks, lines 47-1104. The bar is 400 significant lines; this is 192 over it, 1.48× 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: PyTensor candle-pyo3/src/lib.rs:34— ClassTooLong — 518 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 65 methods, 2 blocks, lines 36-1129. The bar is 400 significant lines; this is 118 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.
ClassTooLong: CudaDevice candle-core/src/cuda_backend/device.rs:59— ClassTooLong — 509 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, 6 blocks, lines 59-815. The bar is 400 significant lines; this is 109 over it, 1.27× 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: QTensor candle-core/src/quantized/mod.rs:65— ClassTooLong — 470 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, 6 blocks, lines 65-1308. The bar is 400 significant lines; this is 70 over it, 1.18× 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.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×9
Edited copy of a member (14 corresponding lines) candle-core/src/safetensors.rs:442— candle-core/src/safetensors.rs:442-460 | candle-core/src/safetensors.rs:469-495 — 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) candle-transformers/src/models/quantized_recurrent_gemma.rs:394— candle-transformers/src/models/quantized_recurrent_gemma.rs:394-407 | candle-transformers/src/models/quantized_stable_lm.rs:268-282 — 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) candle-transformers/src/models/convnext.rs:184— candle-transformers/src/models/convnext.rs:184-197 | candle-transformers/src/models/convnext.rs:200-216 — 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) candle-transformers/src/quantized_var_builder.rs:20— candle-transformers/src/quantized_var_builder.rs:20-33 | candle-transformers/src/quantized_var_builder.rs:35-48 — 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) candle-transformers/src/models/mixtral.rs:282— candle-transformers/src/models/mixtral.rs:282-295 | candle-transformers/src/models/qwen3_moe.rs:106-120 — 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) candle-core/src/cpu/mod.rs:235— candle-core/src/cpu/mod.rs:235-248 | candle-core/src/cpu/mod.rs:251-264 — 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) candle-transformers/src/models/nomic_bert.rs:467— candle-transformers/src/models/nomic_bert.rs:467-480 | candle-transformers/src/models/stella_en_v5.rs:780-796 — 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) candle-transformers/src/models/quantized_t5.rs:636— candle-transformers/src/models/quantized_t5.rs:636-649 | candle-transformers/src/models/t5.rs:775-792 — 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) candle-transformers/src/models/codegeex4_9b.rs:136— candle-transformers/src/models/codegeex4_9b.rs:136-149 | candle-transformers/src/models/glm4.rs:157-170 — 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· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×9
Members sharing a duplicated core (5 members, 50+ identical tokens) candle-core/src/quantized/neon.rs:978— candle-core/src/quantized/neon.rs:978-1120 | candle-core/src/quantized/neon.rs:1208-1405 | candle-core/src/quantized/neon.rs:1417-1574 | candle-core/src/quantized/neon.rs:1972-2143 | candle-core/src/quantized/neon.rs:2155-2280 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) candle-core/src/quantized/repack.rs:458— candle-core/src/quantized/repack.rs:458-489 | candle-core/src/quantized/repack.rs:492-533 | candle-core/src/quantized/repack.rs:536-579 | candle-core/src/quantized/repack.rs:628-659 | candle-core/src/quantized/repack.rs:662-692 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) candle-transformers/src/models/glm4_new.rs:332— candle-transformers/src/models/glm4_new.rs:332-352 | candle-transformers/src/models/quantized_glm4.rs:430-455 | candle-transformers/src/models/quantized_qwen3.rs:538-561 | candle-transformers/src/models/qwen3_moe.rs:302-322 | candle-transformers/src/models/smol/smollm3.rs:396-417 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) candle-transformers/src/models/granite.rs:120— candle-transformers/src/models/granite.rs:120-170 | candle-transformers/src/models/granitemoehybrid.rs:163-213 | candle-transformers/src/models/lfm2.rs:165-186 | candle-transformers/src/models/llama.rs:164-216 | candle-transformers/src/models/voxtral/voxtral_llama.rs:89-111 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) candle-transformers/src/models/granite.rs:395— candle-transformers/src/models/granite.rs:395-403 | candle-transformers/src/models/llama.rs:442-450 | candle-transformers/src/models/llama2_c.rs:313-320 | candle-transformers/src/models/quantized_llama2_c.rs:200-207 | candle-transformers/src/models/voxtral/voxtral_llama.rs:366-374 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) candle-transformers/src/models/granite.rs:434— candle-transformers/src/models/granite.rs:434-444 | candle-transformers/src/models/llama.rs:503-513 | candle-transformers/src/models/llama2_c.rs:347-356 | candle-transformers/src/models/quantized_llama2_c.rs:234-243 | candle-transformers/src/models/voxtral/voxtral_llama.rs:438-448 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) candle-transformers/src/models/mixtral.rs:107— candle-transformers/src/models/mixtral.rs:107-116 | candle-transformers/src/models/recurrent_gemma.rs:135-144 | candle-transformers/src/models/stable_lm.rs:117-126 | candle-transformers/src/models/starcoder2.rs:77-86 | candle-transformers/src/models/yi.rs:108-117 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) candle-transformers/src/models/quantized_lfm2.rs:589— candle-transformers/src/models/quantized_lfm2.rs:589-598 | candle-transformers/src/models/quantized_llama.rs:547-556 | candle-transformers/src/models/quantized_phi.rs:272-281 | candle-transformers/src/models/quantized_phi3.rs:304-313 | candle-transformers/src/models/quantized_qwen2.rs:296-305 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) candle-transformers/src/models/stable_diffusion/mod.rs:77— candle-transformers/src/models/stable_diffusion/mod.rs:77-139 | candle-transformers/src/models/stable_diffusion/mod.rs:146-209 | candle-transformers/src/models/stable_diffusion/mod.rs:230-292 | candle-transformers/src/models/stable_diffusion/mod.rs:299-364 | candle-transformers/src/models/stable_diffusion/mod.rs:398-459 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Duplicated block (25 lines × 2) candle-metal-kernels/src/kernels/reduce.rs:40— candle-metal-kernels/src/kernels/reduce.rs:40-64 | candle-metal-kernels/src/kernels/reduce.rs:100-124 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `candle-metal-kernels/src/kernels/reduce.rs:40` 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, `candle-metal-kernels/src/kernels/reduce.rs:99` calls `as_slice` and `candle-metal-kernels/src/kernels/reduce.rs:39` 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 (25 lines × 2) candle-transformers/src/models/bert.rs:156— candle-transformers/src/models/bert.rs:156-180 | candle-transformers/src/models/xlm_roberta.rs:35-59 — 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 `candle-transformers/src/models/bert.rs:156` 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 (25 lines × 2) candle-transformers/src/models/quantized_t5.rs:574— candle-transformers/src/models/quantized_t5.rs:574-598 | candle-transformers/src/models/t5.rs:704-728 — before extracting anything, compare `candle-transformers/src/models/quantized_t5.rs` and `candle-transformers/src/models/t5.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 390 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 (25 lines × 2) candle-transformers/src/models/quantized_t5.rs:760— candle-transformers/src/models/quantized_t5.rs:760-784 | candle-transformers/src/models/t5.rs:914-938 — before extracting anything, compare `candle-transformers/src/models/quantized_t5.rs` and `candle-transformers/src/models/t5.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 390 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 (25 lines × 2) candle-transformers/src/models/codegeex4_9b.rs:166— candle-transformers/src/models/codegeex4_9b.rs:166-190 | candle-transformers/src/models/glm4.rs:187-211 — before extracting anything, compare `candle-transformers/src/models/codegeex4_9b.rs` and `candle-transformers/src/models/glm4.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 459 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 `candle-transformers/src/models/codegeex4_9b.rs:166` 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 (25 lines × 2) candle-transformers/src/models/whisper/model.rs:107— candle-transformers/src/models/whisper/model.rs:107-131 | candle-transformers/src/models/whisper/quantized_model.rs:104-128 — before extracting anything, compare `candle-transformers/src/models/whisper/model.rs` and `candle-transformers/src/models/whisper/quantized_model.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 201 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 (25 lines × 2) candle-transformers/src/models/llama2_c_weights.rs:86— candle-transformers/src/models/llama2_c_weights.rs:86-110 | candle-wasm-examples/llama2-c/src/worker.rs:167-191 — before extracting anything, compare `candle-transformers/src/models/llama2_c_weights.rs` and `candle-wasm-examples/llama2-c/src/worker.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/llama2_c_weights.rs:86` 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 (25 lines × 2) candle-transformers/src/models/flux/model.rs:371— candle-transformers/src/models/flux/model.rs:371-395 | candle-transformers/src/models/flux/quantized_model.rs:210-234 — before extracting anything, compare `candle-transformers/src/models/flux/model.rs` and `candle-transformers/src/models/flux/quantized_model.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 209 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 (25 lines × 2) candle-core/src/quantized/neon.rs:1029— candle-core/src/quantized/neon.rs:1029-1053 | candle-core/src/quantized/neon.rs:1483-1507 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:1029` 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 × 3) candle-nn/src/attention/cpu_flash/causal.rs:909— candle-nn/src/attention/cpu_flash/causal.rs:909-918 | candle-nn/src/attention/cpu_flash/standard.rs:330-339 | candle-nn/src/attention/cpu_flash/standard.rs:417-426 — before extracting anything, compare `candle-nn/src/attention/cpu_flash/causal.rs` and `candle-nn/src/attention/cpu_flash/standard.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 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 `candle-nn/src/attention/cpu_flash/causal.rs:909` 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) candle-transformers/src/models/chinese_clip/vision_model.rs:280— candle-transformers/src/models/chinese_clip/vision_model.rs:280-289 | candle-transformers/src/models/clip/text_model.rs:230-239 | candle-transformers/src/models/stable_diffusion/clip.rs:303-312 — before extracting anything, compare `candle-transformers/src/models/chinese_clip/vision_model.rs` and `candle-transformers/src/models/clip/text_model.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `causal_attention_mask` to `Option<&Tensor>` in one and `&Tensor` 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 × 3) candle-transformers/src/models/paddleocr_vl/mod.rs:371— candle-transformers/src/models/paddleocr_vl/mod.rs:371-380 | candle-transformers/src/models/paddleocr_vl/mod.rs:489-498 | candle-transformers/src/models/paddleocr_vl/mod.rs:788-797 — 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 `candle-transformers/src/models/paddleocr_vl/mod.rs:371` 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 × 3) candle-transformers/src/models/quantized_lfm2.rs:170— candle-transformers/src/models/quantized_lfm2.rs:170-179 | candle-transformers/src/models/quantized_phi.rs:148-157 | candle-transformers/src/models/quantized_qwen2.rs:135-144 — before extracting anything, compare `candle-transformers/src/models/quantized_lfm2.rs` and `candle-transformers/src/models/quantized_phi.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 43 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 `candle-transformers/src/models/quantized_lfm2.rs:170` 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 (10 lines × 3) candle-transformers/src/models/chatglm.rs:141— candle-transformers/src/models/chatglm.rs:141-150 | candle-transformers/src/models/codegeex4_9b.rs:158-167 | candle-transformers/src/models/glm4.rs:179-188 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 `candle-transformers/src/models/chatglm.rs:141` 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) candle-transformers/src/models/helium.rs:231— candle-transformers/src/models/helium.rs:231-240 | candle-transformers/src/models/mistral.rs:280-289 | candle-transformers/src/models/mixtral.rs:212-221 — before extracting anything, compare `candle-transformers/src/models/helium.rs` and `candle-transformers/src/models/mistral.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 220 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 `candle-transformers/src/models/helium.rs:231` 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) candle-transformers/src/models/quantized_gemma3.rs:75— candle-transformers/src/models/quantized_gemma3.rs:75-84 | candle-transformers/src/models/quantized_llama.rs:289-298 | candle-transformers/src/models/quantized_phi.rs:180-189 — before extracting anything, compare `candle-transformers/src/models/quantized_gemma3.rs` and `candle-transformers/src/models/quantized_llama.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 74 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 `candle-transformers/src/models/quantized_gemma3.rs:75` 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 × 3) candle-transformers/src/models/blip_text.rs:103— candle-transformers/src/models/blip_text.rs:103-112 | candle-transformers/src/models/quantized_blip_text.rs:99-108 | candle-transformers/src/models/vit.rs:213-222 — before extracting anything, compare `candle-transformers/src/models/blip_text.rs` and `candle-transformers/src/models/quantized_blip_text.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 222 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 (10 lines × 3) candle-core/src/metal_backend/mod.rs:123— candle-core/src/metal_backend/mod.rs:123-132 | candle-core/src/metal_backend/mod.rs:187-196 | candle-core/src/metal_backend/mod.rs:243-252 — 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.
Tensor::backward (cognitive 108) candle-core/src/backprop.rs:165— Tensor::backward has cognitive complexity 108 (threshold 15). Drivers by points: if/else 26 (81 pts), loops 5 (17 pts), match/switch 2 (7 pts), boolean chains 3 (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.
Tensor::cat_contiguous (cognitive 20) candle-core/src/tensor_cat.rs:154— Tensor::cat_contiguous has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 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.
Tensor::write_bytes (cognitive 19) candle-core/src/convert.rs:102— Tensor::write_bytes has cognitive complexity 19 (threshold 15). Drivers by points: loops 9 (18 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.
Tensor::fmt_dt (cognitive 18) candle-core/src/display.rs:9— Tensor::fmt_dt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (5 pts), match/switch 2 (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.
Tensor::cat0 (cognitive 17) candle-core/src/tensor_cat.rs:79— Tensor::cat0 has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (4 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.
Tensor::sorted_nodes::walk (cognitive 16) candle-core/src/backprop.rs:38— Tensor::sorted_nodes::walk has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 1 (2 pts) (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.
Tensor::fmt (cognitive 16) candle-core/src/display.rs:454— Tensor::fmt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 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.
Tensor::cat (cognitive 16) candle-core/src/tensor_cat.rs:21— Tensor::cat has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (4 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.
Duplicated block (23 lines × 2) candle-core/src/metal_backend/mod.rs:1531— candle-core/src/metal_backend/mod.rs:1531-1553 | candle-core/src/metal_backend/mod.rs:1580-1602 — both copies are in the same file, so extract the 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 `candle-core/src/metal_backend/mod.rs:1531` 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 (23 lines × 2) candle-core/src/quantized/neon.rs:1212— candle-core/src/quantized/neon.rs:1212-1234 | candle-core/src/quantized/neon.rs:1977-1999 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:1212` 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, `candle-core/src/quantized/neon.rs:1976` calls `vdupq_n_s8` and `candle-core/src/quantized/neon.rs:1211` 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 (23 lines × 2) candle-flash-attn-v3/src/lib.rs:86— candle-flash-attn-v3/src/lib.rs:86-108 | candle-flash-attn-v3/src/lib.rs:520-542 — both copies are in the same file, so extract the 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 `candle-flash-attn-v3/src/lib.rs:86` 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 (23 lines × 2) candle-flash-attn-v3/src/lib.rs:457— candle-flash-attn-v3/src/lib.rs:457-479 | candle-flash-attn/src/lib.rs:477-499 — before extracting anything, compare `candle-flash-attn-v3/src/lib.rs` and `candle-flash-attn/src/lib.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 174 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (23 lines × 2) candle-transformers/src/models/quantized_t5.rs:712— candle-transformers/src/models/quantized_t5.rs:712-734 | candle-transformers/src/models/t5.rs:862-884 — before extracting anything, compare `candle-transformers/src/models/quantized_t5.rs` and `candle-transformers/src/models/t5.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 390 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 `candle-transformers/src/models/quantized_t5.rs:712` 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) candle-transformers/src/models/qwen3_vl/mod.rs:94— candle-transformers/src/models/qwen3_vl/mod.rs:94-116 | candle-transformers/src/models/qwen3_vl/mod.rs:143-165 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/qwen3_vl/mod.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 (23 lines × 2) candle-transformers/src/models/stable_diffusion/mod.rs:78— candle-transformers/src/models/stable_diffusion/mod.rs:78-100 | candle-transformers/src/models/stable_diffusion/mod.rs:147-169 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/stable_diffusion/mod.rs:78` 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 (23 lines × 2) candle-transformers/src/models/whisper/audio.rs:64— candle-transformers/src/models/whisper/audio.rs:64-86 | candle-wasm-examples/whisper/src/audio.rs:58-80 — before extracting anything, compare `candle-transformers/src/models/whisper/audio.rs` and `candle-wasm-examples/whisper/src/audio.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. 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 (20 lines × 2) candle-flash-attn-v3/src/lib.rs:170— candle-flash-attn-v3/src/lib.rs:170-189 | candle-flash-attn/src/lib.rs:147-166 — before extracting anything, compare `candle-flash-attn-v3/src/lib.rs` and `candle-flash-attn/src/lib.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 174 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-flash-attn-v3/src/lib.rs:170` 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 (20 lines × 2) candle-transformers/src/models/chatglm.rs:35— candle-transformers/src/models/chatglm.rs:35-54 | candle-transformers/src/models/codegeex4_9b.rs:44-63 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 `candle-transformers/src/models/chatglm.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 (20 lines × 2) candle-transformers/src/models/falcon.rs:51— candle-transformers/src/models/falcon.rs:51-70 | candle-transformers/src/models/falcon.rs:91-110 — both copies are in the same file, so extract the 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 (20 lines × 2) candle-transformers/src/models/flux/model.rs:272— candle-transformers/src/models/flux/model.rs:272-291 | candle-transformers/src/models/flux/quantized_model.rs:111-130 — before extracting anything, compare `candle-transformers/src/models/flux/model.rs` and `candle-transformers/src/models/flux/quantized_model.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 209 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 (20 lines × 2) candle-transformers/src/models/quantized_t5.rs:224— candle-transformers/src/models/quantized_t5.rs:224-243 | candle-transformers/src/models/t5.rs:353-372 — before extracting anything, compare `candle-transformers/src/models/quantized_t5.rs` and `candle-transformers/src/models/t5.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 390 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 (20 lines × 2) candle-transformers/src/object_detection.rs:39— candle-transformers/src/object_detection.rs:39-58 | candle-wasm-examples/yolo/src/model.rs:794-813 — 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 (20 lines × 2) candle-onnx/src/eval.rs:1724— candle-onnx/src/eval.rs:1724-1743 | candle-onnx/src/eval.rs:1752-1771 — both copies are in the same file, so extract the 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 `candle-onnx/src/eval.rs:1724` 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 (20 lines × 2) candle-core/src/cpu_backend/mod.rs:1590— candle-core/src/cpu_backend/mod.rs:1590-1609 | candle-core/src/cpu_backend/mod.rs:1708-1727 — both copies are in the same file, so extract the 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 `candle-core/src/cpu_backend/mod.rs:1590` 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.
Focus outline removed inline candle-wasm-examples/bert/lib-example.html:308— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline candle-wasm-examples/bert/lib-example.html:328— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline candle-wasm-examples/bert/lib-example.html:354— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline candle-wasm-examples/llama2-c/lib-example.html:229— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline candle-wasm-examples/moondream/index.html:89— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline REDACTED:432— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline candle-wasm-examples/t5/index.html:201— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Low contrast Tailwind colour pair (4.4:1) candle-wasm-examples/bert/lib-example.html:349— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.4:1) candle-wasm-examples/blip/index.html:355— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.4:1) candle-wasm-examples/llama2-c/lib-example.html:339— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.4:1) candle-wasm-examples/moondream/index.html:270— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.4:1) REDACTED:560— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.4:1) candle-wasm-examples/t5/index.html:275— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.4:1) candle-wasm-examples/whisper/lib-example.html:341— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×7
Members sharing a duplicated core (6 members, 50+ identical tokens) candle-core/src/cpu/avx.rs:315— candle-core/src/cpu/avx.rs:315-332 | candle-core/src/cpu/avx.rs:355-370 | candle-core/src/cpu/neon.rs:520-537 | candle-core/src/cpu/neon.rs:560-575 | candle-core/src/cpu/simd128.rs:205-222 | candle-core/src/cpu/simd128.rs:243-258 — 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) candle-core/src/storage.rs:383— candle-core/src/storage.rs:383-406 | candle-core/src/storage.rs:414-437 | candle-core/src/storage.rs:445-468 | candle-core/src/storage.rs:476-499 | candle-core/src/storage.rs:751-773 | candle-core/src/storage.rs:781-804 — 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) candle-metal-kernels/src/kernels/reduce.rs:137— candle-metal-kernels/src/kernels/reduce.rs:137-179 | candle-metal-kernels/src/kernels/reduce.rs:195-238 | candle-metal-kernels/src/kernels/reduce.rs:256-301 | candle-metal-kernels/src/kernels/reduce.rs:319-341 | candle-metal-kernels/src/kernels/reduce.rs:361-385 | candle-metal-kernels/src/kernels/reduce.rs:404-427 — 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) candle-nn/src/ops.rs:337— candle-nn/src/ops.rs:337-387 | candle-nn/src/ops.rs:548-608 | candle-nn/src/ops.rs:785-853 | candle-nn/src/rotary_emb.rs:114-184 | candle-nn/src/rotary_emb.rs:419-489 | candle-nn/src/rotary_emb.rs:693-763 — 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) candle-nn/src/ops.rs:394— candle-nn/src/ops.rs:394-434 | candle-nn/src/ops.rs:617-658 | candle-nn/src/ops.rs:864-909 | candle-nn/src/rotary_emb.rs:195-246 | candle-nn/src/rotary_emb.rs:500-552 | candle-nn/src/rotary_emb.rs:774-827 — 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) candle-transformers/src/models/blip_text.rs:482— candle-transformers/src/models/blip_text.rs:482-492 | candle-transformers/src/models/marian.rs:630-641 | candle-transformers/src/models/quantized_blip_text.rs:478-488 | candle-transformers/src/models/trocr.rs:503-512 | candle-transformers/src/models/whisper/model.rs:316-343 | candle-transformers/src/models/whisper/quantized_model.rs:318-347 — 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) candle-transformers/src/models/granite.rs:172— candle-transformers/src/models/granite.rs:172-181 | candle-transformers/src/models/granitemoehybrid.rs:215-224 | candle-transformers/src/models/lfm2.rs:188-197 | candle-transformers/src/models/llama.rs:218-227 | candle-transformers/src/models/llama2_c.rs:123-132 | candle-transformers/src/models/voxtral/voxtral_llama.rs:113-122 — 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· Edited copy of a member (23 corresponding lines) · ×7
Edited copy of a member (23 corresponding lines) candle-datasets/src/vision/cifar.rs:95— candle-datasets/src/vision/cifar.rs:95-117 | candle-datasets/src/vision/mnist.rs:94-117 — 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) candle-transformers/src/models/quantized_lfm2.rs:600— candle-transformers/src/models/quantized_lfm2.rs:600-629 | candle-transformers/src/models/quantized_phi3.rs:315-337 — 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) candle-core/src/quantized/k_quants.rs:486— candle-core/src/quantized/k_quants.rs:486-508 | candle-core/src/quantized/k_quants.rs:597-621 — 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) candle-transformers/src/models/quantized_recurrent_gemma.rs:362— candle-transformers/src/models/quantized_recurrent_gemma.rs:362-387 | candle-transformers/src/models/recurrent_gemma.rs:596-618 — 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) candle-transformers/src/models/mixtral.rs:443— candle-transformers/src/models/mixtral.rs:443-465 | candle-transformers/src/models/qwen2_moe.rs:438-460 — 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) candle-transformers/src/models/hiera.rs:268— candle-transformers/src/models/hiera.rs:268-293 | candle-transformers/src/models/mobilenetv4.rs:775-797 — 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) candle-transformers/src/models/chatglm.rs:34— candle-transformers/src/models/chatglm.rs:34-56 | candle-transformers/src/models/codegeex4_9b.rs:43-66 — 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 copies of one member (3 members, 7+ corresponding lines) · ×7
Edited copies of one member (3 members, 7+ corresponding lines) candle-transformers/src/models/granite.rs:216— candle-transformers/src/models/granite.rs:216-222 | candle-transformers/src/models/granitemoehybrid.rs:265-271 | candle-transformers/src/models/llama.rs:262-268 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) candle-transformers/src/models/bert.rs:438— candle-transformers/src/models/bert.rs:438-444 | candle-transformers/src/models/chinese_clip/text_model.rs:457-463 | candle-transformers/src/models/distilbert.rs:281-287 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) candle-nn/src/ops.rs:948— candle-nn/src/ops.rs:948-954 | candle-nn/src/ops.rs:956-969 | candle-transformers/src/models/flux/sampling.rs:85-92 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) candle-transformers/src/models/dac.rs:325— candle-transformers/src/models/dac.rs:325-331 | candle-transformers/src/models/encodec.rs:324-333 | candle-transformers/src/models/snac.rs:680-688 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) candle-transformers/src/models/bert.rs:237— candle-transformers/src/models/bert.rs:237-244 | candle-transformers/src/models/chinese_clip/text_model.rs:245-252 | candle-transformers/src/models/jina_bert.rs:161-167 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) candle-transformers/src/models/clip/text_model.rs:89— candle-transformers/src/models/clip/text_model.rs:89-95 | candle-transformers/src/models/openclip/text_model.rs:58-65 | candle-transformers/src/models/siglip.rs:689-695 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) candle-transformers/src/models/csm.rs:83— candle-transformers/src/models/csm.rs:83-89 | candle-transformers/src/models/lfm2.rs:156-162 | candle-transformers/src/models/voxtral/voxtral_llama.rs:73-81 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
Duplicated block (6 lines × 4) candle-core/src/cuda_backend/mod.rs:145— candle-core/src/cuda_backend/mod.rs:145-150 | candle-core/src/cuda_backend/mod.rs:176-181 | candle-core/src/cuda_backend/mod.rs:307-312 | candle-nn/src/ops.rs:107-112 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 4) candle-nn/src/ops.rs:832— candle-nn/src/ops.rs:832-837 | candle-nn/src/rotary_emb.rs:152-157 | candle-nn/src/rotary_emb.rs:457-462 | candle-nn/src/rotary_emb.rs:731-736 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 4) candle-transformers/src/models/granite.rs:297— candle-transformers/src/models/granite.rs:297-302 | candle-transformers/src/models/granitemoehybrid.rs:347-352 | candle-transformers/src/models/llama2_c.rs:204-209 | candle-transformers/src/models/quantized_llama2_c.rs:91-96 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 `candle-transformers/src/models/granite.rs:297` 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 × 4) candle-transformers/src/models/helium.rs:70— candle-transformers/src/models/helium.rs:70-75 | candle-transformers/src/models/mistral.rs:121-126 | candle-transformers/src/models/nvembed_v2/embedding.rs:21-26 | candle-transformers/src/models/quantized_mistral.rs:36-41 — before extracting anything, compare `candle-transformers/src/models/helium.rs` and `candle-transformers/src/models/mistral.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 220 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 4) candle-core/src/quantized/k_quants.rs:1601— candle-core/src/quantized/k_quants.rs:1601-1606 | candle-core/src/quantized/k_quants.rs:1667-1672 | candle-core/src/quantized/k_quants.rs:1866-1871 | candle-core/src/quantized/k_quants.rs:1948-1953 — 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 `candle-core/src/quantized/k_quants.rs:1601` 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 × 4) candle-onnx/src/eval.rs:1320— candle-onnx/src/eval.rs:1320-1325 | candle-onnx/src/eval.rs:1429-1434 | candle-onnx/src/eval.rs:1607-1613 | candle-onnx/src/eval.rs:1640-1646 — 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 `candle-onnx/src/eval.rs:1320` 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 × 4) candle-core/src/cuda_backend/mod.rs:523— candle-core/src/cuda_backend/mod.rs:523-528 | candle-core/src/cuda_backend/mod.rs:578-583 | candle-core/src/cuda_backend/mod.rs:632-637 | candle-core/src/cuda_backend/mod.rs:684-689 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 4) candle-core/src/cuda_backend/mod.rs:738— candle-core/src/cuda_backend/mod.rs:738-742 | candle-core/src/cuda_backend/mod.rs:784-788 | candle-core/src/cuda_backend/mod.rs:855-859 | candle-core/src/cuda_backend/mod.rs:903-907 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-core/src/cuda_backend/mod.rs:782` calls `out_w`, `out_h` and `candle-core/src/cuda_backend/mod.rs:737` 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 × 4) candle-core/src/quantized/neon.rs:369— candle-core/src/quantized/neon.rs:369-373 | candle-core/src/quantized/neon.rs:446-450 | candle-core/src/quantized/neon.rs:2827-2831 | candle-core/src/quantized/neon.rs:2859-2863 — 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 `candle-core/src/quantized/neon.rs:369` 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, `candle-core/src/quantized/neon.rs:368` calls `vdupq_n_u8` and `candle-core/src/quantized/neon.rs:2826` 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 × 4) candle-core/src/quantized/neon.rs:690— candle-core/src/quantized/neon.rs:690-694 | candle-core/src/quantized/neon.rs:863-867 | candle-core/src/quantized/neon.rs:2981-2985 | candle-core/src/quantized/neon.rs:3123-3127 — 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 `candle-core/src/quantized/neon.rs:690` 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 (5 lines × 4) candle-transformers/src/models/granite.rs:160— candle-transformers/src/models/granite.rs:160-164 | candle-transformers/src/models/granitemoehybrid.rs:203-207 | candle-transformers/src/models/llama.rs:206-210 | candle-transformers/src/models/voxtral/voxtral_llama.rs:101-105 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 `candle-transformers/src/models/granite.rs:160` 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 × 4) candle-core/src/cuda_backend/mod.rs:753— candle-core/src/cuda_backend/mod.rs:753-757 | candle-core/src/cuda_backend/mod.rs:796-800 | candle-core/src/cuda_backend/mod.rs:867-871 | candle-core/src/cuda_backend/mod.rs:915-919 — 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 `candle-core/src/cuda_backend/mod.rs:753` 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, `candle-core/src/cuda_backend/mod.rs:752` calls `stride`, `dims`, `concat` and `candle-core/src/cuda_backend/mod.rs:795` 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 × 4) candle-nn/src/rotary_emb.rs:300— candle-nn/src/rotary_emb.rs:300-304 | candle-transformers/src/models/llama2_c.rs:159-163 | candle-transformers/src/models/quantized_llama2_c.rs:46-50 | candle-wasm-examples/llama2-c/src/model.rs:82-86 — before extracting anything, compare `candle-transformers/src/models/llama2_c.rs` and `candle-transformers/src/models/quantized_llama2_c.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 141 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 (5 lines × 4) candle-transformers/src/models/flux/autoencoder.rs:51— candle-transformers/src/models/flux/autoencoder.rs:51-55 | candle-transformers/src/models/moondream.rs:59-63 | candle-transformers/src/models/quantized_moondream.rs:23-27 | candle-transformers/src/models/z_image/vae.rs:87-91 — before extracting anything, compare `candle-transformers/src/models/moondream.rs` and `candle-transformers/src/models/quantized_moondream.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 84 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.
AC1 · Text alternatives· <canvas> without a text alternative · ×6
<canvas> without a text alternative candle-wasm-examples/blip/index.html:348— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
<canvas> without a text alternative candle-wasm-examples/moondream/index.html:261— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
<canvas> without a text alternative candle-wasm-examples/segment-anything/lib-example.html:532— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
<canvas> without a text alternative candle-wasm-examples/segment-anything/lib-example.html:533— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
<canvas> without a text alternative candle-wasm-examples/yolo/lib-example.html:457— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
<canvas> without a text alternative candle-wasm-examples/yolo/lib-example.html:461— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
D4 · Code Duplication· Edited copy of a member (31 corresponding lines) · ×6
Edited copy of a member (31 corresponding lines) candle-transformers/src/models/llama2_c_weights.rs:80— candle-transformers/src/models/llama2_c_weights.rs:80-110 | candle-wasm-examples/llama2-c/src/worker.rs:161-191 — 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) candle-transformers/src/models/jina_bert.rs:308— candle-transformers/src/models/jina_bert.rs:308-338 | candle-transformers/src/models/mpt.rs:203-235 — 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) candle-core/src/tensor.rs:1826— candle-core/src/tensor.rs:1826-1874 | candle-core/src/tensor.rs:1887-1917 — 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) candle-transformers/src/models/quantized_stable_lm.rs:80— candle-transformers/src/models/quantized_stable_lm.rs:80-110 | candle-transformers/src/models/stable_lm.rs:201-233 — 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) candle-metal-kernels/src/metal/commands.rs:160— candle-metal-kernels/src/metal/commands.rs:160-190 | candle-metal-kernels/src/metal/commands.rs:192-229 — 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) candle-core/src/quantized/neon.rs:133— candle-core/src/quantized/neon.rs:133-172 | candle-core/src/quantized/neon.rs:175-205 — 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 copies of one member (4 members, 9+ corresponding lines) · ×6
Edited copies of one member (4 members, 9+ corresponding lines) candle-transformers/src/models/granite.rs:446— candle-transformers/src/models/granite.rs:446-460 | candle-transformers/src/models/llama2_c.rs:358-372 | candle-transformers/src/models/quantized_llama2_c.rs:245-259 | candle-wasm-examples/llama2-c/src/model.rs:273-281 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 9+ corresponding lines) candle-core/src/accelerate.rs:394— candle-core/src/accelerate.rs:394-402 | candle-core/src/accelerate.rs:405-413 | candle-core/src/mkl.rs:347-355 | candle-core/src/mkl.rs:358-366 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 9+ corresponding lines) candle-core/src/accelerate.rs:416— candle-core/src/accelerate.rs:416-424 | candle-core/src/accelerate.rs:427-435 | candle-core/src/mkl.rs:369-377 | candle-core/src/mkl.rs:380-388 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 9+ corresponding lines) candle-transformers/src/models/chinese_clip/vision_model.rs:298— candle-transformers/src/models/chinese_clip/vision_model.rs:298-306 | candle-transformers/src/models/clip/text_model.rs:248-256 | candle-transformers/src/models/openclip/text_model.rs:208-216 | candle-transformers/src/models/stable_diffusion/clip.rs:321-329 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 9+ corresponding lines) candle-transformers/src/models/chinese_clip/text_model.rs:289— candle-transformers/src/models/chinese_clip/text_model.rs:289-297 | candle-transformers/src/models/chinese_clip/text_model.rs:389-399 | candle-transformers/src/models/jina_bert.rs:226-234 | candle-transformers/src/models/jina_bert.rs:292-300 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 9+ corresponding lines) candle-transformers/src/models/bert.rs:543— candle-transformers/src/models/bert.rs:543-556 | candle-transformers/src/models/blip_text.rs:365-373 | candle-transformers/src/models/jina_bert.rs:201-209 | candle-transformers/src/models/quantized_blip_text.rs:361-369 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Duplicated block (21 lines × 2) candle-core/src/metal_backend/mod.rs:1283— candle-core/src/metal_backend/mod.rs:1283-1303 | candle-core/src/metal_backend/mod.rs:1330-1350 — both copies are in the same file, so extract the 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 `candle-core/src/metal_backend/mod.rs:1283` 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) candle-transformers/src/models/qwen3_vl/mod.rs:118— candle-transformers/src/models/qwen3_vl/mod.rs:118-138 | candle-transformers/src/models/qwen3_vl/mod.rs:167-187 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/qwen3_vl/mod.rs:118` 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 (21 lines × 2) candle-transformers/src/models/quantized_recurrent_gemma.rs:188— candle-transformers/src/models/quantized_recurrent_gemma.rs:188-208 | candle-transformers/src/models/recurrent_gemma.rs:421-441 — before extracting anything, compare `candle-transformers/src/models/quantized_recurrent_gemma.rs` and `candle-transformers/src/models/recurrent_gemma.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 219 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 (21 lines × 2) candle-transformers/src/models/blip.rs:148— candle-transformers/src/models/blip.rs:148-168 | candle-transformers/src/models/quantized_blip.rs:109-129 — before extracting anything, compare `candle-transformers/src/models/blip.rs` and `candle-transformers/src/models/quantized_blip.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 128 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 (21 lines × 2) candle-transformers/src/models/metavoice.rs:931— candle-transformers/src/models/metavoice.rs:931-951 | candle-transformers/src/models/quantized_metavoice.rs:233-253 — before extracting anything, compare `candle-transformers/src/models/metavoice.rs` and `candle-transformers/src/models/quantized_metavoice.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 125 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `candle-transformers/src/models/quantized_metavoice.rs:254` calls `contiguous` and `candle-transformers/src/models/metavoice.rs:952` 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) candle-metal-kernels/src/kernels/quantized.rs:148— candle-metal-kernels/src/kernels/quantized.rs:148-168 | candle-metal-kernels/src/kernels/quantized.rs:254-275 — both copies are in the same file, so extract the 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 `candle-metal-kernels/src/kernels/quantized.rs:148` 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 (18 lines × 2) candle-core/src/cpu/avx.rs:295— candle-core/src/cpu/avx.rs:295-312 | candle-core/src/cpu/neon.rs:501-518 — before extracting anything, compare `candle-core/src/cpu/avx.rs` and `candle-core/src/cpu/neon.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 113 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 (18 lines × 2) candle-core/src/cpu/avx.rs:374— candle-core/src/cpu/avx.rs:374-391 | candle-core/src/cpu/simd128.rs:261-278 — before extracting anything, compare `candle-core/src/cpu/avx.rs` and `candle-core/src/cpu/simd128.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 106 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 (18 lines × 2) candle-core/src/quantized/k_quants.rs:2628— candle-core/src/quantized/k_quants.rs:2628-2645 | candle-core/src/quantized/k_quants.rs:2654-2671 — both copies are in the same file, so extract the 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) candle-nn/src/attention/cpu_flash/causal.rs:348— candle-nn/src/attention/cpu_flash/causal.rs:348-365 | candle-nn/src/attention/cpu_flash/causal.rs:764-781 — both copies are in the same file, so extract the 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 `candle-nn/src/attention/cpu_flash/causal.rs:348` 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, `candle-nn/src/attention/cpu_flash/causal.rs:762` calls `min` and `candle-nn/src/attention/cpu_flash/causal.rs:346` 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 (18 lines × 2) candle-transformers/src/models/quantized_recurrent_gemma.rs:315— candle-transformers/src/models/quantized_recurrent_gemma.rs:315-332 | candle-transformers/src/models/recurrent_gemma.rs:548-565 — before extracting anything, compare `candle-transformers/src/models/quantized_recurrent_gemma.rs` and `candle-transformers/src/models/recurrent_gemma.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 219 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 `candle-transformers/src/models/quantized_recurrent_gemma.rs:315` 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 (18 lines × 2) candle-examples/src/chat_template.rs:337— candle-examples/src/chat_template.rs:337-354 | candle-wasm-examples/chat-template/src/lib.rs:459-476 — before extracting anything, compare `candle-examples/src/chat_template.rs` and `candle-wasm-examples/chat-template/src/lib.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. 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 × 3) candle-transformers/src/models/convnext.rs:321— candle-transformers/src/models/convnext.rs:321-332 | candle-transformers/src/models/efficientvit.rs:471-482 | candle-transformers/src/models/mobileone.rs:315-326 — 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 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/convnext.rs:321` 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, `candle-transformers/src/models/convnext.rs:320` calls `apply` and `candle-transformers/src/models/efficientvit.rs:470` 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) candle-transformers/src/models/dinov2.rs:201— candle-transformers/src/models/dinov2.rs:201-212 | candle-transformers/src/models/dinov2reg4.rs:194-205 | candle-transformers/src/models/eva2.rs:234-245 — before extracting anything, compare `candle-transformers/src/models/dinov2.rs` and `candle-transformers/src/models/dinov2reg4.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 108 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 × 3) candle-transformers/src/models/gemma3.rs:414— candle-transformers/src/models/gemma3.rs:414-425 | candle-transformers/src/models/gemma4/text.rs:502-513 | candle-transformers/src/models/quantized_gemma3.rs:167-178 — before extracting anything, compare `candle-transformers/src/models/gemma3.rs` and `candle-transformers/src/models/gemma4/text.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 165 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/gemma3.rs:414` 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 × 3) candle-transformers/src/models/llama2_c.rs:218— candle-transformers/src/models/llama2_c.rs:218-229 | candle-transformers/src/models/quantized_llama2_c.rs:105-116 | candle-wasm-examples/llama2-c/src/model.rs:132-143 — before extracting anything, compare `candle-transformers/src/models/llama2_c.rs` and `candle-transformers/src/models/quantized_llama2_c.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 141 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 × 3) candle-transformers/src/models/mixtral.rs:445— candle-transformers/src/models/mixtral.rs:445-456 | candle-transformers/src/models/qwen2.rs:304-315 | candle-transformers/src/models/qwen2_moe.rs:440-451 — before extracting anything, compare `candle-transformers/src/models/mixtral.rs` and `candle-transformers/src/models/qwen2.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 187 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 (12 lines × 3) candle-transformers/src/models/repvgg.rs:295— candle-transformers/src/models/repvgg.rs:295-306 | candle-transformers/src/models/resnet.rs:110-121 | candle-transformers/src/models/resnet.rs:222-233 — 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 `candle-transformers/src/models/repvgg.rs:295` 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 × 4) candle-core/src/cpu/avx.rs:336— candle-core/src/cpu/avx.rs:336-342 | candle-core/src/cpu/avx.rs:375-381 | candle-core/src/cpu/simd128.rs:225-231 | candle-core/src/cpu/simd128.rs:262-268 — before extracting anything, compare `candle-core/src/cpu/avx.rs` and `candle-core/src/cpu/simd128.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 106 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 `candle-core/src/cpu/avx.rs:336` 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 × 4) candle-core/src/tensor.rs:676— candle-core/src/tensor.rs:676-682 | candle-core/src/tensor.rs:1980-1986 | candle-core/src/tensor.rs:2011-2017 | candle-core/src/tensor.rs:2052-2058 — 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 `candle-core/src/tensor.rs:676` 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 × 4) candle-transformers/src/models/convnext.rs:318— candle-transformers/src/models/convnext.rs:318-324 | candle-transformers/src/models/fastvit.rs:486-492 | candle-transformers/src/models/mobileone.rs:312-318 | candle-transformers/src/models/repvgg.rs:292-298 — before extracting anything, compare `candle-transformers/src/models/fastvit.rs` and `candle-transformers/src/models/mobileone.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 54 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 `candle-transformers/src/models/convnext.rs:318` 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 × 4) candle-transformers/src/models/quantized_qwen3.rs:437— candle-transformers/src/models/quantized_qwen3.rs:437-443 | candle-transformers/src/models/qwen3.rs:386-392 | candle-transformers/src/models/smol/smollm3.rs:337-343 | candle-transformers/src/models/z_image/text_encoder.rs:350-356 — before extracting anything, compare `candle-transformers/src/models/quantized_qwen3.rs` and `candle-transformers/src/models/qwen3.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 69 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `candle-transformers/src/models/quantized_qwen3.rs:445` calls `clear_kv_cache` and `candle-transformers/src/models/z_image/text_encoder.rs:357` 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 × 4) candle-transformers/src/models/glm4_new.rs:372— candle-transformers/src/models/glm4_new.rs:372-378 | candle-transformers/src/models/qwen3.rs:487-493 | candle-transformers/src/models/qwen3_moe.rs:342-348 | candle-transformers/src/models/smol/smollm3.rs:437-444 — before extracting anything, compare `candle-transformers/src/models/glm4_new.rs` and `candle-transformers/src/models/qwen3.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 120 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 (7 lines × 4) candle-transformers/src/models/gemma.rs:358— candle-transformers/src/models/gemma.rs:358-364 | candle-transformers/src/models/gemma2.rs:377-383 | candle-transformers/src/models/gemma3.rs:457-463 | candle-transformers/src/models/recurrent_gemma.rs:606-612 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 240 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 `candle-transformers/src/models/gemma.rs:358` 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.
candle_core::quantized::utils::make_qx_quants (cyclomatic 36) candle-core/src/quantized/utils.rs:62— candle_core::quantized::utils::make_qx_quants 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.
candle_core::cuda_backend::gemm_config (cyclomatic 27) candle-core/src/cuda_backend/mod.rs:1402— candle_core::cuda_backend::gemm_config 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.
candle_core::quantized::utils::make_qkx3_quants (cyclomatic 21) candle-core/src/quantized/utils.rs:356— candle_core::quantized::utils::make_qkx3_quants 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.
candle_core::cpu_backend::conv2d::conv2d_tiled (cyclomatic 19) candle-core/src/cpu_backend/conv2d.rs:126— candle_core::cpu_backend::conv2d::conv2d_tiled 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.
candle_core::quantized::repack::try_indexed_gemv (cyclomatic 17) candle-core/src/quantized/repack.rs:989— candle_core::quantized::repack::try_indexed_gemv has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×5
Members sharing a duplicated core (7 members, 50+ identical tokens) candle-metal-kernels/src/kernels/affine.rs:20— candle-metal-kernels/src/kernels/affine.rs:20-35 | candle-metal-kernels/src/kernels/affine.rs:88-103 | candle-metal-kernels/src/kernels/affine.rs:154-169 | candle-metal-kernels/src/kernels/binary.rs:22-39 | candle-metal-kernels/src/kernels/cast.rs:18-33 | candle-metal-kernels/src/kernels/ternary.rs:26-65 | candle-metal-kernels/src/kernels/unary.rs:25-40 — 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.
Members sharing a duplicated core (7 members, 50+ identical tokens) candle-nn/src/rotary_emb.rs:583— candle-nn/src/rotary_emb.rs:583-588 | candle-transformers/src/models/mixtral.rs:74-79 | candle-transformers/src/models/paddleocr_vl/vision.rs:278-283 | candle-transformers/src/models/qwen3_vl/vision.rs:83-88 | candle-transformers/src/models/recurrent_gemma.rs:99-104 | candle-transformers/src/models/starcoder2.rs:44-49 | candle-transformers/src/models/yi.rs:75-80 — 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.
Members sharing a duplicated core (7 members, 50+ identical tokens) candle-transformers/src/models/glm4_new.rs:194— candle-transformers/src/models/glm4_new.rs:194-230 | candle-transformers/src/models/quantized_glm4.rs:211-277 | candle-transformers/src/models/quantized_qwen3.rs:238-378 | candle-transformers/src/models/quantized_qwen3_moe.rs:130-219 | candle-transformers/src/models/qwen3.rs:334-352 | candle-transformers/src/models/smol/smollm3.rs:242-298 | candle-transformers/src/models/z_image/text_encoder.rs:271-318 — 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.
Members sharing a duplicated core (7 members, 50+ identical tokens) candle-transformers/src/models/granite.rs:315— candle-transformers/src/models/granite.rs:315-338 | candle-transformers/src/models/granitemoehybrid.rs:365-389 | candle-transformers/src/models/llama.rs:362-385 | candle-transformers/src/models/llama2_c.rs:231-248 | candle-transformers/src/models/quantized_llama2_c.rs:118-135 | candle-transformers/src/models/voxtral/voxtral_llama.rs:280-309 | candle-wasm-examples/llama2-c/src/model.rs:145-163 — 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.
Members sharing a duplicated core (7 members, 50+ identical tokens) candle-transformers/src/models/mistral.rs:218— candle-transformers/src/models/mistral.rs:218-241 | candle-transformers/src/models/mixtral.rs:152-176 | candle-transformers/src/models/nvembed_v2/embedding.rs:101-123 | candle-transformers/src/models/quantized_mistral.rs:117-140 | candle-transformers/src/models/qwen2.rs:130-153 | candle-transformers/src/models/qwen2_moe.rs:137-160 | candle-transformers/src/models/yi.rs:169-192 — 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· Edited copy of a member (25 corresponding lines) · ×5
Edited copy of a member (25 corresponding lines) candle-transformers/src/models/metavoice.rs:930— candle-transformers/src/models/metavoice.rs:930-954 | candle-transformers/src/models/quantized_metavoice.rs:232-257 — 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) candle-core/src/cuda_backend/mod.rs:219— candle-core/src/cuda_backend/mod.rs:219-243 | candle-core/src/cuda_backend/mod.rs:270-296 — 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) candle-transformers/src/models/pixtral/vision_model.rs:109— candle-transformers/src/models/pixtral/vision_model.rs:109-135 | candle-transformers/src/models/siglip.rs:415-439 — 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) candle-transformers/src/models/whisper/model.rs:151— candle-transformers/src/models/whisper/model.rs:151-175 | candle-transformers/src/models/whisper/quantized_model.rs:148-172 — 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) candle-transformers/src/models/marian.rs:259— candle-transformers/src/models/marian.rs:259-283 | candle-transformers/src/models/voxtral/model.rs:272-304 — 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 copies of one member (3 members, 14+ corresponding lines) · ×5
Edited copies of one member (3 members, 14+ corresponding lines) candle-core/src/cuda_backend/utils.rs:48— candle-core/src/cuda_backend/utils.rs:48-63 | candle-core/src/cuda_backend/utils.rs:124-138 | candle-core/src/cuda_backend/utils.rs:180-193 — 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) candle-transformers/src/models/csm.rs:353— candle-transformers/src/models/csm.rs:353-366 | candle-transformers/src/models/helium.rs:354-367 | candle-transformers/src/models/quantized_mistral.rs:290-312 — 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) candle-transformers/src/models/quantized_gemma3.rs:73— candle-transformers/src/models/quantized_gemma3.rs:73-86 | candle-transformers/src/models/quantized_llama.rs:287-300 | candle-transformers/src/models/quantized_phi.rs:178-191 — 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) candle-core/src/conv.rs:132— candle-core/src/conv.rs:132-145 | candle-core/src/conv.rs:211-228 | candle-core/src/conv.rs:273-286 — 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) candle-flash-attn-v3/src/lib.rs:925— candle-flash-attn-v3/src/lib.rs:925-938 | candle-flash-attn/src/lib.rs:1006-1022 | candle-flash-attn/src/lib.rs:1180-1196 — 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.
Duplicated block (26 lines × 2) candle-core/src/quantized/k_quants.rs:1873— candle-core/src/quantized/k_quants.rs:1873-1898 | candle-core/src/quantized/k_quants.rs:1956-1981 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/k_quants.rs:1873` 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) candle-nn/src/attention/cpu_flash/varlen.rs:232— candle-nn/src/attention/cpu_flash/varlen.rs:232-257 | candle-nn/src/attention/cpu_flash/varlen.rs:324-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. Read the line range as the matched WINDOW rather than a finished unit: at `candle-nn/src/attention/cpu_flash/varlen.rs:232` 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 (26 lines × 2) candle-transformers/src/models/quantized_t5.rs:88— candle-transformers/src/models/quantized_t5.rs:88-113 | candle-transformers/src/models/t5.rs:186-211 — before extracting anything, compare `candle-transformers/src/models/quantized_t5.rs` and `candle-transformers/src/models/t5.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 390 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 (26 lines × 2) candle-transformers/src/models/whisper/model.rs:67— candle-transformers/src/models/whisper/model.rs:67-92 | candle-transformers/src/models/whisper/quantized_model.rs:64-89 — before extracting anything, compare `candle-transformers/src/models/whisper/model.rs` and `candle-transformers/src/models/whisper/quantized_model.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 201 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 (26 lines × 2) candle-transformers/src/models/quantized_rwkv_v5.rs:105— candle-transformers/src/models/quantized_rwkv_v5.rs:105-130 | candle-transformers/src/models/rwkv_v5.rs:156-181 — before extracting anything, compare `candle-transformers/src/models/quantized_rwkv_v5.rs` and `candle-transformers/src/models/rwkv_v5.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 164 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 (22 lines × 2) candle-core/src/quantized/neon.rs:1095— candle-core/src/quantized/neon.rs:1095-1116 | candle-core/src/quantized/neon.rs:1549-1570 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:1095` 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 (22 lines × 2) candle-nn/src/attention/cpu_flash/causal.rs:258— candle-nn/src/attention/cpu_flash/causal.rs:258-279 | candle-nn/src/attention/cpu_flash/causal.rs:663-684 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) candle-transformers/src/models/blip_text.rs:80— candle-transformers/src/models/blip_text.rs:80-101 | candle-transformers/src/models/quantized_blip_text.rs:76-97 — before extracting anything, compare `candle-transformers/src/models/blip_text.rs` and `candle-transformers/src/models/quantized_blip_text.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 222 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 (22 lines × 2) candle-transformers/src/models/gemma4/text.rs:425— candle-transformers/src/models/gemma4/text.rs:425-446 | candle-transformers/src/models/gemma4/vision.rs:328-349 — before extracting anything, compare `candle-transformers/src/models/gemma4/text.rs` and `candle-transformers/src/models/gemma4/vision.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 52 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 `candle-transformers/src/models/gemma4/text.rs:425` 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 (22 lines × 2) candle-core/src/quantized/neon.rs:2323— candle-core/src/quantized/neon.rs:2323-2344 | candle-core/src/quantized/neon.rs:2460-2481 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:2323` 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 × 3) candle-core/src/cpu/avx.rs:316— candle-core/src/cpu/avx.rs:316-332 | candle-core/src/cpu/neon.rs:521-537 | candle-core/src/cpu/simd128.rs:206-222 — before extracting anything, compare `candle-core/src/cpu/avx.rs` and `candle-core/src/cpu/neon.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 113 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 (17 lines × 3) candle-transformers/src/models/chatglm.rs:214— candle-transformers/src/models/chatglm.rs:214-230 | candle-transformers/src/models/codegeex4_9b.rs:235-251 | candle-transformers/src/models/glm4.rs:256-272 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 `candle-transformers/src/models/chatglm.rs:214` 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 × 3) candle-transformers/src/models/chatglm.rs:343— candle-transformers/src/models/chatglm.rs:343-359 | candle-transformers/src/models/codegeex4_9b.rs:364-380 | candle-transformers/src/models/glm4.rs:385-401 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 (17 lines × 3) candle-transformers/src/models/beit.rs:319— candle-transformers/src/models/beit.rs:319-335 | candle-transformers/src/models/dinov2.rs:306-322 | candle-transformers/src/models/eva2.rs:347-363 — before extracting anything, compare `candle-transformers/src/models/beit.rs` and `candle-transformers/src/models/dinov2.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 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 (17 lines × 3) candle-transformers/src/models/granite.rs:406— candle-transformers/src/models/granite.rs:406-422 | candle-transformers/src/models/llama.rs:453-469 | candle-transformers/src/models/voxtral/voxtral_llama.rs:377-393 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/llama.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 309 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `cfg` to `&Config` in one and `&VoxtralLlamaConfig` 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 (15 lines × 3) candle-core/src/cpu/avx.rs:356— candle-core/src/cpu/avx.rs:356-370 | candle-core/src/cpu/neon.rs:561-575 | candle-core/src/cpu/simd128.rs:244-258 — before extracting anything, compare `candle-core/src/cpu/avx.rs` and `candle-core/src/cpu/neon.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 113 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 (15 lines × 3) candle-transformers/src/models/chatglm.rs:164— candle-transformers/src/models/chatglm.rs:164-178 | candle-transformers/src/models/codegeex4_9b.rs:182-196 | candle-transformers/src/models/glm4.rs:203-217 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 `candle-transformers/src/models/chatglm.rs:164` 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 × 3) candle-transformers/src/models/beit.rs:212— candle-transformers/src/models/beit.rs:212-226 | candle-transformers/src/models/dinov2.rs:154-168 | candle-transformers/src/models/dinov2reg4.rs:147-161 — before extracting anything, compare `candle-transformers/src/models/beit.rs` and `candle-transformers/src/models/dinov2.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 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 (15 lines × 3) candle-transformers/src/models/llama2_c.rs:232— candle-transformers/src/models/llama2_c.rs:232-246 | candle-transformers/src/models/quantized_llama2_c.rs:119-133 | candle-wasm-examples/llama2-c/src/model.rs:146-160 — before extracting anything, compare `candle-transformers/src/models/llama2_c.rs` and `candle-transformers/src/models/quantized_llama2_c.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 141 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 `candle-transformers/src/models/llama2_c.rs:232` 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, `candle-wasm-examples/llama2-c/src/model.rs:161` calls `clone` and `candle-transformers/src/models/llama2_c.rs:247` 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 (15 lines × 3) candle-transformers/src/models/quantized_qwen3.rs:252— candle-transformers/src/models/quantized_qwen3.rs:252-266 | candle-transformers/src/models/qwen3.rs:206-220 | candle-transformers/src/models/z_image/text_encoder.rs:285-299 — before extracting anything, compare `candle-transformers/src/models/quantized_qwen3.rs` and `candle-transformers/src/models/qwen3.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 69 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 `candle-transformers/src/models/quantized_qwen3.rs:252` 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 × 3) candle-core/src/cpu/avx.rs:223— candle-core/src/cpu/avx.rs:223-236 | candle-core/src/cpu/neon.rs:432-445 | candle-core/src/cpu/simd128.rs:170-183 — before extracting anything, compare `candle-core/src/cpu/avx.rs` and `candle-core/src/cpu/neon.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 113 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 `candle-core/src/cpu/avx.rs:223` 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 × 3) candle-core/src/quantized/simd128.rs:308— candle-core/src/quantized/simd128.rs:308-321 | candle-core/src/quantized/simd128.rs:326-339 | candle-core/src/quantized/simd128.rs:345-358 — 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 `candle-core/src/quantized/simd128.rs:308` 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 × 3) candle-transformers/src/models/efficientvit.rs:315— candle-transformers/src/models/efficientvit.rs:315-328 | candle-transformers/src/models/fastvit.rs:162-175 | candle-transformers/src/models/mobileone.rs:90-103 — before extracting anything, compare `candle-transformers/src/models/fastvit.rs` and `candle-transformers/src/models/mobileone.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 54 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 (14 lines × 3) candle-transformers/src/models/bert.rs:247— candle-transformers/src/models/bert.rs:247-260 | candle-transformers/src/models/chinese_clip/text_model.rs:255-268 | candle-transformers/src/models/jina_bert.rs:170-183 — before extracting anything, compare `candle-transformers/src/models/bert.rs` and `candle-transformers/src/models/chinese_clip/text_model.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/bert.rs:247` 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 × 3) candle-metal-kernels/src/kernels/reduce.rs:141— candle-metal-kernels/src/kernels/reduce.rs:141-155 | candle-metal-kernels/src/kernels/reduce.rs:197-210 | candle-metal-kernels/src/kernels/reduce.rs:258-271 — 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 `candle-metal-kernels/src/kernels/reduce.rs:141` 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 (13–14 lines × 2) candle-core/src/quantized/mod.rs:575— candle-core/src/quantized/mod.rs:575-588 | candle-core/src/quantized/mod.rs:619-631 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 2) candle-nn/src/attention/cpu_flash/causal.rs:911— candle-nn/src/attention/cpu_flash/causal.rs:911-923 | candle-nn/src/attention/cpu_flash/standard.rs:419-432 — before extracting anything, compare `candle-nn/src/attention/cpu_flash/causal.rs` and `candle-nn/src/attention/cpu_flash/standard.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 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 `candle-nn/src/attention/cpu_flash/causal.rs:911` 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–14 lines × 2) candle-transformers/src/models/clip/text_model.rs:116— candle-transformers/src/models/clip/text_model.rs:116-129 | candle-transformers/src/models/stable_diffusion/clip.rs:198-210 — before extracting anything, compare `candle-transformers/src/models/clip/text_model.rs` and `candle-transformers/src/models/stable_diffusion/clip.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 82 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/clip/text_model.rs:116` 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–14 lines × 2) candle-transformers/src/models/paddleocr_vl/text.rs:861— candle-transformers/src/models/paddleocr_vl/text.rs:861-873 | candle-transformers/src/models/paddleocr_vl/text.rs:953-966 — both copies are in the same file, so extract the 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, `candle-transformers/src/models/paddleocr_vl/text.rs:948` calls `dim`, `narrow`, `insert` and `candle-transformers/src/models/paddleocr_vl/text.rs:858` 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–14 lines × 2) candle-transformers/src/models/quantized_lfm2.rs:158— candle-transformers/src/models/quantized_lfm2.rs:158-170 | candle-transformers/src/models/quantized_qwen2.rs:122-135 — before extracting anything, compare `candle-transformers/src/models/quantized_lfm2.rs` and `candle-transformers/src/models/quantized_qwen2.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 85 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 `candle-transformers/src/models/quantized_lfm2.rs:158` 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 × 4) candle-core/src/quantized/k_quants.rs:1582— candle-core/src/quantized/k_quants.rs:1582-1590 | candle-core/src/quantized/k_quants.rs:1649-1657 | candle-core/src/quantized/k_quants.rs:1847-1855 | candle-core/src/quantized/k_quants.rs:1930-1938 — 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 `candle-core/src/quantized/k_quants.rs:1582` 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 × 4) candle-nn/src/attention/cpu_flash/causal.rs:258— candle-nn/src/attention/cpu_flash/causal.rs:258-266 | candle-nn/src/attention/cpu_flash/causal.rs:349-357 | candle-nn/src/attention/cpu_flash/causal.rs:663-671 | candle-nn/src/attention/cpu_flash/causal.rs:765-773 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-nn/src/attention/cpu_flash/causal.rs:762` calls `min` and `candle-nn/src/attention/cpu_flash/causal.rs:346` 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 × 4) candle-nn/src/ops.rs:798— candle-nn/src/ops.rs:798-806 | candle-nn/src/rotary_emb.rs:122-130 | candle-nn/src/rotary_emb.rs:427-435 | candle-nn/src/rotary_emb.rs:701-709 — 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 `candle-nn/src/ops.rs:798` 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 × 4) candle-transformers/src/models/granite.rs:323— candle-transformers/src/models/granite.rs:323-331 | candle-transformers/src/models/granitemoehybrid.rs:373-381 | candle-transformers/src/models/llama.rs:370-378 | candle-transformers/src/models/voxtral/voxtral_llama.rs:294-302 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 `candle-transformers/src/models/granite.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. Note first that the copies are not typed on the same thing: the declarations holding them bind `cfg` to `&Config` in one and `&GraniteMoeHybridInternalConfig` 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 (9 lines × 4) candle-core/src/quantized/k_quants.rs:968— candle-core/src/quantized/k_quants.rs:968-976 | candle-core/src/quantized/k_quants.rs:1290-1298 | candle-core/src/quantized/k_quants.rs:1631-1639 | candle-core/src/quantized/k_quants.rs:1912-1920 — 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 `candle-core/src/quantized/k_quants.rs:968` 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 × 5) candle-core/src/cuda_backend/mod.rs:153— candle-core/src/cuda_backend/mod.rs:153-157 | candle-core/src/cuda_backend/mod.rs:184-188 | candle-core/src/cuda_backend/mod.rs:315-319 | candle-core/src/cuda_backend/mod.rs:496-500 | candle-core/src/cuda_backend/mod.rs:1129-1133 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `candle-core/src/cuda_backend/mod.rs:189` calls `from_f64` and `candle-core/src/cuda_backend/mod.rs:158` 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 × 5) candle-nn/src/ops.rs:588— candle-nn/src/ops.rs:588-592 | candle-nn/src/ops.rs:832-836 | candle-nn/src/rotary_emb.rs:152-156 | candle-nn/src/rotary_emb.rs:457-461 | candle-nn/src/rotary_emb.rs:731-735 — there are 5 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 5 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `candle-nn/src/ops.rs:837` calls `arg` and `candle-nn/src/ops.rs:593` 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 (5 lines × 5) candle-transformers/src/models/granite.rs:154— candle-transformers/src/models/granite.rs:154-158 | candle-transformers/src/models/granitemoehybrid.rs:197-201 | candle-transformers/src/models/lfm2.rs:167-171 | candle-transformers/src/models/llama.rs:198-202 | candle-transformers/src/models/voxtral/voxtral_llama.rs:93-97 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 (5 lines × 5) candle-transformers/src/models/granite.rs:290— candle-transformers/src/models/granite.rs:290-294 | candle-transformers/src/models/granitemoehybrid.rs:338-342 | candle-transformers/src/models/lfm2.rs:383-387 | candle-transformers/src/models/llama.rs:336-340 | candle-transformers/src/models/voxtral/voxtral_llama.rs:250-254 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 `candle-transformers/src/models/granite.rs:290` 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 × 5) candle-transformers/src/models/quantized_lfm2.rs:91— candle-transformers/src/models/quantized_lfm2.rs:91-95 | candle-transformers/src/models/quantized_llama.rs:171-175 | candle-transformers/src/models/quantized_phi.rs:87-91 | candle-transformers/src/models/quantized_phi3.rs:92-96 | candle-transformers/src/models/quantized_qwen2.rs:64-68 — before extracting anything, compare `candle-transformers/src/models/quantized_lfm2.rs` and `candle-transformers/src/models/quantized_llama.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 56 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.
X15 · Unvalidated length from an untrusted reader· Length read from the parsed input is spent without ever being bounded · ×5
Length read from the parsed input is spent without ever being bounded candle-core/src/pickle.rs:484— `len` is read from the bytes being parsed at line 483 (`read_u32`), then used to size a `vec![…; n]` at line 484 — and nowhere in its scope is `len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: it reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB, and an allocation the allocator refuses aborts the process with `memory allocation of … bytes failed` — an abort, not a panic, so no `catch_unwind` intercepts it and the whole process dies; a 64-bit length past `isize::MAX` panics with `capacity overflow` instead, out of a parser whose failure path was written for malformed input, not for hostile input. Bound `len` against the bytes actually remaining and a maximum the format allows before allocating.
Length read from the parsed input is spent without ever being bounded candle-core/src/quantized/ggml_file.rs:111— `len` is read from the bytes being parsed at line 110 (`read_u32`), then used to size a `vec![…; n]` at line 111 — and nowhere in its scope is `len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: it reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB, and an allocation the allocator refuses aborts the process with `memory allocation of … bytes failed` — an abort, not a panic, so no `catch_unwind` intercepts it and the whole process dies; a 64-bit length past `isize::MAX` panics with `capacity overflow` instead, out of a parser whose failure path was written for malformed input, not for hostile input. Bound `len` against the bytes actually remaining and a maximum the format allows before allocating.
Length read from the parsed input is spent without ever being bounded candle-core/src/quantized/ggml_file.rs:200— `n_dims` is read from the bytes being parsed at line 196 (`read_u32`), then used to size a `vec![…; n]` at line 200 — and nowhere in its scope is `n_dims` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: it reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB, and an allocation the allocator refuses aborts the process with `memory allocation of … bytes failed` — an abort, not a panic, so no `catch_unwind` intercepts it and the whole process dies; a 64-bit length past `isize::MAX` panics with `capacity overflow` instead, out of a parser whose failure path was written for malformed input, not for hostile input. Bound `n_dims` against the bytes actually remaining and a maximum the format allows before allocating.
Length read from the parsed input is spent without ever being bounded candle-core/src/quantized/ggml_file.rs:205— `name_len` is read from the bytes being parsed at line 197 (`read_u32`), then used to size a `vec![…; n]` at line 205 — and nowhere in its scope is `name_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: it reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB, and an allocation the allocator refuses aborts the process with `memory allocation of … bytes failed` — an abort, not a panic, so no `catch_unwind` intercepts it and the whole process dies; a 64-bit length past `isize::MAX` panics with `capacity overflow` instead, out of a parser whose failure path was written for malformed input, not for hostile input. Bound `name_len` against the bytes actually remaining and a maximum the format allows before allocating.
Length read from the parsed input is spent without ever being bounded candle-core/src/quantized/imatrix_file.rs:51— `len` is read from the bytes being parsed at line 42 (`read_i32`), then used to size a `vec![…; n]` at line 51 — and nowhere in its scope is `len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: it reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB, and an allocation the allocator refuses aborts the process with `memory allocation of … bytes failed` — an abort, not a panic, so no `catch_unwind` intercepts it and the whole process dies; a 64-bit length past `isize::MAX` panics with `capacity overflow` instead, out of a parser whose failure path was written for malformed input, not for hostile input. Bound `len` against the bytes actually remaining and a maximum the format allows before allocating.
XxxComment candle-onnx/src/eval.rs:1871— // XXX: depends on layout — 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 candle-onnx/src/eval.rs:2081— // XXX: depends on layout — 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 candle-core/src/safetensors.rs:125— // XXX: We need to specify `T` here, otherwise the compiler will infer u8 because of the following cast — 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 candle-core/src/safetensors.rs:156— // XXX: We need to specify `T` here, otherwise the compiler will infer u8 because of the following cast — 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.
BlockQ3K::from_float (cognitive 45) candle-core/src/quantized/k_quants.rs:1197— BlockQ3K::from_float has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 9 (21 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.
BlockQ3K::vec_dot_unopt (cognitive 42) candle-core/src/quantized/k_quants.rs:1075— BlockQ3K::vec_dot_unopt has cognitive complexity 42 (threshold 15). Drivers by points: loops 9 (26 pts), if/else 8 (16 pts) (nesting depth added 25). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
BlockQ3K::from_float_imatrix (cognitive 38) candle-core/src/quantized/k_quants.rs:1279— BlockQ3K::from_float_imatrix has cognitive complexity 38 (threshold 15). Drivers by points: loops 9 (21 pts), if/else 7 (17 pts) (nesting depth added 22). 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.
BlockQ3K::to_float (cognitive 22) candle-core/src/quantized/k_quants.rs:1378— BlockQ3K::to_float has cognitive complexity 22 (threshold 15). Drivers by points: loops 5 (15 pts), if/else 2 (7 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.
BlockQ5K::vec_dot_unopt (cognitive 36) candle-core/src/quantized/k_quants.rs:1734— BlockQ5K::vec_dot_unopt has cognitive complexity 36 (threshold 15). Drivers by points: loops 10 (26 pts), if/else 4 (10 pts) (nesting depth added 22). 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.
BlockQ5K::from_float (cognitive 36) candle-core/src/quantized/k_quants.rs:1824— BlockQ5K::from_float has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 7 (15 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.
BlockQ5K::from_float_imatrix (cognitive 34) candle-core/src/quantized/k_quants.rs:1900— BlockQ5K::from_float_imatrix has cognitive complexity 34 (threshold 15). Drivers by points: loops 8 (19 pts), if/else 5 (15 pts) (nesting depth added 21). 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.
BlockQ5K::to_float (cognitive 19) candle-core/src/quantized/k_quants.rs:1984— BlockQ5K::to_float has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 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.
TooManyMethods: Tensor candle-core/src/tensor.rs:70— TooManyMethods — 212 methods, declared across 12 files: src/tensor.rs (164), src/custom_op.rs (13), src/conv.rs (9), src/npy.rs (7), +8 more file(s). The bar is 30 methods; this is 182 over it, 7.07× 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: PyTensor candle-pyo3/src/lib.rs:34— TooManyMethods — 65 methods. The bar is 30 methods; this is 35 over it, 2.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.
TooManyMethods: Storage candle-core/src/storage.rs:12— 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: Module candle-pyo3/py_src/candle/nn/module.py:31— TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.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.
D4 · Code Duplication· Edited copy of a member (26 corresponding lines) · ×4
Edited copy of a member (26 corresponding lines) candle-transformers/src/models/gemma2.rs:298— candle-transformers/src/models/gemma2.rs:298-326 | candle-transformers/src/models/gemma3.rs:325-366 — These two members are one piece of code written twice and then edited apart: 26 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 (26 corresponding lines) candle-transformers/src/models/mmdit/blocks.rs:60— candle-transformers/src/models/mmdit/blocks.rs:60-85 | candle-transformers/src/models/mmdit/blocks.rs:151-194 — These two members are one piece of code written twice and then edited apart: 26 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 (26 corresponding lines) candle-transformers/src/models/convnext.rs:263— candle-transformers/src/models/convnext.rs:263-288 | candle-transformers/src/models/efficientvit.rs:400-435 — These two members are one piece of code written twice and then edited apart: 26 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 (26 corresponding lines) candle-wasm-examples/llama2-c/src/bin/m.rs:75— candle-wasm-examples/llama2-c/src/bin/m.rs:75-103 | candle-wasm-examples/phi/src/bin/m.rs:91-116 — These two members are one piece of code written twice and then edited apart: 26 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, 11+ corresponding lines) · ×4
Edited copies of one member (3 members, 11+ corresponding lines) candle-transformers/src/models/lfm2.rs:642— candle-transformers/src/models/lfm2.rs:642-654 | candle-transformers/src/models/llama.rs:491-501 | candle-transformers/src/models/voxtral/voxtral_llama.rs:415-431 — 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) candle-transformers/src/models/metavoice.rs:567— candle-transformers/src/models/metavoice.rs:567-579 | candle-transformers/src/models/mixformer.rs:353-363 | candle-transformers/src/models/quantized_mixformer.rs:268-278 — 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) candle-transformers/src/models/deepseek2.rs:956— candle-transformers/src/models/deepseek2.rs:956-966 | candle-transformers/src/models/paddleocr_vl/text.rs:1030-1042 | candle-transformers/src/models/qwen3_vl/text.rs:237-249 — 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) candle-nn/src/kv_cache.rs:263— candle-nn/src/kv_cache.rs:263-273 | candle-nn/src/kv_cache.rs:617-631 | candle-transformers/src/models/parler_tts.rs:459-472 — 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, 12+ corresponding lines) · ×4
Edited copies of one member (3 members, 12+ corresponding lines) candle-transformers/src/models/gemma2.rs:333— candle-transformers/src/models/gemma2.rs:333-344 | candle-transformers/src/models/gemma3.rs:373-384 | candle-transformers/src/models/gemma4/text.rs:457-470 — 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.
Edited copies of one member (3 members, 12+ corresponding lines) candle-transformers/src/models/gemma.rs:127— candle-transformers/src/models/gemma.rs:127-139 | candle-transformers/src/models/pixtral/vision_model.rs:147-158 | candle-transformers/src/models/qwen3_vl/text.rs:73-85 — 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.
Edited copies of one member (3 members, 12+ corresponding lines) candle-transformers/src/models/moondream.rs:165— candle-transformers/src/models/moondream.rs:165-177 | candle-transformers/src/models/nomic_bert.rs:312-325 | candle-transformers/src/models/quantized_moondream.rs:96-107 — 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.
Edited copies of one member (3 members, 12+ corresponding lines) candle-wasm-examples/bert/src/bin/m.rs:17— candle-wasm-examples/bert/src/bin/m.rs:17-28 | candle-wasm-examples/t5/src/bin/m.rs:28-43 | candle-wasm-examples/t5/src/bin/m.rs:126-137 — 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, 10+ corresponding lines) · ×4
Edited copies of one member (3 members, 10+ corresponding lines) candle-transformers/src/models/fastvit.rs:180— candle-transformers/src/models/fastvit.rs:180-189 | candle-transformers/src/models/mobileone.rs:108-117 | candle-transformers/src/models/repvgg.rs:124-133 — 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) candle-transformers/src/models/clip/text_model.rs:290— candle-transformers/src/models/clip/text_model.rs:290-299 | candle-transformers/src/models/clip/vision_model.rs:134-145 | candle-transformers/src/models/stable_diffusion/clip.rs:289-300 — 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) candle-transformers/src/models/encodec.rs:770— candle-transformers/src/models/encodec.rs:770-779 | candle-transformers/src/models/flux/autoencoder.rs:413-424 | candle-transformers/src/models/z_image/vae.rs:639-651 — 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) candle-transformers/src/models/smol/quantized_smollm3.rs:244— candle-transformers/src/models/smol/quantized_smollm3.rs:244-253 | candle-transformers/src/models/z_image/text_encoder.rs:187-196 | candle-transformers/src/utils.rs:91-101 — 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, 4+ corresponding lines) · ×4
Edited copies of one member (3 members, 4+ corresponding lines) candle-transformers/src/models/llama2_c.rs:274— candle-transformers/src/models/llama2_c.rs:274-277 | candle-transformers/src/models/quantized_llama2_c.rs:161-164 | candle-wasm-examples/llama2-c/src/model.rs:188-191 — 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.
Edited copies of one member (3 members, 4+ corresponding lines) candle-transformers/src/models/pixtral/vision_model.rs:162— candle-transformers/src/models/pixtral/vision_model.rs:162-165 | candle-transformers/src/models/quantized_recurrent_gemma.rs:55-58 | candle-transformers/src/models/recurrent_gemma.rs:172-175 — 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.
Edited copies of one member (3 members, 4+ corresponding lines) candle-transformers/src/models/chinese_clip/vision_model.rs:242— candle-transformers/src/models/chinese_clip/vision_model.rs:242-245 | candle-transformers/src/models/clip/text_model.rs:200-203 | candle-transformers/src/models/stable_diffusion/clip.rs:274-277 — 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.
Edited copies of one member (3 members, 4+ corresponding lines) candle-transformers/src/models/blip_text.rs:342— candle-transformers/src/models/blip_text.rs:342-345 | candle-transformers/src/models/quantized_blip_text.rs:338-341 | candle-transformers/src/models/vit.rs:252-255 — 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 (24 lines × 2) candle-core/src/quantized/cuda.rs:140— candle-core/src/quantized/cuda.rs:140-163 | candle-core/src/quantized/cuda.rs:200-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 `candle-core/src/quantized/cuda.rs:140` 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 (24 lines × 2) candle-core/src/quantized/k_quants.rs:932— candle-core/src/quantized/k_quants.rs:932-955 | candle-core/src/quantized/k_quants.rs:991-1014 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/k_quants.rs:932` 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 (24 lines × 2) candle-transformers/src/models/codegeex4_9b.rs:224— candle-transformers/src/models/codegeex4_9b.rs:224-247 | candle-transformers/src/models/glm4.rs:245-268 — before extracting anything, compare `candle-transformers/src/models/codegeex4_9b.rs` and `candle-transformers/src/models/glm4.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 459 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 `candle-transformers/src/models/codegeex4_9b.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.
Duplicated block (24 lines × 2) candle-transformers/src/models/gemma2.rs:301— candle-transformers/src/models/gemma2.rs:301-324 | candle-transformers/src/models/gemma3.rs:340-363 — before extracting anything, compare `candle-transformers/src/models/gemma2.rs` and `candle-transformers/src/models/gemma3.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 235 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 `candle-transformers/src/models/gemma2.rs:301` 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 (19–20 lines × 2) candle-core/src/quantized/k_quants.rs:345— candle-core/src/quantized/k_quants.rs:345-364 | candle-core/src/quantized/k_quants.rs:556-574 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/k_quants.rs:345` 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 (19–20 lines × 2) candle-flash-attn-v3/src/lib.rs:614— candle-flash-attn-v3/src/lib.rs:614-632 | candle-flash-attn/src/lib.rs:710-729 — before extracting anything, compare `candle-flash-attn-v3/src/lib.rs` and `candle-flash-attn/src/lib.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 174 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-flash-attn-v3/src/lib.rs:614` 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 (19–20 lines × 2) candle-core/src/cuda_backend/mod.rs:867— candle-core/src/cuda_backend/mod.rs:867-885 | candle-core/src/cuda_backend/mod.rs:915-934 — both copies are in the same file, so extract the 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 `candle-core/src/cuda_backend/mod.rs:867` 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 (19–20 lines × 2) candle-core/src/quantized/neon.rs:1673— candle-core/src/quantized/neon.rs:1673-1691 | candle-core/src/quantized/neon.rs:1775-1794 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:1673` 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–15 lines × 2) candle-core/src/quantized/neon.rs:159— candle-core/src/quantized/neon.rs:159-172 | candle-core/src/quantized/neon.rs:191-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 `candle-core/src/quantized/neon.rs:159` 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 (14–15 lines × 2) candle-core/src/sort.rs:25— candle-core/src/sort.rs:25-38 | candle-core/src/sort.rs:40-54 — both copies are in the same file, so extract the 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 `candle-core/src/sort.rs:40` 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 (14–15 lines × 2) candle-transformers/src/models/chinese_clip/vision_model.rs:186— candle-transformers/src/models/chinese_clip/vision_model.rs:186-200 | candle-transformers/src/models/clip/text_model.rs:153-166 — before extracting anything, compare `candle-transformers/src/models/chinese_clip/vision_model.rs` and `candle-transformers/src/models/clip/text_model.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/chinese_clip/vision_model.rs:186` 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–15 lines × 2) candle-transformers/src/models/quantized_t5.rs:736— candle-transformers/src/models/quantized_t5.rs:736-749 | candle-transformers/src/models/t5.rs:889-903 — before extracting anything, compare `candle-transformers/src/models/quantized_t5.rs` and `candle-transformers/src/models/t5.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 390 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 `candle-transformers/src/models/quantized_t5.rs:736` 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 × 4) candle-nn/src/attention/cpu_flash/causal.rs:274— candle-nn/src/attention/cpu_flash/causal.rs:274-286 | candle-nn/src/attention/cpu_flash/causal.rs:360-372 | candle-nn/src/attention/cpu_flash/causal.rs:679-691 | candle-nn/src/attention/cpu_flash/causal.rs:776-788 — 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 `candle-nn/src/attention/cpu_flash/causal.rs:274` 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 × 4) candle-transformers/src/models/based.rs:550— candle-transformers/src/models/based.rs:550-562 | candle-transformers/src/models/mistral.rs:403-415 | candle-transformers/src/models/quantized_mistral.rs:292-304 | candle-transformers/src/models/starcoder2.rs:307-319 — before extracting anything, compare `candle-transformers/src/models/based.rs` and `candle-transformers/src/models/mistral.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 56 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 `candle-transformers/src/models/based.rs:550` 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 × 4) candle-transformers/src/models/beit.rs:266— candle-transformers/src/models/beit.rs:266-278 | candle-transformers/src/models/dinov2.rs:217-229 | candle-transformers/src/models/dinov2reg4.rs:210-222 | candle-transformers/src/models/eva2.rs:250-262 — before extracting anything, compare `candle-transformers/src/models/beit.rs` and `candle-transformers/src/models/dinov2.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 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 (13 lines × 4) candle-transformers/src/models/quantized_gemma3.rs:210— candle-transformers/src/models/quantized_gemma3.rs:210-222 | candle-transformers/src/models/quantized_lfm2.rs:151-163 | candle-transformers/src/models/quantized_llama.rs:220-232 | candle-transformers/src/models/quantized_qwen2.rs:115-127 — before extracting anything, compare `candle-transformers/src/models/quantized_gemma3.rs` and `candle-transformers/src/models/quantized_llama.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 74 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 (12–13 lines × 2) candle-core/src/quantized/cuda.rs:416— candle-core/src/quantized/cuda.rs:416-428 | candle-core/src/quantized/cuda.rs:485-496 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `candle-core/src/quantized/cuda.rs:416` 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 (12–13 lines × 2) candle-nn/src/moe.rs:66— candle-nn/src/moe.rs:66-78 | candle-nn/src/moe.rs:238-249 — both copies are in the same file, so extract the 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 `candle-nn/src/moe.rs:66` 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–13 lines × 2) candle-transformers/src/models/nvembed_v2/embedding.rs:157— candle-transformers/src/models/nvembed_v2/embedding.rs:157-169 | candle-transformers/src/models/starcoder2.rs:197-208 — before extracting anything, compare `candle-transformers/src/models/nvembed_v2/embedding.rs` and `candle-transformers/src/models/starcoder2.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12–13 lines × 2) candle-transformers/src/models/quantized_qwen3.rs:114— candle-transformers/src/models/quantized_qwen3.rs:114-125 | candle-transformers/src/models/smol/quantized_smollm3.rs:188-200 — before extracting anything, compare `candle-transformers/src/models/quantized_qwen3.rs` and `candle-transformers/src/models/smol/quantized_smollm3.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/quantized_qwen3.rs:114` 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–11 lines × 3) candle-core/src/quantized/k_quants.rs:723— candle-core/src/quantized/k_quants.rs:723-733 | candle-core/src/quantized/k_quants.rs:753-763 | candle-core/src/quantized/k_quants.rs:2343-2352 — 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 `candle-core/src/quantized/k_quants.rs:723` 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–11 lines × 3) candle-core/src/tensor.rs:2610— candle-core/src/tensor.rs:2610-2619 | candle-core/src/tensor.rs:2648-2658 | candle-core/src/tensor.rs:3002-3012 — 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 `candle-core/src/tensor.rs:2648` 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 after the matched lines, `candle-core/src/tensor.rs:2619` calls `Ok`, `Tensor`, `clone` and `candle-core/src/tensor.rs:3012` 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–11 lines × 3) candle-nn/src/var_builder.rs:380— candle-nn/src/var_builder.rs:380-390 | candle-nn/src/var_builder.rs:428-437 | candle-nn/src/var_builder.rs:473-482 — 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 `candle-nn/src/var_builder.rs:380` 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–11 lines × 3) candle-transformers/src/models/gemma4/text.rs:422— candle-transformers/src/models/gemma4/text.rs:422-432 | candle-transformers/src/models/gemma4/vision.rs:326-335 | candle-transformers/src/models/glm4_new.rs:252-261 — before extracting anything, compare `candle-transformers/src/models/gemma4/text.rs` and `candle-transformers/src/models/gemma4/vision.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 52 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 `candle-transformers/src/models/gemma4/text.rs:422` 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 `cfg` to `&Gemma4VisionConfig` in one and `&Config` 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–11 lines × 2) candle-core/src/cuda_backend/mod.rs:1862— candle-core/src/cuda_backend/mod.rs:1862-1871 | candle-core/src/cuda_backend/mod.rs:2045-2055 — both copies are in the same file, so extract the 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 `candle-core/src/cuda_backend/mod.rs:1862` 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 (10–11 lines × 2) candle-core/src/quantized/k_quants.rs:1477— candle-core/src/quantized/k_quants.rs:1477-1487 | candle-core/src/quantized/simd128.rs:180-189 — before extracting anything, compare `candle-core/src/quantized/k_quants.rs` and `candle-core/src/quantized/simd128.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10–11 lines × 2) candle-transformers/src/models/mobileone.rs:203— candle-transformers/src/models/mobileone.rs:203-212 | candle-transformers/src/models/repvgg.rs:201-211 — before extracting anything, compare `candle-transformers/src/models/mobileone.rs` and `candle-transformers/src/models/repvgg.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/mobileone.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 (10–11 lines × 2) candle-transformers/src/models/paddleocr_vl/text.rs:294— candle-transformers/src/models/paddleocr_vl/text.rs:294-303 | candle-transformers/src/models/paddleocr_vl/text.rs:429-439 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/paddleocr_vl/text.rs:294` 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 × 5) candle-transformers/src/models/mistral.rs:382— candle-transformers/src/models/mistral.rs:382-390 | candle-transformers/src/models/mixtral.rs:423-431 | candle-transformers/src/models/quantized_mistral.rs:272-280 | candle-transformers/src/models/qwen2_moe.rs:418-426 | candle-transformers/src/models/yi.rs:313-321 — before extracting anything, compare `candle-transformers/src/models/mistral.rs` and `candle-transformers/src/models/mixtral.rs` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 175 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 `candle-transformers/src/models/mistral.rs:382` 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, `candle-transformers/src/models/mistral.rs:393` calls `dtype` and `candle-transformers/src/models/quantized_mistral.rs:283` 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 (9 lines × 5) candle-transformers/src/models/quantized_lfm2.rs:590— candle-transformers/src/models/quantized_lfm2.rs:590-598 | candle-transformers/src/models/quantized_llama.rs:548-556 | candle-transformers/src/models/quantized_phi.rs:273-281 | candle-transformers/src/models/quantized_phi3.rs:305-313 | candle-transformers/src/models/quantized_qwen2.rs:297-305 — before extracting anything, compare `candle-transformers/src/models/quantized_lfm2.rs` and `candle-transformers/src/models/quantized_llama.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 56 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 (9 lines × 5) candle-transformers/src/models/quantized_lfm2.rs:168— candle-transformers/src/models/quantized_lfm2.rs:168-176 | candle-transformers/src/models/quantized_llama.rs:250-258 | candle-transformers/src/models/quantized_phi.rs:146-154 | candle-transformers/src/models/quantized_phi3.rs:157-165 | candle-transformers/src/models/quantized_qwen2.rs:133-141 — before extracting anything, compare `candle-transformers/src/models/quantized_lfm2.rs` and `candle-transformers/src/models/quantized_llama.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 5) candle-transformers/src/models/mixtral.rs:108— candle-transformers/src/models/mixtral.rs:108-116 | candle-transformers/src/models/recurrent_gemma.rs:136-144 | candle-transformers/src/models/stable_lm.rs:118-126 | candle-transformers/src/models/starcoder2.rs:78-86 | candle-transformers/src/models/yi.rs:109-117 — before extracting anything, compare `candle-transformers/src/models/mixtral.rs` and `candle-transformers/src/models/recurrent_gemma.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 53 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.
Tensor::backward (cyclomatic 88) candle-core/src/backprop.rs:165— Tensor::backward has cyclomatic complexity 88 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Tensor::write_bytes (cyclomatic 20) candle-core/src/convert.rs:102— Tensor::write_bytes has cyclomatic complexity 20 (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.
Tensor::fmt (cyclomatic 20) candle-core/src/display.rs:454— Tensor::fmt 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.
candle_metal_kernels::kernels::mlx_gemm::call_mlx_gemv (cyclomatic 41) candle-metal-kernels/src/kernels/mlx_gemm.rs:261— candle_metal_kernels::kernels::mlx_gemm::call_mlx_gemv has cyclomatic complexity 41 (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.
candle_metal_kernels::kernels::mlx_gemm::call_mlx_gemm (cyclomatic 28) candle-metal-kernels/src/kernels/mlx_gemm.rs:453— candle_metal_kernels::kernels::mlx_gemm::call_mlx_gemm has cyclomatic complexity 28 (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.
candle_metal_kernels::kernels::mlx_gemm::select_tile_config (cyclomatic 27) candle-metal-kernels/src/kernels/mlx_gemm.rs:59— candle_metal_kernels::kernels::mlx_gemm::select_tile_config 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.
candle_metal_kernels::kernels::mlx_gemm::call_mlx_gemv (cognitive 68) candle-metal-kernels/src/kernels/mlx_gemm.rs:261— candle_metal_kernels::kernels::mlx_gemm::call_mlx_gemv has cognitive complexity 68 (threshold 15). Drivers by points: if/else 45 (54 pts), boolean chains 13, match/switch 1 (nesting depth added 9). 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.
candle_metal_kernels::kernels::mlx_gemm::select_tile_config (cognitive 62) candle-metal-kernels/src/kernels/mlx_gemm.rs:59— candle_metal_kernels::kernels::mlx_gemm::select_tile_config has cognitive complexity 62 (threshold 15). Drivers by points: if/else 27 (52 pts), boolean chains 7, match/switch 2 (3 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.
candle_metal_kernels::kernels::mlx_gemm::call_mlx_gemm (cognitive 32) candle-metal-kernels/src/kernels/mlx_gemm.rs:453— candle_metal_kernels::kernels::mlx_gemm::call_mlx_gemm has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 13, match/switch 2 (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.
candle_transformers::models::paddleocr_vl::text::compute_mrope_position_ids_multi (cognitive 45) candle-transformers/src/models/paddleocr_vl/text.rs:288— candle_transformers::models::paddleocr_vl::text::compute_mrope_position_ids_multi has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (33 pts), loops 4 (9 pts), boolean chains 3 (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.
candle_transformers::models::paddleocr_vl::text::compute_mrope_position_ids_video (cognitive 38) candle-transformers/src/models/paddleocr_vl/text.rs:541— candle_transformers::models::paddleocr_vl::text::compute_mrope_position_ids_video has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 4 (10 pts), boolean chains 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
candle_transformers::models::whisper::audio::log_mel_spectrogram_w (cognitive 24) candle-transformers/src/models/whisper/audio.rs:90— candle_transformers::models::whisper::audio::log_mel_spectrogram_w has cognitive complexity 24 (threshold 15). Drivers by points: loops 8 (18 pts), if/else 4 (6 pts) (nesting depth added 12). 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.
BlockQ2K::from_float (cognitive 31) candle-core/src/quantized/k_quants.rs:893— BlockQ2K::from_float has cognitive complexity 31 (threshold 15). Drivers by points: loops 9 (22 pts), if/else 5 (9 pts) (nesting depth added 17). 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.
BlockQ2K::from_float_imatrix (cognitive 21) candle-core/src/quantized/k_quants.rs:957— BlockQ2K::from_float_imatrix has cognitive complexity 21 (threshold 15). Drivers by points: loops 8 (18 pts), if/else 1 (3 pts) (nesting depth added 12). 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.
BlockQ2K::vec_dot_unopt (cognitive 16) candle-core/src/quantized/k_quants.rs:840— BlockQ2K::vec_dot_unopt has cognitive complexity 16 (threshold 15). Drivers by points: loops 6 (16 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
BlockQ4K::from_float (cognitive 29) candle-core/src/quantized/k_quants.rs:1558— BlockQ4K::from_float has cognitive complexity 29 (threshold 15). Drivers by points: loops 7 (16 pts), if/else 7 (13 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.
BlockQ4K::vec_dot_unopt (cognitive 26) candle-core/src/quantized/k_quants.rs:1476— BlockQ4K::vec_dot_unopt has cognitive complexity 26 (threshold 15). Drivers by points: loops 10 (26 pts) (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.
BlockQ4K::from_float_imatrix (cognitive 26) candle-core/src/quantized/k_quants.rs:1619— BlockQ4K::from_float_imatrix has cognitive complexity 26 (threshold 15). Drivers by points: loops 8 (19 pts), if/else 3 (7 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.
BlockQ6K::vec_dot_unopt (cognitive 22) candle-core/src/quantized/k_quants.rs:2072— BlockQ6K::vec_dot_unopt has cognitive complexity 22 (threshold 15). Drivers by points: loops 9 (22 pts) (nesting depth added 13). 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.
BlockQ6K::from_float (cognitive 21) candle-core/src/quantized/k_quants.rs:2131— BlockQ6K::from_float has cognitive complexity 21 (threshold 15). Drivers by points: loops 7 (15 pts), if/else 2 (6 pts) (nesting depth added 12). 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. This shape REPEATS in the file: one other method here (BlockQ6K::from_float_imatrix) 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.
BlockQ6K::from_float_imatrix (cognitive 21) candle-core/src/quantized/k_quants.rs:2203— BlockQ6K::from_float_imatrix has cognitive complexity 21 (threshold 15). Drivers by points: loops 7 (15 pts), if/else 2 (6 pts) (nesting depth added 12). 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. This shape REPEATS in the file: one other method here (BlockQ6K::from_float) 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.
PaddleOCRVLModel::forward_multi_image_separate (cognitive 19) candle-transformers/src/models/paddleocr_vl/mod.rs:392— PaddleOCRVLModel::forward_multi_image_separate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (8 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.
PaddleOCRVLModel::forward_multi_image (cognitive 18) candle-transformers/src/models/paddleocr_vl/mod.rs:275— PaddleOCRVLModel::forward_multi_image has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 4 (7 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.
PaddleOCRVLModel::forward_video (cognitive 17) candle-transformers/src/models/paddleocr_vl/mod.rs:700— PaddleOCRVLModel::forward_video has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (6 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.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×3
Edited copy of a member (27 corresponding lines) candle-transformers/src/models/quantized_qwen3.rs:238— candle-transformers/src/models/quantized_qwen3.rs:238-378 | candle-transformers/src/models/qwen3.rs:192-241 — 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) candle-transformers/src/models/chinese_clip/mod.rs:134— candle-transformers/src/models/chinese_clip/mod.rs:134-164 | candle-transformers/src/models/clip/mod.rs:96-122 — 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) candle-metal-kernels/src/kernels/sort.rs:18— candle-metal-kernels/src/kernels/sort.rs:18-44 | candle-metal-kernels/src/kernels/sort.rs:250-287 — 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 (36 corresponding lines) · ×3
Edited copy of a member (36 corresponding lines) candle-core/src/cpu_backend/mod.rs:2724— candle-core/src/cpu_backend/mod.rs:2724-2774 | candle-core/src/cpu_backend/mod.rs:2776-2811 — 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) candle-core/src/cpu_backend/mod.rs:395— candle-core/src/cpu_backend/mod.rs:395-430 | candle-core/src/cpu_backend/mod.rs:436-472 — 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) candle-transformers/src/models/quantized_glm4.rs:174— candle-transformers/src/models/quantized_glm4.rs:174-209 | candle-transformers/src/models/quantized_qwen3.rs:185-236 — 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 (54 corresponding lines) · ×3
Edited copy of a member (54 corresponding lines) candle-core/src/quantized/cuda.rs:110— candle-core/src/quantized/cuda.rs:110-163 | candle-core/src/quantized/cuda.rs:170-223 — These two members are one piece of code written twice and then edited apart: 54 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 (54 corresponding lines) candle-transformers/src/models/llama2_c_weights.rs:112— candle-transformers/src/models/llama2_c_weights.rs:112-172 | candle-wasm-examples/llama2-c/src/worker.rs:193-246 — These two members are one piece of code written twice and then edited apart: 54 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 (54 corresponding lines) candle-core/src/cuda_backend/device.rs:425— candle-core/src/cuda_backend/device.rs:425-478 | candle-core/src/cuda_backend/device.rs:579-632 — These two members are one piece of code written twice and then edited apart: 54 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 (38 corresponding lines) · ×3
Edited copy of a member (38 corresponding lines) candle-core/src/quantized/simd128.rs:8— candle-core/src/quantized/simd128.rs:8-51 | candle-core/src/quantized/simd128.rs:54-91 — 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.
Edited copy of a member (38 corresponding lines) candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:309— candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:309-346 | candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:403-449 — 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.
Edited copy of a member (38 corresponding lines) candle-wasm-examples/moondream/src/bin/m.rs:50— candle-wasm-examples/moondream/src/bin/m.rs:50-87 | candle-wasm-examples/phi/src/bin/m.rs:41-81 — 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 copy of a member (41 corresponding lines) · ×3
Edited copy of a member (41 corresponding lines) candle-transformers/src/models/whisper/model.rs:239— candle-transformers/src/models/whisper/model.rs:239-279 | candle-transformers/src/models/whisper/quantized_model.rs:235-275 — 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.
Edited copy of a member (41 corresponding lines) candle-core/src/metal_backend/mod.rs:1263— candle-core/src/metal_backend/mod.rs:1263-1303 | candle-core/src/metal_backend/mod.rs:1310-1350 — 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.
Edited copy of a member (41 corresponding lines) candle-core/src/metal_backend/mod.rs:1356— candle-core/src/metal_backend/mod.rs:1356-1396 | candle-core/src/metal_backend/mod.rs:1406-1453 — 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, 25+ corresponding lines) · ×3
Edited copies of one member (3 members, 25+ corresponding lines) candle-transformers/src/models/vgg.rs:146— candle-transformers/src/models/vgg.rs:146-170 | candle-transformers/src/models/vgg.rs:172-217 | candle-transformers/src/models/vgg.rs:219-267 — 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) candle-core/src/storage.rs:147— candle-core/src/storage.rs:147-174 | candle-core/src/storage.rs:348-375 | candle-core/src/storage.rs:614-638 — 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) candle-transformers/src/models/olmo.rs:128— candle-transformers/src/models/olmo.rs:128-154 | candle-transformers/src/models/olmo2.rs:121-149 | candle-transformers/src/models/starcoder2.rs:132-156 — 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 (28 corresponding lines) · ×3
Edited copy of a member (28 corresponding lines) candle-transformers/src/models/bert.rs:466— candle-transformers/src/models/bert.rs:466-498 | candle-transformers/src/models/distilbert.rs:310-337 — 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) candle-transformers/src/models/gemma4/vision.rs:203— candle-transformers/src/models/gemma4/vision.rs:203-230 | candle-transformers/src/models/lfm2.rs:279-311 — 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) candle-transformers/src/models/flux/autoencoder.rs:110— candle-transformers/src/models/flux/autoencoder.rs:110-137 | candle-transformers/src/models/z_image/vae.rs:180-210 — 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 (30 corresponding lines) · ×3
Edited copy of a member (30 corresponding lines) candle-transformers/src/models/lfm2.rs:606— candle-transformers/src/models/lfm2.rs:606-635 | candle-transformers/src/models/paddleocr_vl/text.rs:1109-1140 — 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) candle-nn/src/rnn.rs:139— candle-nn/src/rnn.rs:139-181 | candle-nn/src/rnn.rs:309-338 — 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) candle-transformers/src/models/bert.rs:155— candle-transformers/src/models/bert.rs:155-184 | candle-transformers/src/models/xlm_roberta.rs:34-63 — 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 copies of one member (3 members, 17+ corresponding lines) · ×3
Edited copies of one member (3 members, 17+ corresponding lines) candle-core/src/storage.rs:673— candle-core/src/storage.rs:673-689 | candle-core/src/storage.rs:699-715 | candle-core/src/storage.rs:725-743 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 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, 17+ corresponding lines) candle-transformers/src/models/bert.rs:217— candle-transformers/src/models/bert.rs:217-235 | candle-transformers/src/models/chinese_clip/text_model.rs:225-243 | candle-transformers/src/models/jina_bert.rs:143-159 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 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, 17+ corresponding lines) candle-core/src/quantized/fast_mmvq.rs:99— candle-core/src/quantized/fast_mmvq.rs:99-115 | candle-core/src/quantized/fast_mmvq.rs:117-133 | candle-core/src/quantized/fast_mmvq.rs:135-151 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 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) · ×3
Edited copies of one member (4 members, 13+ corresponding lines) candle-transformers/src/models/quantized_rwkv_v5.rs:200— candle-transformers/src/models/quantized_rwkv_v5.rs:200-212 | candle-transformers/src/models/quantized_rwkv_v6.rs:247-259 | candle-transformers/src/models/rwkv_v5.rs:247-259 | candle-transformers/src/models/rwkv_v6.rs:221-233 — 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.
Edited copies of one member (4 members, 13+ corresponding lines) candle-core/src/device.rs:431— candle-core/src/device.rs:431-446 | candle-core/src/device.rs:448-463 | candle-core/src/device.rs:465-477 | candle-core/src/device.rs:479-493 — 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.
Edited copies of one member (4 members, 13+ corresponding lines) candle-nn/src/conv.rs:351— candle-nn/src/conv.rs:351-364 | candle-nn/src/conv.rs:372-384 | candle-nn/src/conv.rs:440-453 | candle-nn/src/conv.rs:461-473 — 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 (3 members, 19+ corresponding lines) · ×3
Edited copies of one member (3 members, 19+ corresponding lines) candle-core/src/cpu/avx.rs:222— candle-core/src/cpu/avx.rs:222-240 | candle-core/src/cpu/neon.rs:431-449 | candle-core/src/cpu/simd128.rs:169-187 — 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.
Edited copies of one member (3 members, 19+ corresponding lines) candle-transformers/src/models/chinese_clip/vision_model.rs:144— candle-transformers/src/models/chinese_clip/vision_model.rs:144-163 | candle-transformers/src/models/clip/text_model.rs:110-129 | candle-transformers/src/models/stable_diffusion/clip.rs:192-210 — 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.
Edited copies of one member (3 members, 19+ corresponding lines) candle-transformers/src/models/dac.rs:52— candle-transformers/src/models/dac.rs:52-70 | candle-transformers/src/models/dac.rs:194-220 | candle-transformers/src/models/snac.rs:259-278 — 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 (4 members, 8+ corresponding lines) · ×3
Edited copies of one member (4 members, 8+ corresponding lines) candle-transformers/src/models/quantized_qwen3.rs:136— candle-transformers/src/models/quantized_qwen3.rs:136-143 | candle-transformers/src/models/qwen3.rs:62-69 | candle-transformers/src/models/smol/smollm3.rs:92-99 | candle-transformers/src/models/z_image/text_encoder.rs:134-141 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 8+ corresponding lines) candle-transformers/src/models/encodec.rs:135— candle-transformers/src/models/encodec.rs:135-142 | candle-transformers/src/models/encodec.rs:165-176 | candle-transformers/src/models/mimi/conv.rs:33-48 | candle-transformers/src/models/snac.rs:94-108 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 8+ corresponding lines) candle-transformers/src/models/helium.rs:112— candle-transformers/src/models/helium.rs:112-125 | candle-transformers/src/models/llama2_c.rs:279-286 | candle-transformers/src/models/quantized_llama2_c.rs:166-173 | candle-wasm-examples/llama2-c/src/model.rs:193-200 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 13+ corresponding lines) · ×3
Edited copies of one member (3 members, 13+ corresponding lines) candle-transformers/src/models/llama2_c.rs:322— candle-transformers/src/models/llama2_c.rs:322-334 | candle-transformers/src/models/quantized_llama2_c.rs:209-221 | candle-wasm-examples/llama2-c/src/model.rs:229-241 — 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) candle-transformers/src/models/siglip.rs:613— candle-transformers/src/models/siglip.rs:613-629 | candle-transformers/src/models/siglip.rs:707-722 | candle-transformers/src/models/vit.rs:394-406 — 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) candle-flash-attn-v3/src/lib.rs:755— candle-flash-attn-v3/src/lib.rs:755-771 | candle-flash-attn-v3/src/lib.rs:864-880 | candle-flash-attn/src/lib.rs:349-361 — 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, 6+ corresponding lines) · ×3
Edited copies of one member (3 members, 6+ corresponding lines) candle-core/src/tensor.rs:2821— candle-core/src/tensor.rs:2821-2826 | candle-core/src/tensor.rs:2829-2834 | candle-core/src/tensor.rs:2837-2842 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 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, 6+ corresponding lines) candle-transformers/src/models/codegeex4_9b.rs:128— candle-transformers/src/models/codegeex4_9b.rs:128-133 | candle-transformers/src/models/falcon.rs:186-193 | candle-transformers/src/models/glm4.rs:149-154 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 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, 6+ corresponding lines) candle-wasm-examples/yolo/src/model.rs:535— candle-wasm-examples/yolo/src/model.rs:535-540 | candle-wasm-examples/yolo/src/model.rs:547-552 | candle-wasm-examples/yolo/src/model.rs:622-627 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 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) · ×3
Edited copies of one member (3 members, 9+ corresponding lines) candle-transformers/src/models/based.rs:497— candle-transformers/src/models/based.rs:497-505 | candle-transformers/src/models/mpt.rs:192-200 | candle-transformers/src/models/quantized_mpt.rs:165-173 — 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) candle-transformers/src/models/beit.rs:394— candle-transformers/src/models/beit.rs:394-402 | candle-transformers/src/models/dinov2reg4.rs:296-304 | candle-transformers/src/models/eva2.rs:422-430 — 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) candle-nn/src/sequential.rs:55— candle-nn/src/sequential.rs:55-63 | candle-transformers/src/models/chinese_clip/vision_model.rs:321-329 | candle-transformers/src/models/clip/text_model.rs:270-278 — 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 (30 lines × 2) candle-transformers/src/models/stable_diffusion/uni_pc.rs:412— candle-transformers/src/models/stable_diffusion/uni_pc.rs:412-441 | candle-transformers/src/models/stable_diffusion/uni_pc.rs:525-554 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/stable_diffusion/uni_pc.rs:412` 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 (30 lines × 2) candle-transformers/src/models/quantized_stable_lm.rs:130— candle-transformers/src/models/quantized_stable_lm.rs:130-159 | candle-transformers/src/models/stable_lm.rs:253-282 — before extracting anything, compare `candle-transformers/src/models/quantized_stable_lm.rs` and `candle-transformers/src/models/stable_lm.rs` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 239 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 `candle-transformers/src/models/quantized_stable_lm.rs:130` 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 (30 lines × 2) candle-core/src/quantized/neon.rs:997— candle-core/src/quantized/neon.rs:997-1026 | candle-core/src/quantized/neon.rs:1445-1474 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:997` 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 (34 lines × 2) candle-core/src/cpu_backend/mod.rs:1541— candle-core/src/cpu_backend/mod.rs:1541-1574 | candle-core/src/cpu_backend/mod.rs:1632-1665 — both copies are in the same file, so extract the 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 `candle-core/src/cpu_backend/mod.rs:1541` 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 (34 lines × 2) candle-transformers/src/models/flux/model.rs:592— candle-transformers/src/models/flux/model.rs:592-625 | candle-transformers/src/models/flux/quantized_model.rs:431-464 — before extracting anything, compare `candle-transformers/src/models/flux/model.rs` and `candle-transformers/src/models/flux/quantized_model.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 209 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 (34 lines × 2) candle-wasm-examples/t5/src/bin/m-quantized.rs:143— candle-wasm-examples/t5/src/bin/m-quantized.rs:143-176 | candle-wasm-examples/t5/src/bin/m.rs:141-174 — before extracting anything, compare `candle-wasm-examples/t5/src/bin/m-quantized.rs` and `candle-wasm-examples/t5/src/bin/m.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 138 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 `candle-wasm-examples/t5/src/bin/m-quantized.rs:143` 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 × 3) candle-core/src/cuda_backend/mod.rs:2605— candle-core/src/cuda_backend/mod.rs:2605-2617 | candle-core/src/cuda_backend/mod.rs:2665-2676 | candle-core/src/cuda_backend/mod.rs:2724-2735 — 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 `candle-core/src/cuda_backend/mod.rs:2605` 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 × 3) candle-core/src/quantized/neon.rs:1062— candle-core/src/quantized/neon.rs:1062-1074 | candle-core/src/quantized/neon.rs:1376-1387 | candle-core/src/quantized/neon.rs:1516-1528 — 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 `candle-core/src/quantized/neon.rs:1062` 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–13 lines × 3) candle-transformers/src/models/quantized_phi.rs:259— candle-transformers/src/models/quantized_phi.rs:259-270 | candle-transformers/src/models/quantized_phi3.rs:291-302 | candle-transformers/src/models/quantized_qwen2.rs:282-294 — before extracting anything, compare `candle-transformers/src/models/quantized_phi.rs` and `candle-transformers/src/models/quantized_phi3.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 70 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 `candle-transformers/src/models/quantized_phi.rs:259` 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 × 3) candle-transformers/src/models/chatglm.rs:200— candle-transformers/src/models/chatglm.rs:200-212 | candle-transformers/src/models/codegeex4_9b.rs:221-233 | candle-transformers/src/models/glm4.rs:242-254 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 (13 lines × 3) candle-transformers/src/models/granite.rs:324— candle-transformers/src/models/granite.rs:324-336 | candle-transformers/src/models/granitemoehybrid.rs:374-386 | candle-transformers/src/models/llama.rs:371-383 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 `candle-transformers/src/models/granite.rs:324` 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 `cfg` to `&Config` in one and `&GraniteMoeHybridInternalConfig` 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 (13 lines × 3) candle-transformers/src/models/granite.rs:364— candle-transformers/src/models/granite.rs:364-376 | candle-transformers/src/models/llama.rs:411-423 | candle-transformers/src/models/voxtral/voxtral_llama.rs:335-347 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/llama.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 309 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `cfg` to `&Config` in one and `&VoxtralLlamaConfig` 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) candle-core/src/quantized/avx.rs:602— candle-core/src/quantized/avx.rs:602-612 | candle-core/src/quantized/avx.rs:615-626 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–12 lines × 2) candle-transformers/src/models/segment_anything/image_encoder.rs:301— candle-transformers/src/models/segment_anything/image_encoder.rs:301-312 | candle-transformers/src/models/segment_anything/tiny_vit.rs:416-426 — 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. 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 `xs` to `Tensor` in one and `&Tensor` 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) candle-nn/src/ops.rs:575— candle-nn/src/ops.rs:575-585 | candle-nn/src/ops.rs:818-829 — both copies are in the same file, so extract the 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 (11 lines × 4) candle-flash-attn-v3/src/lib.rs:67— candle-flash-attn-v3/src/lib.rs:67-77 | candle-flash-attn-v3/src/lib.rs:501-511 | candle-flash-attn/src/lib.rs:58-68 | candle-flash-attn/src/lib.rs:546-556 — before extracting anything, compare `candle-flash-attn-v3/src/lib.rs` and `candle-flash-attn/src/lib.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 174 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-flash-attn-v3/src/lib.rs:67` 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) candle-core/src/quantized/neon.rs:1579— candle-core/src/quantized/neon.rs:1579-1589 | candle-core/src/quantized/neon.rs:1696-1706 | candle-core/src/quantized/neon.rs:2311-2321 | candle-core/src/quantized/neon.rs:2448-2458 — 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 `candle-core/src/quantized/neon.rs:1579` 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 × 4) candle-transformers/src/models/based.rs:560— candle-transformers/src/models/based.rs:560-570 | candle-transformers/src/models/olmo.rs:319-329 | candle-transformers/src/models/olmo2.rs:314-324 | candle-transformers/src/models/qwen2.rs:314-324 — before extracting anything, compare `candle-transformers/src/models/based.rs` and `candle-transformers/src/models/olmo.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 90 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 `candle-transformers/src/models/based.rs:560` 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) candle-core/src/quantized/avx.rs:500— candle-core/src/quantized/avx.rs:500-508 | candle-core/src/quantized/avx.rs:591-601 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/avx.rs:500` 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, `candle-core/src/quantized/avx.rs:588` calls `_mm256_loadu_si256`, `as_ptr` and `candle-core/src/quantized/avx.rs:498` 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 (9–11 lines × 2) candle-transformers/src/models/bert.rs:417— candle-transformers/src/models/bert.rs:417-427 | candle-transformers/src/models/chinese_clip/text_model.rs:402-410 — before extracting anything, compare `candle-transformers/src/models/bert.rs` and `candle-transformers/src/models/chinese_clip/text_model.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. 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 (9–11 lines × 2) candle-transformers/src/models/paddleocr_vl/vision.rs:910— candle-transformers/src/models/paddleocr_vl/vision.rs:910-920 | candle-transformers/src/models/qwen3_vl/vision.rs:492-500 — `candle-transformers/src/models/paddleocr_vl/vision.rs` and `candle-transformers/src/models/qwen3_vl/vision.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 81 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (10 lines × 4) candle-nn/src/attention/cpu_flash/causal.rs:227— candle-nn/src/attention/cpu_flash/causal.rs:227-236 | candle-nn/src/attention/cpu_flash/causal.rs:320-329 | candle-nn/src/attention/cpu_flash/causal.rs:614-623 | candle-nn/src/attention/cpu_flash/causal.rs:728-737 — 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 `candle-nn/src/attention/cpu_flash/causal.rs:227` 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 × 4) candle-transformers/src/models/quantized_rwkv_v5.rs:246— candle-transformers/src/models/quantized_rwkv_v5.rs:246-255 | candle-transformers/src/models/quantized_rwkv_v6.rs:293-302 | candle-transformers/src/models/rwkv_v5.rs:293-302 | candle-transformers/src/models/rwkv_v6.rs:267-276 — before extracting anything, compare `candle-transformers/src/models/quantized_rwkv_v5.rs` and `candle-transformers/src/models/quantized_rwkv_v6.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 168 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 (10 lines × 4) candle-metal-kernels/src/kernels/convolution.rs:153— candle-metal-kernels/src/kernels/convolution.rs:153-162 | candle-metal-kernels/src/kernels/convolution.rs:194-204 | candle-metal-kernels/src/kernels/convolution.rs:240-249 | candle-metal-kernels/src/kernels/convolution.rs:287-299 — 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 `candle-metal-kernels/src/kernels/convolution.rs:153` 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–10 lines × 2) candle-core/src/display.rs:271— candle-core/src/display.rs:271-279 | candle-core/src/display.rs:282-291 — both copies are in the same file, so extract the 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 `candle-core/src/display.rs:271` 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–10 lines × 2) candle-transformers/src/models/chinese_clip/vision_model.rs:361— candle-transformers/src/models/chinese_clip/vision_model.rs:361-370 | candle-transformers/src/models/clip/vision_model.rs:148-156 — `candle-transformers/src/models/chinese_clip/vision_model.rs` and `candle-transformers/src/models/clip/vision_model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 32 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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) candle-transformers/src/models/rwkv_v7.rs:933— candle-transformers/src/models/rwkv_v7.rs:933-941 | candle-transformers/src/models/rwkv_v7.rs:993-1002 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/rwkv_v7.rs:933` 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 × 6) candle-nn/src/attention/cpu_flash/causal.rs:231— candle-nn/src/attention/cpu_flash/causal.rs:231-239 | candle-nn/src/attention/cpu_flash/causal.rs:324-332 | candle-nn/src/attention/cpu_flash/causal.rs:412-420 | candle-nn/src/attention/cpu_flash/causal.rs:484-492 | candle-nn/src/attention/cpu_flash/causal.rs:618-626 | candle-nn/src/attention/cpu_flash/causal.rs:732-740 — 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 `candle-nn/src/attention/cpu_flash/causal.rs:231` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-nn/src/attention/cpu_flash/causal.rs:230` calls `as_ptr` and `candle-nn/src/attention/cpu_flash/causal.rs:411` 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 (9 lines × 6) candle-transformers/src/models/granite.rs:173— candle-transformers/src/models/granite.rs:173-181 | candle-transformers/src/models/granitemoehybrid.rs:216-224 | candle-transformers/src/models/lfm2.rs:189-197 | candle-transformers/src/models/llama.rs:219-227 | candle-transformers/src/models/llama2_c.rs:124-132 | candle-transformers/src/models/voxtral/voxtral_llama.rs:114-122 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 (9 lines × 6) candle-transformers/src/models/helium.rs:77— candle-transformers/src/models/helium.rs:77-85 | candle-transformers/src/models/mistral.rs:128-136 | candle-transformers/src/models/mixformer.rs:157-165 | candle-transformers/src/models/qwen3.rs:51-59 | candle-transformers/src/models/smol/smollm3.rs:81-89 | candle-transformers/src/models/z_image/text_encoder.rs:123-131 — before extracting anything, compare `candle-transformers/src/models/helium.rs` and `candle-transformers/src/models/mistral.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 220 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 `candle-transformers/src/models/helium.rs:77` 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–9 lines × 3) candle-core/src/quantized/k_quants.rs:1480— candle-core/src/quantized/k_quants.rs:1480-1488 | candle-core/src/quantized/k_quants.rs:1738-1746 | candle-core/src/quantized/simd128.rs:183-190 — before extracting anything, compare `candle-core/src/quantized/k_quants.rs` and `candle-core/src/quantized/simd128.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-core/src/quantized/k_quants.rs:1480` 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 × 3) candle-transformers/src/models/wuerstchen/common.rs:21— candle-transformers/src/models/wuerstchen/common.rs:21-29 | candle-transformers/src/models/wuerstchen/common.rs:51-58 | candle-transformers/src/models/z_image/transformer.rs:693-701 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-transformers/src/models/wuerstchen/common.rs:18` calls `permute` and `candle-transformers/src/models/wuerstchen/common.rs:49` 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–9 lines × 3) candle-wasm-examples/segment-anything/src/bin/m.rs:57— candle-wasm-examples/segment-anything/src/bin/m.rs:57-64 | candle-wasm-examples/yolo/src/worker.rs:72-80 | candle-wasm-examples/yolo/src/worker.rs:151-159 — 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 `candle-wasm-examples/segment-anything/src/bin/m.rs:57` 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) candle-nn/src/attention/cpu_flash/causal.rs:249— candle-nn/src/attention/cpu_flash/causal.rs:249-256 | candle-nn/src/attention/cpu_flash/causal.rs:341-348 | candle-nn/src/attention/cpu_flash/causal.rs:427-434 | candle-nn/src/attention/cpu_flash/causal.rs:838-845 — 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 `candle-nn/src/attention/cpu_flash/causal.rs:249` 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 × 4) candle-transformers/src/models/glm4_new.rs:317— candle-transformers/src/models/glm4_new.rs:317-324 | candle-transformers/src/models/qwen3.rs:426-433 | candle-transformers/src/models/qwen3_moe.rs:287-294 | candle-transformers/src/models/smol/smollm3.rs:381-388 — before extracting anything, compare `candle-transformers/src/models/glm4_new.rs` and `candle-transformers/src/models/qwen3.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 120 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 `candle-transformers/src/models/glm4_new.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 (8 lines × 4) candle-transformers/src/models/glm4_new.rs:363— candle-transformers/src/models/glm4_new.rs:363-370 | candle-transformers/src/models/qwen3.rs:478-485 | candle-transformers/src/models/qwen3_moe.rs:333-340 | candle-transformers/src/models/smol/smollm3.rs:428-435 — before extracting anything, compare `candle-transformers/src/models/glm4_new.rs` and `candle-transformers/src/models/qwen3.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 120 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 (7 lines × 13) candle-nn/src/layer_norm.rs:123— candle-nn/src/layer_norm.rs:123-129 | candle-nn/src/ops.rs:662-668 | candle-nn/src/ops.rs:913-919 | candle-transformers/src/models/gemma.rs:61-67 | candle-transformers/src/models/gemma2.rs:54-60 | candle-transformers/src/models/gemma3.rs:49-55 | candle-transformers/src/models/gemma4/audio.rs:28-34 | candle-transformers/src/models/gemma4/text.rs:29-35 | candle-transformers/src/models/gemma4/vision.rs:28-34 | candle-transformers/src/models/recurrent_gemma.rs:78-84 | candle-transformers/src/models/wuerstchen/common.rs:20-27 | candle-transformers/src/models/wuerstchen/common.rs:50-56 | candle-transformers/src/models/z_image/transformer.rs:692-698 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 240 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-nn/src/ops.rs:661` calls `rms_norm_slow` and `candle-nn/src/layer_norm.rs:122` 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 × 13) candle-transformers/src/models/based.rs:578— candle-transformers/src/models/based.rs:578-584 | candle-transformers/src/models/helium.rs:379-385 | candle-transformers/src/models/mistral.rs:435-441 | candle-transformers/src/models/mixtral.rs:473-479 | candle-transformers/src/models/olmo.rs:337-343 | candle-transformers/src/models/olmo2.rs:332-338 | candle-transformers/src/models/phi3.rs:412-418 | candle-transformers/src/models/quantized_mistral.rs:320-326 | candle-transformers/src/models/quantized_stable_lm.rs:291-297 | candle-transformers/src/models/qwen2_moe.rs:468-474 | candle-transformers/src/models/stable_lm.rs:423-429 | candle-transformers/src/models/starcoder2.rs:335-341 | candle-transformers/src/models/yi.rs:354-360 — before extracting anything, compare `candle-transformers/src/models/based.rs` and `candle-transformers/src/models/helium.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 43 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 `candle-transformers/src/models/based.rs:578` 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, `candle-transformers/src/models/quantized_mistral.rs:327` calls `contiguous` and `candle-transformers/src/models/based.rs:585` 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 × 13) candle-transformers/src/models/based.rs:581— candle-transformers/src/models/based.rs:581-587 | candle-transformers/src/models/gemma.rs:405-411 | candle-transformers/src/models/helium.rs:382-388 | candle-transformers/src/models/mistral.rs:438-444 | candle-transformers/src/models/mixtral.rs:476-482 | candle-transformers/src/models/olmo.rs:340-346 | candle-transformers/src/models/olmo2.rs:335-341 | candle-transformers/src/models/phi3.rs:415-421 | candle-transformers/src/models/quantized_stable_lm.rs:294-300 | candle-transformers/src/models/qwen2_moe.rs:471-477 | candle-transformers/src/models/stable_lm.rs:426-432 | candle-transformers/src/models/starcoder2.rs:338-344 | candle-transformers/src/models/yi.rs:357-363 — before extracting anything, compare `candle-transformers/src/models/based.rs` and `candle-transformers/src/models/gemma.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 61 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 `candle-transformers/src/models/based.rs:581` 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 × 3) candle-transformers/src/models/quantized_gemma3.rs:398— candle-transformers/src/models/quantized_gemma3.rs:398-404 | candle-transformers/src/models/quantized_llama.rs:332-337 | candle-transformers/src/models/quantized_llama.rs:491-496 — before extracting anything, compare `candle-transformers/src/models/quantized_gemma3.rs` and `candle-transformers/src/models/quantized_llama.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 74 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 `candle-transformers/src/models/quantized_gemma3.rs:398` 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–7 lines × 3) candle-transformers/src/models/quantized_llama.rs:331— candle-transformers/src/models/quantized_llama.rs:331-336 | candle-transformers/src/models/quantized_llama.rs:490-495 | candle-transformers/src/models/quantized_qwen2.rs:255-261 — before extracting anything, compare `candle-transformers/src/models/quantized_llama.rs` and `candle-transformers/src/models/quantized_qwen2.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 124 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 `candle-transformers/src/models/quantized_llama.rs:331` 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, `candle-transformers/src/models/quantized_qwen2.rs:262` calls `dequantize` and `candle-transformers/src/models/quantized_llama.rs:496` 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–7 lines × 3) candle-transformers/src/models/quantized_llama.rs:577— candle-transformers/src/models/quantized_llama.rs:577-582 | candle-transformers/src/models/quantized_qwen2.rs:326-331 | candle-transformers/src/models/quantized_qwen3_moe.rs:410-416 — before extracting anything, compare `candle-transformers/src/models/quantized_llama.rs` and `candle-transformers/src/models/quantized_qwen2.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 124 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 `candle-transformers/src/models/quantized_llama.rs:577` 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, `candle-transformers/src/models/quantized_llama.rs:585` calls `enter` and `candle-transformers/src/models/quantized_qwen3_moe.rs:419` 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–7 lines × 2) candle-core/src/cpu_backend/mod.rs:410— candle-core/src/cpu_backend/mod.rs:410-415 | candle-core/src/cpu_backend/mod.rs:449-455 — both copies are in the same file, so extract the 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 `candle-core/src/cpu_backend/mod.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. 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–7 lines × 2) candle-core/src/npy.rs:406— candle-core/src/npy.rs:406-411 | candle-core/src/npy.rs:419-425 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `candle-core/src/npy.rs:406` 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–7 lines × 2) candle-core/src/quantized/avx.rs:239— candle-core/src/quantized/avx.rs:239-245 | candle-core/src/quantized/avx.rs:328-333 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/avx.rs:239` 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 `xs` to `&[BlockQ2K]` in one and `&[BlockQ3K]` 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 after the matched lines, `candle-core/src/quantized/avx.rs:246` calls `to_f32` and `candle-core/src/quantized/avx.rs:335` 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) candle-core/src/quantized/repack.rs:460— candle-core/src/quantized/repack.rs:460-465 | candle-core/src/quantized/repack.rs:496-501 | candle-core/src/quantized/repack.rs:540-545 | candle-core/src/quantized/repack.rs:631-636 | candle-core/src/quantized/repack.rs:665-670 — 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 `candle-core/src/quantized/repack.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. Note first that the copies are not typed on the same thing: the declarations holding them bind `blocks` to `&[BlockQ4K]` in one and `&[BlockQ5K]` 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 × 5) candle-transformers/src/models/granite.rs:296— candle-transformers/src/models/granite.rs:296-301 | candle-transformers/src/models/granitemoehybrid.rs:346-351 | candle-transformers/src/models/lfm2.rs:389-394 | candle-transformers/src/models/llama.rs:342-347 | candle-transformers/src/models/voxtral/voxtral_llama.rs:256-261 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 5) candle-core/src/cpu_backend/mod.rs:3017— candle-core/src/cpu_backend/mod.rs:3017-3022 | candle-core/src/cpu_backend/mod.rs:3024-3029 | candle-core/src/cpu_backend/mod.rs:3031-3036 | candle-core/src/cpu_backend/mod.rs:3038-3043 | candle-core/src/cpu_backend/mod.rs:3045-3050 — 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. 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 (5 lines × 9) candle-transformers/src/models/gemma.rs:298— candle-transformers/src/models/gemma.rs:298-303 | candle-transformers/src/models/gemma2.rs:300-305 | candle-transformers/src/models/gemma3.rs:338-344 | candle-transformers/src/models/helium.rs:276-281 | candle-transformers/src/models/mistral.rs:325-330 | candle-transformers/src/models/nvembed_v2/embedding.rs:185-190 | candle-transformers/src/models/quantized_mistral.rs:216-221 | candle-transformers/src/models/qwen2.rs:228-233 | candle-transformers/src/models/yi.rs:262-266 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 240 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 `candle-transformers/src/models/gemma.rs:298` 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 × 9) candle-transformers/src/models/helium.rs:77— candle-transformers/src/models/helium.rs:77-81 | candle-transformers/src/models/mimi/transformer.rs:65-69 | candle-transformers/src/models/mistral.rs:128-132 | candle-transformers/src/models/mixformer.rs:157-161 | candle-transformers/src/models/quantized_mistral.rs:43-47 | candle-transformers/src/models/quantized_mixformer.rs:69-73 | candle-transformers/src/models/qwen3.rs:51-55 | candle-transformers/src/models/smol/smollm3.rs:81-85 | candle-transformers/src/models/z_image/text_encoder.rs:123-127 — before extracting anything, compare `candle-transformers/src/models/helium.rs` and `candle-transformers/src/models/mistral.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 220 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 `candle-transformers/src/models/helium.rs:77` 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 × 9) candle-onnx/src/eval.rs:341— candle-onnx/src/eval.rs:341-345 | candle-onnx/src/eval.rs:347-351 | candle-onnx/src/eval.rs:353-357 | candle-onnx/src/eval.rs:377-381 | candle-onnx/src/eval.rs:388-392 | candle-onnx/src/eval.rs:813-818 | candle-onnx/src/eval.rs:821-826 | candle-onnx/src/eval.rs:829-834 | candle-onnx/src/eval.rs:2421-2426 — 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 `candle-onnx/src/eval.rs:341` 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 × 8) candle-transformers/src/models/codegeex4_9b.rs:79— candle-transformers/src/models/codegeex4_9b.rs:79-83 | candle-transformers/src/models/flux/model.rs:86-90 | candle-transformers/src/models/gemma3.rs:84-88 | candle-transformers/src/models/gemma4/text.rs:69-73 | candle-transformers/src/models/glm4.rs:101-105 | candle-transformers/src/models/modernbert.rs:62-66 | candle-transformers/src/models/quantized_glm4.rs:114-118 | candle-transformers/src/models/quantized_qwen3.rs:106-110 — before extracting anything, compare `candle-transformers/src/models/codegeex4_9b.rs` and `candle-transformers/src/models/glm4.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 459 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 (5 lines × 8) candle-transformers/src/models/deepseek2.rs:348— candle-transformers/src/models/deepseek2.rs:348-352 | candle-transformers/src/models/mimi/transformer.rs:62-66 | candle-transformers/src/models/mixformer.rs:154-158 | candle-transformers/src/models/paddleocr_vl/text.rs:43-49 | candle-transformers/src/models/quantized_mistral.rs:40-44 | candle-transformers/src/models/quantized_mixformer.rs:66-70 | candle-transformers/src/models/qwen3_vl/text.rs:28-32 | candle-transformers/src/models/trocr.rs:111-115 — before extracting anything, compare `candle-transformers/src/models/deepseek2.rs` and `candle-transformers/src/models/paddleocr_vl/text.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/deepseek2.rs:348` 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 × 8) candle-transformers/src/models/chatglm.rs:550— candle-transformers/src/models/chatglm.rs:550-554 | candle-transformers/src/models/codegeex4_9b.rs:571-575 | candle-transformers/src/models/glm4.rs:592-596 | candle-transformers/src/models/mpt.rs:287-291 | candle-transformers/src/models/phi.rs:137-141 | candle-transformers/src/models/quantized_mixformer.rs:42-46 | candle-transformers/src/models/quantized_t5.rs:44-48 | candle-transformers/src/models/t5.rs:111-115 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 (5 lines × 6) candle-core/src/cpu/avx.rs:316— candle-core/src/cpu/avx.rs:316-321 | candle-core/src/cpu/avx.rs:357-361 | candle-core/src/cpu/neon.rs:521-526 | candle-core/src/cpu/neon.rs:562-566 | candle-core/src/cpu/simd128.rs:206-211 | candle-core/src/cpu/simd128.rs:245-249 — before extracting anything, compare `candle-core/src/cpu/avx.rs` and `candle-core/src/cpu/neon.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 113 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 `candle-core/src/cpu/avx.rs:316` 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 × 6) candle-transformers/src/models/helium.rs:71— candle-transformers/src/models/helium.rs:71-75 | candle-transformers/src/models/mimi/transformer.rs:59-63 | candle-transformers/src/models/mistral.rs:122-126 | candle-transformers/src/models/nvembed_v2/embedding.rs:22-26 | candle-transformers/src/models/quantized_mistral.rs:37-41 | candle-transformers/src/models/qwen3_vl/text.rs:25-29 — before extracting anything, compare `candle-transformers/src/models/helium.rs` and `candle-transformers/src/models/mistral.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 220 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 (5 lines × 6) candle-transformers/src/models/lfm2.rs:329— candle-transformers/src/models/lfm2.rs:329-333 | candle-transformers/src/models/paddleocr_vl/text.rs:897-902 | candle-transformers/src/models/quantized_glm4.rs:213-217 | candle-transformers/src/models/quantized_qwen3.rs:240-245 | candle-transformers/src/models/quantized_stable_lm.rs:119-123 | candle-transformers/src/models/stable_lm.rs:242-246 — before extracting anything, compare `candle-transformers/src/models/paddleocr_vl/text.rs` and `candle-transformers/src/models/quantized_qwen3.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
FlashAttnVarLen::cuda_fwd_t (cyclomatic 58) candle-flash-attn/src/lib.rs:464— FlashAttnVarLen::cuda_fwd_t has cyclomatic complexity 58 (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.
FlashAttnVarLen::cuda_fwd_t (cyclomatic 31) candle-flash-attn-v3/src/lib.rs:444— FlashAttnVarLen::cuda_fwd_t has cyclomatic complexity 31 (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.
candle_nn::attention::cpu_flash::varlen::flash_attn_varlen_cpu (cyclomatic 54) candle-nn/src/attention/cpu_flash/varlen.rs:27— candle_nn::attention::cpu_flash::varlen::flash_attn_varlen_cpu has cyclomatic complexity 54 (threshold 15). Of this number, 47 points are the body's own statements and 7 belong to 2 function items inside it that branch. 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.
candle_nn::moe::moe_gemm_gguf::cuda_fwd (cyclomatic 16) candle-nn/src/moe.rs:188— candle_nn::moe::moe_gemm_gguf::cuda_fwd 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.
FlashAttn::cuda_fwd_t (cyclomatic 25) candle-flash-attn-v3/src/lib.rs:30— FlashAttn::cuda_fwd_t has cyclomatic complexity 25 (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.
FlashAttn::cuda_fwd_t (cyclomatic 22) candle-flash-attn/src/lib.rs:21— FlashAttn::cuda_fwd_t has cyclomatic complexity 22 (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.
tensor_tools::run_print (cyclomatic 25) tensor-tools/src/main.rs:171— tensor_tools::run_print 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.
tensor_tools::run_ls (cyclomatic 19) tensor-tools/src/main.rs:299— tensor_tools::run_ls 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.
PyTensor::__getitem__ (cyclomatic 21) candle-pyo3/src/lib.rs:533— PyTensor::__getitem__ has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to 2 function items inside it that branch (extract_indexer, to_absolute_index). 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.
PyTensor::to (cyclomatic 17) candle-pyo3/src/lib.rs:984— PyTensor::to 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 cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MatMul::f (cyclomatic 19) candle-core/src/cpu_backend/mod.rs:1625— MatMul::f 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. This is NOT this file's highest cyclomatic complexity: CpuStorage::to_dtype (cyclomatic 102) 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.
MatMul::f (cyclomatic 18) candle-core/src/cpu_backend/mod.rs:1534— MatMul::f 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. This is NOT this file's highest cyclomatic complexity: CpuStorage::to_dtype (cyclomatic 102) 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.
Value::read (cyclomatic 19) candle-core/src/quantized/gguf_file.rs:319— Value::read 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.
Value::write (cyclomatic 16) candle-core/src/quantized/gguf_file.rs:376— Value::write 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.
candle_transformers::models::paddleocr_vl::text::compute_mrope_position_ids_multi (cyclomatic 19) candle-transformers/src/models/paddleocr_vl/text.rs:288— candle_transformers::models::paddleocr_vl::text::compute_mrope_position_ids_multi 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.
candle_transformers::models::paddleocr_vl::text::compute_mrope_position_ids_video (cyclomatic 16) candle-transformers/src/models/paddleocr_vl/text.rs:541— candle_transformers::models::paddleocr_vl::text::compute_mrope_position_ids_video 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.
WDiffNeXt::forward (cyclomatic 18) candle-transformers/src/models/wuerstchen/diffnext.rs:307— WDiffNeXt::forward 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.
WDiffNeXt::new (cyclomatic 17) candle-transformers/src/models/wuerstchen/diffnext.rs:92— WDiffNeXt::new 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.
HackComment candle-onnx/src/eval.rs:364— // HACK: current implementation of broadcast_pow cannot handle negative base, — 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 candle-core/src/npy.rs:107— // Hacky parser for the npy header, a typical example would be: — 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.
FlashAttnVarLen::cuda_fwd_t (cognitive 83) candle-flash-attn/src/lib.rs:464— FlashAttnVarLen::cuda_fwd_t has cognitive complexity 83 (threshold 15). Drivers by points: if/else 47 (59 pts), match/switch 9 (14 pts), boolean chains 10 (nesting depth added 17). 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.
FlashAttnVarLen::cuda_fwd_t (cognitive 36) candle-flash-attn-v3/src/lib.rs:444— FlashAttnVarLen::cuda_fwd_t has cognitive complexity 36 (threshold 15). Drivers by points: if/else 22 (24 pts), match/switch 6 (7 pts), boolean chains 5 (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.
tensor_tools::run_print (cognitive 46) tensor-tools/src/main.rs:171— tensor_tools::run_print has cognitive complexity 46 (threshold 15). Drivers by points: match/switch 8 (19 pts), if/else 12 (17 pts), loops 5 (10 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.
tensor_tools::run_ls (cognitive 30) tensor-tools/src/main.rs:299— tensor_tools::run_ls has cognitive complexity 30 (threshold 15). Drivers by points: loops 7 (15 pts), match/switch 5 (10 pts), if/else 2 (5 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.
WDiffNeXt::new (cognitive 41) candle-transformers/src/models/wuerstchen/diffnext.rs:92— WDiffNeXt::new has cognitive complexity 41 (threshold 15). Drivers by points: if/else 18 (32 pts), loops 6 (8 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WDiffNeXt::forward (cognitive 33) candle-transformers/src/models/wuerstchen/diffnext.rs:307— WDiffNeXt::forward has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 4 (8 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FlashAttn::cuda_fwd_t (cognitive 30) candle-flash-attn-v3/src/lib.rs:30— FlashAttn::cuda_fwd_t has cognitive complexity 30 (threshold 15). Drivers by points: if/else 20 (22 pts), boolean chains 5, match/switch 2 (3 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.
FlashAttn::cuda_fwd_t (cognitive 27) candle-flash-attn/src/lib.rs:21— FlashAttn::cuda_fwd_t has cognitive complexity 27 (threshold 15). Drivers by points: if/else 19 (21 pts), boolean chains 4, match/switch 1 (2 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.
PyTensor::__getitem__ (cognitive 26) candle-pyo3/src/lib.rs:533— PyTensor::__getitem__ has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (18 pts), loops 3 (5 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 6). Most of this is not in the body itself: 9 of the 26 points are its own statements and the rest belongs to 2 function items inside it that branch (extract_indexer, to_absolute_index). 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.
PyTensor::to (cognitive 20) candle-pyo3/src/lib.rs:984— PyTensor::to has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 1, match/switch 1 (nesting depth added 5). Of this number, 17 points are the body's own statements and 3 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.
Model::generate (cognitive 24) candle-transformers/src/models/parler_tts.rs:383— Model::generate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 3 (5 pts), boolean chains 1, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model::new (cognitive 17) candle-transformers/src/models/rwkv_v7.rs:844— Model::new has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 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.
T5Attention::forward (cognitive 22) candle-transformers/src/models/quantized_t5.rs:321— T5Attention::forward has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 5 (8 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.
T5Attention::forward (cognitive 22) candle-transformers/src/models/t5.rs:450— T5Attention::forward has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 5 (8 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.
MatMul::f (cognitive 21) candle-core/src/cpu_backend/mod.rs:1625— MatMul::f has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, if/else 6, loops 3 (6 pts), 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.
MatMul::f (cognitive 19) candle-core/src/cpu_backend/mod.rs:1534— MatMul::f has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 6, loops 2 (4 pts), match/switch 1 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Projector::forward (cognitive 21) candle-transformers/src/models/paddleocr_vl/vision.rs:711— Projector::forward has cognitive complexity 21 (threshold 15). Drivers by points: loops 6 (21 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. This shape REPEATS in the file: one other method here (Projector::forward_multi) 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.
Projector::forward_multi (cognitive 21) candle-transformers/src/models/paddleocr_vl/vision.rs:786— Projector::forward_multi has cognitive complexity 21 (threshold 15). Drivers by points: loops 6 (21 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. This shape REPEATS in the file: one other method here (Projector::forward) 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.
MetalStorage::reduce_op (cognitive 19) candle-core/src/metal_backend/mod.rs:298— MetalStorage::reduce_op has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, match/switch 2 (3 pts), loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MetalStorage::copy_strided_src (cognitive 17) candle-core/src/metal_backend/mod.rs:1837— MetalStorage::copy_strided_src has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 8). 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.
candle_datasets::vision::cifar::load_parquet (cognitive 16) candle-datasets/src/vision/cifar.rs:66— candle_datasets::vision::cifar::load_parquet has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (7 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.
candle_datasets::vision::mnist::load_parquet (cognitive 16) candle-datasets/src/vision/mnist.rs:64— candle_datasets::vision::mnist::load_parquet has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (7 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.
TooManyFunctions: candle_core::mkl candle-core/src/mkl.rs:83— TooManyFunctions — 37 free functions. The bar is 30 free functions; this is 7 over it, 1.23× 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.
TooManyFunctions: candle_core::accelerate candle-core/src/accelerate.rs:169— TooManyFunctions — 36 free functions. The bar is 30 free functions; 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.
D4 · Code Duplication· Near-duplicate member family (13 members, 15 shared lines) · ×2
Near-duplicate member family (13 members, 15 shared lines) candle-transformers/src/models/csm.rs:192— candle-transformers/src/models/csm.rs:192-244 | candle-transformers/src/models/gemma.rs:202-259 | candle-transformers/src/models/helium.rs:199-258 | candle-transformers/src/models/mistral.rs:248-307 | candle-transformers/src/models/mixtral.rs:183-239 | candle-transformers/src/models/nvembed_v2/embedding.rs:130-171 | candle-transformers/src/models/quantized_mistral.rs:147-198 | candle-transformers/src/models/quantized_stable_lm.rs:117-177 | candle-transformers/src/models/qwen2.rs:160-210 | candle-transformers/src/models/qwen2_moe.rs:167-217 | candle-transformers/src/models/stable_lm.rs:240-307 | candle-transformers/src/models/starcoder2.rs:163-210 | candle-transformers/src/models/yi.rs:199-248 — These 13 members are variants of one another: a block of 15 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 13 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 13 times.
Near-duplicate member family (13 members, 15 shared lines) candle-transformers/src/models/csm.rs:192— candle-transformers/src/models/csm.rs:192-244 | candle-transformers/src/models/gemma.rs:202-259 | candle-transformers/src/models/gemma2.rs:197-259 | candle-transformers/src/models/helium.rs:199-258 | candle-transformers/src/models/mistral.rs:248-307 | candle-transformers/src/models/mixtral.rs:183-239 | candle-transformers/src/models/quantized_mistral.rs:147-198 | candle-transformers/src/models/quantized_stable_lm.rs:117-177 | candle-transformers/src/models/qwen2.rs:160-210 | candle-transformers/src/models/qwen2_moe.rs:167-217 | candle-transformers/src/models/stable_lm.rs:240-307 | candle-transformers/src/models/starcoder2.rs:163-210 | candle-transformers/src/models/yi.rs:199-248 — These 13 members are variants of one another: a block of 15 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 13 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 13 times.
D4 · Code Duplication· Near-duplicate member family (6 members, 13 shared lines) · ×2
Near-duplicate member family (6 members, 13 shared lines) candle-nn/src/attention/cpu_flash/causal.rs:204— candle-nn/src/attention/cpu_flash/causal.rs:204-295 | candle-nn/src/attention/cpu_flash/causal.rs:310-381 | candle-nn/src/attention/cpu_flash/causal.rs:397-461 | candle-nn/src/attention/cpu_flash/causal.rs:472-568 | candle-nn/src/attention/cpu_flash/causal.rs:587-700 | candle-nn/src/attention/cpu_flash/causal.rs:716-797 — These 6 members are variants of one another: a block of 13 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Near-duplicate member family (6 members, 13 shared lines) candle-transformers/src/models/olmo.rs:161— candle-transformers/src/models/olmo.rs:161-221 | candle-transformers/src/models/olmo2.rs:156-209 | candle-transformers/src/models/paddleocr_vl/text.rs:837-884 | candle-transformers/src/models/phi3.rs:205-261 | candle-transformers/src/models/qwen2.rs:160-210 | candle-transformers/src/models/qwen2_moe.rs:167-217 — These 6 members are variants of one another: a block of 13 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Near-duplicate member family (4 members, 10 shared lines) · ×2
Near-duplicate member family (4 members, 10 shared lines) candle-core/src/cuda_backend/mod.rs:734— candle-core/src/cuda_backend/mod.rs:734-766 | candle-core/src/cuda_backend/mod.rs:778-809 | candle-core/src/cuda_backend/mod.rs:849-885 | candle-core/src/cuda_backend/mod.rs:897-934 — These 4 members are variants of one another: a block of 10 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 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.
Near-duplicate member family (4 members, 10 shared lines) candle-transformers/src/models/helium.rs:67— candle-transformers/src/models/helium.rs:67-85 | candle-transformers/src/models/mimi/transformer.rs:58-74 | candle-transformers/src/models/mistral.rs:118-136 | candle-transformers/src/models/quantized_mistral.rs:33-51 — These 4 members are variants of one another: a block of 10 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 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.
Near-duplicate member pair (36 shared lines) candle-transformers/src/models/mixformer.rs:283— candle-transformers/src/models/mixformer.rs:283-337 | candle-transformers/src/models/quantized_mixformer.rs:203-252 — These two members are variants of one another: 36 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 (36 shared lines) candle-core/src/quantized/avx.rs:451— candle-core/src/quantized/avx.rs:451-533 | candle-core/src/quantized/avx.rs:536-646 — These two members are variants of one another: 36 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 (33 shared lines) candle-core/src/cuda_backend/mod.rs:1888— candle-core/src/cuda_backend/mod.rs:1888-1950 | candle-core/src/cuda_backend/mod.rs:2074-2136 — These two members are variants of one another: 33 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 (33 shared lines) candle-wasm-examples/llama2-c/src/app.rs:107— candle-wasm-examples/llama2-c/src/app.rs:107-177 | candle-wasm-examples/yolo/src/app.rs:146-231 — These two members are variants of one another: 33 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 (28 shared lines) candle-transformers/src/models/quantized_phi.rs:205— candle-transformers/src/models/quantized_phi.rs:205-270 | candle-transformers/src/models/quantized_phi3.rs:228-302 — These two members are variants of one another: 28 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 (28 shared lines) candle-nn/src/attention/cpu_flash/causal.rs:814— candle-nn/src/attention/cpu_flash/causal.rs:814-878 | candle-nn/src/attention/cpu_flash/causal.rs:895-965 — These two members are variants of one another: 28 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 (25 shared lines) candle-core/src/quantized/neon.rs:1814— candle-core/src/quantized/neon.rs:1814-1865 | candle-core/src/quantized/neon.rs:2600-2652 — These two members are variants of one another: 25 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 (25 shared lines) candle-core/src/quantized/neon.rs:533— candle-core/src/quantized/neon.rs:533-584 | candle-core/src/quantized/neon.rs:2908-2959 — These two members are variants of one another: 25 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (48 corresponding lines) · ×2
Edited copy of a member (48 corresponding lines) candle-transformers/src/models/codegeex4_9b.rs:157— candle-transformers/src/models/codegeex4_9b.rs:157-204 | candle-transformers/src/models/glm4.rs:178-225 — These two members are one piece of code written twice and then edited apart: 48 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 (48 corresponding lines) candle-core/src/cpu_backend/mod.rs:2883— candle-core/src/cpu_backend/mod.rs:2883-2930 | candle-core/src/cuda_backend/mod.rs:1958-2009 — These two members are one piece of code written twice and then edited apart: 48 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) · ×2
Edited copy of a member (32 corresponding lines) candle-transformers/src/models/qwen3.rs:192— candle-transformers/src/models/qwen3.rs:192-241 | candle-transformers/src/models/z_image/text_encoder.rs:271-318 — 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.
Edited copy of a member (32 corresponding lines) candle-transformers/src/models/chinese_clip/vision_model.rs:81— candle-transformers/src/models/chinese_clip/vision_model.rs:81-113 | candle-transformers/src/models/clip/vision_model.rs:74-105 — 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· Members sharing a duplicated core (13 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (13 members, 50+ identical tokens) candle-nn/src/layer_norm.rs:117— candle-nn/src/layer_norm.rs:117-143 | candle-nn/src/ops.rs:661-672 | candle-nn/src/ops.rs:912-930 | candle-transformers/src/models/gemma.rs:60-73 | candle-transformers/src/models/gemma2.rs:53-66 | candle-transformers/src/models/gemma3.rs:48-61 | candle-transformers/src/models/gemma4/audio.rs:27-38 | candle-transformers/src/models/gemma4/text.rs:28-41 | candle-transformers/src/models/gemma4/vision.rs:27-40 | candle-transformers/src/models/recurrent_gemma.rs:77-90 | candle-transformers/src/models/wuerstchen/common.rs:17-34 | candle-transformers/src/models/wuerstchen/common.rs:49-62 | candle-transformers/src/models/z_image/transformer.rs:691-706 — These 13 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 13 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 13 times.
Members sharing a duplicated core (13 members, 50+ identical tokens) candle-transformers/src/models/gemma.rs:319— candle-transformers/src/models/gemma.rs:319-327 | candle-transformers/src/models/helium.rs:297-305 | candle-transformers/src/models/mistral.rs:346-354 | candle-transformers/src/models/mixtral.rs:389-399 | candle-transformers/src/models/nvembed_v2/embedding.rs:206-216 | candle-transformers/src/models/olmo.rs:256-264 | candle-transformers/src/models/phi3.rs:333-341 | candle-transformers/src/models/quantized_mistral.rs:237-245 | candle-transformers/src/models/quantized_stable_lm.rs:217-226 | candle-transformers/src/models/qwen2.rs:249-257 | candle-transformers/src/models/qwen2_moe.rs:382-390 | candle-transformers/src/models/stable_lm.rs:347-356 | candle-transformers/src/models/starcoder2.rs:249-257 — These 13 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 13 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 13 times.
D4 · Code Duplication· Members sharing a duplicated core (8 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (8 members, 50+ identical tokens) candle-transformers/src/models/chatglm.rs:549— candle-transformers/src/models/chatglm.rs:549-554 | candle-transformers/src/models/codegeex4_9b.rs:570-575 | candle-transformers/src/models/glm4.rs:591-596 | candle-transformers/src/models/mpt.rs:286-291 | candle-transformers/src/models/phi.rs:136-141 | candle-transformers/src/models/quantized_mixformer.rs:41-46 | candle-transformers/src/models/quantized_t5.rs:43-48 | candle-transformers/src/models/t5.rs:110-115 — These 8 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 8 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 8 times.
Members sharing a duplicated core (8 members, 50+ identical tokens) candle-transformers/src/models/codegeex4_9b.rs:75— candle-transformers/src/models/codegeex4_9b.rs:75-92 | candle-transformers/src/models/flux/model.rs:80-99 | candle-transformers/src/models/gemma3.rs:76-98 | candle-transformers/src/models/gemma4/text.rs:68-83 | candle-transformers/src/models/glm4.rs:97-113 | candle-transformers/src/models/modernbert.rs:60-77 | candle-transformers/src/models/quantized_glm4.rs:107-129 | candle-transformers/src/models/quantized_qwen3.rs:103-133 — These 8 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 8 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 8 times.
D4 · Code Duplication· Edited copy of a member (71 corresponding lines) · ×2
Edited copy of a member (71 corresponding lines) candle-core/src/quantized/k_quants.rs:2131— candle-core/src/quantized/k_quants.rs:2131-2201 | candle-core/src/quantized/k_quants.rs:2203-2281 — These two members are one piece of code written twice and then edited apart: 71 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 (71 corresponding lines) candle-core/src/safetensors.rs:214— candle-core/src/safetensors.rs:214-287 | candle-core/src/safetensors.rs:316-386 — These two members are one piece of code written twice and then edited apart: 71 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) candle-core/src/cpu_backend/mod.rs:2471— candle-core/src/cpu_backend/mod.rs:2471-2505 | candle-core/src/cpu_backend/mod.rs:2507-2540 — 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) candle-transformers/src/models/resnet.rs:88— candle-transformers/src/models/resnet.rs:88-121 | candle-transformers/src/models/resnet.rs:200-233 — 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 copy of a member (61 corresponding lines) · ×2
Edited copy of a member (61 corresponding lines) candle-core/src/cpu_backend/mod.rs:3192— candle-core/src/cpu_backend/mod.rs:3192-3253 | candle-core/src/cpu_backend/mod.rs:3255-3315 — These two members are one piece of code written twice and then edited apart: 61 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 (61 corresponding lines) candle-wasm-examples/quant-qwen3/src/m.rs:488— candle-wasm-examples/quant-qwen3/src/m.rs:488-548 | candle-wasm-examples/quant-qwen3/src/m.rs:552-614 — These two members are one piece of code written twice and then edited apart: 61 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, 20+ corresponding lines) · ×2
Edited copies of one member (3 members, 20+ corresponding lines) candle-core/src/cpu_backend/utils.rs:59— candle-core/src/cpu_backend/utils.rs:59-78 | candle-core/src/cpu_backend/utils.rs:85-105 | candle-core/src/cpu_backend/utils.rs:112-131 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 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, 20+ corresponding lines) candle-transformers/src/models/deepseek2.rs:341— candle-transformers/src/models/deepseek2.rs:341-360 | candle-transformers/src/models/marian.rs:212-232 | candle-transformers/src/models/paddleocr_vl/text.rs:35-61 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 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 (40 corresponding lines) · ×2
Edited copy of a member (40 corresponding lines) candle-core/src/metal_backend/mod.rs:1514— candle-core/src/metal_backend/mod.rs:1514-1553 | candle-core/src/metal_backend/mod.rs:1563-1602 — 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) candle-transformers/src/models/z_image/transformer.rs:752— candle-transformers/src/models/z_image/transformer.rs:752-793 | candle-transformers/src/models/z_image/transformer.rs:807-846 — 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 (58 corresponding lines) · ×2
Edited copy of a member (58 corresponding lines) candle-transformers/src/models/paddleocr_vl/vision.rs:711— candle-transformers/src/models/paddleocr_vl/vision.rs:711-771 | candle-transformers/src/models/paddleocr_vl/vision.rs:786-843 — 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.
Edited copy of a member (58 corresponding lines) candle-transformers/src/models/z_image/vae.rs:436— candle-transformers/src/models/z_image/vae.rs:436-493 | candle-transformers/src/models/z_image/vae.rs:522-582 — 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 (33 corresponding lines) · ×2
Edited copy of a member (33 corresponding lines) candle-core/src/quantized/repack_x86.rs:334— candle-core/src/quantized/repack_x86.rs:334-366 | candle-core/src/quantized/repack_x86.rs:381-423 — 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) candle-core/src/metal_backend/mod.rs:2276— candle-core/src/metal_backend/mod.rs:2276-2308 | candle-core/src/metal_backend/mod.rs:2316-2348 — 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 copy of a member (37 corresponding lines) · ×2
Edited copy of a member (37 corresponding lines) candle-core/src/quantized/k_quants.rs:343— candle-core/src/quantized/k_quants.rs:343-379 | candle-core/src/quantized/k_quants.rs:554-594 — 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.
Edited copy of a member (37 corresponding lines) candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:602— candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:602-638 | candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:808-845 — 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 copy of a member (35 corresponding lines) · ×2
Edited copy of a member (35 corresponding lines) candle-transformers/src/models/metavoice.rs:887— candle-transformers/src/models/metavoice.rs:887-922 | candle-transformers/src/models/quantized_metavoice.rs:190-224 — 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) candle-transformers/src/models/quantized_t5.rs:285— candle-transformers/src/models/quantized_t5.rs:285-319 | candle-transformers/src/models/t5.rs:414-448 — 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 (24 corresponding lines) · ×2
Edited copy of a member (24 corresponding lines) candle-datasets/src/vision/cifar.rs:66— candle-datasets/src/vision/cifar.rs:66-93 | candle-datasets/src/vision/mnist.rs:64-87 — 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) candle-transformers/src/models/gemma2.rs:425— candle-transformers/src/models/gemma2.rs:425-448 | candle-transformers/src/models/gemma3.rs:503-529 — 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.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×2
Edited copy of a member (29 corresponding lines) candle-transformers/src/models/quantized_llama.rs:568— candle-transformers/src/models/quantized_llama.rs:568-596 | candle-transformers/src/models/quantized_qwen2.rs:317-345 — 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) candle-transformers/src/models/quantized_recurrent_gemma.rs:97— candle-transformers/src/models/quantized_recurrent_gemma.rs:97-127 | candle-transformers/src/models/recurrent_gemma.rs:332-360 — 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 copies of one member (3 members, 22+ corresponding lines) · ×2
Edited copies of one member (3 members, 22+ corresponding lines) candle-transformers/src/models/dinov2.rs:268— candle-transformers/src/models/dinov2.rs:268-292 | candle-transformers/src/models/dinov2reg4.rs:260-281 | candle-transformers/src/models/eva2.rs:304-329 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 22+ corresponding lines) candle-transformers/src/models/bert.rs:246— candle-transformers/src/models/bert.rs:246-269 | candle-transformers/src/models/chinese_clip/text_model.rs:254-277 | candle-transformers/src/models/jina_bert.rs:169-190 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 33+ corresponding lines) · ×2
Edited copies of one member (4 members, 33+ corresponding lines) candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:135— candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:135-172 | candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:224-256 | candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:506-540 | candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs:705-744 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 33 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, 33+ corresponding lines) candle-metal-kernels/src/kernels/indexing.rs:23— candle-metal-kernels/src/kernels/indexing.rs:23-58 | candle-metal-kernels/src/kernels/indexing.rs:72-104 | candle-metal-kernels/src/kernels/indexing.rs:118-151 | candle-metal-kernels/src/kernels/indexing.rs:166-200 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 33 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, 21+ corresponding lines) · ×2
Edited copies of one member (6 members, 21+ corresponding lines) candle-transformers/src/models/mistral.rs:373— candle-transformers/src/models/mistral.rs:373-395 | candle-transformers/src/models/mixtral.rs:414-436 | candle-transformers/src/models/quantized_mistral.rs:263-284 | candle-transformers/src/models/qwen2.rs:275-295 | candle-transformers/src/models/qwen2_moe.rs:409-431 | candle-transformers/src/models/starcoder2.rs:276-298 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 21 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.
Edited copies of one member (6 members, 21+ corresponding lines) candle-core/src/cpu/mod.rs:189— candle-core/src/cpu/mod.rs:189-209 | candle-core/src/cpu/mod.rs:212-232 | candle-core/src/cpu/mod.rs:267-287 | candle-core/src/cpu/mod.rs:290-310 | candle-core/src/cpu/mod.rs:313-333 | candle-core/src/cpu/mod.rs:350-370 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 21 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, 17+ corresponding lines) · ×2
Edited copies of one member (5 members, 17+ corresponding lines) candle-transformers/src/models/glm4_new.rs:308— candle-transformers/src/models/glm4_new.rs:308-324 | candle-transformers/src/models/qwen3.rs:409-433 | candle-transformers/src/models/qwen3_moe.rs:274-294 | candle-transformers/src/models/smol/smollm3.rs:360-388 | candle-transformers/src/models/z_image/text_encoder.rs:375-400 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 17 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.
Edited copies of one member (5 members, 17+ corresponding lines) candle-core/src/accelerate.rs:183— candle-core/src/accelerate.rs:183-199 | candle-core/src/accelerate.rs:217-233 | candle-core/src/mkl.rs:97-113 | candle-core/src/mkl.rs:131-147 | candle-core/src/mkl.rs:165-181 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 17 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 (3 members, 15+ corresponding lines) · ×2
Edited copies of one member (3 members, 15+ corresponding lines) candle-core/src/cpu/avx.rs:243— candle-core/src/cpu/avx.rs:243-257 | candle-core/src/cpu/neon.rs:451-465 | candle-core/src/cpu/simd128.rs:189-203 — 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.
Edited copies of one member (3 members, 15+ corresponding lines) candle-transformers/src/models/efficientvit.rs:108— candle-transformers/src/models/efficientvit.rs:108-122 | candle-transformers/src/models/mobilenetv4.rs:400-414 | candle-transformers/src/models/mobilenetv4.rs:629-645 — 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 copies of one member (5 members, 14+ corresponding lines) · ×2
Edited copies of one member (5 members, 14+ corresponding lines) candle-transformers/src/models/mixformer.rs:423— candle-transformers/src/models/mixformer.rs:423-436 | candle-transformers/src/models/mpt.rs:265-283 | candle-transformers/src/models/phi.rs:344-360 | candle-transformers/src/models/quantized_mixformer.rs:338-351 | candle-transformers/src/models/quantized_mpt.rs:200-218 — These 5 members are one piece of code written 5 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 5 times and the copies will drift further apart.
Edited copies of one member (5 members, 14+ corresponding lines) candle-transformers/src/models/bert.rs:281— candle-transformers/src/models/bert.rs:281-295 | candle-transformers/src/models/bert.rs:370-384 | candle-transformers/src/models/chinese_clip/text_model.rs:187-201 | candle-transformers/src/models/chinese_clip/text_model.rs:351-369 | candle-transformers/src/models/debertav2.rs:741-754 — These 5 members are one piece of code written 5 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 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 11+ corresponding lines) · ×2
Edited copies of one member (4 members, 11+ corresponding lines) candle-core/src/quantized/mod.rs:171— candle-core/src/quantized/mod.rs:171-181 | candle-core/src/quantized/mod.rs:188-202 | candle-core/src/quantized/mod.rs:204-214 | candle-core/src/quantized/mod.rs:221-235 — 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) candle-nn/src/conv.rs:313— candle-nn/src/conv.rs:313-327 | candle-nn/src/conv.rs:392-411 | candle-nn/src/linear.rs:84-94 | candle-transformers/src/models/vgg.rs:133-144 — 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 (3 members, 16+ corresponding lines) · ×2
Edited copies of one member (3 members, 16+ corresponding lines) candle-transformers/src/models/clip/text_model.rs:70— candle-transformers/src/models/clip/text_model.rs:70-85 | candle-transformers/src/models/siglip.rs:670-685 | candle-transformers/src/models/stable_diffusion/clip.rs:154-169 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 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, 16+ corresponding lines) candle-transformers/src/models/qwen3_moe.rs:70— candle-transformers/src/models/qwen3_moe.rs:70-85 | candle-transformers/src/models/smol/smollm3.rs:111-134 | candle-transformers/src/models/z_image/text_encoder.rs:155-174 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 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, 8+ corresponding lines) · ×2
Edited copies of one member (3 members, 8+ corresponding lines) candle-core/src/tensor.rs:788— candle-core/src/tensor.rs:788-795 | candle-core/src/tensor.rs:798-805 | candle-core/src/tensor.rs:808-815 — 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) candle-transformers/src/models/mixformer.rs:365— candle-transformers/src/models/mixformer.rs:365-372 | candle-transformers/src/models/phi.rs:295-302 | candle-transformers/src/models/quantized_mixformer.rs:280-287 — 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 (69 lines × 2) candle-transformers/src/models/paddleocr_vl/mod.rs:307— candle-transformers/src/models/paddleocr_vl/mod.rs:307-375 | candle-transformers/src/models/paddleocr_vl/mod.rs:425-493 — both copies are in the same file, so extract the 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 (69 lines × 2) candle-wasm-examples/t5/src/bin/m-quantized.rs:51— candle-wasm-examples/t5/src/bin/m-quantized.rs:51-119 | candle-wasm-examples/t5/src/bin/m.rs:48-116 — before extracting anything, compare `candle-wasm-examples/t5/src/bin/m-quantized.rs` and `candle-wasm-examples/t5/src/bin/m.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 138 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 `candle-wasm-examples/t5/src/bin/m-quantized.rs:51` 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 (38 lines × 2) candle-onnx/src/eval.rs:1876— candle-onnx/src/eval.rs:1876-1913 | candle-onnx/src/eval.rs:2086-2123 — both copies are in the same file, so extract the 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 `candle-onnx/src/eval.rs:1876` 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 (38 lines × 2) candle-core/src/safetensors.rs:228— candle-core/src/safetensors.rs:228-265 | candle-core/src/safetensors.rs:332-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. Read the line range as the matched WINDOW rather than a finished unit: at `candle-core/src/safetensors.rs:228` 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 (37 lines × 2) candle-core/src/quantized/neon.rs:2351— candle-core/src/quantized/neon.rs:2351-2387 | candle-core/src/quantized/neon.rs:2492-2528 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:2351` 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 (37 lines × 2) candle-transformers/src/models/quantized_glm4.rs:392— candle-transformers/src/models/quantized_glm4.rs:392-428 | candle-transformers/src/models/quantized_qwen3.rs:500-536 — before extracting anything, compare `candle-transformers/src/models/quantized_glm4.rs` and `candle-transformers/src/models/quantized_qwen3.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 111 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 `candle-transformers/src/models/quantized_glm4.rs:392` 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, `candle-transformers/src/models/quantized_glm4.rs:391` calls `Some` and `candle-transformers/src/models/quantized_qwen3.rs:499` 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 (43 lines × 2) candle-transformers/src/models/whisper/audio.rs:18— candle-transformers/src/models/whisper/audio.rs:18-60 | candle-wasm-examples/whisper/src/audio.rs:12-54 — before extracting anything, compare `candle-transformers/src/models/whisper/audio.rs` and `candle-wasm-examples/whisper/src/audio.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. 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 (43 lines × 2) candle-core/src/quantized/k_quants.rs:1235— candle-core/src/quantized/k_quants.rs:1235-1277 | candle-core/src/quantized/k_quants.rs:1333-1375 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/k_quants.rs:1235` 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 (35 lines × 2) candle-core/src/cuda_backend/cudnn.rs:90— candle-core/src/cuda_backend/cudnn.rs:90-124 | candle-core/src/cuda_backend/cudnn.rs:191-225 — both copies are in the same file, so extract the 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 `candle-core/src/cuda_backend/cudnn.rs:90` 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 (35 lines × 2) candle-wasm-examples/yolo/src/worker.rs:49— candle-wasm-examples/yolo/src/worker.rs:49-83 | candle-wasm-examples/yolo/src/worker.rs:128-162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (31 lines × 2) candle-core/src/cpu/avx.rs:261— candle-core/src/cpu/avx.rs:261-291 | candle-core/src/cpu/neon.rs:468-498 — before extracting anything, compare `candle-core/src/cpu/avx.rs` and `candle-core/src/cpu/neon.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 113 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 (31 lines × 2) candle-core/src/quantized/neon.rs:1896— candle-core/src/quantized/neon.rs:1896-1926 | candle-core/src/quantized/neon.rs:2683-2713 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:1896` 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 (24 lines × 3) candle-nn/src/rotary_emb.rs:263— candle-nn/src/rotary_emb.rs:263-286 | candle-nn/src/rotary_emb.rs:556-579 | candle-nn/src/rotary_emb.rs:831-854 — 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 (24 lines × 3) candle-transformers/src/models/chatglm.rs:83— candle-transformers/src/models/chatglm.rs:83-106 | candle-transformers/src/models/codegeex4_9b.rs:95-118 | candle-transformers/src/models/glm4.rs:116-139 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 (22 lines × 4) candle-nn/src/attention/cpu_flash/standard.rs:181— candle-nn/src/attention/cpu_flash/standard.rs:181-202 | candle-nn/src/attention/cpu_flash/standard.rs:282-303 | candle-nn/src/attention/cpu_flash/standard.rs:357-378 | candle-nn/src/attention/cpu_flash/standard.rs:464-485 — 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 `candle-nn/src/attention/cpu_flash/standard.rs:181` 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 × 4) candle-transformers/src/models/quantized_rwkv_v5.rs:142— candle-transformers/src/models/quantized_rwkv_v5.rs:142-163 | candle-transformers/src/models/quantized_rwkv_v6.rs:189-210 | candle-transformers/src/models/rwkv_v5.rs:193-214 | candle-transformers/src/models/rwkv_v6.rs:167-188 — before extracting anything, compare `candle-transformers/src/models/quantized_rwkv_v5.rs` and `candle-transformers/src/models/quantized_rwkv_v6.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 168 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 `candle-transformers/src/models/quantized_rwkv_v5.rs:142` 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 (36 lines × 2) candle-transformers/src/models/flux/model.rs:542— candle-transformers/src/models/flux/model.rs:542-577 | candle-transformers/src/models/flux/quantized_model.rs:381-416 — before extracting anything, compare `candle-transformers/src/models/flux/model.rs` and `candle-transformers/src/models/flux/quantized_model.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 209 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 `candle-transformers/src/models/flux/model.rs:542` 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 (36 lines × 2) candle-transformers/src/models/flux/model.rs:404— candle-transformers/src/models/flux/model.rs:404-439 | candle-transformers/src/models/flux/quantized_model.rs:243-278 — before extracting anything, compare `candle-transformers/src/models/flux/model.rs` and `candle-transformers/src/models/flux/quantized_model.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 209 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 (21 lines × 4) candle-core/src/quantized/neon.rs:603— candle-core/src/quantized/neon.rs:603-623 | candle-core/src/quantized/neon.rs:764-784 | candle-core/src/quantized/neon.rs:2765-2785 | candle-core/src/quantized/neon.rs:3054-3074 — 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 `candle-core/src/quantized/neon.rs:603` 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, `candle-core/src/quantized/neon.rs:601` calls `vdupq_n_u8` and `candle-core/src/quantized/neon.rs:762` 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 × 4) candle-core/src/quantized/neon.rs:696— candle-core/src/quantized/neon.rs:696-716 | candle-core/src/quantized/neon.rs:869-889 | candle-core/src/quantized/neon.rs:2987-3007 | candle-core/src/quantized/neon.rs:3129-3149 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (28 lines × 2) candle-transformers/src/models/whisper/model.rs:240— candle-transformers/src/models/whisper/model.rs:240-267 | candle-transformers/src/models/whisper/quantized_model.rs:236-263 — before extracting anything, compare `candle-transformers/src/models/whisper/model.rs` and `candle-transformers/src/models/whisper/quantized_model.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 201 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 (28 lines × 2) candle-examples/src/chat_template.rs:196— candle-examples/src/chat_template.rs:196-223 | candle-wasm-examples/chat-template/src/lib.rs:251-278 — before extracting anything, compare `candle-examples/src/chat_template.rs` and `candle-wasm-examples/chat-template/src/lib.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. 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 (18–20 lines × 2) candle-core/src/quantized/repack_x86.rs:101— candle-core/src/quantized/repack_x86.rs:101-120 | candle-core/src/quantized/repack_x86.rs:628-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 `candle-core/src/quantized/repack_x86.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.
Duplicated block (18–20 lines × 2) candle-transformers/src/models/mixtral.rs:337— candle-transformers/src/models/mixtral.rs:337-354 | candle-transformers/src/models/quantized_llama.rs:120-139 — 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 `candle-transformers/src/models/mixtral.rs:337` 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 after the matched lines, `candle-transformers/src/models/quantized_llama.rs:140` calls `Mlp`, `forward` and `candle-transformers/src/models/mixtral.rs:355` 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 (19 lines × 3) candle-transformers/src/models/chatglm.rs:430— candle-transformers/src/models/chatglm.rs:430-448 | candle-transformers/src/models/codegeex4_9b.rs:451-469 | candle-transformers/src/models/glm4.rs:472-490 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 (19 lines × 3) candle-nn/src/rotary_emb.rs:85— candle-nn/src/rotary_emb.rs:85-103 | candle-nn/src/rotary_emb.rs:390-408 | candle-nn/src/rotary_emb.rs:664-682 — 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 `candle-nn/src/rotary_emb.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 (16–18 lines × 2) candle-transformers/src/models/fastvit.rs:260— candle-transformers/src/models/fastvit.rs:260-275 | candle-transformers/src/models/mobileone.rs:191-208 — before extracting anything, compare `candle-transformers/src/models/fastvit.rs` and `candle-transformers/src/models/mobileone.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 54 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 `candle-transformers/src/models/mobileone.rs:191` 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 (16–18 lines × 2) candle-transformers/src/models/quantized_glm4.rs:438— candle-transformers/src/models/quantized_glm4.rs:438-455 | candle-transformers/src/models/quantized_qwen3.rs:546-561 — before extracting anything, compare `candle-transformers/src/models/quantized_glm4.rs` and `candle-transformers/src/models/quantized_qwen3.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 111 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 `candle-transformers/src/models/quantized_glm4.rs:438` 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) candle-transformers/src/models/segment_anything/sam.rs:66— candle-transformers/src/models/segment_anything/sam.rs:66-83 | candle-transformers/src/models/segment_anything/sam.rs:98-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. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/segment_anything/sam.rs:66` 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 (17–18 lines × 2) candle-core/src/backprop.rs:296— candle-core/src/backprop.rs:296-313 | candle-core/src/backprop.rs:326-342 — both copies are in the same file, so extract the 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 `candle-core/src/backprop.rs:296` 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, `candle-core/src/backprop.rs:314` calls `Err` and `candle-core/src/backprop.rs:343` 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 (16–17 lines × 4) candle-transformers/src/models/glm4_new.rs:333— candle-transformers/src/models/glm4_new.rs:333-348 | candle-transformers/src/models/quantized_glm4.rs:432-447 | candle-transformers/src/models/qwen3_moe.rs:303-318 | candle-transformers/src/models/smol/smollm3.rs:397-413 — before extracting anything, compare `candle-transformers/src/models/glm4_new.rs` and `candle-transformers/src/models/quantized_glm4.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 78 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 `candle-transformers/src/models/glm4_new.rs:333` 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, `candle-transformers/src/models/quantized_glm4.rs:431` calls `enter` and `candle-transformers/src/models/glm4_new.rs:332` 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 (16–17 lines × 4) candle-transformers/src/models/paddleocr_vl/mod.rs:526— candle-transformers/src/models/paddleocr_vl/mod.rs:526-541 | candle-transformers/src/models/paddleocr_vl/mod.rs:586-602 | candle-transformers/src/models/paddleocr_vl/mod.rs:651-666 | candle-transformers/src/models/paddleocr_vl/mod.rs:856-871 — 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 `candle-transformers/src/models/paddleocr_vl/mod.rs:526` 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, `candle-transformers/src/models/paddleocr_vl/mod.rs:873` calls `apply_repetition_penalty` and `candle-transformers/src/models/paddleocr_vl/mod.rs:543` 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 (16 lines × 4) candle-transformers/src/models/paddleocr_vl/mod.rs:543— candle-transformers/src/models/paddleocr_vl/mod.rs:543-558 | candle-transformers/src/models/paddleocr_vl/mod.rs:604-619 | candle-transformers/src/models/paddleocr_vl/mod.rs:668-683 | candle-transformers/src/models/paddleocr_vl/mod.rs:874-889 — 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 `candle-transformers/src/models/paddleocr_vl/mod.rs:543` 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, `candle-transformers/src/models/paddleocr_vl/mod.rs:873` calls `apply_repetition_penalty` and `candle-transformers/src/models/paddleocr_vl/mod.rs:542` 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 (16 lines × 4) candle-flash-attn-v3/src/lib.rs:47— candle-flash-attn-v3/src/lib.rs:47-62 | candle-flash-attn-v3/src/lib.rs:481-496 | candle-flash-attn/src/lib.rs:38-53 | candle-flash-attn/src/lib.rs:520-535 — before extracting anything, compare `candle-flash-attn-v3/src/lib.rs` and `candle-flash-attn/src/lib.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 174 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 3) candle-core/src/quantized/fast_mmvq.rs:237— candle-core/src/quantized/fast_mmvq.rs:237-252 | candle-core/src/quantized/fast_mmvq.rs:271-286 | candle-core/src/quantized/fast_mmvq.rs:305-320 — 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 `candle-core/src/quantized/fast_mmvq.rs:237` 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 × 3) candle-transformers/src/models/mistral.rs:49— candle-transformers/src/models/mistral.rs:49-64 | candle-transformers/src/models/mistral.rs:69-84 | candle-transformers/src/models/mistral.rs:88-103 — 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 (2–16 lines × 4) candle-transformers/src/models/quantized_rwkv_v5.rs:132— candle-transformers/src/models/quantized_rwkv_v5.rs:132-147 | candle-transformers/src/models/quantized_rwkv_v6.rs:183-184 | candle-transformers/src/models/rwkv_v5.rs:183-198 | candle-transformers/src/models/rwkv_v6.rs:161-162 — before extracting anything, compare `candle-transformers/src/models/quantized_rwkv_v5.rs` and `candle-transformers/src/models/quantized_rwkv_v6.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 168 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-transformers/src/models/quantized_rwkv_v5.rs:132` calls `reshape`, `transpose` and `candle-transformers/src/models/quantized_rwkv_v6.rs:183` 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–16 lines × 4) candle-transformers/src/models/quantized_rwkv_v5.rs:183— candle-transformers/src/models/quantized_rwkv_v5.rs:183-198 | candle-transformers/src/models/quantized_rwkv_v6.rs:230-245 | candle-transformers/src/models/rwkv_v5.rs:233-234 | candle-transformers/src/models/rwkv_v6.rs:207-208 — before extracting anything, compare `candle-transformers/src/models/quantized_rwkv_v5.rs` and `candle-transformers/src/models/quantized_rwkv_v6.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 168 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 `candle-transformers/src/models/quantized_rwkv_v5.rs:183` 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, `candle-transformers/src/models/quantized_rwkv_v5.rs:183` calls `linear`, `pp` and `candle-transformers/src/models/rwkv_v5.rs:233` 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 (13–14 lines × 5) candle-transformers/src/models/csm.rs:196— candle-transformers/src/models/csm.rs:196-208 | candle-transformers/src/models/helium.rs:203-215 | candle-transformers/src/models/mistral.rs:252-264 | candle-transformers/src/models/nvembed_v2/embedding.rs:134-147 | candle-transformers/src/models/quantized_mistral.rs:151-163 — before extracting anything, compare `candle-transformers/src/models/csm.rs` and `candle-transformers/src/models/helium.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 104 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 (13–14 lines × 5) candle-transformers/src/models/glm4_new.rs:337— candle-transformers/src/models/glm4_new.rs:337-350 | candle-transformers/src/models/quantized_glm4.rs:436-449 | candle-transformers/src/models/quantized_qwen3.rs:544-556 | candle-transformers/src/models/qwen3_moe.rs:307-320 | candle-transformers/src/models/smol/smollm3.rs:402-415 — before extracting anything, compare `candle-transformers/src/models/glm4_new.rs` and `candle-transformers/src/models/quantized_glm4.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 78 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 `candle-transformers/src/models/glm4_new.rs:337` 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 × 4) candle-transformers/src/models/mixformer.rs:36— candle-transformers/src/models/mixformer.rs:36-49 | candle-transformers/src/models/mixformer.rs:52-65 | candle-transformers/src/models/mixformer.rs:68-81 | candle-transformers/src/models/mixformer.rs:85-98 — 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. 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 × 4) candle-transformers/src/models/granite.rs:288— candle-transformers/src/models/granite.rs:288-301 | candle-transformers/src/models/lfm2.rs:381-394 | candle-transformers/src/models/llama.rs:334-347 | candle-transformers/src/models/voxtral/voxtral_llama.rs:248-261 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/lfm2.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 52 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 `candle-transformers/src/models/granite.rs:288` 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 (13 lines × 5) candle-transformers/src/models/mixtral.rs:161— candle-transformers/src/models/mixtral.rs:161-173 | candle-transformers/src/models/quantized_mistral.rs:126-138 | candle-transformers/src/models/qwen2.rs:139-151 | candle-transformers/src/models/qwen2_moe.rs:146-158 | candle-transformers/src/models/yi.rs:178-190 — before extracting anything, compare `candle-transformers/src/models/mixtral.rs` and `candle-transformers/src/models/quantized_mistral.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 193 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 `candle-transformers/src/models/mixtral.rs:161` 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 × 5) candle-transformers/src/models/stable_diffusion/mod.rs:111— candle-transformers/src/models/stable_diffusion/mod.rs:111-123 | candle-transformers/src/models/stable_diffusion/mod.rs:186-198 | candle-transformers/src/models/stable_diffusion/mod.rs:269-281 | candle-transformers/src/models/stable_diffusion/mod.rs:341-353 | candle-transformers/src/models/stable_diffusion/mod.rs:436-448 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-transformers/src/models/stable_diffusion/mod.rs:433` calls `default` and `candle-transformers/src/models/stable_diffusion/mod.rs:110` 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 (11–13 lines × 2) candle-transformers/src/models/quantized_gemma3.rs:417— candle-transformers/src/models/quantized_gemma3.rs:417-429 | candle-transformers/src/models/quantized_phi.rs:252-262 — before extracting anything, compare `candle-transformers/src/models/quantized_gemma3.rs` and `candle-transformers/src/models/quantized_phi.rs` as WHOLE FILES: this scan already matched 3 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 `candle-transformers/src/models/quantized_gemma3.rs:417` 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–13 lines × 2) candle-transformers/src/models/quantized_rwkv_v5.rs:65— candle-transformers/src/models/quantized_rwkv_v5.rs:65-77 | candle-transformers/src/models/quantized_rwkv_v6.rs:80-90 — before extracting anything, compare `candle-transformers/src/models/quantized_rwkv_v5.rs` and `candle-transformers/src/models/quantized_rwkv_v6.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 168 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 `candle-transformers/src/models/quantized_rwkv_v5.rs:65` 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, `candle-transformers/src/models/quantized_rwkv_v6.rs:91` calls `get`, `dequantize`, `device` and `candle-transformers/src/models/quantized_rwkv_v5.rs:78` 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 (11–12 lines × 3) candle-core/src/cpu/avx.rs:244— candle-core/src/cpu/avx.rs:244-255 | candle-core/src/cpu/neon.rs:452-463 | candle-core/src/cpu/simd128.rs:190-200 — before extracting anything, compare `candle-core/src/cpu/avx.rs` and `candle-core/src/cpu/neon.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 113 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 `candle-core/src/cpu/avx.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. 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 × 3) candle-core/src/cpu_backend/conv2d.rs:147— candle-core/src/cpu_backend/conv2d.rs:147-157 | candle-core/src/cpu_backend/conv2d.rs:294-304 | candle-core/src/cpu_backend/mod.rs:1338-1349 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-core/src/cpu_backend/conv2d.rs:293` calls `zero` and `candle-core/src/cpu_backend/mod.rs:1337` 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–12 lines × 4) candle-transformers/src/models/llama2_c.rs:200— candle-transformers/src/models/llama2_c.rs:200-211 | candle-transformers/src/models/quantized_llama2_c.rs:87-98 | candle-wasm-examples/llama2-c/src/model.rs:118-120 | candle-wasm-examples/llama2-c/src/model.rs:125-127 — before extracting anything, compare `candle-transformers/src/models/llama2_c.rs` and `candle-transformers/src/models/quantized_llama2_c.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 141 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `candle-transformers/src/models/llama2_c.rs:211` calls `matmul`, `contiguous`, `transpose` and `candle-wasm-examples/llama2-c/src/model.rs:127` 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 (3–12 lines × 4) candle-transformers/src/models/quantized_rwkv_v5.rs:122— candle-transformers/src/models/quantized_rwkv_v5.rs:122-124 | candle-transformers/src/models/quantized_rwkv_v6.rs:164-175 | candle-transformers/src/models/rwkv_v5.rs:173-175 | candle-transformers/src/models/rwkv_v6.rs:142-153 — before extracting anything, compare `candle-transformers/src/models/quantized_rwkv_v5.rs` and `candle-transformers/src/models/quantized_rwkv_v6.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 168 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 (10 lines × 5) candle-transformers/src/models/gemma.rs:250— candle-transformers/src/models/gemma.rs:250-259 | candle-transformers/src/models/gemma2.rs:250-259 | candle-transformers/src/models/gemma3.rs:273-282 | candle-transformers/src/models/gemma4/text.rs:367-376 | candle-transformers/src/models/phi3.rs:252-261 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 240 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 `candle-transformers/src/models/gemma.rs:250` 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 × 5) candle-transformers/src/models/mixtral.rs:91— candle-transformers/src/models/mixtral.rs:91-100 | candle-transformers/src/models/recurrent_gemma.rs:119-128 | candle-transformers/src/models/stable_lm.rs:101-110 | candle-transformers/src/models/starcoder2.rs:61-70 | candle-transformers/src/models/yi.rs:92-101 — before extracting anything, compare `candle-transformers/src/models/mixtral.rs` and `candle-transformers/src/models/recurrent_gemma.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 53 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 `candle-transformers/src/models/mixtral.rs:91` 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 lines × 4) candle-transformers/src/models/quantized_rwkv_v5.rs:291— candle-transformers/src/models/quantized_rwkv_v5.rs:291-302 | candle-transformers/src/models/quantized_rwkv_v6.rs:338-349 | candle-transformers/src/models/rwkv_v5.rs:338-349 | candle-transformers/src/models/rwkv_v6.rs:312-323 — before extracting anything, compare `candle-transformers/src/models/quantized_rwkv_v5.rs` and `candle-transformers/src/models/quantized_rwkv_v6.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 168 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 × 4) candle-core/src/quantized/cuda.rs:714— candle-core/src/quantized/cuda.rs:714-725 | candle-core/src/quantized/cuda.rs:742-753 | candle-core/src/quantized/cuda.rs:771-782 | candle-core/src/quantized/cuda.rs:795-806 — 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 `candle-core/src/quantized/cuda.rs:714` 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–10 lines × 3) candle-transformers/src/models/gemma.rs:356— candle-transformers/src/models/gemma.rs:356-364 | candle-transformers/src/models/gemma2.rs:375-383 | candle-transformers/src/models/gemma3.rs:454-463 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 240 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 `candle-transformers/src/models/gemma.rs:356` 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–10 lines × 3) candle-transformers/src/models/quantized_gemma3.rs:315— candle-transformers/src/models/quantized_gemma3.rs:315-324 | candle-transformers/src/models/quantized_llama.rs:431-439 | candle-transformers/src/models/quantized_qwen2.rs:203-211 — before extracting anything, compare `candle-transformers/src/models/quantized_gemma3.rs` and `candle-transformers/src/models/quantized_llama.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 74 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 `candle-transformers/src/models/quantized_gemma3.rs:315` 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–9 lines × 4) candle-transformers/src/models/paddleocr_vl/mod.rs:223— candle-transformers/src/models/paddleocr_vl/mod.rs:223-231 | candle-transformers/src/models/paddleocr_vl/mod.rs:370-376 | candle-transformers/src/models/paddleocr_vl/mod.rs:488-494 | candle-transformers/src/models/paddleocr_vl/mod.rs:786-793 — 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 `candle-transformers/src/models/paddleocr_vl/mod.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 (7–9 lines × 4) candle-transformers/src/models/gemma3.rs:416— candle-transformers/src/models/gemma3.rs:416-422 | candle-transformers/src/models/gemma4/text.rs:504-510 | candle-transformers/src/models/quantized_gemma3.rs:169-175 | candle-transformers/src/models/qwen3_vl/mod.rs:40-48 — before extracting anything, compare `candle-transformers/src/models/gemma3.rs` and `candle-transformers/src/models/gemma4/text.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 165 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/qwen3_vl/mod.rs:40` 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 (7–9 lines × 3) candle-core/src/cpu_backend/mod.rs:2859— candle-core/src/cpu_backend/mod.rs:2859-2865 | candle-core/src/cuda_backend/mod.rs:1864-1871 | candle-core/src/cuda_backend/mod.rs:2047-2055 — `candle-core/src/cpu_backend/mod.rs` and `candle-core/src/cuda_backend/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 65 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `candle-core/src/cpu_backend/mod.rs:2859` 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 (7–9 lines × 3) candle-transformers/src/models/chatglm.rs:124— candle-transformers/src/models/chatglm.rs:124-130 | candle-transformers/src/models/codegeex4_9b.rs:137-145 | candle-transformers/src/models/glm4.rs:158-166 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 `candle-transformers/src/models/codegeex4_9b.rs:137` 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) candle-transformers/src/models/lfm2.rs:466— candle-transformers/src/models/lfm2.rs:466-474 | candle-transformers/src/models/quantized_lfm2.rs:207-214 — 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 `candle-transformers/src/models/lfm2.rs:466` 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) candle-transformers/src/models/paddleocr_vl/text.rs:433— candle-transformers/src/models/paddleocr_vl/text.rs:433-440 | candle-transformers/src/models/paddleocr_vl/text.rs:558-566 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/paddleocr_vl/text.rs:433` 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) candle-transformers/src/models/pixtral/vision_model.rs:122— candle-transformers/src/models/pixtral/vision_model.rs:122-129 | candle-transformers/src/models/siglip.rs:426-432 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-transformers/src/models/pixtral/vision_model.rs:121` calls `apply_rotary_emb_qkv` and `candle-transformers/src/models/siglip.rs:424` 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–8 lines × 2) candle-transformers/src/models/resnet.rs:47— candle-transformers/src/models/resnet.rs:47-53 | candle-transformers/src/models/resnet.rs:156-163 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/resnet.rs:47` 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 after the matched lines, `candle-transformers/src/models/resnet.rs:163` calls `apply_t`, `relu` and `candle-transformers/src/models/resnet.rs:53` 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 × 5) candle-nn/src/attention/cpu_flash/causal.rs:261— candle-nn/src/attention/cpu_flash/causal.rs:261-267 | candle-nn/src/attention/cpu_flash/causal.rs:352-358 | candle-nn/src/attention/cpu_flash/causal.rs:439-445 | candle-nn/src/attention/cpu_flash/causal.rs:666-672 | candle-nn/src/attention/cpu_flash/causal.rs:768-774 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 5) candle-transformers/src/models/granite.rs:233— candle-transformers/src/models/granite.rs:233-239 | candle-transformers/src/models/granitemoehybrid.rs:282-288 | candle-transformers/src/models/lfm2.rs:331-337 | candle-transformers/src/models/llama.rs:279-285 | candle-transformers/src/models/voxtral/voxtral_llama.rs:193-199 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 (4–6 lines × 3) candle-core/src/cpu_backend/conv2d.rs:140— candle-core/src/cpu_backend/conv2d.rs:140-145 | candle-core/src/cpu_backend/conv2d.rs:287-292 | candle-core/src/cpu_backend/mod.rs:1324-1327 — 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 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, `candle-core/src/cpu_backend/conv2d.rs:287` calls `zero` and `candle-core/src/cpu_backend/mod.rs:1324` 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 (4–6 lines × 3) candle-transformers/src/models/quantized_glm4.rs:369— candle-transformers/src/models/quantized_glm4.rs:369-374 | candle-transformers/src/models/quantized_qwen3.rs:469-474 | candle-transformers/src/models/quantized_qwen3_moe.rs:251-254 — before extracting anything, compare `candle-transformers/src/models/quantized_glm4.rs` and `candle-transformers/src/models/quantized_qwen3.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 111 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 `candle-transformers/src/models/quantized_qwen3_moe.rs:251` 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, `candle-transformers/src/models/quantized_glm4.rs:369` calls `metadata`, `get` and `candle-transformers/src/models/quantized_qwen3_moe.rs:251` 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 (3–6 lines × 3) candle-transformers/src/models/lfm2.rs:285— candle-transformers/src/models/lfm2.rs:285-287 | candle-transformers/src/models/qwen2.rs:131-136 | candle-transformers/src/models/qwen2_moe.rs:138-143 — before extracting anything, compare `candle-transformers/src/models/qwen2.rs` and `candle-transformers/src/models/qwen2_moe.rs` as WHOLE FILES: this scan already matched 30 separate duplicated blocks between them, totalling at least 267 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 (3–6 lines × 3) candle-transformers/src/models/vgg.rs:148— candle-transformers/src/models/vgg.rs:148-150 | candle-transformers/src/models/vgg.rs:176-181 | candle-transformers/src/models/vgg.rs:223-228 — 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 `candle-transformers/src/models/vgg.rs:148` 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, `candle-transformers/src/models/vgg.rs:175` calls `conv2d_block` and `candle-transformers/src/models/vgg.rs:148` 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 (4–5 lines × 3) candle-core/src/quantized/k_quants.rs:902— candle-core/src/quantized/k_quants.rs:902-905 | candle-core/src/quantized/k_quants.rs:1565-1569 | candle-core/src/quantized/k_quants.rs:1831-1835 — 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 `candle-core/src/quantized/k_quants.rs:902` 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 (4–5 lines × 3) candle-core/src/quantized/neon.rs:1296— candle-core/src/quantized/neon.rs:1296-1299 | candle-core/src/quantized/neon.rs:1604-1608 | candle-core/src/quantized/neon.rs:1722-1726 — 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 `candle-core/src/quantized/neon.rs:1296` 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 (10 lines × 6) candle-metal-kernels/src/kernels/reduce.rs:141— candle-metal-kernels/src/kernels/reduce.rs:141-153 | candle-metal-kernels/src/kernels/reduce.rs:197-209 | candle-metal-kernels/src/kernels/reduce.rs:258-270 | candle-metal-kernels/src/kernels/reduce.rs:321-330 | candle-metal-kernels/src/kernels/reduce.rs:363-372 | candle-metal-kernels/src/kernels/reduce.rs:406-415 — 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 `candle-metal-kernels/src/kernels/reduce.rs:141` 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 × 6) candle-core/src/storage.rs:397— candle-core/src/storage.rs:397-406 | candle-core/src/storage.rs:428-437 | candle-core/src/storage.rs:459-468 | candle-core/src/storage.rs:490-499 | candle-core/src/storage.rs:764-773 | candle-core/src/storage.rs:795-804 — 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 `candle-core/src/storage.rs:397` 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 × 7) candle-onnx/src/eval.rs:341— candle-onnx/src/eval.rs:341-345 | candle-onnx/src/eval.rs:347-351 | candle-onnx/src/eval.rs:353-357 | candle-onnx/src/eval.rs:813-818 | candle-onnx/src/eval.rs:821-826 | candle-onnx/src/eval.rs:829-834 | candle-onnx/src/eval.rs:2421-2426 — 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 `candle-onnx/src/eval.rs:341` 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 × 7) candle-nn/src/rotary_emb.rs:584— candle-nn/src/rotary_emb.rs:584-588 | candle-transformers/src/models/mixtral.rs:75-79 | candle-transformers/src/models/paddleocr_vl/vision.rs:279-283 | candle-transformers/src/models/qwen3_vl/vision.rs:84-88 | candle-transformers/src/models/recurrent_gemma.rs:100-104 | candle-transformers/src/models/starcoder2.rs:45-49 | candle-transformers/src/models/yi.rs:76-80 — before extracting anything, compare `candle-transformers/src/models/mixtral.rs` and `candle-transformers/src/models/recurrent_gemma.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 53 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 (3–5 lines × 4) candle-core/src/cuda_backend/mod.rs:544— candle-core/src/cuda_backend/mod.rs:544-546 | candle-core/src/cuda_backend/mod.rs:597-601 | candle-core/src/cuda_backend/mod.rs:651-655 | candle-core/src/cuda_backend/mod.rs:703-707 — 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 `candle-core/src/cuda_backend/mod.rs:544` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `candle-core/src/cuda_backend/mod.rs:602` calls `dims`, `iter`, `product` and `candle-core/src/cuda_backend/mod.rs:546` 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) candle-core/src/cpu_backend/mod.rs:1425— candle-core/src/cpu_backend/mod.rs:1425-1429 | candle-core/src/cpu_backend/mod.rs:1433-1437 | candle-core/src/cuda_backend/mod.rs:1462-1464 | candle-core/src/cuda_backend/mod.rs:1474-1476 — `candle-core/src/cpu_backend/mod.rs` and `candle-core/src/cuda_backend/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 65 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `candle-core/src/cpu_backend/mod.rs:1425` 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.
AC3 · Page structure· Page without a main landmark · ×1
Page without a main landmark candle-wasm-examples/quant-qwen3/index.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
AC3 · Page structure· Heading level jumps from h1 to h3 · ×1
Heading level jumps from h1 to h3 candle-wasm-examples/quant-qwen3/index.html:307— Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
Low contrast colour pair in CSS (3.7:1) candle-wasm-examples/quant-qwen3/index.html:110— `.thinking-toggle` sets color: white on background-color: #667eea — 3.7:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
candle_onnx::eval::simple_eval_ (cyclomatic 345) candle-onnx/src/eval.rs:250— candle_onnx::eval::simple_eval_ has cyclomatic complexity 345 (threshold 15). Of this number, 344 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.
MetalStorage::reduce_op (cyclomatic 72) candle-core/src/metal_backend/mod.rs:298— MetalStorage::reduce_op has cyclomatic complexity 72 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever 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: MetalStorage::unary_impl (cyclomatic 111) 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.
Stack::read (cyclomatic 44) candle-core/src/pickle.rs:437— Stack::read 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.
Header::parse (cyclomatic 30) candle-core/src/npy.rs:109— Header::parse 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.
CpuStorage::concat (cyclomatic 28) candle-core/src/cpu_backend/mod.rs:1756— CpuStorage::concat 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. This is NOT this file's highest cyclomatic complexity: CpuStorage::to_dtype (cyclomatic 102) 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.
Sdpa::metal_fwd (cyclomatic 28) candle-nn/src/ops.rs:1033— Sdpa::metal_fwd 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.
VoxtralForConditionalGeneration::generate (cyclomatic 26) candle-transformers/src/models/voxtral/model.rs:873— VoxtralForConditionalGeneration::generate 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.
TensorFormatter::fmt_tensor (cyclomatic 24) candle-core/src/display.rs:203— TensorFormatter::fmt_tensor 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.
Qwen3VLModel::forward (cyclomatic 24) candle-transformers/src/models/qwen3_vl/mod.rs:57— Qwen3VLModel::forward 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.
CudaStorage::copy_strided_src (cyclomatic 22) candle-core/src/cuda_backend/mod.rs:2362— CudaStorage::copy_strided_src 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.
QMetalStorage::indexed_moe_forward (cyclomatic 21) candle-core/src/quantized/metal/moe.rs:9— QMetalStorage::indexed_moe_forward has cyclomatic complexity 21 (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.
Tokenizer::from_gguf (cyclomatic 20) candle-core/src/quantized/tokenizer.rs:203— Tokenizer::from_gguf 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.
PackedKind::select (cyclomatic 19) candle-core/src/quantized/repack.rs:287— PackedKind::select has cyclomatic complexity 19 (threshold 15). 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.
stub.pyi_file (cyclomatic 18) candle-pyo3/stub.py:87— stub.pyi_file 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.
UpsampleBilinear2D::f (cyclomatic 17) candle-core/src/cpu_backend/mod.rs:551— UpsampleBilinear2D::f has cyclomatic complexity 17 (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: CpuStorage::to_dtype (cyclomatic 102) 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.
BlockQ3K::from_float (cyclomatic 17) candle-core/src/quantized/k_quants.rs:1197— BlockQ3K::from_float 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.
RotaryEmb::cpu_fwd (cyclomatic 16) candle-nn/src/rotary_emb.rs:319— RotaryEmb::cpu_fwd has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to one function item inside it that branches (inner). 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.
LLaVA::prepare_inputs_labels_for_multimodal (cyclomatic 16) candle-transformers/src/models/llava/mod.rs:238— LLaVA::prepare_inputs_labels_for_multimodal 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.
Quantile::add (cyclomatic 16) candle-transformers/src/models/stable_diffusion/uni_pc.rs:815— Quantile::add 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.
Hotspot: candle-onnx/src/eval.rs candle-onnx/src/eval.rs:250— candle-onnx/src/eval.rs changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 345 in candle_onnx::eval::simple_eval_ at line 250. 2 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-03..2026-11-01, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-03 17:36:13 -05:00' --until='2026-11-01 17:36:13 -05:00' --full-history --no-merges -- candle-onnx/src/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.
FixmeComment candle-nn/src/ops.rs:63— // FIXME: using `candle::map_dtype` causes compilation errors. — 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.
candle_onnx::eval::simple_eval_ (cognitive 754) candle-onnx/src/eval.rs:250— candle_onnx::eval::simple_eval_ has cognitive complexity 754 (threshold 15). Drivers by points: if/else 198 (513 pts), match/switch 54 (144 pts), loops 27 (83 pts), boolean chains 14 (nesting depth added 461). Of this number, 751 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
VoxtralForConditionalGeneration::generate (cognitive 68) candle-transformers/src/models/voxtral/model.rs:873— VoxtralForConditionalGeneration::generate has cognitive complexity 68 (threshold 15). Drivers by points: if/else 23 (40 pts), match/switch 6 (22 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TensorFormatter::fmt_tensor (cognitive 56) candle-core/src/display.rs:203— TensorFormatter::fmt_tensor has cognitive complexity 56 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 6 (18 pts), match/switch 4 (7 pts), boolean chains 2 (nesting depth added 33). 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.
Qwen3VLModel::forward (cognitive 44) candle-transformers/src/models/qwen3_vl/mod.rs:57— Qwen3VLModel::forward has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 7 (16 pts), boolean chains 1, match/switch 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.
ConvTranspose2D::f (cognitive 39) candle-core/src/cpu_backend/mod.rs:1318— ConvTranspose2D::f has cognitive complexity 39 (threshold 15). Drivers by points: loops 9 (25 pts), if/else 2 (12 pts), boolean chains 2 (nesting depth added 26). 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.
Im2Col::f (cognitive 38) candle-core/src/cpu_backend/mod.rs:1159— Im2Col::f has cognitive complexity 38 (threshold 15). Drivers by points: loops 6 (21 pts), if/else 2 (13 pts), boolean chains 4 (nesting depth added 26). 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.
ScatteredCacheBuilder::indices_and_mask (cognitive 38) candle-nn/src/kv_cache.rs:503— ScatteredCacheBuilder::indices_and_mask has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 5 (15 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.
Sdpa::metal_fwd (cognitive 38) candle-nn/src/ops.rs:1033— Sdpa::metal_fwd has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 3 (7 pts), boolean chains 6, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReduceIndex::fold_impl (cognitive 37) candle-core/src/cpu_backend/mod.rs:204— ReduceIndex::fold_impl has cognitive complexity 37 (threshold 15). Drivers by points: loops 6 (19 pts), if/else 5 (17 pts), match/switch 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.
LLaVA::prepare_inputs_labels_for_multimodal (cognitive 37) candle-transformers/src/models/llava/mod.rs:238— LLaVA::prepare_inputs_labels_for_multimodal has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (32 pts), loops 4 (5 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.
UpsampleBilinear2D::f (cognitive 34) candle-core/src/cpu_backend/mod.rs:551— UpsampleBilinear2D::f has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (21 pts), loops 6 (12 pts), boolean chains 1 (nesting depth added 11). 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.
Tokenizer::from_gguf (cognitive 33) candle-core/src/quantized/tokenizer.rs:203— Tokenizer::from_gguf has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (29 pts), loops 2 (3 pts), boolean chains 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.
CudaStorage::copy_strided_src (cognitive 32) candle-core/src/cuda_backend/mod.rs:2362— CudaStorage::copy_strided_src has cognitive complexity 32 (threshold 15). Drivers by points: if/else 21 (31 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.
NdIter::new (cognitive 32) candle-core/src/nditer.rs:46— NdIter::new has cognitive complexity 32 (threshold 15). Drivers by points: loops 8 (17 pts), if/else 8 (15 pts) (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.
CpuStorage::concat (cognitive 29) candle-core/src/cpu_backend/mod.rs:1756— CpuStorage::concat has cognitive complexity 29 (threshold 15). Drivers by points: match/switch 15 (29 pts) (nesting depth added 14). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
IndexAdd::f (cognitive 29) candle-core/src/cpu_backend/mod.rs:886— IndexAdd::f has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 5 (14 pts), match/switch 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.
stub.pyi_file (cognitive 29) candle-pyo3/stub.py:87— stub.pyi_file has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 4 (10 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.
MaxPool2D::f (cognitive 28) candle-core/src/cpu_backend/mod.rs:436— MaxPool2D::f has cognitive complexity 28 (threshold 15). Drivers by points: loops 6 (21 pts), if/else 1 (7 pts) (nesting depth added 21). 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.
Header::parse (cognitive 28) candle-core/src/npy.rs:109— Header::parse has cognitive complexity 28 (threshold 15). Drivers by points: match/switch 7 (12 pts), if/else 5 (9 pts), boolean chains 5, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Stack::read (cognitive 28) candle-core/src/pickle.rs:437— Stack::read has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 3 (7 pts), match/switch 2 (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.
AttentionWeights::forward (cognitive 28) candle-transformers/src/models/quantized_qwen3.rs:238— AttentionWeights::forward has cognitive complexity 28 (threshold 15). Drivers by points: match/switch 5 (15 pts), if/else 7 (11 pts), boolean chains 2 (nesting depth added 14). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
BarrierPool::new (cognitive 27) candle-core/src/utils.rs:115— BarrierPool::new has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 5 (10 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.
FloatFormatter::new (cognitive 26) candle-core/src/display.rs:310— FloatFormatter::new has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (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.
RotaryEmb::cpu_fwd::inner (cognitive 26) candle-nn/src/rotary_emb.rs:328— RotaryEmb::cpu_fwd::inner has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (10 pts), match/switch 3, 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.
QuantizedAttention::forward (cognitive 25) candle-transformers/src/models/smol/quantized_smollm3.rs:391— QuantizedAttention::forward has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 6 (12 pts), if/else 8 (11 pts), boolean chains 2 (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.
Quantile::add (cognitive 25) candle-transformers/src/models/stable_diffusion/uni_pc.rs:815— Quantile::add has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 4 (5 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Module._load_from_state_dict (cognitive 25) candle-pyo3/py_src/candle/nn/module.py:391— Module._load_from_state_dict has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (18 pts), error handling 1 (3 pts), loops 2 (3 pts), boolean chains 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.
RotaryEmbI::cpu_fwd::inner (cognitive 22) candle-nn/src/rotary_emb.rs:28— RotaryEmbI::cpu_fwd::inner has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (7 pts), match/switch 3, 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.
AvgPool2D::f (cognitive 21) candle-core/src/cpu_backend/mod.rs:395— AvgPool2D::f has cognitive complexity 21 (threshold 15). Drivers by points: loops 6 (21 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.
QMetalStorage::indexed_moe_forward (cognitive 21) candle-core/src/quantized/metal/moe.rs:9— QMetalStorage::indexed_moe_forward has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12, boolean chains 7, 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.
ConformerAttention::forward (cognitive 21) candle-transformers/src/models/gemma4/audio.rs:500— ConformerAttention::forward has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18 (21 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.
ConvTranspose1D::f (cognitive 20) candle-core/src/cpu_backend/mod.rs:1249— ConvTranspose1D::f has cognitive complexity 20 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 2 (8 pts) (nesting depth added 12). 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.
VoxtralEncoder::forward_with_training (cognitive 20) candle-transformers/src/models/voxtral/model.rs:501— VoxtralEncoder::forward_with_training has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (19 pts), loops 1 (nesting depth added 4). 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.
BlockQ8K::from_float (cognitive 19) candle-core/src/quantized/k_quants.rs:2359— BlockQ8K::from_float has cognitive complexity 19 (threshold 15). Drivers by points: loops 5 (13 pts), if/else 3 (6 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.
Gather::f (cognitive 18) candle-core/src/cpu_backend/mod.rs:668— Gather::f has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (6 pts), 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.
Qwen3VLVisionModel::rot_pos_emb (cognitive 18) candle-transformers/src/models/qwen3_vl/vision.rs:491— Qwen3VLVisionModel::rot_pos_emb has cognitive complexity 18 (threshold 15). Drivers by points: loops 7 (18 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.
UNet2DConditionModel::forward_with_additional_residuals (cognitive 18) candle-transformers/src/models/stable_diffusion/unet_2d.rs:309— UNet2DConditionModel::forward_with_additional_residuals has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (6 pts), match/switch 4 (6 pts), loops 3 (4 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.
Module.to (cognitive 18) candle-pyo3/py_src/candle/nn/module.py:592— Module.to has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 1 (2 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.
Scatter::f (cognitive 17) candle-core/src/cpu_backend/mod.rs:816— Scatter::f has cognitive complexity 17 (threshold 15). Drivers by points: if/else 2 (8 pts), loops 3 (6 pts), match/switch 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Conv1D::f (cognitive 17) candle-core/src/cpu_backend/mod.rs:1025— Conv1D::f has cognitive complexity 17 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 1 (4 pts), boolean chains 1 (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.
Im2Col1D::f (cognitive 17) candle-core/src/cpu_backend/mod.rs:1097— Im2Col1D::f has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 1 (5 pts), boolean chains 2 (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
DebertaV2Embeddings::forward (cognitive 17) candle-transformers/src/models/debertav2.rs:197— DebertaV2Embeddings::forward has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 5 (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.
ReduceSum::fold_impl (cognitive 16) candle-core/src/cpu_backend/mod.rs:312— ReduceSum::fold_impl has cognitive complexity 16 (threshold 15). Drivers by points: loops 5 (13 pts), if/else 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.
QTensor::indexed_gemv (cognitive 16) candle-core/src/quantized/mod.rs:1076— QTensor::indexed_gemv has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, boolean chains 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MMProjector::load (cognitive 16) candle-transformers/src/models/llava/mod.rs:73— MMProjector::load has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), loops 2 (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.
BPE::from_json (cognitive 16) candle-transformers/src/models/metavoice.rs:194— BPE::from_json has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 8 (12 pts), if/else 1 (2 pts), loops 2 (nesting depth added 5). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ShortConvLayer::forward (cognitive 16) candle-transformers/src/models/quantized_lfm2.rs:185— ShortConvLayer::forward has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TooManyFields: Config candle-transformers/src/models/debertav2.rs:46— TooManyFields — 31 stored fields. The bar is 30 stored fields; this is 1 over it, 1.03× 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.
Change coupling: backend.rs ↔ backprop.rs candle-core/src/backend.rs:1— `candle-core/src/backend.rs` and `candle-core/src/backprop.rs` change together 55% of the time (16 of the 29 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 16 shared commits counted here, the most recent 3 are `5498dff9` Add bilinear interpolation support (upsample_bilinear2d) (#3237); `38276855` Add the scatter op. (#2921); `be4555c5` Add the conv-transpose1d op. (#1251) — run `git show` on any of them.
D4 · Code Duplication· Near-duplicate member family (16 members, 14 shared lines) · ×1
Near-duplicate member family (16 members, 14 shared lines) candle-transformers/src/models/based.rs:384— candle-transformers/src/models/based.rs:384-433 | candle-transformers/src/models/csm.rs:192-244 | candle-transformers/src/models/gemma.rs:202-259 | candle-transformers/src/models/helium.rs:199-258 | candle-transformers/src/models/mistral.rs:248-307 | candle-transformers/src/models/mixtral.rs:183-239 | candle-transformers/src/models/olmo.rs:161-221 | candle-transformers/src/models/olmo2.rs:156-209 | candle-transformers/src/models/phi3.rs:205-261 | candle-transformers/src/models/quantized_mistral.rs:147-198 | candle-transformers/src/models/quantized_stable_lm.rs:117-177 | candle-transformers/src/models/qwen2.rs:160-210 | candle-transformers/src/models/qwen2_moe.rs:167-217 | candle-transformers/src/models/stable_lm.rs:240-307 | candle-transformers/src/models/starcoder2.rs:163-210 | candle-transformers/src/models/yi.rs:199-248 — These 16 members are variants of one another: a block of 14 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 16 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 16 times.
D4 · Code Duplication· Near-duplicate member family (15 members, 16 shared lines) · ×1
Near-duplicate member family (15 members, 16 shared lines) candle-transformers/src/models/csm.rs:192— candle-transformers/src/models/csm.rs:192-244 | candle-transformers/src/models/gemma.rs:202-259 | candle-transformers/src/models/gemma2.rs:197-259 | candle-transformers/src/models/helium.rs:199-258 | candle-transformers/src/models/mistral.rs:248-307 | candle-transformers/src/models/mixtral.rs:183-239 | candle-transformers/src/models/olmo.rs:161-221 | candle-transformers/src/models/olmo2.rs:156-209 | candle-transformers/src/models/phi3.rs:205-261 | candle-transformers/src/models/quantized_mistral.rs:147-198 | candle-transformers/src/models/quantized_stable_lm.rs:117-177 | candle-transformers/src/models/qwen2.rs:160-210 | candle-transformers/src/models/qwen2_moe.rs:167-217 | candle-transformers/src/models/stable_lm.rs:240-307 | candle-transformers/src/models/yi.rs:199-248 — These 15 members are variants of one another: a block of 16 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 15 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 15 times.
D4 · Code Duplication· Near-duplicate member family (13 members, 17 shared lines) · ×1
Near-duplicate member family (13 members, 17 shared lines) candle-transformers/src/models/csm.rs:192— candle-transformers/src/models/csm.rs:192-244 | candle-transformers/src/models/gemma.rs:202-259 | candle-transformers/src/models/gemma2.rs:197-259 | candle-transformers/src/models/gemma3.rs:223-282 | candle-transformers/src/models/helium.rs:199-258 | candle-transformers/src/models/mistral.rs:248-307 | candle-transformers/src/models/mixtral.rs:183-239 | candle-transformers/src/models/quantized_mistral.rs:147-198 | candle-transformers/src/models/quantized_stable_lm.rs:117-177 | candle-transformers/src/models/qwen2.rs:160-210 | candle-transformers/src/models/qwen2_moe.rs:167-217 | candle-transformers/src/models/stable_lm.rs:240-307 | candle-transformers/src/models/yi.rs:199-248 — These 13 members are variants of one another: a block of 17 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 13 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 13 times.
D4 · Code Duplication· Near-duplicate member family (13 members, 16 shared lines) · ×1
Near-duplicate member family (13 members, 16 shared lines) candle-transformers/src/models/gemma.rs:202— candle-transformers/src/models/gemma.rs:202-259 | candle-transformers/src/models/gemma2.rs:197-259 | candle-transformers/src/models/mixtral.rs:183-239 | candle-transformers/src/models/olmo.rs:161-221 | candle-transformers/src/models/olmo2.rs:156-209 | candle-transformers/src/models/phi.rs:190-263 | candle-transformers/src/models/phi3.rs:205-261 | candle-transformers/src/models/quantized_stable_lm.rs:117-177 | candle-transformers/src/models/qwen2.rs:160-210 | candle-transformers/src/models/qwen2_moe.rs:167-217 | candle-transformers/src/models/stable_lm.rs:240-307 | candle-transformers/src/models/starcoder2.rs:163-210 | candle-transformers/src/models/yi.rs:199-248 — These 13 members are variants of one another: a block of 16 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 13 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 13 times.
D4 · Code Duplication· Near-duplicate member family (13 members, 14 shared lines) · ×1
Near-duplicate member family (13 members, 14 shared lines) candle-transformers/src/models/gemma.rs:202— candle-transformers/src/models/gemma.rs:202-259 | candle-transformers/src/models/gemma2.rs:197-259 | candle-transformers/src/models/gemma3.rs:223-282 | candle-transformers/src/models/gemma4/text.rs:309-376 | candle-transformers/src/models/mixtral.rs:183-239 | candle-transformers/src/models/olmo.rs:161-221 | candle-transformers/src/models/olmo2.rs:156-209 | candle-transformers/src/models/phi3.rs:205-261 | candle-transformers/src/models/quantized_stable_lm.rs:117-177 | candle-transformers/src/models/qwen2.rs:160-210 | candle-transformers/src/models/qwen2_moe.rs:167-217 | candle-transformers/src/models/stable_lm.rs:240-307 | candle-transformers/src/models/yi.rs:199-248 — These 13 members are variants of one another: a block of 14 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 13 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 13 times.
D4 · Code Duplication· Near-duplicate member family (12 members, 10 shared lines) · ×1
Near-duplicate member family (12 members, 10 shared lines) candle-transformers/src/models/based.rs:572— candle-transformers/src/models/based.rs:572-587 | candle-transformers/src/models/helium.rs:373-388 | candle-transformers/src/models/mistral.rs:429-444 | candle-transformers/src/models/mixtral.rs:467-482 | candle-transformers/src/models/olmo.rs:331-346 | candle-transformers/src/models/olmo2.rs:326-341 | candle-transformers/src/models/phi3.rs:406-421 | candle-transformers/src/models/quantized_stable_lm.rs:284-300 | candle-transformers/src/models/qwen2_moe.rs:462-477 | candle-transformers/src/models/stable_lm.rs:416-432 | candle-transformers/src/models/starcoder2.rs:329-344 | candle-transformers/src/models/yi.rs:348-363 — These 12 members are variants of one another: a block of 10 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 12 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 12 times.
D4 · Code Duplication· Near-duplicate member family (7 members, 21 shared lines) · ×1
Near-duplicate member family (7 members, 21 shared lines) candle-core/src/quantized/neon.rs:677— candle-core/src/quantized/neon.rs:677-745 | candle-core/src/quantized/neon.rs:853-920 | candle-core/src/quantized/neon.rs:1129-1196 | candle-core/src/quantized/neon.rs:1873-1960 | candle-core/src/quantized/neon.rs:2660-2747 | candle-core/src/quantized/neon.rs:2968-3036 | candle-core/src/quantized/neon.rs:3113-3178 — These 7 members are variants of one another: a block of 21 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 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· Near-duplicate member family (5 members, 32 shared lines) · ×1
Near-duplicate member family (5 members, 32 shared lines) candle-nn/src/attention/cpu_flash/causal.rs:204— candle-nn/src/attention/cpu_flash/causal.rs:204-295 | candle-nn/src/attention/cpu_flash/causal.rs:310-381 | candle-nn/src/attention/cpu_flash/causal.rs:397-461 | candle-nn/src/attention/cpu_flash/causal.rs:587-700 | candle-nn/src/attention/cpu_flash/causal.rs:716-797 — These 5 members are variants of one another: a block of 32 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Near-duplicate member family (5 members, 18 shared lines) · ×1
Near-duplicate member family (5 members, 18 shared lines) candle-transformers/src/models/granite.rs:230— candle-transformers/src/models/granite.rs:230-309 | candle-transformers/src/models/granitemoehybrid.rs:279-359 | candle-transformers/src/models/lfm2.rs:327-405 | candle-transformers/src/models/llama.rs:276-356 | candle-transformers/src/models/voxtral/voxtral_llama.rs:190-274 — These 5 members are variants of one another: a block of 18 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Near-duplicate member family (4 members, 64 shared lines) · ×1
Near-duplicate member family (4 members, 64 shared lines) candle-flash-attn-v3/src/lib.rs:41— candle-flash-attn-v3/src/lib.rs:41-240 | candle-flash-attn-v3/src/lib.rs:455-685 | candle-flash-attn/src/lib.rs:32-220 | candle-flash-attn/src/lib.rs:475-821 — These 4 members are variants of one another: a block of 64 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 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· Near-duplicate member family (4 members, 35 shared lines) · ×1
Near-duplicate member family (4 members, 35 shared lines) candle-transformers/src/models/quantized_rwkv_v5.rs:104— candle-transformers/src/models/quantized_rwkv_v5.rs:104-163 | candle-transformers/src/models/quantized_rwkv_v6.rs:135-210 | candle-transformers/src/models/rwkv_v5.rs:155-214 | candle-transformers/src/models/rwkv_v6.rs:113-188 — These 4 members are variants of one another: a block of 35 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 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· Near-duplicate member family (4 members, 32 shared lines) · ×1
Near-duplicate member family (4 members, 32 shared lines) candle-transformers/src/models/paddleocr_vl/mod.rs:518— candle-transformers/src/models/paddleocr_vl/mod.rs:518-558 | candle-transformers/src/models/paddleocr_vl/mod.rs:578-619 | candle-transformers/src/models/paddleocr_vl/mod.rs:642-683 | candle-transformers/src/models/paddleocr_vl/mod.rs:819-889 — These 4 members are variants of one another: a block of 32 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 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· Near-duplicate member family (4 members, 24 shared lines) · ×1
Near-duplicate member family (4 members, 24 shared lines) candle-core/src/quantized/neon.rs:596— candle-core/src/quantized/neon.rs:596-668 | candle-core/src/quantized/neon.rs:757-844 | candle-core/src/quantized/neon.rs:2759-2820 | candle-core/src/quantized/neon.rs:3048-3104 — These 4 members are variants of one another: a block of 24 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 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· Near-duplicate member family (4 members, 9 shared lines) · ×1
Near-duplicate member family (4 members, 9 shared lines) candle-core/src/cuda_backend/mod.rs:521— candle-core/src/cuda_backend/mod.rs:521-564 | candle-core/src/cuda_backend/mod.rs:576-618 | candle-core/src/cuda_backend/mod.rs:630-670 | candle-core/src/cuda_backend/mod.rs:682-722 — These 4 members are variants of one another: a block of 9 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 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· Near-duplicate member family (3 members, 22 shared lines) · ×1
Near-duplicate member family (3 members, 22 shared lines) candle-transformers/src/models/quantized_lfm2.rs:126— candle-transformers/src/models/quantized_lfm2.rs:126-181 | candle-transformers/src/models/quantized_llama.rs:196-266 | candle-transformers/src/models/quantized_qwen2.rs:84-147 — These 3 members are variants of one another: a block of 22 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 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 3 times.
D4 · Code Duplication· Near-duplicate member family (3 members, 15 shared lines) · ×1
Near-duplicate member family (3 members, 15 shared lines) candle-core/src/quantized/k_quants.rs:1619— candle-core/src/quantized/k_quants.rs:1619-1683 | candle-core/src/quantized/k_quants.rs:1824-1898 | candle-core/src/quantized/k_quants.rs:1900-1981 — These 3 members are variants of one another: a block of 15 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 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 3 times.
D4 · Code Duplication· Near-duplicate member family (3 members, 4 shared lines) · ×1
Near-duplicate member family (3 members, 4 shared lines) candle-transformers/src/models/gemma.rs:346— candle-transformers/src/models/gemma.rs:346-369 | candle-transformers/src/models/gemma2.rs:365-390 | candle-transformers/src/models/nvembed_v2/embedding.rs:228-245 — These 3 members are variants of one another: a block of 4 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 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 3 times.
Near-duplicate member pair (115 shared lines) candle-transformers/src/models/quantized_t5.rs:327— candle-transformers/src/models/quantized_t5.rs:327-447 | candle-transformers/src/models/t5.rs:456-577 — These two members are variants of one another: 115 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 (78 shared lines) candle-core/src/cpu_backend/mod.rs:1540— candle-core/src/cpu_backend/mod.rs:1540-1622 | candle-core/src/cpu_backend/mod.rs:1631-1740 — These two members are variants of one another: 78 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 (70 shared lines) candle-core/src/quantized/neon.rs:2310— candle-core/src/quantized/neon.rs:2310-2443 | candle-core/src/quantized/neon.rs:2447-2580 — These two members are variants of one another: 70 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 (61 shared lines) candle-core/src/quantized/k_quants.rs:1476— candle-core/src/quantized/k_quants.rs:1476-1556 | candle-core/src/quantized/k_quants.rs:1734-1821 — These two members are variants of one another: 61 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 (59 shared lines) candle-core/src/cuda_backend/cudnn.rs:37— candle-core/src/cuda_backend/cudnn.rs:37-124 | candle-core/src/cuda_backend/cudnn.rs:136-225 — These two members are variants of one another: 59 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 (54 shared lines) candle-core/src/quantized/neon.rs:1578— candle-core/src/quantized/neon.rs:1578-1691 | candle-core/src/quantized/neon.rs:1695-1794 — These two members are variants of one another: 54 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 (37 shared lines) candle-core/src/metal_backend/mod.rs:186— candle-core/src/metal_backend/mod.rs:186-240 | candle-core/src/metal_backend/mod.rs:242-296 — These two members are variants of one another: 37 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 (35 shared lines) candle-transformers/src/models/whisper/audio.rs:177— candle-transformers/src/models/whisper/audio.rs:177-266 | candle-wasm-examples/whisper/src/audio.rs:156-199 — These two members are variants of one another: 35 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 (26 shared lines) candle-transformers/src/models/paddleocr_vl/vision.rs:478— candle-transformers/src/models/paddleocr_vl/vision.rs:478-565 | candle-transformers/src/models/qwen3_vl/vision.rs:127-175 — These two members are variants of one another: 26 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (42 corresponding lines) · ×1
Edited copy of a member (42 corresponding lines) candle-transformers/src/models/llama2_c.rs:174— candle-transformers/src/models/llama2_c.rs:174-215 | candle-transformers/src/models/quantized_llama2_c.rs:61-102 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (15 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (15 members, 50+ identical tokens) candle-transformers/src/models/based.rs:314— candle-transformers/src/models/based.rs:314-331 | candle-transformers/src/models/gemma.rs:83-100 | candle-transformers/src/models/gemma2.rs:76-93 | candle-transformers/src/models/glm4_new.rs:38-63 | candle-transformers/src/models/olmo.rs:44-61 | candle-transformers/src/models/olmo2.rs:36-53 | candle-transformers/src/models/qwen2.rs:47-64 | candle-transformers/src/models/qwen2_moe.rs:55-72 | candle-transformers/src/models/qwen3.rs:42-59 | candle-transformers/src/models/recurrent_gemma.rs:107-128 | candle-transformers/src/models/smol/quantized_smollm3.rs:177-210 | candle-transformers/src/models/smol/smollm3.rs:72-89 | candle-transformers/src/models/stable_lm.rs:92-110 | candle-transformers/src/models/starcoder2.rs:52-70 | candle-transformers/src/models/z_image/text_encoder.rs:114-131 — These 15 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 15 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 15 times.
D4 · Code Duplication· Members sharing a duplicated core (14 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (14 members, 50+ identical tokens) candle-transformers/src/models/based.rs:314— candle-transformers/src/models/based.rs:314-331 | candle-transformers/src/models/gemma.rs:83-100 | candle-transformers/src/models/gemma2.rs:76-93 | candle-transformers/src/models/gemma3.rs:76-98 | candle-transformers/src/models/gemma4/text.rs:68-83 | candle-transformers/src/models/glm4_new.rs:38-63 | candle-transformers/src/models/modernbert.rs:60-77 | candle-transformers/src/models/nvembed_v2/embedding.rs:18-36 | candle-transformers/src/models/olmo.rs:44-61 | candle-transformers/src/models/olmo2.rs:36-53 | candle-transformers/src/models/quantized_glm4.rs:107-129 | candle-transformers/src/models/qwen2.rs:47-64 | candle-transformers/src/models/qwen2_moe.rs:55-72 | candle-transformers/src/models/stella_en_v5.rs:144-189 — These 14 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 14 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 14 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) candle-transformers/src/models/mistral.rs:163— candle-transformers/src/models/mistral.rs:163-175 | candle-transformers/src/models/nvembed_v2/embedding.rs:63-75 | candle-transformers/src/models/olmo.rs:88-100 | candle-transformers/src/models/olmo2.rs:80-92 | candle-transformers/src/models/quantized_mistral.rs:78-90 | candle-transformers/src/models/quantized_stable_lm.rs:36-49 | candle-transformers/src/models/qwen2.rs:91-103 | candle-transformers/src/models/qwen2_moe.rs:99-110 | candle-transformers/src/models/stable_lm.rs:140-153 | candle-transformers/src/models/yi.rs:130-142 — 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· Edited copy of a member (101 corresponding lines) · ×1
Edited copy of a member (101 corresponding lines) candle-transformers/src/models/stable_diffusion/uni_pc.rs:383— candle-transformers/src/models/stable_diffusion/uni_pc.rs:383-483 | candle-transformers/src/models/stable_diffusion/uni_pc.rs:492-598 — These two members are one piece of code written twice and then edited apart: 101 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, 65+ corresponding lines) · ×1
Edited copies of one member (3 members, 65+ corresponding lines) candle-nn/src/rotary_emb.rs:27— candle-nn/src/rotary_emb.rs:27-103 | candle-nn/src/rotary_emb.rs:327-408 | candle-nn/src/rotary_emb.rs:618-682 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 65 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 (72 corresponding lines) · ×1
Edited copy of a member (72 corresponding lines) candle-core/src/metal_backend/mod.rs:913— candle-core/src/metal_backend/mod.rs:913-984 | candle-core/src/metal_backend/mod.rs:1111-1189 — These two members are one piece of code written twice and then edited apart: 72 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) candle-transformers/src/models/mpt.rs:87— candle-transformers/src/models/mpt.rs:87-142 | candle-transformers/src/models/quantized_mpt.rs:64-119 — 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 (79 corresponding lines) · ×1
Edited copy of a member (79 corresponding lines) candle-core/src/quantized/neon.rs:3477— candle-core/src/quantized/neon.rs:3477-3559 | candle-core/src/quantized/neon.rs:3562-3640 — These two members are one piece of code written twice and then edited apart: 79 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 (86 corresponding lines) · ×1
Edited copy of a member (86 corresponding lines) candle-transformers/src/models/fastvit.rs:199— candle-transformers/src/models/fastvit.rs:199-289 | candle-transformers/src/models/mobileone.rs:135-220 — These two members are one piece of code written twice and then edited apart: 86 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 (70 corresponding lines) · ×1
Edited copy of a member (70 corresponding lines) candle-transformers/src/models/lfm2.rs:441— candle-transformers/src/models/lfm2.rs:441-522 | candle-transformers/src/models/quantized_lfm2.rs:185-254 — These two members are one piece of code written twice and then edited apart: 70 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 (63 corresponding lines) · ×1
Edited copy of a member (63 corresponding lines) candle-core/src/cpu_backend/mod.rs:1249— candle-core/src/cpu_backend/mod.rs:1249-1311 | candle-core/src/cpu_backend/mod.rs:1318-1401 — These two members are one piece of code written twice and then edited apart: 63 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 (82 corresponding lines) · ×1
Edited copy of a member (82 corresponding lines) candle-core/src/metal_backend/mod.rs:2095— candle-core/src/metal_backend/mod.rs:2095-2176 | candle-core/src/metal_backend/mod.rs:2178-2264 — These two members are one piece of code written twice and then edited apart: 82 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 (62 corresponding lines) · ×1
Edited copy of a member (62 corresponding lines) candle-transformers/src/models/quantized_glm4.rs:367— candle-transformers/src/models/quantized_glm4.rs:367-428 | candle-transformers/src/models/quantized_qwen3.rs:467-536 — These two members are one piece of code written twice and then edited apart: 62 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 (100 corresponding lines) · ×1
Edited copy of a member (100 corresponding lines) candle-transformers/src/models/mimi/seanet.rs:160— candle-transformers/src/models/mimi/seanet.rs:160-261 | candle-transformers/src/models/mimi/seanet.rs:318-417 — These two members are one piece of code written twice and then edited apart: 100 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) candle-core/src/metal_backend/mod.rs:1455— candle-core/src/metal_backend/mod.rs:1455-1504 | candle-core/src/metal_backend/mod.rs:1604-1665 — 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 copies of one member (3 members, 39+ corresponding lines) · ×1
Edited copies of one member (3 members, 39+ corresponding lines) candle-core/src/cpu_backend/mod.rs:2837— candle-core/src/cpu_backend/mod.rs:2837-2875 | candle-core/src/cuda_backend/mod.rs:1837-1879 | candle-core/src/cuda_backend/mod.rs:2018-2065 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 39 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 (43 corresponding lines) · ×1
Edited copy of a member (43 corresponding lines) candle-core/src/quantized/repack_x86.rs:90— candle-core/src/quantized/repack_x86.rs:90-132 | candle-core/src/quantized/repack_x86.rs:617-659 — These two members are one piece of code written twice and then edited apart: 43 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, 58+ corresponding lines) · ×1
Edited copies of one member (3 members, 58+ corresponding lines) candle-core/src/cuda_backend/device.rs:634— candle-core/src/cuda_backend/device.rs:634-691 | candle-core/src/cuda_backend/device.rs:693-750 | candle-core/src/cuda_backend/device.rs:752-809 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 58 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, 34+ corresponding lines) · ×1
Edited copies of one member (3 members, 34+ corresponding lines) candle-transformers/src/models/chinese_clip/vision_model.rs:171— candle-transformers/src/models/chinese_clip/vision_model.rs:171-210 | candle-transformers/src/models/clip/text_model.rs:137-176 | candle-transformers/src/models/stable_diffusion/clip.rs:218-251 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 34 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, 31+ corresponding lines) · ×1
Edited copies of one member (3 members, 31+ corresponding lines) candle-core/src/cuda_backend/mod.rs:956— candle-core/src/cuda_backend/mod.rs:956-991 | candle-core/src/cuda_backend/mod.rs:1001-1031 | candle-core/src/cuda_backend/mod.rs:1048-1083 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 31 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, 43+ corresponding lines) · ×1
Edited copies of one member (3 members, 43+ corresponding lines) candle-core/src/cuda_backend/mod.rs:2592— candle-core/src/cuda_backend/mod.rs:2592-2634 | candle-core/src/cuda_backend/mod.rs:2642-2693 | candle-core/src/cuda_backend/mod.rs:2701-2752 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 43 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 (46 corresponding lines) · ×1
Edited copy of a member (46 corresponding lines) candle-metal-kernels/src/kernels/reduce.rs:19— candle-metal-kernels/src/kernels/reduce.rs:19-64 | candle-metal-kernels/src/kernels/reduce.rs:77-124 — 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 (47 corresponding lines) · ×1
Edited copy of a member (47 corresponding lines) candle-core/src/cuda_backend/device.rs:480— candle-core/src/cuda_backend/device.rs:480-526 | candle-core/src/cuda_backend/device.rs:528-577 — These two members are one piece of code written twice and then edited apart: 47 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, 31+ corresponding lines) · ×1
Edited copies of one member (5 members, 31+ corresponding lines) candle-transformers/src/models/convnext.rs:302— candle-transformers/src/models/convnext.rs:302-332 | candle-transformers/src/models/efficientvit.rs:451-482 | candle-transformers/src/models/fastvit.rs:460-499 | candle-transformers/src/models/mobileone.rs:294-326 | candle-transformers/src/models/repvgg.rs:274-306 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 31 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 (7 members, 22+ corresponding lines) · ×1
Edited copies of one member (7 members, 22+ corresponding lines) candle-transformers/src/models/helium.rs:323— candle-transformers/src/models/helium.rs:323-348 | candle-transformers/src/models/olmo.rs:282-308 | candle-transformers/src/models/olmo2.rs:278-303 | candle-transformers/src/models/phi3.rs:359-384 | candle-transformers/src/models/quantized_stable_lm.rs:240-261 | candle-transformers/src/models/stable_lm.rs:371-393 | candle-transformers/src/models/yi.rs:304-325 — These 7 members are one piece of code written 7 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 7 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 51+ corresponding lines) · ×1
Edited copies of one member (4 members, 51+ corresponding lines) candle-transformers/src/models/glm4_new.rs:134— candle-transformers/src/models/glm4_new.rs:134-187 | candle-transformers/src/models/qwen3.rs:125-185 | candle-transformers/src/models/smol/smollm3.rs:171-235 | candle-transformers/src/models/z_image/text_encoder.rs:219-269 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 51 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, 33+ corresponding lines) · ×1
Edited copies of one member (3 members, 33+ corresponding lines) candle-core/src/conv.rs:168— candle-core/src/conv.rs:168-205 | candle-core/src/conv.rs:239-271 | candle-core/src/conv.rs:308-341 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 33 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, 32+ corresponding lines) · ×1
Edited copies of one member (3 members, 32+ corresponding lines) candle-transformers/src/models/chatglm.rs:199— candle-transformers/src/models/chatglm.rs:199-230 | candle-transformers/src/models/codegeex4_9b.rs:220-251 | candle-transformers/src/models/glm4.rs:241-272 — 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 copies of one member (3 members, 27+ corresponding lines) · ×1
Edited copies of one member (3 members, 27+ corresponding lines) candle-nn/src/rotary_emb.rs:262— candle-nn/src/rotary_emb.rs:262-288 | candle-nn/src/rotary_emb.rs:555-581 | candle-nn/src/rotary_emb.rs:830-856 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 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, 29+ corresponding lines) · ×1
Edited copies of one member (3 members, 29+ corresponding lines) candle-transformers/src/models/gemma4/text.rs:407— candle-transformers/src/models/gemma4/text.rs:407-449 | candle-transformers/src/models/gemma4/vision.rs:323-351 | candle-transformers/src/models/glm4_new.rs:248-278 — 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 (4 members, 25+ corresponding lines) · ×1
Edited copies of one member (4 members, 25+ corresponding lines) candle-metal-kernels/src/kernels/convolution.rs:19— candle-metal-kernels/src/kernels/convolution.rs:19-46 | candle-metal-kernels/src/kernels/convolution.rs:59-86 | candle-metal-kernels/src/kernels/unary.rs:52-76 | candle-metal-kernels/src/kernels/unary.rs:117-141 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 26+ corresponding lines) · ×1
Edited copies of one member (4 members, 26+ corresponding lines) candle-metal-kernels/src/kernels/affine.rs:49— candle-metal-kernels/src/kernels/affine.rs:49-75 | candle-metal-kernels/src/kernels/affine.rs:116-141 | candle-metal-kernels/src/kernels/affine.rs:182-207 | candle-metal-kernels/src/kernels/cast.rs:45-71 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 26 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, 24+ corresponding lines) · ×1
Edited copies of one member (4 members, 24+ corresponding lines) candle-metal-kernels/src/kernels/convolution.rs:147— candle-metal-kernels/src/kernels/convolution.rs:147-172 | candle-metal-kernels/src/kernels/convolution.rs:189-218 | candle-metal-kernels/src/kernels/convolution.rs:236-259 | candle-metal-kernels/src/kernels/convolution.rs:283-313 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 24 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, 18+ corresponding lines) · ×1
Edited copies of one member (3 members, 18+ corresponding lines) candle-core/src/quantized/k_quants.rs:719— candle-core/src/quantized/k_quants.rs:719-737 | candle-core/src/quantized/k_quants.rs:749-767 | candle-core/src/quantized/k_quants.rs:2339-2356 — 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 (6 members, 16+ corresponding lines) · ×1
Edited copies of one member (6 members, 16+ corresponding lines) candle-core/src/storage.rs:90— candle-core/src/storage.rs:90-105 | candle-core/src/storage.rs:176-191 | candle-core/src/storage.rs:506-521 | candle-core/src/storage.rs:528-543 | candle-core/src/storage.rs:562-577 | candle-core/src/storage.rs:587-605 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 16 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, 8+ corresponding lines) · ×1
Edited copies of one member (5 members, 8+ corresponding lines) candle-transformers/src/models/csm.rs:136— candle-transformers/src/models/csm.rs:136-143 | candle-transformers/src/models/helium.rs:92-99 | candle-transformers/src/models/mistral.rs:143-150 | candle-transformers/src/models/nvembed_v2/embedding.rs:43-50 | candle-transformers/src/models/quantized_mistral.rs:58-65 — These 5 members are one piece of code written 5 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 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 16+ corresponding lines) · ×1
Edited copies of one member (4 members, 16+ corresponding lines) candle-core/src/storage.rs:107— candle-core/src/storage.rs:107-122 | candle-core/src/storage.rs:124-139 | candle-core/src/storage.rs:193-208 | candle-core/src/storage.rs:545-560 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 16 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, 17+ corresponding lines) · ×1
Edited copies of one member (4 members, 17+ corresponding lines) candle-nn/src/conv.rs:56— candle-nn/src/conv.rs:56-73 | candle-nn/src/conv.rs:127-144 | candle-nn/src/conv.rs:218-235 | candle-nn/src/conv.rs:288-304 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 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, 10+ corresponding lines) · ×1
Edited copies of one member (4 members, 10+ corresponding lines) candle-pyo3/src/lib.rs:679— candle-pyo3/src/lib.rs:679-688 | candle-pyo3/src/lib.rs:696-705 | candle-pyo3/src/lib.rs:713-722 | candle-pyo3/src/lib.rs:726-735 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 13+ corresponding lines) · ×1
Edited copies of one member (5 members, 13+ corresponding lines) candle-transformers/src/models/distilbert.rs:242— candle-transformers/src/models/distilbert.rs:242-254 | candle-transformers/src/models/metavoice.rs:848-860 | candle-transformers/src/models/quantized_metavoice.rs:151-163 | candle-transformers/src/models/quantized_stable_lm.rs:190-210 | candle-transformers/src/models/stable_lm.rs:320-340 — These 5 members are one piece of code written 5 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 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (7 members, 23+ corresponding lines) · ×1
Edited copies of one member (7 members, 23+ corresponding lines) candle-transformers/src/models/marian.rs:36— candle-transformers/src/models/marian.rs:36-58 | candle-transformers/src/models/marian.rs:61-83 | candle-transformers/src/models/marian.rs:85-107 | candle-transformers/src/models/marian.rs:109-131 | candle-transformers/src/models/marian.rs:133-155 | candle-transformers/src/models/marian.rs:157-179 | candle-transformers/src/models/marian.rs:181-203 — These 7 members are one piece of code written 7 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 7 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 11+ corresponding lines) · ×1
Edited copies of one member (5 members, 11+ corresponding lines) candle-transformers/src/models/bigcode.rs:290— candle-transformers/src/models/bigcode.rs:290-300 | candle-transformers/src/models/gemma4/vision.rs:353-365 | candle-transformers/src/models/glm4_new.rs:280-291 | candle-transformers/src/models/openclip/text_model.rs:188-199 | candle-transformers/src/models/quantized_glm4.rs:333-346 — These 5 members are one piece of code written 5 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 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 7+ corresponding lines) · ×1
Edited copies of one member (5 members, 7+ corresponding lines) candle-transformers/src/models/lfm2.rs:313— candle-transformers/src/models/lfm2.rs:313-319 | candle-transformers/src/models/mimi/transformer.rs:76-85 | candle-transformers/src/models/quantized_lfm2.rs:118-124 | candle-transformers/src/models/quantized_phi3.rs:99-105 | candle-transformers/src/models/quantized_qwen2.rs:71-77 — These 5 members are one piece of code written 5 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 5 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) candle-flash-attn-v3/src/lib.rs:268— candle-flash-attn-v3/src/lib.rs:268-274 | candle-flash-attn-v3/src/lib.rs:713-719 | candle-flash-attn/src/lib.rs:248-254 | candle-flash-attn/src/lib.rs:849-855 — 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 (8 members, 11+ corresponding lines) · ×1
Edited copies of one member (8 members, 11+ corresponding lines) candle-core/src/quantized/k_quants.rs:269— candle-core/src/quantized/k_quants.rs:269-282 | candle-core/src/quantized/k_quants.rs:687-700 | candle-core/src/quantized/k_quants.rs:825-838 | candle-core/src/quantized/k_quants.rs:1063-1073 | candle-core/src/quantized/k_quants.rs:1444-1457 | candle-core/src/quantized/k_quants.rs:1722-1732 | candle-core/src/quantized/k_quants.rs:2027-2040 | candle-core/src/quantized/k_quants.rs:2324-2337 — These 8 members are one piece of code written 8 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 8 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 6+ corresponding lines) · ×1
Edited copies of one member (6 members, 6+ corresponding lines) candle-transformers/src/models/nvembed_v2/model.rs:105— candle-transformers/src/models/nvembed_v2/model.rs:105-110 | candle-transformers/src/models/nvembed_v2/model.rs:112-117 | candle-transformers/src/models/stable_diffusion/attention.rs:131-136 | candle-transformers/src/models/stable_diffusion/attention.rs:138-143 | candle-transformers/src/models/wuerstchen/attention_processor.rs:58-63 | candle-transformers/src/models/wuerstchen/attention_processor.rs:65-70 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 6 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 (7 members, 9+ corresponding lines) · ×1
Edited copies of one member (7 members, 9+ corresponding lines) candle-transformers/src/models/blip.rs:240— candle-transformers/src/models/blip.rs:240-248 | candle-transformers/src/models/blip_text.rs:308-316 | candle-transformers/src/models/mimi/quantization.rs:216-224 | candle-transformers/src/models/pixtral/vision_model.rs:217-225 | candle-transformers/src/models/quantized_blip.rs:201-209 | candle-transformers/src/models/quantized_blip_text.rs:304-312 | candle-transformers/src/models/vit.rs:363-371 — These 7 members are one piece of code written 7 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 7 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 5+ corresponding lines) · ×1
Edited copies of one member (4 members, 5+ corresponding lines) candle-transformers/src/models/based.rs:69— candle-transformers/src/models/based.rs:69-73 | candle-transformers/src/models/blip.rs:180-188 | candle-transformers/src/models/phi.rs:100-110 | candle-transformers/src/models/quantized_blip.rs:141-149 — These 4 members are one piece of code written 4 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 4 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) candle-transformers/src/models/bert.rs:297— candle-transformers/src/models/bert.rs:297-302 | candle-transformers/src/models/chinese_clip/text_model.rs:203-208 | candle-transformers/src/models/jina_bert.rs:211-215 — 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 (4 members, 4+ corresponding lines) · ×1
Edited copies of one member (4 members, 4+ corresponding lines) candle-transformers/src/models/chinese_clip/mod.rs:206— candle-transformers/src/models/chinese_clip/mod.rs:206-209 | candle-transformers/src/models/clip/mod.rs:149-152 | candle-transformers/src/models/mobileclip.rs:98-101 | candle-transformers/src/models/nomic_bert.rs:483-486 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (3 corresponding lines) · ×1
Edited copy of a member (3 corresponding lines) candle-core/src/cpu_backend/mod.rs:1091— candle-core/src/cpu_backend/mod.rs:1091-1093 | candle-core/src/cuda_backend/mod.rs:208-210 — These two members are one piece of code written twice and then edited apart: 3 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 (90 lines × 2) candle-transformers/src/models/quantized_t5.rs:330— candle-transformers/src/models/quantized_t5.rs:330-419 | candle-transformers/src/models/t5.rs:459-548 — before extracting anything, compare `candle-transformers/src/models/quantized_t5.rs` and `candle-transformers/src/models/t5.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 390 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 `candle-transformers/src/models/quantized_t5.rs:330` 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 (57 lines × 2) candle-onnx/src/eval.rs:1324— candle-onnx/src/eval.rs:1324-1380 | candle-onnx/src/eval.rs:1433-1489 — both copies are in the same file, so extract the 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 `candle-onnx/src/eval.rs:1324` 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 (38–52 lines × 4) candle-transformers/src/models/mobilenetv4.rs:97— candle-transformers/src/models/mobilenetv4.rs:97-134 | candle-transformers/src/models/mobilenetv4.rs:140-186 | candle-transformers/src/models/mobilenetv4.rs:192-233 | candle-transformers/src/models/mobilenetv4.rs:239-290 — 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 `candle-transformers/src/models/mobilenetv4.rs:97` 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 (90 lines × 3) candle-transformers/src/models/chatglm.rs:242— candle-transformers/src/models/chatglm.rs:242-331 | candle-transformers/src/models/codegeex4_9b.rs:263-352 | candle-transformers/src/models/glm4.rs:284-373 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 (47 lines × 2) candle-transformers/src/models/encodec.rs:192— candle-transformers/src/models/encodec.rs:192-238 | candle-transformers/src/models/mimi/quantization.rs:22-68 — 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 (46 lines × 3) candle-transformers/src/models/beit.rs:345— candle-transformers/src/models/beit.rs:345-390 | candle-transformers/src/models/dinov2.rs:332-377 | candle-transformers/src/models/eva2.rs:373-418 — before extracting anything, compare `candle-transformers/src/models/beit.rs` and `candle-transformers/src/models/dinov2.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 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 (40–43 lines × 2) candle-transformers/src/models/paddleocr_vl/vision.rs:718— candle-transformers/src/models/paddleocr_vl/vision.rs:718-760 | candle-transformers/src/models/paddleocr_vl/vision.rs:793-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 `candle-transformers/src/models/paddleocr_vl/vision.rs:718` 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 (44 lines × 2) candle-transformers/src/models/marian.rs:298— candle-transformers/src/models/marian.rs:298-341 | candle-transformers/src/models/trocr.rs:212-255 — before extracting anything, compare `candle-transformers/src/models/marian.rs` and `candle-transformers/src/models/trocr.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 77 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `candle-transformers/src/models/marian.rs:343` calls `reset_kv_cache` and `candle-transformers/src/models/trocr.rs:256` 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 (38 lines × 3) candle-transformers/src/models/chatglm.rs:381— candle-transformers/src/models/chatglm.rs:381-418 | candle-transformers/src/models/codegeex4_9b.rs:402-439 | candle-transformers/src/models/glm4.rs:423-460 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 (37–38 lines × 2) candle-core/src/cpu_backend/mod.rs:2888— candle-core/src/cpu_backend/mod.rs:2888-2925 | candle-core/src/cuda_backend/mod.rs:1967-2003 — `candle-core/src/cpu_backend/mod.rs` and `candle-core/src/cuda_backend/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 65 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `candle-core/src/cpu_backend/mod.rs:2888` 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 (37 lines × 4) candle-flash-attn-v3/src/lib.rs:110— candle-flash-attn-v3/src/lib.rs:110-146 | candle-flash-attn-v3/src/lib.rs:555-591 | candle-flash-attn/src/lib.rs:90-126 | candle-flash-attn/src/lib.rs:650-686 — before extracting anything, compare `candle-flash-attn-v3/src/lib.rs` and `candle-flash-attn/src/lib.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 174 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (45 lines × 2) candle-core/src/quantized/k_quants.rs:1512— candle-core/src/quantized/k_quants.rs:1512-1556 | candle-core/src/quantized/k_quants.rs:1777-1821 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/k_quants.rs:1512` 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 (4–35 lines × 3) candle-core/src/quantized/neon.rs:1046— candle-core/src/quantized/neon.rs:1046-1080 | candle-core/src/quantized/neon.rs:1500-1534 | candle-core/src/quantized/neon.rs:2239-2242 — 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 `candle-core/src/quantized/neon.rs:1046` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-core/src/quantized/neon.rs:1046` calls `vmlaq_s32` and `candle-core/src/quantized/neon.rs:2239` 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 (34–35 lines × 2) candle-transformers/src/models/qwen3.rs:130— candle-transformers/src/models/qwen3.rs:130-164 | candle-transformers/src/models/z_image/text_encoder.rs:220-253 — before extracting anything, compare `candle-transformers/src/models/qwen3.rs` and `candle-transformers/src/models/z_image/text_encoder.rs` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 188 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (56 lines × 4) candle-transformers/src/models/granite.rs:232— candle-transformers/src/models/granite.rs:232-287 | candle-transformers/src/models/granitemoehybrid.rs:281-336 | candle-transformers/src/models/llama.rs:278-333 | candle-transformers/src/models/voxtral/voxtral_llama.rs:192-247 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 `candle-transformers/src/models/granite.rs:232` 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 (33 lines × 3) candle-transformers/src/models/granite.rs:126— candle-transformers/src/models/granite.rs:126-158 | candle-transformers/src/models/granitemoehybrid.rs:169-201 | candle-transformers/src/models/llama.rs:170-202 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 `candle-transformers/src/models/granite.rs:126` 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 (51–52 lines × 2) candle-core/src/quantized/k_quants.rs:2151— candle-core/src/quantized/k_quants.rs:2151-2201 | candle-core/src/quantized/k_quants.rs:2230-2281 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/k_quants.rs:2151` 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) candle-transformers/src/models/stable_diffusion/ddim.rs:75— candle-transformers/src/models/stable_diffusion/ddim.rs:75-107 | candle-transformers/src/models/stable_diffusion/euler_ancestral_discrete.rs:76-108 — 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 `candle-transformers/src/models/stable_diffusion/ddim.rs:75` 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 `config` to `DDIMSchedulerConfig` in one and `EulerAncestralDiscreteSchedulerConfig` 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 (32 lines × 3) candle-transformers/src/models/chatglm.rs:460— candle-transformers/src/models/chatglm.rs:460-491 | candle-transformers/src/models/codegeex4_9b.rs:481-512 | candle-transformers/src/models/glm4.rs:502-533 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 (33–35 lines × 2) candle-transformers/src/models/qwen2_moe.rs:278— candle-transformers/src/models/qwen2_moe.rs:278-312 | candle-transformers/src/models/qwen3_moe.rs:138-170 — before extracting anything, compare `candle-transformers/src/models/qwen2_moe.rs` and `candle-transformers/src/models/qwen3_moe.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 96 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 `candle-transformers/src/models/qwen2_moe.rs:278` 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 lines × 2) candle-transformers/src/models/stable_diffusion/mod.rs:171— candle-transformers/src/models/stable_diffusion/mod.rs:171-202 | candle-transformers/src/models/stable_diffusion/mod.rs:254-285 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/stable_diffusion/mod.rs:171` 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 (25–30 lines × 2) candle-nn/src/attention/cpu_flash/causal.rs:635— candle-nn/src/attention/cpu_flash/causal.rs:635-664 | candle-nn/src/attention/cpu_flash/causal.rs:917-941 — both copies are in the same file, so extract the 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 `candle-nn/src/attention/cpu_flash/causal.rs:635` 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 (39 lines × 2) candle-transformers/src/models/blip_text.rs:124— candle-transformers/src/models/blip_text.rs:124-162 | candle-transformers/src/models/quantized_blip_text.rs:120-158 — before extracting anything, compare `candle-transformers/src/models/blip_text.rs` and `candle-transformers/src/models/quantized_blip_text.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 222 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 (35 lines × 3) candle-nn/src/rotary_emb.rs:115— candle-nn/src/rotary_emb.rs:115-149 | candle-nn/src/rotary_emb.rs:420-454 | candle-nn/src/rotary_emb.rs:694-728 — 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 `candle-nn/src/rotary_emb.rs:115` 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 (20–27 lines × 2) candle-core/src/quantized/avx.rs:191— candle-core/src/quantized/avx.rs:191-210 | candle-core/src/quantized/avx.rs:402-428 — both copies are in the same file, so extract the 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 (52 lines × 2) candle-transformers/src/models/quantized_recurrent_gemma.rs:223— candle-transformers/src/models/quantized_recurrent_gemma.rs:223-274 | candle-transformers/src/models/recurrent_gemma.rs:456-507 — before extracting anything, compare `candle-transformers/src/models/quantized_recurrent_gemma.rs` and `candle-transformers/src/models/recurrent_gemma.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 219 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 `candle-transformers/src/models/quantized_recurrent_gemma.rs:223` 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 × 3) candle-transformers/src/models/stable_diffusion/mod.rs:231— candle-transformers/src/models/stable_diffusion/mod.rs:231-256 | candle-transformers/src/models/stable_diffusion/mod.rs:300-325 | candle-transformers/src/models/stable_diffusion/mod.rs:399-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 `candle-transformers/src/models/stable_diffusion/mod.rs:231` 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 (25–26 lines × 2) candle-transformers/src/models/wuerstchen/diffnext.rs:167— candle-transformers/src/models/wuerstchen/diffnext.rs:167-191 | candle-transformers/src/models/wuerstchen/diffnext.rs:211-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 `candle-transformers/src/models/wuerstchen/diffnext.rs:167` 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–25 lines × 4) candle-core/src/quantized/neon.rs:642— candle-core/src/quantized/neon.rs:642-666 | candle-core/src/quantized/neon.rs:818-842 | candle-core/src/quantized/neon.rs:2818-2820 | candle-core/src/quantized/neon.rs:3102-3104 — 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 `candle-core/src/quantized/neon.rs:642` 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 (23–25 lines × 2) candle-nn/src/ops.rs:458— candle-nn/src/ops.rs:458-480 | candle-nn/src/ops.rs:706-730 — both copies are in the same file, so extract the 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 `candle-nn/src/ops.rs:458` 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 (21–24 lines × 2) candle-transformers/src/models/gemma3.rs:478— candle-transformers/src/models/gemma3.rs:478-501 | candle-transformers/src/models/gemma4/text.rs:589-609 — before extracting anything, compare `candle-transformers/src/models/gemma3.rs` and `candle-transformers/src/models/gemma4/text.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 165 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. 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 (22–23 lines × 4) candle-transformers/src/models/stable_diffusion/mod.rs:159— candle-transformers/src/models/stable_diffusion/mod.rs:159-180 | candle-transformers/src/models/stable_diffusion/mod.rs:242-263 | candle-transformers/src/models/stable_diffusion/mod.rs:311-333 | candle-transformers/src/models/stable_diffusion/mod.rs:410-431 — 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 `candle-transformers/src/models/stable_diffusion/mod.rs:159` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-transformers/src/models/stable_diffusion/mod.rs:158` calls `bc` and `candle-transformers/src/models/stable_diffusion/mod.rs:241` 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 (29 lines × 2) candle-transformers/src/models/quantized_t5.rs:291— candle-transformers/src/models/quantized_t5.rs:291-319 | candle-transformers/src/models/t5.rs:420-448 — before extracting anything, compare `candle-transformers/src/models/quantized_t5.rs` and `candle-transformers/src/models/t5.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 390 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 `candle-transformers/src/models/quantized_t5.rs:291` 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–22 lines × 2) candle-core/src/quantized/neon.rs:3859— candle-core/src/quantized/neon.rs:3859-3874 | candle-core/src/quantized/neon.rs:3885-3906 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/neon.rs:3859` 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 × 3) candle-metal-kernels/src/kernels/reduce.rs:159— candle-metal-kernels/src/kernels/reduce.rs:159-179 | candle-metal-kernels/src/kernels/reduce.rs:218-238 | candle-metal-kernels/src/kernels/reduce.rs:281-301 — 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 `candle-metal-kernels/src/kernels/reduce.rs:159` 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–21 lines × 3) candle-transformers/src/models/glm4_new.rs:333— candle-transformers/src/models/glm4_new.rs:333-352 | candle-transformers/src/models/qwen3_moe.rs:303-322 | candle-transformers/src/models/smol/smollm3.rs:397-417 — before extracting anything, compare `candle-transformers/src/models/glm4_new.rs` and `candle-transformers/src/models/qwen3_moe.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 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 (24–28 lines × 3) candle-nn/src/rotary_emb.rs:28— candle-nn/src/rotary_emb.rs:28-55 | candle-nn/src/rotary_emb.rs:328-355 | candle-nn/src/rotary_emb.rs:619-642 — 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 `candle-nn/src/rotary_emb.rs:28` 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 (2–20 lines × 6) candle-core/src/quantized/avx.rs:475— candle-core/src/quantized/avx.rs:475-494 | candle-core/src/quantized/avx.rs:562-581 | candle-core/src/quantized/k_quants.rs:1518-1519 | candle-core/src/quantized/k_quants.rs:1783-1784 | candle-core/src/quantized/neon.rs:3505-3508 | candle-core/src/quantized/simd128.rs:223-224 — before extracting anything, compare `candle-core/src/quantized/k_quants.rs` and `candle-core/src/quantized/simd128.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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 (40 lines × 2) candle-transformers/src/models/quantized_recurrent_gemma.rs:130— candle-transformers/src/models/quantized_recurrent_gemma.rs:130-169 | candle-transformers/src/models/recurrent_gemma.rs:363-402 — before extracting anything, compare `candle-transformers/src/models/quantized_recurrent_gemma.rs` and `candle-transformers/src/models/recurrent_gemma.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 219 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 (59 lines × 2) candle-transformers/src/models/quantized_rwkv_v6.rs:136— candle-transformers/src/models/quantized_rwkv_v6.rs:136-194 | candle-transformers/src/models/rwkv_v6.rs:114-172 — before extracting anything, compare `candle-transformers/src/models/quantized_rwkv_v6.rs` and `candle-transformers/src/models/rwkv_v6.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 197 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 (18–19 lines × 3) candle-transformers/src/models/stable_diffusion/ddim.rs:100— candle-transformers/src/models/stable_diffusion/ddim.rs:100-117 | candle-transformers/src/models/stable_diffusion/ddpm.rs:56-74 | candle-transformers/src/models/stable_diffusion/euler_ancestral_discrete.rs:101-118 — 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 3 call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `DDIMSchedulerConfig` in one and `DDPMSchedulerConfig` 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 after the matched lines, `candle-transformers/src/models/stable_diffusion/ddpm.rs:78` calls `min`, `rev`, `collect` and `candle-transformers/src/models/stable_diffusion/ddim.rs:118` 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 (17–18 lines × 3) candle-transformers/src/models/vgg.rs:154— candle-transformers/src/models/vgg.rs:154-170 | candle-transformers/src/models/vgg.rs:200-217 | candle-transformers/src/models/vgg.rs:250-267 — 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 `candle-transformers/src/models/vgg.rs:154` 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 (3–18 lines × 4) candle-transformers/src/models/gemma.rs:242— candle-transformers/src/models/gemma.rs:242-244 | candle-transformers/src/models/gemma2.rs:239-256 | candle-transformers/src/models/gemma3.rs:262-279 | candle-transformers/src/models/gemma4/text.rs:359-361 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 240 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 `candle-transformers/src/models/gemma.rs:242` 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, `candle-transformers/src/models/gemma2.rs:238` calls `flash_attn`, `is_some`, `transpose` and `candle-transformers/src/models/gemma.rs:242` 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 (18 lines × 4) candle-transformers/src/models/quantized_rwkv_v5.rs:226— candle-transformers/src/models/quantized_rwkv_v5.rs:226-243 | candle-transformers/src/models/quantized_rwkv_v6.rs:273-290 | candle-transformers/src/models/rwkv_v5.rs:273-290 | candle-transformers/src/models/rwkv_v6.rs:247-264 — before extracting anything, compare `candle-transformers/src/models/quantized_rwkv_v5.rs` and `candle-transformers/src/models/quantized_rwkv_v6.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 168 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 (17 lines × 4) candle-transformers/src/models/quantized_rwkv_v5.rs:272— candle-transformers/src/models/quantized_rwkv_v5.rs:272-288 | candle-transformers/src/models/quantized_rwkv_v6.rs:319-335 | candle-transformers/src/models/rwkv_v5.rs:319-335 | candle-transformers/src/models/rwkv_v6.rs:293-309 — before extracting anything, compare `candle-transformers/src/models/quantized_rwkv_v5.rs` and `candle-transformers/src/models/quantized_rwkv_v6.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 168 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 `candle-transformers/src/models/quantized_rwkv_v5.rs:272` 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 (15–16 lines × 3) candle-transformers/src/models/chatglm.rs:558— candle-transformers/src/models/chatglm.rs:558-572 | candle-transformers/src/models/codegeex4_9b.rs:579-594 | candle-transformers/src/models/glm4.rs:600-615 — before extracting anything, compare `candle-transformers/src/models/chatglm.rs` and `candle-transformers/src/models/codegeex4_9b.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 400 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 (15–16 lines × 2) candle-metal-kernels/src/kernels/sdpa.rs:316— candle-metal-kernels/src/kernels/sdpa.rs:316-330 | candle-metal-kernels/src/kernels/sdpa.rs:433-448 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (41 lines × 2) candle-transformers/src/models/mpt.rs:88— candle-transformers/src/models/mpt.rs:88-128 | candle-transformers/src/models/quantized_mpt.rs:65-105 — before extracting anything, compare `candle-transformers/src/models/mpt.rs` and `candle-transformers/src/models/quantized_mpt.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 128 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 `candle-transformers/src/models/mpt.rs:88` 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–16 lines × 2) candle-transformers/src/models/paddleocr_vl/vision.rs:101— candle-transformers/src/models/paddleocr_vl/vision.rs:101-116 | candle-transformers/src/models/siglip.rs:544-555 — 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 (27–28 lines × 2) candle-transformers/src/models/quantized_stable_lm.rs:81— candle-transformers/src/models/quantized_stable_lm.rs:81-107 | candle-transformers/src/models/stable_lm.rs:202-229 — before extracting anything, compare `candle-transformers/src/models/quantized_stable_lm.rs` and `candle-transformers/src/models/stable_lm.rs` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 239 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 `candle-transformers/src/models/quantized_stable_lm.rs:81` 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 (4–16 lines × 3) candle-transformers/src/models/mixtral.rs:300— candle-transformers/src/models/mixtral.rs:300-303 | candle-transformers/src/models/qwen2_moe.rs:264-279 | candle-transformers/src/models/qwen3_moe.rs:126-139 — before extracting anything, compare `candle-transformers/src/models/mixtral.rs` and `candle-transformers/src/models/qwen2_moe.rs` as WHOLE FILES: this scan already matched 30 separate duplicated blocks between them, totalling at least 277 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-transformers/src/models/qwen2_moe.rs:264` calls `reshape` and `candle-transformers/src/models/mixtral.rs:300` 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 (15 lines × 7) candle-core/src/quantized/neon.rs:724— candle-core/src/quantized/neon.rs:724-738 | candle-core/src/quantized/neon.rs:897-911 | candle-core/src/quantized/neon.rs:1173-1187 | candle-core/src/quantized/neon.rs:1931-1945 | candle-core/src/quantized/neon.rs:2718-2732 | candle-core/src/quantized/neon.rs:3015-3029 | candle-core/src/quantized/neon.rs:3156-3170 — 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 `candle-core/src/quantized/neon.rs:724` 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 (15 lines × 4) candle-transformers/src/models/quantized_mistral.rs:126— candle-transformers/src/models/quantized_mistral.rs:126-140 | candle-transformers/src/models/qwen2.rs:139-153 | candle-transformers/src/models/qwen2_moe.rs:146-160 | candle-transformers/src/models/yi.rs:178-192 — before extracting anything, compare `candle-transformers/src/models/quantized_mistral.rs` and `candle-transformers/src/models/qwen2.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 210 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 `candle-transformers/src/models/quantized_mistral.rs:126` 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–15 lines × 2) candle-core/src/cpu_backend/mod.rs:1065— candle-core/src/cpu_backend/mod.rs:1065-1076 | candle-core/src/cpu_backend/mod.rs:1293-1307 — both copies are in the same file, so extract the 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 `candle-core/src/cpu_backend/mod.rs:1065` 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 × 2) candle-transformers/src/models/whisper/audio.rs:129— candle-transformers/src/models/whisper/audio.rs:129-149 | candle-wasm-examples/whisper/src/audio.rs:120-139 — before extracting anything, compare `candle-transformers/src/models/whisper/audio.rs` and `candle-wasm-examples/whisper/src/audio.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/whisper/audio.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 (25 lines × 3) candle-nn/src/rotary_emb.rs:160— candle-nn/src/rotary_emb.rs:160-184 | candle-nn/src/rotary_emb.rs:465-489 | candle-nn/src/rotary_emb.rs:739-763 — 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 `candle-nn/src/rotary_emb.rs:160` 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–14 lines × 3) candle-transformers/src/models/chinese_clip/vision_model.rs:178— candle-transformers/src/models/chinese_clip/vision_model.rs:178-191 | candle-transformers/src/models/clip/text_model.rs:145-157 | candle-transformers/src/models/stable_diffusion/clip.rs:225-237 — before extracting anything, compare `candle-transformers/src/models/chinese_clip/vision_model.rs` and `candle-transformers/src/models/clip/text_model.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/chinese_clip/vision_model.rs:178` 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) candle-transformers/src/models/metavoice.rs:790— candle-transformers/src/models/metavoice.rs:790-831 | candle-transformers/src/models/quantized_metavoice.rs:93-134 — before extracting anything, compare `candle-transformers/src/models/metavoice.rs` and `candle-transformers/src/models/quantized_metavoice.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 125 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 (11–14 lines × 2) candle-transformers/src/models/paddleocr_vl/mod.rs:196— candle-transformers/src/models/paddleocr_vl/mod.rs:196-209 | candle-transformers/src/models/paddleocr_vl/mod.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 `candle-transformers/src/models/paddleocr_vl/mod.rs:196` 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–13 lines × 14) candle-transformers/src/models/gemma.rs:300— candle-transformers/src/models/gemma.rs:300-312 | candle-transformers/src/models/helium.rs:278-290 | candle-transformers/src/models/mistral.rs:327-339 | candle-transformers/src/models/mixtral.rs:370-382 | candle-transformers/src/models/nvembed_v2/embedding.rs:187-199 | candle-transformers/src/models/phi3.rs:314-326 | candle-transformers/src/models/quantized_mistral.rs:218-230 | candle-transformers/src/models/qwen2.rs:230-242 | candle-transformers/src/models/qwen2_moe.rs:363-375 | candle-transformers/src/models/qwen3.rs:372-383 | candle-transformers/src/models/qwen3_moe.rs:236-248 | candle-transformers/src/models/smol/smollm3.rs:323-334 | candle-transformers/src/models/yi.rs:264-275 | candle-transformers/src/models/z_image/text_encoder.rs:336-347 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/helium.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 177 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 `candle-transformers/src/models/gemma.rs:300` 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 `cfg` to `&Config` in one and `&TextEncoderConfig` 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–13 lines × 3) candle-nn/src/attention/cpu_flash/causal.rs:644— candle-nn/src/attention/cpu_flash/causal.rs:644-656 | candle-nn/src/attention/cpu_flash/causal.rs:752-764 | candle-nn/src/attention/cpu_flash/causal.rs:924-934 — 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 `candle-nn/src/attention/cpu_flash/causal.rs:644` 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–13 lines × 2) candle-core/src/backprop.rs:672— candle-core/src/backprop.rs:672-680 | candle-core/src/backprop.rs:684-696 — both copies are in the same file, so extract the 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 `candle-core/src/backprop.rs:672` 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–13 lines × 2) candle-transformers/src/models/mobilenetv4.rs:378— candle-transformers/src/models/mobilenetv4.rs:378-390 | candle-transformers/src/models/mobilenetv4.rs:617-626 — both copies are in the same file, so extract the 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 `candle-transformers/src/models/mobilenetv4.rs:378` 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 (2–13 lines × 3) candle-transformers/src/models/olmo.rs:138— candle-transformers/src/models/olmo.rs:138-150 | candle-transformers/src/models/olmo2.rs:129-130 | candle-transformers/src/models/starcoder2.rs:141-153 — before extracting anything, compare `candle-transformers/src/models/olmo.rs` and `candle-transformers/src/models/olmo2.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 205 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 `candle-transformers/src/models/olmo.rs:138` 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, `candle-transformers/src/models/olmo.rs:136` calls `linear_b`, `pp` and `candle-transformers/src/models/olmo2.rs:127` 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 (11–12 lines × 18) candle-transformers/src/models/gemma.rs:299— candle-transformers/src/models/gemma.rs:299-310 | candle-transformers/src/models/granite.rs:409-419 | candle-transformers/src/models/granitemoehybrid.rs:474-484 | candle-transformers/src/models/helium.rs:277-288 | candle-transformers/src/models/llama.rs:456-466 | candle-transformers/src/models/mistral.rs:326-337 | candle-transformers/src/models/mixtral.rs:369-380 | candle-transformers/src/models/nvembed_v2/embedding.rs:186-197 | candle-transformers/src/models/phi3.rs:313-324 | candle-transformers/src/models/quantized_mistral.rs:217-228 | candle-transformers/src/models/qwen2.rs:229-240 | candle-transformers/src/models/qwen2_moe.rs:362-373 | candle-transformers/src/models/qwen3.rs:371-381 | candle-transformers/src/models/qwen3_moe.rs:235-246 | candle-transformers/src/models/smol/smollm3.rs:322-332 | candle-transformers/src/models/voxtral/voxtral_llama.rs:380-390 | candle-transformers/src/models/yi.rs:263-273 | candle-transformers/src/models/z_image/text_encoder.rs:335-345 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/helium.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 177 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 `candle-transformers/src/models/gemma.rs:299` 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 `cfg` to `&Config` in one and `&GraniteMoeHybridInternalConfig` 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–12 lines × 10) candle-transformers/src/models/mixtral.rs:230— candle-transformers/src/models/mixtral.rs:230-239 | candle-transformers/src/models/olmo.rs:212-221 | candle-transformers/src/models/olmo2.rs:200-209 | candle-transformers/src/models/quantized_mistral.rs:189-198 | candle-transformers/src/models/quantized_stable_lm.rs:168-177 | candle-transformers/src/models/qwen2.rs:201-210 | candle-transformers/src/models/qwen2_moe.rs:208-217 | candle-transformers/src/models/stable_lm.rs:298-307 | candle-transformers/src/models/stella_en_v5.rs:412-423 | candle-transformers/src/models/yi.rs:239-248 — before extracting anything, compare `candle-transformers/src/models/mixtral.rs` and `candle-transformers/src/models/olmo.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 122 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 `candle-transformers/src/models/mixtral.rs:230` 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 after the matched lines, `candle-transformers/src/models/olmo.rs:223` calls `clear_kv_cache` and `candle-transformers/src/models/mixtral.rs:240` 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 × 6) candle-transformers/src/models/mixtral.rs:161— candle-transformers/src/models/mixtral.rs:161-172 | candle-transformers/src/models/nvembed_v2/embedding.rs:110-121 | candle-transformers/src/models/quantized_mistral.rs:126-137 | candle-transformers/src/models/qwen2.rs:139-150 | candle-transformers/src/models/qwen2_moe.rs:146-157 | candle-transformers/src/models/yi.rs:178-189 — before extracting anything, compare `candle-transformers/src/models/mixtral.rs` and `candle-transformers/src/models/nvembed_v2/embedding.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/mixtral.rs:161` 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 × 5) candle-core/src/quantized/neon.rs:708— candle-core/src/quantized/neon.rs:708-719 | candle-core/src/quantized/neon.rs:881-892 | candle-core/src/quantized/neon.rs:1157-1168 | candle-core/src/quantized/neon.rs:2999-3010 | candle-core/src/quantized/neon.rs:3141-3152 — 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 `candle-core/src/quantized/neon.rs:708` 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–12 lines × 4) candle-nn/src/attention/cpu_flash/causal.rs:210— candle-nn/src/attention/cpu_flash/causal.rs:210-221 | candle-nn/src/attention/cpu_flash/causal.rs:595-606 | candle-nn/src/attention/cpu_flash/causal.rs:815-825 | candle-nn/src/attention/cpu_flash/causal.rs:896-906 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-nn/src/attention/cpu_flash/causal.rs:207` calls `causal_decode_f32_lean` and `candle-nn/src/attention/cpu_flash/causal.rs:814` 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–12 lines × 4) candle-transformers/src/models/quantized_gemma3.rs:420— candle-transformers/src/models/quantized_gemma3.rs:420-431 | candle-transformers/src/models/quantized_llama.rs:508-518 | candle-transformers/src/models/quantized_phi.rs:255-264 | candle-transformers/src/models/quantized_phi3.rs:286-296 — before extracting anything, compare `candle-transformers/src/models/quantized_gemma3.rs` and `candle-transformers/src/models/quantized_llama.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 74 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 `candle-transformers/src/models/quantized_gemma3.rs:420` 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, `candle-transformers/src/models/quantized_phi.rs:253` calls `clone` and `candle-transformers/src/models/quantized_phi3.rs:285` 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–12 lines × 4) candle-core/src/quantized/k_quants.rs:1107— candle-core/src/quantized/k_quants.rs:1107-1118 | candle-core/src/quantized/k_quants.rs:1120-1131 | candle-core/src/quantized/k_quants.rs:1133-1144 | candle-core/src/quantized/k_quants.rs:1145-1153 — 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 `candle-core/src/quantized/k_quants.rs:1107` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-core/src/quantized/k_quants.rs:1143` calls `zip`, `for_each`, `iter_mut` and `candle-core/src/quantized/k_quants.rs:1107` 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 (23 lines × 3) candle-core/src/quantized/neon.rs:1076— candle-core/src/quantized/neon.rs:1076-1098 | candle-core/src/quantized/neon.rs:1530-1552 | candle-core/src/quantized/neon.rs:2246-2268 — 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 `candle-core/src/quantized/neon.rs:1076` 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–12 lines × 2) candle-core/src/display.rs:13— candle-core/src/display.rs:13-21 | candle-core/src/display.rs:540-551 — both copies are in the same file, so extract the 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 `candle-core/src/display.rs:540` 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 (27–30 lines × 2) candle-core/src/quantized/k_quants.rs:1569— candle-core/src/quantized/k_quants.rs:1569-1598 | candle-core/src/quantized/k_quants.rs:1835-1861 — both copies are in the same file, so extract the 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 `candle-core/src/quantized/k_quants.rs:1569` 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 (3–12 lines × 6) candle-transformers/src/models/blip_text.rs:484— candle-transformers/src/models/blip_text.rs:484-486 | candle-transformers/src/models/marian.rs:632-634 | candle-transformers/src/models/quantized_blip_text.rs:480-482 | candle-transformers/src/models/trocr.rs:505-507 | candle-transformers/src/models/whisper/model.rs:332-343 | candle-transformers/src/models/whisper/quantized_model.rs:336-347 — before extracting anything, compare `candle-transformers/src/models/blip_text.rs` and `candle-transformers/src/models/quantized_blip_text.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 222 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 `candle-transformers/src/models/whisper/model.rs:332` 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 × 15) candle-transformers/src/models/csm.rs:230— candle-transformers/src/models/csm.rs:230-240 | candle-transformers/src/models/gemma.rs:245-255 | candle-transformers/src/models/gemma4/text.rs:362-372 | candle-transformers/src/models/helium.rs:244-254 | candle-transformers/src/models/mistral.rs:293-303 | candle-transformers/src/models/mixtral.rs:225-235 | candle-transformers/src/models/olmo.rs:207-217 | candle-transformers/src/models/olmo2.rs:195-205 | candle-transformers/src/models/phi3.rs:247-257 | candle-transformers/src/models/quantized_mistral.rs:184-194 | candle-transformers/src/models/quantized_stable_lm.rs:163-173 | candle-transformers/src/models/qwen2.rs:196-206 | candle-transformers/src/models/qwen2_moe.rs:203-213 | candle-transformers/src/models/stable_lm.rs:293-303 | candle-transformers/src/models/yi.rs:234-244 — before extracting anything, compare `candle-transformers/src/models/csm.rs` and `candle-transformers/src/models/gemma.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 76 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 `candle-transformers/src/models/csm.rs:230` 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–11 lines × 14) candle-transformers/src/models/based.rs:323— candle-transformers/src/models/based.rs:323-329 | candle-transformers/src/models/gemma.rs:92-98 | candle-transformers/src/models/gemma2.rs:85-91 | candle-transformers/src/models/gemma3.rs:90-96 | candle-transformers/src/models/gemma4/text.rs:75-81 | candle-transformers/src/models/glm4_new.rs:54-60 | candle-transformers/src/models/modernbert.rs:69-75 | candle-transformers/src/models/nvembed_v2/embedding.rs:28-34 | candle-transformers/src/models/olmo.rs:53-59 | candle-transformers/src/models/olmo2.rs:45-51 | candle-transformers/src/models/quantized_glm4.rs:120-126 | candle-transformers/src/models/qwen2.rs:56-62 | candle-transformers/src/models/qwen2_moe.rs:64-70 | candle-transformers/src/models/stella_en_v5.rs:177-187 — before extracting anything, compare `candle-transformers/src/models/based.rs` and `candle-transformers/src/models/gemma.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 61 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 `candle-transformers/src/models/based.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 (11 lines × 10) candle-transformers/src/models/based.rs:573— candle-transformers/src/models/based.rs:573-583 | candle-transformers/src/models/mixtral.rs:468-478 | candle-transformers/src/models/olmo.rs:332-342 | candle-transformers/src/models/olmo2.rs:327-337 | candle-transformers/src/models/phi3.rs:407-417 | candle-transformers/src/models/quantized_stable_lm.rs:286-296 | candle-transformers/src/models/qwen2_moe.rs:463-473 | candle-transformers/src/models/stable_lm.rs:418-428 | candle-transformers/src/models/starcoder2.rs:330-340 | candle-transformers/src/models/yi.rs:349-359 — before extracting anything, compare `candle-transformers/src/models/based.rs` and `candle-transformers/src/models/mixtral.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 63 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-transformers/src/models/quantized_stable_lm.rs:285` calls `enter` and `candle-transformers/src/models/based.rs:572` 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 (11 lines × 5) candle-nn/src/attention/cpu_flash/causal.rs:282— candle-nn/src/attention/cpu_flash/causal.rs:282-292 | candle-nn/src/attention/cpu_flash/causal.rs:368-378 | candle-nn/src/attention/cpu_flash/causal.rs:448-458 | candle-nn/src/attention/cpu_flash/causal.rs:687-697 | candle-nn/src/attention/cpu_flash/causal.rs:784-794 — 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 `candle-nn/src/attention/cpu_flash/causal.rs:282` 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–18 lines × 5) candle-transformers/src/models/mistral.rs:224— candle-transformers/src/models/mistral.rs:224-236 | candle-transformers/src/models/mixtral.rs:153-170 | candle-transformers/src/models/nvembed_v2/embedding.rs:102-119 | candle-transformers/src/models/quantized_mistral.rs:118-135 | candle-transformers/src/models/yi.rs:170-187 — before extracting anything, compare `candle-transformers/src/models/mistral.rs` and `candle-transformers/src/models/mixtral.rs` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 175 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 `candle-transformers/src/models/mistral.rs:224` 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 × 4) candle-transformers/src/models/glm4_new.rs:221— candle-transformers/src/models/glm4_new.rs:221-230 | candle-transformers/src/models/qwen3.rs:342-352 | candle-transformers/src/models/smol/smollm3.rs:288-298 | candle-transformers/src/models/z_image/text_encoder.rs:308-318 — before extracting anything, compare `candle-transformers/src/models/glm4_new.rs` and `candle-transformers/src/models/qwen3.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 120 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 `candle-transformers/src/models/glm4_new.rs:221` 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 after the matched lines, `candle-transformers/src/models/glm4_new.rs:232` calls `pub`, `clear_kv_cache`, `reset` and `candle-transformers/src/models/z_image/text_encoder.rs:319` 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–11 lines × 3) candle-core/src/quantized/avx.rs:192— candle-core/src/quantized/avx.rs:192-198 | candle-core/src/quantized/avx.rs:403-413 | candle-core/src/quantized/avx.rs:628-634 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10–19 lines × 4) candle-transformers/src/models/gemma.rs:172— candle-transformers/src/models/gemma.rs:172-190 | candle-transformers/src/models/gemma2.rs:166-184 | candle-transformers/src/models/gemma3.rs:180-189 | candle-transformers/src/models/helium.rs:169-187 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 240 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 `candle-transformers/src/models/gemma.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. 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–11 lines × 3) candle-core/src/safetensors.rs:445— candle-core/src/safetensors.rs:445-455 | candle-core/src/safetensors.rs:475-485 | candle-core/src/safetensors.rs:593-596 — 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 before the matched lines, `candle-core/src/safetensors.rs:444` calls `open`, `map_err`, `from` and `candle-core/src/safetensors.rs:593` 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 (8–11 lines × 2) candle-transformers/src/models/quantized_qwen3.rs:367— candle-transformers/src/models/quantized_qwen3.rs:367-374 | candle-transformers/src/models/quantized_qwen3_moe.rs:205-215 — 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 `candle-transformers/src/models/quantized_qwen3.rs:367` 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–10 lines × 17) candle-transformers/src/models/gemma.rs:206— candle-transformers/src/models/gemma.rs:206-213 | candle-transformers/src/models/gemma2.rs:201-208 | candle-transformers/src/models/gemma3.rs:227-234 | candle-transformers/src/models/glm4_new.rs:198-205 | candle-transformers/src/models/mixtral.rs:187-194 | candle-transformers/src/models/paddleocr_vl/text.rs:798-805 | candle-transformers/src/models/paddleocr_vl/text.rs:901-910 | candle-transformers/src/models/quantized_qwen3.rs:244-251 | candle-transformers/src/models/quantized_stable_lm.rs:122-129 | candle-transformers/src/models/qwen2.rs:164-171 | candle-transformers/src/models/qwen2_moe.rs:171-178 | candle-transformers/src/models/qwen3.rs:197-205 | candle-transformers/src/models/smol/smollm3.rs:247-255 | candle-transformers/src/models/stable_lm.rs:245-252 | candle-transformers/src/models/starcoder2.rs:167-174 | candle-transformers/src/models/yi.rs:203-210 | candle-transformers/src/models/z_image/text_encoder.rs:276-284 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 240 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-transformers/src/models/quantized_stable_lm.rs:118` calls `enter` and `candle-transformers/src/models/gemma.rs:202` 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 (15 lines × 10) candle-core/src/cuda_backend/mod.rs:2374— candle-core/src/cuda_backend/mod.rs:2374-2388 | candle-core/src/cuda_backend/mod.rs:2390-2404 | candle-core/src/cuda_backend/mod.rs:2406-2420 | candle-core/src/cuda_backend/mod.rs:2422-2436 | candle-core/src/cuda_backend/mod.rs:2438-2452 | candle-core/src/cuda_backend/mod.rs:2454-2468 | candle-core/src/cuda_backend/mod.rs:2470-2484 | candle-core/src/cuda_backend/mod.rs:2486-2500 | candle-core/src/cuda_backend/mod.rs:2502-2516 | candle-core/src/cuda_backend/mod.rs:2518-2532 — 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. 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 × 5) candle-transformers/src/models/quantized_lfm2.rs:601— candle-transformers/src/models/quantized_lfm2.rs:601-610 | candle-transformers/src/models/quantized_llama.rs:569-577 | candle-transformers/src/models/quantized_phi.rs:284-292 | candle-transformers/src/models/quantized_phi3.rs:316-324 | candle-transformers/src/models/quantized_qwen2.rs:318-326 — before extracting anything, compare `candle-transformers/src/models/quantized_lfm2.rs` and `candle-transformers/src/models/quantized_llama.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 56 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 `candle-transformers/src/models/quantized_lfm2.rs:601` 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–10 lines × 4) candle-core/src/quantized/mod.rs:548— candle-core/src/quantized/mod.rs:548-557 | candle-core/src/quantized/mod.rs:584-592 | candle-core/src/quantized/mod.rs:627-636 | candle-core/src/quantized/mod.rs:656-665 — 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 `candle-core/src/quantized/mod.rs:548` 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 × 4) candle-transformers/src/models/quantized_gemma3.rs:193— candle-transformers/src/models/quantized_gemma3.rs:193-200 | candle-transformers/src/models/quantized_lfm2.rs:134-141 | candle-transformers/src/models/quantized_llama.rs:203-210 | candle-transformers/src/models/quantized_phi3.rs:124-133 — before extracting anything, compare `candle-transformers/src/models/quantized_gemma3.rs` and `candle-transformers/src/models/quantized_llama.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 74 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 `candle-transformers/src/models/quantized_phi3.rs:124` 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 (4–10 lines × 4) candle-transformers/src/models/nomic_bert.rs:96— candle-transformers/src/models/nomic_bert.rs:96-99 | candle-transformers/src/models/quantized_lfm2.rs:106-115 | candle-transformers/src/models/quantized_phi3.rs:211-220 | candle-transformers/src/models/quantized_qwen2.rs:169-178 — before extracting anything, compare `candle-transformers/src/models/quantized_lfm2.rs` and `candle-transformers/src/models/quantized_phi3.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 58 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 `candle-transformers/src/models/nomic_bert.rs:96` 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 (3–10 lines × 4) candle-core/src/cpu_backend/mod.rs:214— candle-core/src/cpu_backend/mod.rs:214-216 | candle-core/src/cpu_backend/utils.rs:287-290 | candle-core/src/cpu_backend/utils.rs:308-317 | candle-core/src/cpu_backend/utils.rs:341-350 — 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 `candle-core/src/cpu_backend/utils.rs:287` 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) candle-nn/src/batch_norm.rs:256— candle-nn/src/batch_norm.rs:256-265 | candle-onnx/src/eval.rs:556-563 — 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 `candle-nn/src/batch_norm.rs:256` 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 (16–17 lines × 2) candle-transformers/src/models/paddleocr_vl/vision.rs:523— candle-transformers/src/models/paddleocr_vl/vision.rs:523-539 | candle-transformers/src/models/qwen3_vl/vision.rs:144-159 — `candle-transformers/src/models/paddleocr_vl/vision.rs` and `candle-transformers/src/models/qwen3_vl/vision.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 81 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/paddleocr_vl/vision.rs:523` 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 × 18) candle-transformers/src/models/csm.rs:233— candle-transformers/src/models/csm.rs:233-241 | candle-transformers/src/models/gemma.rs:248-256 | candle-transformers/src/models/gemma2.rs:248-256 | candle-transformers/src/models/gemma3.rs:271-279 | candle-transformers/src/models/gemma4/text.rs:365-373 | candle-transformers/src/models/helium.rs:247-255 | candle-transformers/src/models/mistral.rs:296-304 | candle-transformers/src/models/mixtral.rs:228-236 | candle-transformers/src/models/olmo.rs:210-218 | candle-transformers/src/models/olmo2.rs:198-206 | candle-transformers/src/models/phi3.rs:250-258 | candle-transformers/src/models/quantized_mistral.rs:187-195 | candle-transformers/src/models/quantized_stable_lm.rs:166-174 | candle-transformers/src/models/qwen2.rs:199-207 | candle-transformers/src/models/qwen2_moe.rs:206-214 | candle-transformers/src/models/stable_lm.rs:296-304 | candle-transformers/src/models/stella_en_v5.rs:410-420 | candle-transformers/src/models/yi.rs:237-245 — before extracting anything, compare `candle-transformers/src/models/csm.rs` and `candle-transformers/src/models/gemma.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 76 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 `candle-transformers/src/models/csm.rs:233` 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 × 12) candle-transformers/src/models/based.rs:402— candle-transformers/src/models/based.rs:402-410 | candle-transformers/src/models/gemma.rs:217-225 | candle-transformers/src/models/gemma2.rs:212-220 | candle-transformers/src/models/mixtral.rs:198-206 | candle-transformers/src/models/olmo.rs:186-194 | candle-transformers/src/models/olmo2.rs:174-182 | candle-transformers/src/models/phi3.rs:226-234 | candle-transformers/src/models/quantized_mistral.rs:164-172 | candle-transformers/src/models/qwen2.rs:175-183 | candle-transformers/src/models/qwen2_moe.rs:182-190 | candle-transformers/src/models/starcoder2.rs:178-186 | candle-transformers/src/models/yi.rs:214-222 — before extracting anything, compare `candle-transformers/src/models/based.rs` and `candle-transformers/src/models/gemma.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 61 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 `candle-transformers/src/models/based.rs:402` 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 × 8) candle-transformers/src/models/mistral.rs:167— candle-transformers/src/models/mistral.rs:167-175 | candle-transformers/src/models/nvembed_v2/embedding.rs:67-75 | candle-transformers/src/models/olmo.rs:92-100 | candle-transformers/src/models/olmo2.rs:84-92 | candle-transformers/src/models/quantized_mistral.rs:82-90 | candle-transformers/src/models/qwen2.rs:95-103 | candle-transformers/src/models/qwen2_moe.rs:102-110 | candle-transformers/src/models/yi.rs:134-142 — before extracting anything, compare `candle-transformers/src/models/mistral.rs` and `candle-transformers/src/models/nvembed_v2/embedding.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/mistral.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 (8–9 lines × 6) candle-nn/src/ops.rs:426— candle-nn/src/ops.rs:426-434 | candle-nn/src/ops.rs:651-658 | candle-nn/src/ops.rs:902-909 | candle-nn/src/rotary_emb.rs:239-246 | candle-nn/src/rotary_emb.rs:545-552 | candle-nn/src/rotary_emb.rs:820-827 — there are 6 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 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `candle-nn/src/ops.rs:426` 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, `candle-nn/src/ops.rs:649` calls `buffer`, `start_offset`, `dtype` and `candle-nn/src/ops.rs:425` 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–9 lines × 5) candle-transformers/src/models/gemma.rs:233— candle-transformers/src/models/gemma.rs:233-241 | candle-transformers/src/models/gemma2.rs:228-236 | candle-transformers/src/models/gemma3.rs:251-259 | candle-transformers/src/models/gemma4/text.rs:357-359 | candle-transformers/src/models/stable_lm.rs:281-289 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 240 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 `candle-transformers/src/models/gemma.rs:233` 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 after the matched lines, `candle-transformers/src/models/gemma.rs:241` calls `transpose` and `candle-transformers/src/models/gemma4/text.rs:359` 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 (4–9 lines × 4) candle-transformers/src/models/beit.rs:297— candle-transformers/src/models/beit.rs:297-305 | candle-transformers/src/models/dinov2.rs:255-263 | candle-transformers/src/models/dinov2reg4.rs:246-254 | candle-transformers/src/models/eva2.rs:282-285 — before extracting anything, compare `candle-transformers/src/models/beit.rs` and `candle-transformers/src/models/dinov2.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 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 `candle-transformers/src/models/beit.rs:297` 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 (3–9 lines × 3) candle-core/src/quantized/neon.rs:798— candle-core/src/quantized/neon.rs:798-800 | candle-core/src/quantized/neon.rs:807-815 | candle-core/src/quantized/neon.rs:3083-3091 — 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 `candle-core/src/quantized/neon.rs:807` 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 (5–8 lines × 29) candle-transformers/src/models/based.rs:412— candle-transformers/src/models/based.rs:412-416 | candle-transformers/src/models/chatglm.rs:292-299 | candle-transformers/src/models/codegeex4_9b.rs:313-320 | candle-transformers/src/models/csm.rs:220-224 | candle-transformers/src/models/deepseek2.rs:669-673 | candle-transformers/src/models/gemma.rs:227-231 | candle-transformers/src/models/gemma2.rs:222-226 | candle-transformers/src/models/glm4.rs:334-341 | candle-transformers/src/models/helium.rs:227-231 | candle-transformers/src/models/metavoice.rs:812-816 | candle-transformers/src/models/mistral.rs:276-280 | candle-transformers/src/models/mixformer.rs:303-307 | candle-transformers/src/models/mixtral.rs:208-212 | candle-transformers/src/models/mpt.rs:109-113 | candle-transformers/src/models/olmo.rs:196-200 | candle-transformers/src/models/olmo2.rs:184-188 | candle-transformers/src/models/paddleocr_vl/text.rs:843-847 | candle-transformers/src/models/phi.rs:233-237 | candle-transformers/src/models/phi3.rs:236-240 | candle-transformers/src/models/quantized_metavoice.rs:115-119 | candle-transformers/src/models/quantized_mistral.rs:174-178 | candle-transformers/src/models/quantized_mixformer.rs:220-224 | candle-transformers/src/models/quantized_mpt.rs:86-90 | candle-transformers/src/models/quantized_recurrent_gemma.rs:248-252 | candle-transformers/src/models/qwen2.rs:185-189 | candle-transformers/src/models/qwen2_moe.rs:192-196 | candle-transformers/src/models/recurrent_gemma.rs:481-485 | candle-transformers/src/models/starcoder2.rs:188-192 | candle-transformers/src/models/yi.rs:224-228 — before extracting anything, compare `candle-transformers/src/models/based.rs` and `candle-transformers/src/models/gemma.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 61 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 `candle-transformers/src/models/based.rs:412` 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, `candle-transformers/src/models/csm.rs:226` calls `repeat_kv` and `candle-transformers/src/models/based.rs:418` 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–8 lines × 22) candle-transformers/src/models/csm.rs:195— candle-transformers/src/models/csm.rs:195-201 | candle-transformers/src/models/gemma.rs:205-210 | candle-transformers/src/models/gemma2.rs:200-205 | candle-transformers/src/models/gemma3.rs:226-231 | candle-transformers/src/models/glm4_new.rs:197-202 | candle-transformers/src/models/helium.rs:202-208 | candle-transformers/src/models/mistral.rs:251-257 | candle-transformers/src/models/mixtral.rs:186-191 | candle-transformers/src/models/nvembed_v2/embedding.rs:133-139 | candle-transformers/src/models/paddleocr_vl/text.rs:797-802 | candle-transformers/src/models/paddleocr_vl/text.rs:900-907 | candle-transformers/src/models/quantized_mistral.rs:150-156 | candle-transformers/src/models/quantized_qwen3.rs:243-248 | candle-transformers/src/models/quantized_stable_lm.rs:121-126 | candle-transformers/src/models/qwen2.rs:163-168 | candle-transformers/src/models/qwen2_moe.rs:170-175 | candle-transformers/src/models/qwen3.rs:196-202 | candle-transformers/src/models/smol/smollm3.rs:246-252 | candle-transformers/src/models/stable_lm.rs:244-249 | candle-transformers/src/models/starcoder2.rs:166-171 | candle-transformers/src/models/yi.rs:202-207 | candle-transformers/src/models/z_image/text_encoder.rs:275-281 — before extracting anything, compare `candle-transformers/src/models/csm.rs` and `candle-transformers/src/models/gemma.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 76 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-transformers/src/models/quantized_stable_lm.rs:118` calls `enter` and `candle-transformers/src/models/csm.rs:192` 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 × 22) candle-transformers/src/models/gemma.rs:209— candle-transformers/src/models/gemma.rs:209-216 | candle-transformers/src/models/gemma2.rs:204-211 | candle-transformers/src/models/gemma3.rs:230-237 | candle-transformers/src/models/glm4_new.rs:201-208 | candle-transformers/src/models/mixtral.rs:190-197 | candle-transformers/src/models/olmo.rs:178-185 | candle-transformers/src/models/olmo2.rs:166-173 | candle-transformers/src/models/paddleocr_vl/text.rs:801-808 | candle-transformers/src/models/paddleocr_vl/text.rs:906-913 | candle-transformers/src/models/phi.rs:206-213 | candle-transformers/src/models/phi3.rs:218-225 | candle-transformers/src/models/quantized_glm4.rs:236-243 | candle-transformers/src/models/quantized_qwen3.rs:247-254 | candle-transformers/src/models/quantized_stable_lm.rs:125-132 | candle-transformers/src/models/qwen2.rs:167-174 | candle-transformers/src/models/qwen2_moe.rs:174-181 | candle-transformers/src/models/qwen3.rs:201-208 | candle-transformers/src/models/smol/smollm3.rs:251-258 | candle-transformers/src/models/stable_lm.rs:248-255 | candle-transformers/src/models/starcoder2.rs:170-177 | candle-transformers/src/models/yi.rs:206-213 | candle-transformers/src/models/z_image/text_encoder.rs:280-287 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 240 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `candle-transformers/src/models/gemma3.rs:239` calls `forward` and `candle-transformers/src/models/gemma.rs:219` 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 × 10) candle-transformers/src/models/mistral.rs:166— candle-transformers/src/models/mistral.rs:166-173 | candle-transformers/src/models/nvembed_v2/embedding.rs:66-73 | candle-transformers/src/models/olmo.rs:91-98 | candle-transformers/src/models/olmo2.rs:83-90 | candle-transformers/src/models/quantized_mistral.rs:81-88 | candle-transformers/src/models/quantized_stable_lm.rs:39-46 | candle-transformers/src/models/qwen2.rs:94-101 | candle-transformers/src/models/qwen2_moe.rs:101-108 | candle-transformers/src/models/stable_lm.rs:143-150 | candle-transformers/src/models/yi.rs:133-140 — before extracting anything, compare `candle-transformers/src/models/mistral.rs` and `candle-transformers/src/models/nvembed_v2/embedding.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/mistral.rs:166` 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 × 7) candle-transformers/src/models/granite.rs:322— candle-transformers/src/models/granite.rs:322-329 | candle-transformers/src/models/granitemoehybrid.rs:372-379 | candle-transformers/src/models/llama.rs:369-376 | candle-transformers/src/models/llama2_c.rs:236-243 | candle-transformers/src/models/quantized_llama2_c.rs:123-130 | candle-transformers/src/models/voxtral/voxtral_llama.rs:293-300 | candle-wasm-examples/llama2-c/src/model.rs:150-157 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 `candle-transformers/src/models/granite.rs:322` 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 × 6) candle-nn/src/attention/cpu_flash/causal.rs:281— candle-nn/src/attention/cpu_flash/causal.rs:281-288 | candle-nn/src/attention/cpu_flash/causal.rs:367-374 | candle-nn/src/attention/cpu_flash/causal.rs:447-454 | candle-nn/src/attention/cpu_flash/causal.rs:686-693 | candle-nn/src/attention/cpu_flash/causal.rs:783-790 | candle-nn/src/attention/cpu_flash/varlen.rs:259-266 — there are 6 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 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `candle-nn/src/attention/cpu_flash/causal.rs:281` 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, `candle-nn/src/attention/cpu_flash/causal.rs:444` calls `vec_dot`, `as_ptr` and `candle-nn/src/attention/cpu_flash/causal.rs:279` 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–8 lines × 6) candle-transformers/src/models/olmo.rs:202— candle-transformers/src/models/olmo.rs:202-206 | candle-transformers/src/models/olmo2.rs:190-194 | candle-transformers/src/models/paddleocr_vl/text.rs:850-857 | candle-transformers/src/models/phi3.rs:242-246 | candle-transformers/src/models/qwen2.rs:191-195 | candle-transformers/src/models/qwen2_moe.rs:198-202 — before extracting anything, compare `candle-transformers/src/models/olmo.rs` and `candle-transformers/src/models/olmo2.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 205 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 `candle-transformers/src/models/olmo.rs:202` 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 (6–8 lines × 4) candle-core/src/quantized/avx.rs:166— candle-core/src/quantized/avx.rs:166-171 | candle-core/src/quantized/avx.rs:188-193 | candle-core/src/quantized/avx.rs:271-278 | candle-core/src/quantized/avx.rs:399-404 — 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. 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) candle-core/src/cuda_backend/mod.rs:607— candle-core/src/cuda_backend/mod.rs:607-610 | candle-core/src/cuda_backend/mod.rs:611-618 | candle-core/src/cuda_backend/mod.rs:663-670 | candle-core/src/cuda_backend/mod.rs:715-722 — 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 `candle-core/src/cuda_backend/mod.rs:611` 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 (4–8 lines × 6) candle-nn/src/attention/cpu_flash/causal.rs:242— candle-nn/src/attention/cpu_flash/causal.rs:242-245 | candle-nn/src/attention/cpu_flash/causal.rs:335-338 | candle-nn/src/attention/cpu_flash/causal.rs:422-425 | candle-nn/src/attention/cpu_flash/causal.rs:497-500 | candle-nn/src/attention/cpu_flash/causal.rs:629-636 | candle-nn/src/attention/cpu_flash/causal.rs:743-750 — 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 `candle-nn/src/attention/cpu_flash/causal.rs:242` 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 after the matched lines, `candle-nn/src/attention/cpu_flash/causal.rs:247` calls `powf` and `candle-nn/src/attention/cpu_flash/causal.rs:340` 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–8 lines × 4) candle-transformers/src/models/quantized_rwkv_v5.rs:50— candle-transformers/src/models/quantized_rwkv_v5.rs:50-52 | candle-transformers/src/models/quantized_rwkv_v6.rs:57-59 | candle-transformers/src/models/rwkv_v5.rs:122-129 | candle-transformers/src/models/rwkv_v6.rs:67-74 — before extracting anything, compare `candle-transformers/src/models/quantized_rwkv_v5.rs` and `candle-transformers/src/models/quantized_rwkv_v6.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 168 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-transformers/src/models/rwkv_v5.rs:119` calls `linear`, `pp` and `candle-transformers/src/models/quantized_rwkv_v5.rs:48` 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 × 23) candle-transformers/src/models/csm.rs:193— candle-transformers/src/models/csm.rs:193-199 | candle-transformers/src/models/gemma.rs:203-209 | candle-transformers/src/models/gemma2.rs:198-204 | candle-transformers/src/models/gemma3.rs:224-230 | candle-transformers/src/models/glm4_new.rs:195-201 | candle-transformers/src/models/helium.rs:200-206 | candle-transformers/src/models/lfm2.rs:329-336 | candle-transformers/src/models/mistral.rs:249-255 | candle-transformers/src/models/mixtral.rs:184-190 | candle-transformers/src/models/nvembed_v2/embedding.rs:131-137 | candle-transformers/src/models/paddleocr_vl/text.rs:795-801 | candle-transformers/src/models/paddleocr_vl/text.rs:897-906 | candle-transformers/src/models/quantized_mistral.rs:148-154 | candle-transformers/src/models/quantized_qwen3.rs:240-247 | candle-transformers/src/models/quantized_stable_lm.rs:119-125 | candle-transformers/src/models/qwen2.rs:161-167 | candle-transformers/src/models/qwen2_moe.rs:168-174 | candle-transformers/src/models/qwen3.rs:193-201 | candle-transformers/src/models/smol/smollm3.rs:243-251 | candle-transformers/src/models/stable_lm.rs:242-248 | candle-transformers/src/models/starcoder2.rs:164-170 | candle-transformers/src/models/yi.rs:200-206 | candle-transformers/src/models/z_image/text_encoder.rs:272-280 — before extracting anything, compare `candle-transformers/src/models/csm.rs` and `candle-transformers/src/models/gemma.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 76 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-transformers/src/models/quantized_stable_lm.rs:118` calls `enter` and `candle-transformers/src/models/csm.rs:192` 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 × 18) candle-transformers/src/models/based.rs:418— candle-transformers/src/models/based.rs:418-424 | candle-transformers/src/models/csm.rs:230-236 | candle-transformers/src/models/gemma.rs:245-251 | candle-transformers/src/models/gemma4/text.rs:362-368 | candle-transformers/src/models/helium.rs:244-250 | candle-transformers/src/models/mistral.rs:293-299 | candle-transformers/src/models/mixtral.rs:225-231 | candle-transformers/src/models/nvembed_v2/embedding.rs:157-163 | candle-transformers/src/models/olmo.rs:207-213 | candle-transformers/src/models/olmo2.rs:195-201 | candle-transformers/src/models/phi3.rs:247-253 | candle-transformers/src/models/quantized_mistral.rs:184-190 | candle-transformers/src/models/quantized_stable_lm.rs:163-169 | candle-transformers/src/models/qwen2.rs:196-202 | candle-transformers/src/models/qwen2_moe.rs:203-209 | candle-transformers/src/models/stable_lm.rs:293-299 | candle-transformers/src/models/starcoder2.rs:197-203 | candle-transformers/src/models/yi.rs:234-240 — before extracting anything, compare `candle-transformers/src/models/based.rs` and `candle-transformers/src/models/gemma.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 61 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-transformers/src/models/csm.rs:226` calls `repeat_kv` and `candle-transformers/src/models/based.rs:416` 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 × 15) candle-transformers/src/models/based.rs:404— candle-transformers/src/models/based.rs:404-410 | candle-transformers/src/models/csm.rs:212-218 | candle-transformers/src/models/gemma.rs:219-225 | candle-transformers/src/models/gemma2.rs:214-220 | candle-transformers/src/models/helium.rs:219-225 | candle-transformers/src/models/mistral.rs:268-274 | candle-transformers/src/models/mixtral.rs:200-206 | candle-transformers/src/models/olmo.rs:188-194 | candle-transformers/src/models/olmo2.rs:176-182 | candle-transformers/src/models/phi3.rs:228-234 | candle-transformers/src/models/quantized_mistral.rs:166-172 | candle-transformers/src/models/qwen2.rs:177-183 | candle-transformers/src/models/qwen2_moe.rs:184-190 | candle-transformers/src/models/starcoder2.rs:180-186 | candle-transformers/src/models/yi.rs:216-222 — before extracting anything, compare `candle-transformers/src/models/based.rs` and `candle-transformers/src/models/gemma.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 61 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 `candle-transformers/src/models/based.rs:404` 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, `candle-transformers/src/models/quantized_mistral.rs:163` calls `reshape`, `transpose` and `candle-transformers/src/models/csm.rs:210` 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–7 lines × 12) candle-transformers/src/models/gemma.rs:322— candle-transformers/src/models/gemma.rs:322-327 | candle-transformers/src/models/helium.rs:300-305 | candle-transformers/src/models/mistral.rs:349-354 | candle-transformers/src/models/nvembed_v2/embedding.rs:210-216 | candle-transformers/src/models/olmo.rs:259-264 | candle-transformers/src/models/phi3.rs:336-341 | candle-transformers/src/models/quantized_mistral.rs:240-245 | candle-transformers/src/models/quantized_stable_lm.rs:221-226 | candle-transformers/src/models/qwen2.rs:252-257 | candle-transformers/src/models/qwen2_moe.rs:385-390 | candle-transformers/src/models/stable_lm.rs:351-356 | candle-transformers/src/models/starcoder2.rs:252-257 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/helium.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 177 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 `candle-transformers/src/models/gemma.rs:322` 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 after the matched lines, `candle-transformers/src/models/gemma.rs:329` calls `clear_kv_cache` and `candle-transformers/src/models/nvembed_v2/embedding.rs:217` 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 × 11) candle-transformers/src/models/deepseek2.rs:1035— candle-transformers/src/models/deepseek2.rs:1035-1041 | candle-transformers/src/models/gemma.rs:387-393 | candle-transformers/src/models/gemma2.rs:417-423 | candle-transformers/src/models/mixtral.rs:459-465 | candle-transformers/src/models/paddleocr_vl/text.rs:1160-1166 | candle-transformers/src/models/phi3.rs:398-404 | candle-transformers/src/models/qwen2_moe.rs:454-460 | candle-transformers/src/models/recurrent_gemma.rs:632-638 | candle-transformers/src/models/stable_lm.rs:408-414 | candle-transformers/src/models/starcoder2.rs:321-327 | candle-transformers/src/models/yi.rs:340-346 — before extracting anything, compare `candle-transformers/src/models/deepseek2.rs` and `candle-transformers/src/models/paddleocr_vl/text.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-transformers/src/models/deepseek2.rs:1035` 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 after the matched lines, `candle-transformers/src/models/stable_lm.rs:417` calls `enter` and `candle-transformers/src/models/gemma.rs:396` 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 × 8) candle-core/src/cuda_backend/mod.rs:1606— candle-core/src/cuda_backend/mod.rs:1606-1612 | candle-core/src/cuda_backend/mod.rs:1617-1623 | candle-core/src/cuda_backend/mod.rs:1628-1634 | candle-core/src/cuda_backend/mod.rs:1639-1645 | candle-core/src/cuda_backend/mod.rs:1650-1656 | candle-core/src/cuda_backend/mod.rs:1661-1667 | candle-core/src/cuda_backend/mod.rs:1672-1678 | candle-core/src/cuda_backend/mod.rs:1683-1689 — 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 (6–7 lines × 7) candle-core/src/quantized/neon.rs:715— candle-core/src/quantized/neon.rs:715-721 | candle-core/src/quantized/neon.rs:888-894 | candle-core/src/quantized/neon.rs:1164-1170 | candle-core/src/quantized/neon.rs:1922-1928 | candle-core/src/quantized/neon.rs:2709-2715 | candle-core/src/quantized/neon.rs:3006-3012 | candle-core/src/quantized/neon.rs:3148-3153 — 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 `candle-core/src/quantized/neon.rs:715` 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–7 lines × 4) candle-transformers/src/models/mixtral.rs:335— candle-transformers/src/models/mixtral.rs:335-340 | candle-transformers/src/models/quantized_llama.rs:118-124 | candle-transformers/src/models/qwen2_moe.rs:297-303 | candle-transformers/src/models/qwen3_moe.rs:158-164 — before extracting anything, compare `candle-transformers/src/models/mixtral.rs` and `candle-transformers/src/models/qwen2_moe.rs` as WHOLE FILES: this scan already matched 30 separate duplicated blocks between them, totalling at least 277 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 (3–7 lines × 3) candle-core/src/quantized/k_quants.rs:1084— candle-core/src/quantized/k_quants.rs:1084-1086 | candle-core/src/quantized/k_quants.rs:1491-1497 | candle-core/src/quantized/k_quants.rs:1749-1755 — 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 `candle-core/src/quantized/k_quants.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. 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 (3–7 lines × 4) candle-transformers/src/models/paddleocr_vl/vision.rs:1017— candle-transformers/src/models/paddleocr_vl/vision.rs:1017-1023 | candle-transformers/src/models/paddleocr_vl/vision.rs:1089-1095 | candle-transformers/src/models/paddleocr_vl/vision.rs:1171-1173 | candle-transformers/src/models/qwen3_vl/vision.rs:566-568 — `candle-transformers/src/models/paddleocr_vl/vision.rs` and `candle-transformers/src/models/qwen3_vl/vision.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 81 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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, `candle-transformers/src/models/paddleocr_vl/vision.rs:1016` calls `cat`, `cos`, `to_dtype` and `candle-transformers/src/models/paddleocr_vl/vision.rs:1171` 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 × 36) candle-transformers/src/models/based.rs:409— candle-transformers/src/models/based.rs:409-415 | candle-transformers/src/models/blip_text.rs:132-138 | candle-transformers/src/models/chatglm.rs:289-295 | candle-transformers/src/models/codegeex4_9b.rs:310-316 | candle-transformers/src/models/csm.rs:217-223 | candle-transformers/src/models/deepseek2.rs:666-672 | candle-transformers/src/models/gemma.rs:224-230 | candle-transformers/src/models/gemma2.rs:219-225 | candle-transformers/src/models/glm4.rs:331-337 | candle-transformers/src/models/helium.rs:224-230 | candle-transformers/src/models/marian.rs:306-312 | candle-transformers/src/models/metavoice.rs:809-815 | candle-transformers/src/models/mistral.rs:273-279 | candle-transformers/src/models/mixformer.rs:300-306 | candle-transformers/src/models/mixtral.rs:205-211 | candle-transformers/src/models/mpt.rs:106-112 | candle-transformers/src/models/olmo.rs:193-199 | candle-transformers/src/models/olmo2.rs:181-187 | candle-transformers/src/models/paddleocr_vl/text.rs:840-846 | candle-transformers/src/models/parler_tts.rs:130-136 | candle-transformers/src/models/phi.rs:230-236 | candle-transformers/src/models/phi3.rs:233-239 | candle-transformers/src/models/quantized_blip_text.rs:128-134 | candle-transformers/src/models/quantized_metavoice.rs:112-118 | candle-transformers/src/models/quantized_mistral.rs:171-177 | candle-transformers/src/models/quantized_mixformer.rs:217-223 | candle-transformers/src/models/quantized_mpt.rs:83-89 | candle-transformers/src/models/quantized_recurrent_gemma.rs:245-251 | candle-transformers/src/models/quantized_stable_lm.rs:147-153 | candle-transformers/src/models/qwen2.rs:182-188 | candle-transformers/src/models/qwen2_moe.rs:189-195 | candle-transformers/src/models/recurrent_gemma.rs:478-484 | candle-transformers/src/models/stable_lm.rs:270-276 | candle-transformers/src/models/starcoder2.rs:185-191 | candle-transformers/src/models/trocr.rs:220-226 | candle-transformers/src/models/yi.rs:221-227 — before extracting anything, compare `candle-transformers/src/models/based.rs` and `candle-transformers/src/models/gemma.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 61 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `candle-transformers/src/models/metavoice.rs:818` calls `repeat_interleave` and `candle-transformers/src/models/based.rs:418` 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 × 17) candle-transformers/src/models/csm.rs:357— candle-transformers/src/models/csm.rs:357-363 | candle-transformers/src/models/deepseek2.rs:1032-1038 | candle-transformers/src/models/gemma.rs:384-390 | candle-transformers/src/models/gemma2.rs:414-420 | candle-transformers/src/models/helium.rs:358-364 | candle-transformers/src/models/mistral.rs:414-420 | candle-transformers/src/models/mixtral.rs:456-462 | candle-transformers/src/models/paddleocr_vl/text.rs:1157-1163 | candle-transformers/src/models/phi3.rs:395-401 | candle-transformers/src/models/quantized_mistral.rs:303-309 | candle-transformers/src/models/quantized_recurrent_gemma.rs:398-404 | candle-transformers/src/models/quantized_stable_lm.rs:273-279 | candle-transformers/src/models/qwen2_moe.rs:451-457 | candle-transformers/src/models/recurrent_gemma.rs:629-635 | candle-transformers/src/models/stable_lm.rs:405-411 | candle-transformers/src/models/starcoder2.rs:318-324 | candle-transformers/src/models/yi.rs:337-343 — before extracting anything, compare `candle-transformers/src/models/csm.rs` and `candle-transformers/src/models/gemma.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 13) candle-transformers/src/models/gemma.rs:85— candle-transformers/src/models/gemma.rs:85-90 | candle-transformers/src/models/gemma2.rs:78-83 | candle-transformers/src/models/glm4_new.rs:47-52 | candle-transformers/src/models/olmo.rs:46-51 | candle-transformers/src/models/olmo2.rs:38-43 | candle-transformers/src/models/qwen2.rs:49-54 | candle-transformers/src/models/qwen2_moe.rs:57-62 | candle-transformers/src/models/qwen3.rs:44-49 | candle-transformers/src/models/smol/quantized_smollm3.rs:179-184 | candle-transformers/src/models/smol/smollm3.rs:74-79 | candle-transformers/src/models/stable_lm.rs:94-99 | candle-transformers/src/models/starcoder2.rs:54-59 | candle-transformers/src/models/z_image/text_encoder.rs:116-121 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 240 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 first that the copies are not typed on the same thing: the declarations holding them bind `cfg` to `&Config` in one and `&TextEncoderConfig` 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 (2–6 lines × 14) candle-transformers/src/models/gemma.rs:299— candle-transformers/src/models/gemma.rs:299-305 | candle-transformers/src/models/gemma4/vision.rs:326-332 | candle-transformers/src/models/glm4_new.rs:252-258 | candle-transformers/src/models/helium.rs:277-283 | candle-transformers/src/models/mistral.rs:326-332 | candle-transformers/src/models/nvembed_v2/embedding.rs:186-192 | candle-transformers/src/models/phi3.rs:313-319 | candle-transformers/src/models/quantized_mistral.rs:217-223 | candle-transformers/src/models/qwen2.rs:229-235 | candle-transformers/src/models/qwen3.rs:371-376 | candle-transformers/src/models/smol/smollm3.rs:322-327 | candle-transformers/src/models/yi.rs:263-268 | candle-transformers/src/models/z_image/text_encoder.rs:333-334 | candle-transformers/src/models/z_image/text_encoder.rs:335-340 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/glm4_new.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 70 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `cfg` to `&Gemma4VisionConfig` in one and `&Config` 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, `candle-transformers/src/models/glm4_new.rs:250` calls `pp` and `candle-transformers/src/models/z_image/text_encoder.rs:333` 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 × 7) candle-metal-kernels/src/kernels/affine.rs:30— candle-metal-kernels/src/kernels/affine.rs:30-35 | candle-metal-kernels/src/kernels/affine.rs:98-103 | candle-metal-kernels/src/kernels/affine.rs:164-169 | candle-metal-kernels/src/kernels/binary.rs:33-39 | candle-metal-kernels/src/kernels/cast.rs:28-33 | candle-metal-kernels/src/kernels/ternary.rs:54-65 | candle-metal-kernels/src/kernels/unary.rs:35-40 — there are 7 copies across 5 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 7 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `candle-metal-kernels/src/kernels/affine.rs:30` 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 (2–6 lines × 7) candle-transformers/src/models/glm4_new.rs:220— candle-transformers/src/models/glm4_new.rs:220-225 | candle-transformers/src/models/quantized_glm4.rs:267-272 | candle-transformers/src/models/quantized_qwen3.rs:362-363 | candle-transformers/src/models/quantized_qwen3_moe.rs:198-199 | candle-transformers/src/models/qwen3.rs:341-346 | candle-transformers/src/models/smol/smollm3.rs:287-292 | candle-transformers/src/models/z_image/text_encoder.rs:307-312 — before extracting anything, compare `candle-transformers/src/models/glm4_new.rs` and `candle-transformers/src/models/quantized_glm4.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 78 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-transformers/src/models/quantized_glm4.rs:267` calls `matmul`, `transpose` and `candle-transformers/src/models/quantized_qwen3.rs:362` 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–6 lines × 4) candle-core/src/quantized/neon.rs:3267— candle-core/src/quantized/neon.rs:3267-3269 | candle-core/src/quantized/neon.rs:3270-3275 | candle-core/src/quantized/neon.rs:3296-3298 | candle-core/src/quantized/neon.rs:3299-3304 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-core/src/quantized/neon.rs:3268` calls `vdotq_s32`, `add`, `vaddvq_s32` and `candle-core/src/quantized/neon.rs:3267` 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 (4–6 lines × 5) candle-transformers/src/models/granite.rs:436— candle-transformers/src/models/granite.rs:436-439 | candle-transformers/src/models/llama.rs:505-508 | candle-transformers/src/models/llama2_c.rs:351-356 | candle-transformers/src/models/quantized_llama2_c.rs:238-243 | candle-transformers/src/models/voxtral/voxtral_llama.rs:440-443 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/llama.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 309 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 `candle-transformers/src/models/llama2_c.rs:351` 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, `candle-transformers/src/models/llama2_c.rs:350` calls `iter`, `enumerate`, `forward` and `candle-transformers/src/models/granite.rs:436` 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 (3–6 lines × 17) candle-nn/src/attention/cpu_flash/causal.rs:86— candle-nn/src/attention/cpu_flash/causal.rs:86-88 | candle-nn/src/attention/cpu_flash/causal.rs:91-93 | candle-nn/src/attention/cpu_flash/causal.rs:96-98 | candle-nn/src/attention/cpu_flash/varlen.rs:185-187 | candle-nn/src/attention/cpu_flash/varlen.rs:191-193 | candle-nn/src/attention/cpu_flash/varlen.rs:197-199 | candle-transformers/src/models/quantized_qwen3.rs:274-276 | candle-transformers/src/models/quantized_qwen3.rs:278-283 | candle-transformers/src/models/quantized_qwen3.rs:285-290 | candle-transformers/src/models/quantized_qwen3.rs:291-296 | candle-transformers/src/models/quantized_qwen3.rs:323-325 | candle-transformers/src/models/quantized_qwen3.rs:328-330 | candle-transformers/src/models/smol/quantized_smollm3.rs:407-409 | candle-transformers/src/models/smol/quantized_smollm3.rs:412-414 | candle-transformers/src/models/smol/quantized_smollm3.rs:417-419 | candle-transformers/src/models/smol/quantized_smollm3.rs:506-508 | candle-transformers/src/models/smol/quantized_smollm3.rs:511-513 — before extracting anything, compare `candle-transformers/src/models/quantized_qwen3.rs` and `candle-transformers/src/models/smol/quantized_smollm3.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `candle-nn/src/attention/cpu_flash/causal.rs:86` 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, `candle-nn/src/attention/cpu_flash/causal.rs:91` calls `storage_and_layout` and `candle-transformers/src/models/quantized_qwen3.rs:291` 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 × 23) candle-transformers/src/models/gemma.rs:213— candle-transformers/src/models/gemma.rs:213-217 | candle-transformers/src/models/gemma2.rs:208-212 | candle-transformers/src/models/gemma3.rs:234-238 | candle-transformers/src/models/gemma4/text.rs:320-324 | candle-transformers/src/models/glm4_new.rs:205-209 | candle-transformers/src/models/mixtral.rs:194-198 | candle-transformers/src/models/olmo.rs:182-186 | candle-transformers/src/models/olmo2.rs:170-174 | candle-transformers/src/models/paddleocr_vl/text.rs:805-809 | candle-transformers/src/models/paddleocr_vl/text.rs:910-914 | candle-transformers/src/models/phi.rs:210-214 | candle-transformers/src/models/phi3.rs:222-226 | candle-transformers/src/models/quantized_glm4.rs:240-244 | candle-transformers/src/models/quantized_qwen3.rs:251-255 | candle-transformers/src/models/quantized_stable_lm.rs:129-133 | candle-transformers/src/models/qwen2.rs:171-175 | candle-transformers/src/models/qwen2_moe.rs:178-182 | candle-transformers/src/models/qwen3.rs:205-209 | candle-transformers/src/models/smol/smollm3.rs:255-259 | candle-transformers/src/models/stable_lm.rs:252-256 | candle-transformers/src/models/starcoder2.rs:174-178 | candle-transformers/src/models/yi.rs:210-214 | candle-transformers/src/models/z_image/text_encoder.rs:284-288 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 240 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 `candle-transformers/src/models/gemma.rs:213` 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, `candle-transformers/src/models/gemma3.rs:239` calls `forward` and `candle-transformers/src/models/gemma.rs:219` 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 × 15) candle-transformers/src/models/based.rs:317— candle-transformers/src/models/based.rs:317-321 | candle-transformers/src/models/gemma.rs:86-90 | candle-transformers/src/models/gemma2.rs:79-83 | candle-transformers/src/models/glm4_new.rs:48-52 | candle-transformers/src/models/olmo.rs:47-51 | candle-transformers/src/models/olmo2.rs:39-43 | candle-transformers/src/models/qwen2.rs:50-54 | candle-transformers/src/models/qwen2_moe.rs:58-62 | candle-transformers/src/models/qwen3.rs:45-49 | candle-transformers/src/models/recurrent_gemma.rs:113-117 | candle-transformers/src/models/smol/quantized_smollm3.rs:180-184 | candle-transformers/src/models/smol/smollm3.rs:75-79 | candle-transformers/src/models/stable_lm.rs:95-99 | candle-transformers/src/models/starcoder2.rs:55-59 | candle-transformers/src/models/z_image/text_encoder.rs:117-121 — before extracting anything, compare `candle-transformers/src/models/based.rs` and `candle-transformers/src/models/gemma.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 61 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 first that the copies are not typed on the same thing: the declarations holding them bind `cfg` to `&Config` in one and `&TextEncoderConfig` 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 × 13) candle-transformers/src/models/gemma.rs:320— candle-transformers/src/models/gemma.rs:320-324 | candle-transformers/src/models/helium.rs:298-302 | candle-transformers/src/models/mistral.rs:347-351 | candle-transformers/src/models/mixtral.rs:390-395 | candle-transformers/src/models/nvembed_v2/embedding.rs:207-213 | candle-transformers/src/models/olmo.rs:257-261 | candle-transformers/src/models/phi3.rs:334-338 | candle-transformers/src/models/quantized_mistral.rs:238-242 | candle-transformers/src/models/quantized_stable_lm.rs:219-223 | candle-transformers/src/models/qwen2.rs:250-254 | candle-transformers/src/models/qwen2_moe.rs:383-387 | candle-transformers/src/models/stable_lm.rs:349-353 | candle-transformers/src/models/starcoder2.rs:250-254 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/helium.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 177 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `candle-transformers/src/models/quantized_stable_lm.rs:218` calls `enter` and `candle-transformers/src/models/gemma.rs:319` 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 (3–5 lines × 17) candle-transformers/src/models/gemma.rs:350— candle-transformers/src/models/gemma.rs:350-353 | candle-transformers/src/models/gemma2.rs:369-372 | candle-transformers/src/models/helium.rs:329-333 | candle-transformers/src/models/mistral.rs:379-383 | candle-transformers/src/models/mixtral.rs:420-424 | candle-transformers/src/models/nvembed_v2/embedding.rs:233-237 | candle-transformers/src/models/olmo.rs:288-292 | candle-transformers/src/models/olmo2.rs:284-288 | candle-transformers/src/models/paddleocr_vl/text.rs:1116-1118 | candle-transformers/src/models/phi3.rs:365-369 | candle-transformers/src/models/quantized_mistral.rs:269-273 | candle-transformers/src/models/quantized_stable_lm.rs:246-250 | candle-transformers/src/models/qwen2.rs:281-285 | candle-transformers/src/models/qwen2_moe.rs:413-416 | candle-transformers/src/models/stable_lm.rs:377-381 | candle-transformers/src/models/starcoder2.rs:282-286 | candle-transformers/src/models/yi.rs:310-314 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 240 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 `candle-transformers/src/models/gemma.rs:350` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `cfg` to `&Config` in one and `&TextConfig` 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, `candle-transformers/src/models/helium.rs:328` calls `with_capacity`, `pp` and `candle-transformers/src/models/gemma.rs:350` 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 (2–5 lines × 7) candle-transformers/src/models/gemma.rs:69— candle-transformers/src/models/gemma.rs:69-73 | candle-transformers/src/models/gemma2.rs:62-66 | candle-transformers/src/models/gemma3.rs:57-61 | candle-transformers/src/models/gemma4/audio.rs:35-36 | candle-transformers/src/models/gemma4/text.rs:37-41 | candle-transformers/src/models/gemma4/vision.rs:36-40 | candle-transformers/src/models/recurrent_gemma.rs:86-90 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 240 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 `candle-transformers/src/models/gemma.rs:69` 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 lines × 6) candle-transformers/src/models/granite.rs:249— candle-transformers/src/models/granite.rs:249-255 | candle-transformers/src/models/granitemoehybrid.rs:298-304 | candle-transformers/src/models/llama.rs:295-301 | candle-transformers/src/models/llama2_c.rs:184-190 | candle-transformers/src/models/quantized_llama2_c.rs:71-77 | candle-transformers/src/models/voxtral/voxtral_llama.rs:209-215 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 `candle-transformers/src/models/granite.rs:249` 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 (4–5 lines × 6) candle-transformers/src/models/marian.rs:217— candle-transformers/src/models/marian.rs:217-221 | candle-transformers/src/models/mixformer.rs:151-155 | candle-transformers/src/models/mixtral.rs:88-91 | candle-transformers/src/models/quantized_mixformer.rs:63-67 | candle-transformers/src/models/snac.rs:122-126 | candle-transformers/src/models/yi.rs:86-90 — before extracting anything, compare `candle-transformers/src/models/mixformer.rs` and `candle-transformers/src/models/quantized_mixformer.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 136 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 `candle-transformers/src/models/mixtral.rs:88` 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 (4–5 lines × 4) candle-core/src/cpu/neon.rs:62— candle-core/src/cpu/neon.rs:62-65 | candle-core/src/cpu/neon.rs:130-134 | candle-core/src/cpu/neon.rs:329-333 | candle-core/src/cpu/neon.rs:410-414 — 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 `candle-core/src/cpu/neon.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. 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–5 lines × 5) candle-transformers/src/models/granite.rs:396— candle-transformers/src/models/granite.rs:396-400 | candle-transformers/src/models/llama.rs:443-447 | candle-transformers/src/models/llama2_c.rs:314-317 | candle-transformers/src/models/quantized_llama2_c.rs:201-204 | candle-transformers/src/models/voxtral/voxtral_llama.rs:367-371 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/llama.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 309 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 (3–5 lines × 6) candle-core/src/cpu_backend/mod.rs:2852— candle-core/src/cpu_backend/mod.rs:2852-2856 | candle-core/src/cpu_backend/mod.rs:2866-2868 | candle-core/src/metal_backend/mod.rs:964-968 | candle-core/src/metal_backend/mod.rs:975-977 | candle-core/src/metal_backend/mod.rs:1168-1171 | candle-core/src/metal_backend/mod.rs:1178-1180 — there are 6 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 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `candle-core/src/cpu_backend/mod.rs:2852` 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 after the matched lines, `candle-core/src/cpu_backend/mod.rs:2856` calls `transpose` and `candle-core/src/cpu_backend/mod.rs:2868` 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–5 lines × 3) candle-nn/src/attention/cpu_flash/varlen.rs:277— candle-nn/src/attention/cpu_flash/varlen.rs:277-279 | candle-nn/src/attention/cpu_flash/varlen.rs:281-285 | candle-nn/src/attention/cpu_flash/varlen.rs:287-291 — 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 `candle-nn/src/attention/cpu_flash/varlen.rs:277` 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 × 16) candle-transformers/src/models/chatglm.rs:115— candle-transformers/src/models/chatglm.rs:115-120 | candle-transformers/src/models/deepseek2.rs:211-216 | candle-transformers/src/models/distilbert.rs:13-18 | candle-transformers/src/models/granite.rs:341-346 | candle-transformers/src/models/granitemoehybrid.rs:393-398 | candle-transformers/src/models/lfm2.rs:205-210 | candle-transformers/src/models/llama.rs:388-393 | candle-transformers/src/models/llama2_c.rs:251-256 | candle-transformers/src/models/mpt.rs:293-298 | candle-transformers/src/models/phi.rs:143-148 | candle-transformers/src/models/quantized_llama2_c.rs:138-143 | candle-transformers/src/models/quantized_mixformer.rs:48-53 | candle-transformers/src/models/quantized_t5.rs:50-55 | candle-transformers/src/models/t5.rs:117-122 | candle-transformers/src/models/voxtral/voxtral_llama.rs:312-317 | candle-wasm-examples/llama2-c/src/model.rs:166-171 — before extracting anything, compare `candle-transformers/src/models/granite.rs` and `candle-transformers/src/models/granitemoehybrid.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 227 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 (5 lines × 17) candle-transformers/src/models/gemma.rs:143— candle-transformers/src/models/gemma.rs:143-147 | candle-transformers/src/models/gemma2.rs:136-140 | candle-transformers/src/models/gemma3.rs:141-145 | candle-transformers/src/models/gemma4/text.rs:185-189 | candle-transformers/src/models/helium.rs:129-133 | candle-transformers/src/models/mistral.rs:179-183 | candle-transformers/src/models/nvembed_v2/embedding.rs:79-83 | candle-transformers/src/models/olmo.rs:104-108 | candle-transformers/src/models/olmo2.rs:96-100 | candle-transformers/src/models/quantized_mistral.rs:94-98 | candle-transformers/src/models/qwen2.rs:107-111 | candle-transformers/src/models/qwen2_moe.rs:114-118 | candle-transformers/src/models/qwen3.rs:92-96 | candle-transformers/src/models/qwen3_moe.rs:89-93 | candle-transformers/src/models/smol/smollm3.rs:138-142 | candle-transformers/src/models/yi.rs:146-150 | candle-transformers/src/models/z_image/text_encoder.rs:178-182 — before extracting anything, compare `candle-transformers/src/models/gemma.rs` and `candle-transformers/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 240 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.
D4 · Code Duplication· Edited copies of one member (3 members, 37+ corresponding lines) · ×1
Edited copies of one member (3 members, 37+ corresponding lines) candle-wasm-examples/segment-anything/src/bin/m.rs:38— candle-wasm-examples/segment-anything/src/bin/m.rs:38-74 | candle-wasm-examples/yolo/src/worker.rs:48-93 | candle-wasm-examples/yolo/src/worker.rs:127-172 — 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.
Duplicated block (18–19 lines × 2) candle-examples/src/chat_template.rs:167— candle-examples/src/chat_template.rs:167-184 | candle-wasm-examples/chat-template/src/lib.rs:227-245 — before extracting anything, compare `candle-examples/src/chat_template.rs` and `candle-wasm-examples/chat-template/src/lib.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. 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 (19–20 lines × 3) candle-wasm-examples/llama2-c/src/app.rs:11— candle-wasm-examples/llama2-c/src/app.rs:11-29 | candle-wasm-examples/whisper/src/app.rs:20-38 | candle-wasm-examples/yolo/src/app.rs:10-29 — before extracting anything, compare `candle-wasm-examples/llama2-c/src/app.rs` and `candle-wasm-examples/whisper/src/app.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. 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 (7–8 lines × 4) candle-wasm-examples/t5/src/bin/m-quantized.rs:69— candle-wasm-examples/t5/src/bin/m-quantized.rs:69-76 | candle-wasm-examples/t5/src/bin/m-quantized.rs:152-158 | candle-wasm-examples/t5/src/bin/m.rs:66-73 | candle-wasm-examples/t5/src/bin/m.rs:150-156 — before extracting anything, compare `candle-wasm-examples/t5/src/bin/m-quantized.rs` and `candle-wasm-examples/t5/src/bin/m.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 138 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.
Low cohesion: Tensor (LCOM4 8) candle-core/src/tensor.rs:70— Tensor's methods fall into 8 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 8 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.
Duplication concentrated across 9 sibling directories (12 clone groups) candle-wasm-examples/moondream/moondreamWorker.js:6— 12 duplicated blocks under candle-wasm-examples/ have copies in at least two of the sibling directories bert, blip, llama2-c, moondream, phi, segment-anything (+3 more sibling(s) not listed) — 11 of them are reported below, and 1 is counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 12 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 12 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 12 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication· Duplicated block with local edits (114 matched lines × 2 locations) · ×1
Duplicated block with local edits (114 matched lines × 2 locations) candle-wasm-examples/moondream/moondreamWorker.js:6— candle-wasm-examples/moondream/moondreamWorker.js:6 · candle-wasm-examples/phi/phiWorker.js:4 — the two spans are one implementation copied and then locally edited — 652 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 (47 lines × 2 locations) candle-wasm-examples/t5/T5ModelConditionalGeneration.js:2— candle-wasm-examples/t5/T5ModelConditionalGeneration.js:2 · candle-wasm-examples/t5/T5ModelEncoderWorker.js:2 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (44 lines × 2 locations) candle-wasm-examples/bert/bertWorker.js:20— candle-wasm-examples/bert/bertWorker.js:20 · candle-wasm-examples/t5/T5ModelEncoderWorker.js:27 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
Duplicated block (29 lines × 2 locations) candle-wasm-examples/moondream/moondreamWorker.js:59— candle-wasm-examples/moondream/moondreamWorker.js:59 · candle-wasm-examples/segment-anything/samWorker.js:39 — the 2 copies are spread across 2 files, 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 (25 lines × 2 locations) candle-wasm-examples/llama2-c/llama2cWorker.js:30— candle-wasm-examples/llama2-c/llama2cWorker.js:30 · candle-wasm-examples/phi/phiWorker.js:54 — the 2 copies are spread across 2 files, 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 (25 lines × 3 locations) candle-wasm-examples/llama2-c/llama2cWorker.js:88— candle-wasm-examples/llama2-c/llama2cWorker.js:88 · candle-wasm-examples/moondream/moondreamWorker.js:176 · candle-wasm-examples/phi/phiWorker.js:130 — the 3 copies are spread across 3 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete.
Duplicated block (23 lines × 2 locations) candle-wasm-examples/blip/blipWorker.js:26— candle-wasm-examples/blip/blipWorker.js:26 · candle-wasm-examples/t5/T5ModelConditionalGeneration.js:29 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
Duplicated block (20 lines × 3 locations) candle-wasm-examples/bert/utils.js:12— candle-wasm-examples/bert/utils.js:12 · candle-wasm-examples/t5/utils.js:14 · candle-wasm-examples/t5/utils.js:48 — the 3 copies are spread across 2 files, 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 × 2 locations) candle-wasm-examples/llama2-c/llama2cWorker.js:71— candle-wasm-examples/llama2-c/llama2cWorker.js:71 · candle-wasm-examples/phi/phiWorker.js:105 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
Duplicated block (14 lines × 8 locations) candle-wasm-examples/bert/bertWorker.js:5— candle-wasm-examples/bert/bertWorker.js:5 · candle-wasm-examples/blip/blipWorker.js:5 · candle-wasm-examples/llama2-c/llama2cWorker.js:4 · candle-wasm-examples/segment-anything/samWorker.js:7 · +4 more site(s) not listed — the 8 copies are spread across 7 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. There is one copy in each of 8 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete.
Duplicated block (14 lines × 2 locations) candle-wasm-examples/t5/utils.js:10— candle-wasm-examples/t5/utils.js:10 · candle-wasm-examples/t5/utils.js:44 — 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) candle-wasm-examples/llama2-c/llama2cWorker.js:3— candle-wasm-examples/llama2-c/llama2cWorker.js:3 · candle-wasm-examples/yolo/yoloWorker.js:4 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
Duplicated block (5 lines × 2 locations) candle-wasm-examples/moondream/moondreamWorker.js:128— candle-wasm-examples/moondream/moondreamWorker.js:128 · candle-wasm-examples/segment-anything/samWorker.js:127 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
Third-party script without Subresource Integrity candle-wasm-examples/bert/lib-example.html:21— `https://cdn.tailwindcss.com` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. The URL also names no version, so it resolves to whatever that origin serves at fetch time — the executed bytes can change with nobody touching this repository. 10 such include(s) across the repository's markup.
Orphaned file candle-transformers/src/models/paddleocr_vl/mod.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 candle-transformers/src/models/metavoice.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 candle-transformers/src/models/rwkv_v7.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 candle-transformers/src/models/z_image/transformer.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 candle-nn/src/kv_cache.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 candle-transformers/src/models/mobilenetv4.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 candle-transformers/src/models/stable_diffusion/uni_pc.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 candle-transformers/src/models/t5.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 candle-examples/src/imagenet.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 candle-nn/src/var_builder.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 candle-pyo3/py_src/candle/nn/module.py: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 candle-transformers/src/models/quantized_t5.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 candle-transformers/src/models/stable_diffusion/unet_2d_blocks.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 candle-wasm-examples/yolo/src/model.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 candle-transformers/src/models/siglip.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 candle-transformers/src/models/encodec.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 candle-wasm-examples/chat-template/src/lib.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 candle-transformers/src/models/snac.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 candle-transformers/src/models/recurrent_gemma.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 candle-transformers/src/models/segformer.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 candle-transformers/src/models/mamba2.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 candle-transformers/src/models/quantized_lfm2.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 candle-transformers/src/models/mimi/conv.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 candle-transformers/src/models/marian.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 candle-wasm-examples/quant-qwen3/src/m.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.
Duplicated predicate candle-wasm-examples/moondream/moondreamWorker.js:70— `this.imageArrayHash[this.currentModelID] === imageArrayHash && this.instance[this.currentModelID]` appears character-identically in 2 files — candle-wasm-examples/moondream/moondreamWorker.js, candle-wasm-examples/segment-anything/samWorker.js. 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 candle-core/src/cpu_backend/mod.rs:1564— `(lhs_m1 == 1 || k == 1) && (lhs_m2 == k || m == 1)` appears character-identically in 3 files — candle-core/src/cpu_backend/mod.rs, candle-core/src/cuda_backend/mod.rs, candle-metal-kernels/src/kernels/mlx_gemm.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 candle-core/src/cuda_backend/mod.rs:1437— `(lhs_m1 == m || k == 1) && (lhs_m2 == 1 || m == 1)` appears character-identically in 2 files — candle-core/src/cuda_backend/mod.rs, candle-metal-kernels/src/kernels/mlx_gemm.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 candle-core/src/cpu_backend/mod.rs:1556— `(rhs_m1 == 1 || n == 1) && (rhs_m2 == n || k == 1)` appears character-identically in 3 files — candle-core/src/cpu_backend/mod.rs, candle-core/src/cuda_backend/mod.rs, candle-metal-kernels/src/kernels/mlx_gemm.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 candle-core/src/cuda_backend/mod.rs:1423— `(rhs_m1 == k || n == 1) && (rhs_m2 == 1 || k == 1)` appears character-identically in 2 files — candle-core/src/cuda_backend/mod.rs, candle-metal-kernels/src/kernels/mlx_gemm.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 candle-transformers/src/models/qwen2_moe.rs:356— `cfg.num_experts > 0 && (layer_idx + 1).is_multiple_of(cfg.decoder_sparse_step)` appears character-identically in 2 files — candle-transformers/src/models/qwen2_moe.rs, candle-transformers/src/models/qwen3_moe.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 candle-core/src/cuda_backend/mod.rs:392— `check_empty && layout.shape().elem_count() == 0` appears character-identically in 2 files — candle-core/src/cuda_backend/mod.rs, candle-core/src/metal_backend/mod.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 candle-core/src/cpu_backend/mod.rs:557— `height_in == height_out && width_in == width_out` appears character-identically in 2 files — candle-core/src/cpu_backend/mod.rs, candle-core/src/tensor.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 candle-core/src/cpu_backend/mod.rs:2884— `kernel_l.is_contiguous() && params.dilation == 1 && params.padding == 0 && params.output_padding == 0` appears character-identically in 2 files — candle-core/src/cpu_backend/mod.rs, candle-core/src/cuda_backend/mod.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 candle-flash-attn-v3/src/lib.rs:64— `q_rank != 4 || k_rank != 4 || v_rank != 4` appears character-identically in 2 files — candle-flash-attn-v3/src/lib.rs, candle-flash-attn/src/lib.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 candle-transformers/src/models/quantized_rwkv_v5.rs:295— `self.layers_are_rescaled && (block_idx + 1) % self.rescale_every == 0` appears character-identically in 4 files — candle-transformers/src/models/quantized_rwkv_v5.rs, candle-transformers/src/models/quantized_rwkv_v6.rs, candle-transformers/src/models/rwkv_v5.rs, candle-transformers/src/models/rwkv_v6.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 candle-transformers/src/models/quantized_t5.rs:351— `self.use_cache && key_value_states.is_none()` appears character-identically in 2 files — candle-transformers/src/models/quantized_t5.rs, candle-transformers/src/models/t5.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 candle-flash-attn-v3/src/lib.rs:174— `window_size_left < 0 && window_size_right == 0` appears character-identically in 2 files — candle-flash-attn-v3/src/lib.rs, candle-flash-attn/src/lib.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 candle-flash-attn-v3/src/lib.rs:179— `window_size_left < 0 && window_size_right >= 0` appears character-identically in 2 files — candle-flash-attn-v3/src/lib.rs, candle-flash-attn/src/lib.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 candle-flash-attn-v3/src/lib.rs:182— `window_size_left >= 0 && window_size_right < 0` appears character-identically in 2 files — candle-flash-attn-v3/src/lib.rs, candle-flash-attn/src/lib.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.
D34 · Knowledge Freshness· Most significant orphaned file · ×3
Most significant orphaned file candle-transformers/src/models/debertav2.rs:1— One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
Most significant orphaned file candle-transformers/src/models/paddleocr_vl/text.rs:1— One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
Most significant orphaned file candle-transformers/src/models/paddleocr_vl/vision.rs:1— One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
Interpolated log message defeats structured logging candle-pyo3/py_src/candle/__init__.py:18— `warning` at line 18 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging candle-pyo3/py_src/candle/__init__.py:24— `warning` at line 24 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging candle-pyo3/py_src/candle/__init__.py:40— `warning` at line 40 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 7 significant file(s) lose their only recent owner: candle-core/src/quantized/repack.rs, candle-transformers/src/models/gemma4/audio.rs, candle-nn/src/moe/cutile.rs, candle-transformers/src/models/qwen3_vl/text.rs, candle-core/src/cuda_backend/cutile.rs, candle-transformers/src/models/gemma4/mod.rs, candle-transformers/src/models/qwen3_vl/config.rs. Pair on, review, or document these before any departure.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 3 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 (12 single-owned of 344 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; 344 of the 419 production source files in this repository met that bar). They are anonymized user #2 (2 file(s)), anonymized user #3 (1 file(s)), anonymized user #4 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: candle-metal-kernels/src/metal/library.rs, candle-metal-kernels/src/metal/command_buffer.rs, candle-transformers/src/models/mimi/transformer.rs, candle-transformers/src/models/lfm2.rs.
No ADRs found tensor-tools/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 `tensor-tools/src/main.rs` makes this repository a deployable product (line 1).
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 2 of 12 project(s) overshoot their size bounds, lowering Project Cohesion to 6.7/10. The most over is `candle-transformers` (75368 LoC, 765 module-visible types across 22 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.
Concentrated knowledge decay — 223 of 344 significant files have no living knowledge, while the repository is still being changed at a low rate (51 commit(s) in the last 90 days) — so this is one repo-wide knowledge-decay state, not 223 separate risks. Counted over 344 of the 419 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over. The code moved on without the people who understood these files: document them or schedule a read-through before the next change lands in them.
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 6/14 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `candle-wasm-examples/bert`, `candle-wasm-examples/blip`, `candle-wasm-examples/moondream`, `candle-wasm-examples/phi` and 3 more.
P3 · Security & performance tooling· Dependabot does not watch github-actions/pip · ×1
Dependabot does not watch github-actions/pip REDACTED:2— `REDACTED` schedules updates, but no `package-ecosystem` entry covers `github-actions`, `pip`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entries to the `updates:` list.
Silent fallback default on Err candle-wasm-examples/chat-template/src/lib.rs:601— `to_json` turns every `Err` into `"[]".to_string()` — 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.
Outdated: js-sys — `js-sys` is locked at 0.3.104 but 0.3.107 is the current stable release on crates.io, and it already satisfies the `"0.3.64"` requirement declared in candle-wasm-examples/bert/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p js-sys` and commit the updated Cargo.lock.
Outdated: wasm-bindgen — `wasm-bindgen` is locked at 0.2.127 but 0.2.130 is the current stable release on crates.io, and it already satisfies the `"0.2.87"` requirement declared in candle-wasm-examples/bert/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p wasm-bindgen` and commit the updated Cargo.lock.
Outdated: wasm-bindgen-futures — `wasm-bindgen-futures` is locked at 0.4.77 but 0.4.80 is the current stable release on crates.io, and it already satisfies the `"0.4.37"` requirement declared in candle-wasm-examples/llama2-c/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p wasm-bindgen-futures` and commit the updated Cargo.lock.
Outdated: web-sys — `web-sys` is locked at 0.3.104 but 0.3.107 is the current stable release on crates.io, and it already satisfies the `"0.3.70"` requirement declared in candle-wasm-examples/llama2-c/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p web-sys` and commit the updated Cargo.lock.
Off the main sequence: candle-kernels — candle-kernels: abstractness 0.00, instability 0.00, distance 1.00 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.
Off the main sequence: candle-metal-kernels — candle-metal-kernels: abstractness 0.05, instability 0.00, distance 0.95 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.
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.
none (dependency manifest found, not scanned for vulnerabilities here)
—
none (dependency manifest found, not scanned for vulnerabilities here): not applicable — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Cargo manifest and a Python pyproject.toml/requirements.txt (pip/uv/Poetry) — not scanned yet).
trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
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.
none (dependency manifest found, not scanned for vulnerabilities here)
—
none (dependency manifest found, not scanned for vulnerabilities here): not applicable — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Cargo manifest and a Python pyproject.toml/requirements.txt (pip/uv/Poetry) — not scanned yet).
0
—
Run 01a1d8c4-dd35-7fb2-af3f-0913b9835532 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 43 · Warnings: 2170 · Recommendations: 253 · Info: 6 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 14-11-2026 @ 06:35 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.