Public report of EricLBuehler/mistral.rs, published 27 October 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.10.5). 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, 27 October 2026, 12:15 UTC · Survey ID cd_32f4d2941acc407a956840b2eb8be748
EricLBuehler/mistral.rs
Measured 27 October 2026, 12:13 UTC, at code version 9459891
No regression since the last survey
A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.
CAI scoreAdequate
CriticalWeakAdequateStrongExemplary
Down 1 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 very large codebase: 520,746 lines of product code in 18 projects, tests not counted · Estimated rebuild effort: about 3.6 person-years · Weakest lens: Security and Compliance, 44
Findings by how serious they are
131 critical4255 serious152 minor
11 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks 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
Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
27 October 2026, 12:13 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 Watchdog. It is open to any tool that
implements it, and today Watchdog is the only one that does.
The score is deterministic, which means the same code always gets the same score. Watchdog works 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 ▸
85of 85 dimensions measured by tools.
4474of 4538 findings point to an exact file and line, so you can open each one in the code. The other 64 concern the repository as a whole, such as missing documentation.
85dimensions across 8 lenses, read from 520,746 lines of product code in 18 projects.
EricLBuehler/mistral.rs falls short of our standard for a preview release, in part because it has pipeline tools referenced by a changeable name. It scores 53 out of 100 and is rated Adequate, and 118 of its 131 critical findings are security problems.
Security and Compliance, at 44, is the weakest lens and counts most in the score. The best first step is naming the access rules, worth about 7 points. Serving traffic only over an encrypted connection comes next, worth about 4 points. Raising Security and Compliance to 68 would lift the score to about 59.
Ninety pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Seven settings leave the servers or containers unsafe, and twelve form fields can't be read by a screen reader. Pinning each tool to an exact version, correcting the unsafe settings and labelling the form fields would close these risks. Limiting each secret to its own step would fix the six secrets exposed to more of the pipeline than needed, and updating the vulnerable packages would deal with the four packages with a known security hole. The set of files in separate parts that keep changing together needs that dependency made explicit.
The product code is 520,746 lines, about €530,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 Security and Compliance rose from 44 to 68, the lowest score rated Strong, the score would rise from 53 to about 59.
Code composition: what the lines of code are
Product code 96%Tests 4%
New since the last survey: 342 findings
These 342 critical or serious findings weren't in the previous survey, on 13 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
God Classes · FileTooLong: metal_kernels/mod.rs mistralrs-quant/src/metal_kernels/mod.rs
God Classes · FunctionTooLong: mistralrs_paged_attn::metal::backend::paged_prefill::metal_paged_prefill mistralrs-paged-attn/src/metal/backend/paged_prefill.rs
God Classes · FunctionTooLong: mistralrs_core::pipeline::loaders::activation_memory::model_activation_memory mistralrs-core/src/pipeline/loaders/activation_memory.rs
God Classes · FunctionTooLong: mistralrs_quant::metal_kernels::afq_qmm_dispatch mistralrs-quant/src/metal_kernels/mod.rs
God Classes · FunctionTooLong: mistralrs_quant::metal_kernels::call_flash_attn_ext_bf16_dk512 mistralrs-quant/src/metal_kernels/mod.rs
God Classes · FileTooLong: models/flint.rs mistralrs-core/src/models/flint.rs
God Classes · FunctionTooLong: mistralrs_quant::metal_kernels::call_multi_block_sort mistralrs-quant/src/metal_kernels/mod.rs
God Classes · FileTooLong: loaders/activation_memory.rs mistralrs-core/src/pipeline/loaders/activation_memory.rs
God Classes · MethodTooLong: CudaGraphCaptureMemory.shape mistralrs-core/src/pipeline/cuda_graph.rs
God Classes · FileTooLong: metal/gdn.rs mistralrs-core/src/metal/gdn.rs
God Classes · FileTooLong: backend/paged_attention.rs mistralrs-paged-attn/src/metal/backend/paged_attention.rs
God Classes · FileTooLong: backend/paged_prefill.rs mistralrs-paged-attn/src/metal/backend/paged_prefill.rs
God Classes · FunctionTooLong: mistralrs_quant::metal_kernels::call_afq_qmm mistralrs-quant/src/metal_kernels/mod.rs
God Classes · FunctionTooLong: mistralrs_quant::metal_kernels::call_scan mistralrs-quant/src/metal_kernels/mod.rs
God Classes · FunctionTooLong: mistralrs_core::metal::gdn::causal_conv1d_metal_impl mistralrs-core/src/metal/gdn.rs
God Classes · FunctionTooLong: mistralrs_quant::metal_kernels::call_copy_gpu_inplace mistralrs-quant/src/metal_kernels/mod.rs
God Classes · MethodTooLong: NormalPipeline.capture_cuda_decode_graph_step mistralrs-core/src/pipeline/normal.rs
God Classes · TooManyFields: FlashAttnKargs mistralrs-quant/src/metal_kernels/mod.rs
God Classes · MethodTooLong: Model.new mistralrs-core/src/models/flint.rs
God Classes · FunctionTooLong: mistralrs_core::paged_attention::plan::metal_decode_workspace mistralrs-core/src/paged_attention/plan.rs
God Classes · MethodTooLong: Sdpa.run_attention mistralrs-core/src/attention/mod.rs
God Classes · FunctionTooLong: mistralrs_quant::metal_kernels::call_flash_attn_ext_vec_bf16_dk512 mistralrs-quant/src/metal_kernels/mod.rs
God Classes · FunctionTooLong: mistralrs_quant::metal_kernels::call_single_block_sort mistralrs-quant/src/metal_kernels/mod.rs
God Classes · FileTooLong: paged_attention/mod.rs mistralrs-core/src/paged_attention/mod.rs
God Classes · FunctionTooLong: mistralrs_core::pipeline::loaders::activation_memory::prefix_prefill_workspace mistralrs-core/src/pipeline/loaders/activation_memory.rs
God Classes · FunctionTooLong: mistralrs_paged_attn::metal::kernels::call_paged_decode_gqa mistralrs-paged-attn/src/metal/kernels/mod.rs
God Classes · FileTooLong: utils/gguf_metadata.rs mistralrs-core/src/utils/gguf_metadata.rs
God Classes · ClassTooLong: Qwen3_5MoeLoader mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs
God Classes · FileTooLong: paged_attention/cache_engine.rs mistralrs-core/src/paged_attention/cache_engine.rs
God Classes · MethodTooLong: Attention.new mistralrs-core/src/models/flint.rs
God Classes · ClassTooLong: Model mistralrs-core/src/models/qwen3_next.rs
Code Duplication · Near-duplicate member family (25 members, 30 shared lines) mistralrs-core/src/models/flint.rs
Code Duplication · Near-duplicate member family (23 members, 23 shared lines) mistralrs-core/src/models/flint.rs
Code Duplication · Near-duplicate member family (22 members, 22 shared lines) mistralrs-core/src/models/flint.rs
Code Duplication · Near-duplicate member family (20 members, 22 shared lines) mistralrs-core/src/models/flint.rs
Code Duplication · Near-duplicate member family (18 members, 28 shared lines) mistralrs-core/src/models/flint.rs
Code Duplication · Near-duplicate member family (18 members, 22 shared lines) mistralrs-core/src/models/flint.rs
Code Duplication · Near-duplicate member family (18 members, 22 shared lines) mistralrs-core/src/models/flint.rs
Code Duplication · Near-duplicate member family (17 members, 31 shared lines) mistralrs-core/src/models/flint.rs
Code Duplication · Near-duplicate member family (7 members, 37 shared lines) mistralrs-core/src/models/flint.rs
Code Duplication · Near-duplicate member family (5 members, 12 shared lines) mistralrs-quant/src/metal_kernels/mod.rs
Code Duplication · Near-duplicate member family (4 members, 49 shared lines) mistralrs/src/model_builder_trait.rs
Code Duplication · Near-duplicate member family (4 members, 34 shared lines) mistralrs-core/src/models/flint.rs
Code Duplication · Near-duplicate member family (4 members, 12 shared lines) mistralrs-quant/src/metal_kernels/mod.rs
Code Duplication · Near-duplicate member pair (145 shared lines) mistralrs-core/src/pipeline/multimodal.rs
Code Duplication · Near-duplicate member pair (74 shared lines) mistralrs-paged-attn/src/metal/kernels/mod.rs
Code Duplication · Near-duplicate member pair (68 shared lines) mistralrs-quant/src/metal_kernels/mod.rs
Code Duplication · Near-duplicate member pair (63 shared lines) mistralrs-core/src/pipeline/multimodal.rs
Code Duplication · Near-duplicate member pair (55 shared lines) mistralrs-quant/src/metal_kernels/mod.rs
Code Duplication · Near-duplicate member pair (50 shared lines) mistralrs/src/model_builder_trait.rs
Code Duplication · Near-duplicate member pair (45 shared lines) mistralrs-paged-attn/src/metal/kernels/mod.rs
Code Duplication · Near-duplicate member pair (35 shared lines) mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs
Code Duplication · Near-duplicate member pair (34 shared lines) mistralrs-quant/src/lib.rs
Code Duplication · Edited copy of a member (32 corresponding lines) mistralrs-pyo3/src/lib.rs
Watchdog compares 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: 177 findings
These 177 critical or serious findings were in the previous survey, on 13 October 2026, and are gone from this one. The first 100 are listed here.
€180,000 to €880,000, for 2,921 to 9,266 hours of work, about 3.6 person-years for 2 to 7 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 53. 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
Very large: 520,746 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: Watchdog prices 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
Name the access rules — roles and permissions declared once (an enum Role/Permission, actix-web-grants #[protect(…)], axum-login's permission_required!, a casbin or oso policy) and consulted where access is checked, so the rule set is reviewable and testable on its own.
Raises the score by about 7 points · Medium effort · Access Controls
2
Secure the server's transport: serve TLS itself (`HttpServer::bind_rustls_0_23(addr, config)` in actix-web, `axum_server::bind_rustls(addr, RustlsConfig::from_pem_file(…))`, tonic's `Server::builder().tls_config(ServerTlsConfig::new().identity(…))`, Rocket's `[default.tls]`), or run it behind a TLS-terminating proxy and check `X-Forwarded-Proto`; send `Strict-Transport-Security` once it is HTTPS-only.
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 €530,000 to build again, about 3.6 person-years of work. Its weakest lens is Security and Compliance, at 44 (Weak). Security and Compliance is about how well the product is protected, and how it handles personal data. Because the weakest lens counts most in the score, work on Security and Compliance also moves the score most.
Based on: the rebuild estimate · the Security and Compliance grade · how much each lens counts
What to do: Start with the Security and Compliance actions in Top priorities.
If you do one thing first · First action
Name the access rules — roles and permissions declared once (an enum Role/Permission, actix-web-grants #[protect(…)], axum-login's permission_required!, a casbin or oso policy) and consulted where access is checked, so the rule set is reviewable and testable on its own. Of all the actions in this report, it raises the score most for the work it takes: about 7 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 6.4 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 4% to 9% on every change. The history of the code shows how much it changes: about 331,265 lines over the last 90 days, which is about 1,343,464 lines a year. At that pace, the extra work comes to an estimated 137.9 to 827.1 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's 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.
716 modules, with 3709 dependencies between them. 6 loops run through 160 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 676 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.
mistralrs_core.request uses mistralrs_mcp.tools, so a change to mistralrs_mcp.tools can break mistralrs_core.request, while a change to mistralrs_core.request can't break mistralrs_mcp.tools.
Position
Below the diagonal: mistralrs_core.request uses a module listed above it, which is the healthy direction.
6→8 mistralrs_quant.safetensors uses mistralrs_quant.uqffpart of a loop✕
Connections
2 pairs of types, where a type in mistralrs_quant.safetensors uses a type in mistralrs_quant.uqff.
mistralrs_quant.safetensors uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_quant.safetensors, while a change to mistralrs_quant.safetensors can't break mistralrs_quant.uqff.
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.
6→11 mistralrs_quant.safetensors uses mistralrs_core.utils.model_configpart of a loop✕
Connections
4 pairs of types, where a type in mistralrs_quant.safetensors uses a type in mistralrs_core.utils.model_config.
mistralrs_quant.safetensors uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_quant.safetensors, while a change to mistralrs_quant.safetensors can't break mistralrs_core.utils.model_config.
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.
mistralrs_quant uses mistralrs_quant.safetensors, so a change to mistralrs_quant.safetensors can break mistralrs_quant, while a change to mistralrs_quant can't break mistralrs_quant.safetensors.
Position
Below the diagonal: mistralrs_quant uses a module listed above it, which is the healthy direction.
7→8 mistralrs_quant uses mistralrs_quant.uqffpart of a loop✕
Connections
4 pairs of types, where a type in mistralrs_quant uses a type in mistralrs_quant.uqff.
mistralrs_quant uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_quant, while a change to mistralrs_quant can't break mistralrs_quant.uqff.
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.
7→11 mistralrs_quant uses mistralrs_core.utils.model_configpart of a loop✕
Connections
8 pairs of types, where a type in mistralrs_quant uses a type in mistralrs_core.utils.model_config.
mistralrs_quant uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_quant, while a change to mistralrs_quant can't break mistralrs_core.utils.model_config.
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.
mistralrs_quant.uqff uses mistralrs_quant.safetensors, so a change to mistralrs_quant.safetensors can break mistralrs_quant.uqff, while a change to mistralrs_quant.uqff can't break mistralrs_quant.safetensors.
Position
Below the diagonal: mistralrs_quant.uqff uses a module listed above it, which is the healthy direction.
mistralrs_quant.uqff uses mistralrs_quant, so a change to mistralrs_quant can break mistralrs_quant.uqff, while a change to mistralrs_quant.uqff can't break mistralrs_quant.
Position
Below the diagonal: mistralrs_quant.uqff uses a module listed above it, which is the healthy direction.
8→11 mistralrs_quant.uqff uses mistralrs_core.utils.model_configpart of a loop✕
Connections
1 pair of types, where a type in mistralrs_quant.uqff uses a type in mistralrs_core.utils.model_config.
mistralrs_quant.uqff uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_quant.uqff, while a change to mistralrs_quant.uqff can't break mistralrs_core.utils.model_config.
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.
mistralrs_core.diffusion_models.flux.autoencoder uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.diffusion_models.flux.autoencoder, while a change to mistralrs_core.diffusion_models.flux.autoencoder can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.diffusion_models.flux.autoencoder uses a module listed above it, which is the healthy direction.
mistralrs_core.lora uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.lora, while a change to mistralrs_core.lora can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.lora uses a module listed above it, which is the healthy direction.
mistralrs_core.utils.model_config uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.utils.model_config, while a change to mistralrs_core.utils.model_config can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.utils.model_config uses a module listed above it, which is the healthy direction.
mistralrs_core.utils.model_config uses mistralrs_core.lora, so a change to mistralrs_core.lora can break mistralrs_core.utils.model_config, while a change to mistralrs_core.utils.model_config can't break mistralrs_core.lora.
Position
Below the diagonal: mistralrs_core.utils.model_config uses a module listed above it, which is the healthy direction.
mistralrs_core.paged_attention uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.paged_attention, while a change to mistralrs_core.paged_attention can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.paged_attention uses a module listed above it, which is the healthy direction.
5 pairs of types, where a type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor uses a type in mistralrs_core.utils.model_config.
mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, while a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor uses a module listed above it, which is the healthy direction.
13→24 mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor uses mistralrs_core.pipelinepart of a loop✕
Connections
1 pair of types, where a type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor uses a type in mistralrs_core.pipeline.
mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor uses mistralrs_core.pipeline, so a change to mistralrs_core.pipeline can break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, while a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can't break mistralrs_core.pipeline.
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.
mistralrs_core.pipeline.isq uses mistralrs_quant, so a change to mistralrs_quant can break mistralrs_core.pipeline.isq, while a change to mistralrs_core.pipeline.isq can't break mistralrs_quant.
Position
Below the diagonal: mistralrs_core.pipeline.isq uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.isq uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.pipeline.isq, while a change to mistralrs_core.pipeline.isq can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.pipeline.isq uses a module listed above it, which is the healthy direction.
mistralrs_quant.distributed uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_quant.distributed, while a change to mistralrs_quant.distributed can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_quant.distributed uses a module listed above it, which is the healthy direction.
mistralrs_core.attention uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.attention, while a change to mistralrs_core.attention can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.attention uses a module listed above it, which is the healthy direction.
mistralrs_core.attention uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, so a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.attention, while a change to mistralrs_core.attention can't break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
Position
Below the diagonal: mistralrs_core.attention uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders uses mistralrs_quant, so a change to mistralrs_quant can break mistralrs_core.pipeline.loaders, while a change to mistralrs_core.pipeline.loaders can't break mistralrs_quant.
Position
Below the diagonal: mistralrs_core.pipeline.loaders uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.pipeline.loaders, while a change to mistralrs_core.pipeline.loaders can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.pipeline.loaders uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders uses mistralrs_core.paged_attention, so a change to mistralrs_core.paged_attention can break mistralrs_core.pipeline.loaders, while a change to mistralrs_core.pipeline.loaders can't break mistralrs_core.paged_attention.
Position
Below the diagonal: mistralrs_core.pipeline.loaders uses a module listed above it, which is the healthy direction.
mistralrs_core.diffusion_models.clip.text uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.diffusion_models.clip.text, while a change to mistralrs_core.diffusion_models.clip.text can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.diffusion_models.clip.text uses a module listed above it, which is the healthy direction.
mistralrs_core.diffusion_models.clip.text uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.diffusion_models.clip.text, while a change to mistralrs_core.diffusion_models.clip.text can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.diffusion_models.clip.text uses a module listed above it, which is the healthy direction.
mistralrs_core.diffusion_models.clip.text uses mistralrs_core.attention, so a change to mistralrs_core.attention can break mistralrs_core.diffusion_models.clip.text, while a change to mistralrs_core.diffusion_models.clip.text can't break mistralrs_core.attention.
Position
Below the diagonal: mistralrs_core.diffusion_models.clip.text uses a module listed above it, which is the healthy direction.
mistralrs_core.kv_cache uses mistralrs_core.attention, so a change to mistralrs_core.attention can break mistralrs_core.kv_cache, while a change to mistralrs_core.kv_cache can't break mistralrs_core.attention.
Position
Below the diagonal: mistralrs_core.kv_cache uses a module listed above it, which is the healthy direction.
mistralrs_core.paged_attention.layers.paged_attention uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.paged_attention.layers.paged_attention, while a change to mistralrs_core.paged_attention.layers.paged_attention can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.paged_attention.layers.paged_attention uses a module listed above it, which is the healthy direction.
7 pairs of types, where a type in mistralrs_core.paged_attention.layers.paged_attention uses a type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
mistralrs_core.paged_attention.layers.paged_attention uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, so a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.paged_attention.layers.paged_attention, while a change to mistralrs_core.paged_attention.layers.paged_attention can't break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
Position
Below the diagonal: mistralrs_core.paged_attention.layers.paged_attention uses a module listed above it, which is the healthy direction.
mistralrs_core.paged_attention.layers.paged_attention uses mistralrs_core.attention, so a change to mistralrs_core.attention can break mistralrs_core.paged_attention.layers.paged_attention, while a change to mistralrs_core.paged_attention.layers.paged_attention can't break mistralrs_core.attention.
Position
Below the diagonal: mistralrs_core.paged_attention.layers.paged_attention uses a module listed above it, which is the healthy direction.
mistralrs_core.amoe uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.amoe, while a change to mistralrs_core.amoe can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.amoe uses a module listed above it, which is the healthy direction.
mistralrs_core.amoe uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.amoe, while a change to mistralrs_core.amoe can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.amoe uses a module listed above it, which is the healthy direction.
mistralrs_core.amoe uses mistralrs_core.diffusion_models.clip.text, so a change to mistralrs_core.diffusion_models.clip.text can break mistralrs_core.amoe, while a change to mistralrs_core.amoe can't break mistralrs_core.diffusion_models.clip.text.
Position
Below the diagonal: mistralrs_core.amoe uses a module listed above it, which is the healthy direction.
mistralrs_core.kv_cache.full_cache uses mistralrs_core.kv_cache, so a change to mistralrs_core.kv_cache can break mistralrs_core.kv_cache.full_cache, while a change to mistralrs_core.kv_cache.full_cache can't break mistralrs_core.kv_cache.
Position
Below the diagonal: mistralrs_core.kv_cache.full_cache uses a module listed above it, which is the healthy direction.
mistralrs_core.sequence uses mistralrs_core.response, so a change to mistralrs_core.response can break mistralrs_core.sequence, while a change to mistralrs_core.sequence can't break mistralrs_core.response.
Position
Below the diagonal: mistralrs_core.sequence uses a module listed above it, which is the healthy direction.
mistralrs_core.sequence uses mistralrs_core.request, so a change to mistralrs_core.request can break mistralrs_core.sequence, while a change to mistralrs_core.sequence can't break mistralrs_core.request.
Position
Below the diagonal: mistralrs_core.sequence uses a module listed above it, which is the healthy direction.
mistralrs_core.sequence uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, so a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.sequence, while a change to mistralrs_core.sequence can't break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
Position
Below the diagonal: mistralrs_core.sequence uses a module listed above it, which is the healthy direction.
mistralrs_core.sequence uses mistralrs_core.kv_cache, so a change to mistralrs_core.kv_cache can break mistralrs_core.sequence, while a change to mistralrs_core.sequence can't break mistralrs_core.kv_cache.
Position
Below the diagonal: mistralrs_core.sequence uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline uses mistralrs_core.speculative.target, so a change to mistralrs_core.speculative.target can break mistralrs_core.pipeline, while a change to mistralrs_core.pipeline can't break mistralrs_core.speculative.target.
Position
Below the diagonal: mistralrs_core.pipeline uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline uses mistralrs_quant, so a change to mistralrs_quant can break mistralrs_core.pipeline, while a change to mistralrs_core.pipeline can't break mistralrs_quant.
Position
Below the diagonal: mistralrs_core.pipeline uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.pipeline, while a change to mistralrs_core.pipeline can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.pipeline uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline uses mistralrs_core.paged_attention, so a change to mistralrs_core.paged_attention can break mistralrs_core.pipeline, while a change to mistralrs_core.pipeline can't break mistralrs_core.paged_attention.
Position
Below the diagonal: mistralrs_core.pipeline uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, so a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.pipeline, while a change to mistralrs_core.pipeline can't break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
Position
Below the diagonal: mistralrs_core.pipeline uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline uses mistralrs_core.pipeline.loaders, so a change to mistralrs_core.pipeline.loaders can break mistralrs_core.pipeline, while a change to mistralrs_core.pipeline can't break mistralrs_core.pipeline.loaders.
Position
Below the diagonal: mistralrs_core.pipeline uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline uses mistralrs_core.amoe, so a change to mistralrs_core.amoe can break mistralrs_core.pipeline, while a change to mistralrs_core.pipeline can't break mistralrs_core.amoe.
Position
Below the diagonal: mistralrs_core.pipeline uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline uses mistralrs_core.kv_cache.full_cache, so a change to mistralrs_core.kv_cache.full_cache can break mistralrs_core.pipeline, while a change to mistralrs_core.pipeline can't break mistralrs_core.kv_cache.full_cache.
Position
Below the diagonal: mistralrs_core.pipeline uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline uses mistralrs_core.sequence, so a change to mistralrs_core.sequence can break mistralrs_core.pipeline, while a change to mistralrs_core.pipeline can't break mistralrs_core.sequence.
Position
Below the diagonal: mistralrs_core.pipeline uses a module listed above it, which is the healthy direction.
mistralrs_core.xlora_models uses mistralrs_core.lora, so a change to mistralrs_core.lora can break mistralrs_core.xlora_models, while a change to mistralrs_core.xlora_models can't break mistralrs_core.lora.
Position
Below the diagonal: mistralrs_core.xlora_models uses a module listed above it, which is the healthy direction.
mistralrs_core.xlora_models uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, so a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.xlora_models, while a change to mistralrs_core.xlora_models can't break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
Position
Below the diagonal: mistralrs_core.xlora_models uses a module listed above it, which is the healthy direction.
mistralrs_core.xlora_models uses mistralrs_core.kv_cache.full_cache, so a change to mistralrs_core.kv_cache.full_cache can break mistralrs_core.xlora_models, while a change to mistralrs_core.xlora_models can't break mistralrs_core.kv_cache.full_cache.
Position
Below the diagonal: mistralrs_core.xlora_models uses a module listed above it, which is the healthy direction.
mistralrs_core.engine uses mistralrs_core.response, so a change to mistralrs_core.response can break mistralrs_core.engine, while a change to mistralrs_core.engine can't break mistralrs_core.response.
Position
Below the diagonal: mistralrs_core.engine uses a module listed above it, which is the healthy direction.
mistralrs_core.engine uses mistralrs_core.request, so a change to mistralrs_core.request can break mistralrs_core.engine, while a change to mistralrs_core.engine can't break mistralrs_core.request.
Position
Below the diagonal: mistralrs_core.engine uses a module listed above it, which is the healthy direction.
mistralrs_core.engine uses mistralrs_core.sequence, so a change to mistralrs_core.sequence can break mistralrs_core.engine, while a change to mistralrs_core.engine can't break mistralrs_core.sequence.
Position
Below the diagonal: mistralrs_core.engine uses a module listed above it, which is the healthy direction.
mistralrs_core.engine uses mistralrs_core.pipeline, so a change to mistralrs_core.pipeline can break mistralrs_core.engine, while a change to mistralrs_core.engine can't break mistralrs_core.pipeline.
Position
Below the diagonal: mistralrs_core.engine uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.paged_attention.config, so a change to mistralrs_core.paged_attention.config can break mistralrs_core.pipeline.loaders.normal_loaders, while a change to mistralrs_core.pipeline.loaders.normal_loaders can't break mistralrs_core.paged_attention.config.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.normal_loaders uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.speculative.target, so a change to mistralrs_core.speculative.target can break mistralrs_core.pipeline.loaders.normal_loaders, while a change to mistralrs_core.pipeline.loaders.normal_loaders can't break mistralrs_core.speculative.target.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.normal_loaders uses a module listed above it, which is the healthy direction.
28 pairs of types, where a type in mistralrs_core.pipeline.loaders.normal_loaders uses a type in mistralrs_quant.uqff. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.pipeline.loaders.normal_loaders, while a change to mistralrs_core.pipeline.loaders.normal_loaders can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.normal_loaders uses a module listed above it, which is the healthy direction.
28 pairs of types, where a type in mistralrs_core.pipeline.loaders.normal_loaders uses a type in mistralrs_core.lora. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.lora, so a change to mistralrs_core.lora can break mistralrs_core.pipeline.loaders.normal_loaders, while a change to mistralrs_core.pipeline.loaders.normal_loaders can't break mistralrs_core.lora.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.normal_loaders uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.pipeline.loaders.normal_loaders, while a change to mistralrs_core.pipeline.loaders.normal_loaders can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.normal_loaders uses a module listed above it, which is the healthy direction.
28 pairs of types, where a type in mistralrs_core.pipeline.loaders.normal_loaders uses a type in mistralrs_core.paged_attention. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.paged_attention, so a change to mistralrs_core.paged_attention can break mistralrs_core.pipeline.loaders.normal_loaders, while a change to mistralrs_core.pipeline.loaders.normal_loaders can't break mistralrs_core.paged_attention.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.normal_loaders uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in mistralrs_core.pipeline.loaders.normal_loaders uses a type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, so a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.pipeline.loaders.normal_loaders, while a change to mistralrs_core.pipeline.loaders.normal_loaders can't break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.normal_loaders uses a module listed above it, which is the healthy direction.
29 pairs of types, where a type in mistralrs_core.pipeline.loaders.normal_loaders uses a type in mistralrs_core.pipeline.isq. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.pipeline.isq, so a change to mistralrs_core.pipeline.isq can break mistralrs_core.pipeline.loaders.normal_loaders, while a change to mistralrs_core.pipeline.loaders.normal_loaders can't break mistralrs_core.pipeline.isq.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.normal_loaders uses a module listed above it, which is the healthy direction.
55 pairs of types, where a type in mistralrs_core.pipeline.loaders.normal_loaders uses a type in mistralrs_core.pipeline.loaders. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.pipeline.loaders, so a change to mistralrs_core.pipeline.loaders can break mistralrs_core.pipeline.loaders.normal_loaders, while a change to mistralrs_core.pipeline.loaders.normal_loaders can't break mistralrs_core.pipeline.loaders.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.normal_loaders uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.amoe, so a change to mistralrs_core.amoe can break mistralrs_core.pipeline.loaders.normal_loaders, while a change to mistralrs_core.pipeline.loaders.normal_loaders can't break mistralrs_core.amoe.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.normal_loaders uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.kv_cache.full_cache, so a change to mistralrs_core.kv_cache.full_cache can break mistralrs_core.pipeline.loaders.normal_loaders, while a change to mistralrs_core.pipeline.loaders.normal_loaders can't break mistralrs_core.kv_cache.full_cache.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.normal_loaders uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.pipeline, so a change to mistralrs_core.pipeline can break mistralrs_core.pipeline.loaders.normal_loaders, while a change to mistralrs_core.pipeline.loaders.normal_loaders can't break mistralrs_core.pipeline.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.normal_loaders uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.xlora_models, so a change to mistralrs_core.xlora_models can break mistralrs_core.pipeline.loaders.normal_loaders, while a change to mistralrs_core.pipeline.loaders.normal_loaders can't break mistralrs_core.xlora_models.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.normal_loaders uses a module listed above it, which is the healthy direction.
mistralrs_core uses mistralrs_mcp.tools, so a change to mistralrs_mcp.tools can break mistralrs_core, while a change to mistralrs_core can't break mistralrs_mcp.tools.
Position
Below the diagonal: mistralrs_core uses a module listed above it, which is the healthy direction.
mistralrs_core uses mistralrs_core.request, so a change to mistralrs_core.request can break mistralrs_core, while a change to mistralrs_core can't break mistralrs_core.request.
Position
Below the diagonal: mistralrs_core uses a module listed above it, which is the healthy direction.
mistralrs_core uses mistralrs_quant, so a change to mistralrs_quant can break mistralrs_core, while a change to mistralrs_core can't break mistralrs_quant.
Position
Below the diagonal: mistralrs_core uses a module listed above it, which is the healthy direction.
mistralrs_core uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core, while a change to mistralrs_core can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core uses a module listed above it, which is the healthy direction.
mistralrs_core uses mistralrs_core.paged_attention, so a change to mistralrs_core.paged_attention can break mistralrs_core, while a change to mistralrs_core can't break mistralrs_core.paged_attention.
Position
Below the diagonal: mistralrs_core uses a module listed above it, which is the healthy direction.
mistralrs_core uses mistralrs_core.pipeline.loaders, so a change to mistralrs_core.pipeline.loaders can break mistralrs_core, while a change to mistralrs_core can't break mistralrs_core.pipeline.loaders.
Position
Below the diagonal: mistralrs_core uses a module listed above it, which is the healthy direction.
mistralrs_core uses mistralrs_core.pipeline, so a change to mistralrs_core.pipeline can break mistralrs_core, while a change to mistralrs_core can't break mistralrs_core.pipeline.
Position
Below the diagonal: mistralrs_core uses a module listed above it, which is the healthy direction.
mistralrs_core uses mistralrs_core.engine, so a change to mistralrs_core.engine can break mistralrs_core, while a change to mistralrs_core can't break mistralrs_core.engine.
Position
Below the diagonal: mistralrs_core uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.paged_attention.config, so a change to mistralrs_core.paged_attention.config can break mistralrs_core.pipeline.loaders.multimodal_loaders, while a change to mistralrs_core.pipeline.loaders.multimodal_loaders can't break mistralrs_core.paged_attention.config.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.multimodal_loaders uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.speculative.target, so a change to mistralrs_core.speculative.target can break mistralrs_core.pipeline.loaders.multimodal_loaders, while a change to mistralrs_core.pipeline.loaders.multimodal_loaders can't break mistralrs_core.speculative.target.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.multimodal_loaders uses a module listed above it, which is the healthy direction.
26 pairs of types, where a type in mistralrs_core.pipeline.loaders.multimodal_loaders uses a type in mistralrs_quant.uqff. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.pipeline.loaders.multimodal_loaders, while a change to mistralrs_core.pipeline.loaders.multimodal_loaders can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.multimodal_loaders uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.pipeline.loaders.multimodal_loaders, while a change to mistralrs_core.pipeline.loaders.multimodal_loaders can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.multimodal_loaders uses a module listed above it, which is the healthy direction.
26 pairs of types, where a type in mistralrs_core.pipeline.loaders.multimodal_loaders uses a type in mistralrs_core.paged_attention. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.paged_attention, so a change to mistralrs_core.paged_attention can break mistralrs_core.pipeline.loaders.multimodal_loaders, while a change to mistralrs_core.pipeline.loaders.multimodal_loaders can't break mistralrs_core.paged_attention.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.multimodal_loaders uses a module listed above it, which is the healthy direction.
27 pairs of types, where a type in mistralrs_core.pipeline.loaders.multimodal_loaders uses a type in mistralrs_core.pipeline.isq. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.pipeline.isq, so a change to mistralrs_core.pipeline.isq can break mistralrs_core.pipeline.loaders.multimodal_loaders, while a change to mistralrs_core.pipeline.loaders.multimodal_loaders can't break mistralrs_core.pipeline.isq.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.multimodal_loaders uses a module listed above it, which is the healthy direction.
51 pairs of types, where a type in mistralrs_core.pipeline.loaders.multimodal_loaders uses a type in mistralrs_core.pipeline.loaders. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.pipeline.loaders, so a change to mistralrs_core.pipeline.loaders can break mistralrs_core.pipeline.loaders.multimodal_loaders, while a change to mistralrs_core.pipeline.loaders.multimodal_loaders can't break mistralrs_core.pipeline.loaders.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.multimodal_loaders uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.diffusion_models.clip.text, so a change to mistralrs_core.diffusion_models.clip.text can break mistralrs_core.pipeline.loaders.multimodal_loaders, while a change to mistralrs_core.pipeline.loaders.multimodal_loaders can't break mistralrs_core.diffusion_models.clip.text.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.multimodal_loaders uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.amoe, so a change to mistralrs_core.amoe can break mistralrs_core.pipeline.loaders.multimodal_loaders, while a change to mistralrs_core.pipeline.loaders.multimodal_loaders can't break mistralrs_core.amoe.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.multimodal_loaders uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.kv_cache.full_cache, so a change to mistralrs_core.kv_cache.full_cache can break mistralrs_core.pipeline.loaders.multimodal_loaders, while a change to mistralrs_core.pipeline.loaders.multimodal_loaders can't break mistralrs_core.kv_cache.full_cache.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.multimodal_loaders uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.pipeline, so a change to mistralrs_core.pipeline can break mistralrs_core.pipeline.loaders.multimodal_loaders, while a change to mistralrs_core.pipeline.loaders.multimodal_loaders can't break mistralrs_core.pipeline.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.multimodal_loaders uses a module listed above it, which is the healthy direction.
26 pairs of types, where a type in mistralrs_core.pipeline.loaders.multimodal_loaders uses a type in mistralrs_core.pipeline.loaders.normal_loaders. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.pipeline.loaders.normal_loaders, so a change to mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.pipeline.loaders.multimodal_loaders, while a change to mistralrs_core.pipeline.loaders.multimodal_loaders can't break mistralrs_core.pipeline.loaders.normal_loaders.
Position
Below the diagonal: mistralrs_core.pipeline.loaders.multimodal_loaders uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.multimodal uses mistralrs_core.speculative.target, so a change to mistralrs_core.speculative.target can break mistralrs_core.pipeline.multimodal, while a change to mistralrs_core.pipeline.multimodal can't break mistralrs_core.speculative.target.
Position
Below the diagonal: mistralrs_core.pipeline.multimodal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.multimodal uses mistralrs_quant, so a change to mistralrs_quant can break mistralrs_core.pipeline.multimodal, while a change to mistralrs_core.pipeline.multimodal can't break mistralrs_quant.
Position
Below the diagonal: mistralrs_core.pipeline.multimodal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.multimodal uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.pipeline.multimodal, while a change to mistralrs_core.pipeline.multimodal can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.pipeline.multimodal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.multimodal uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.pipeline.multimodal, while a change to mistralrs_core.pipeline.multimodal can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.pipeline.multimodal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.multimodal uses mistralrs_core.paged_attention, so a change to mistralrs_core.paged_attention can break mistralrs_core.pipeline.multimodal, while a change to mistralrs_core.pipeline.multimodal can't break mistralrs_core.paged_attention.
Position
Below the diagonal: mistralrs_core.pipeline.multimodal uses a module listed above it, which is the healthy direction.
4 pairs of types, where a type in mistralrs_core.pipeline.multimodal uses a type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
mistralrs_core.pipeline.multimodal uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, so a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.pipeline.multimodal, while a change to mistralrs_core.pipeline.multimodal can't break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
Position
Below the diagonal: mistralrs_core.pipeline.multimodal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.multimodal uses mistralrs_core.pipeline.isq, so a change to mistralrs_core.pipeline.isq can break mistralrs_core.pipeline.multimodal, while a change to mistralrs_core.pipeline.multimodal can't break mistralrs_core.pipeline.isq.
Position
Below the diagonal: mistralrs_core.pipeline.multimodal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.multimodal uses mistralrs_core.pipeline.loaders, so a change to mistralrs_core.pipeline.loaders can break mistralrs_core.pipeline.multimodal, while a change to mistralrs_core.pipeline.multimodal can't break mistralrs_core.pipeline.loaders.
Position
Below the diagonal: mistralrs_core.pipeline.multimodal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.multimodal uses mistralrs_core.amoe, so a change to mistralrs_core.amoe can break mistralrs_core.pipeline.multimodal, while a change to mistralrs_core.pipeline.multimodal can't break mistralrs_core.amoe.
Position
Below the diagonal: mistralrs_core.pipeline.multimodal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.multimodal uses mistralrs_core.kv_cache.full_cache, so a change to mistralrs_core.kv_cache.full_cache can break mistralrs_core.pipeline.multimodal, while a change to mistralrs_core.pipeline.multimodal can't break mistralrs_core.kv_cache.full_cache.
Position
Below the diagonal: mistralrs_core.pipeline.multimodal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.multimodal uses mistralrs_core.pipeline, so a change to mistralrs_core.pipeline can break mistralrs_core.pipeline.multimodal, while a change to mistralrs_core.pipeline.multimodal can't break mistralrs_core.pipeline.
Position
Below the diagonal: mistralrs_core.pipeline.multimodal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.multimodal uses mistralrs_core.pipeline.loaders.multimodal_loaders, so a change to mistralrs_core.pipeline.loaders.multimodal_loaders can break mistralrs_core.pipeline.multimodal, while a change to mistralrs_core.pipeline.multimodal can't break mistralrs_core.pipeline.loaders.multimodal_loaders.
Position
Below the diagonal: mistralrs_core.pipeline.multimodal uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.paged_attention.config, so a change to mistralrs_core.paged_attention.config can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_core.paged_attention.config.
Position
Below the diagonal: mistralrs_core.vision_models.idefics2 uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.speculative.target, so a change to mistralrs_core.speculative.target can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_core.speculative.target.
Position
Below the diagonal: mistralrs_core.vision_models.idefics2 uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.idefics2 uses mistralrs_quant, so a change to mistralrs_quant can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_quant.
Position
Below the diagonal: mistralrs_core.vision_models.idefics2 uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.idefics2 uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.vision_models.idefics2 uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.diffusion_models.flux.autoencoder, so a change to mistralrs_core.diffusion_models.flux.autoencoder can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_core.diffusion_models.flux.autoencoder.
Position
Below the diagonal: mistralrs_core.vision_models.idefics2 uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.vision_models.idefics2 uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.paged_attention, so a change to mistralrs_core.paged_attention can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_core.paged_attention.
Position
Below the diagonal: mistralrs_core.vision_models.idefics2 uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.pipeline.isq, so a change to mistralrs_core.pipeline.isq can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_core.pipeline.isq.
Position
Below the diagonal: mistralrs_core.vision_models.idefics2 uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.attention, so a change to mistralrs_core.attention can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_core.attention.
Position
Below the diagonal: mistralrs_core.vision_models.idefics2 uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.diffusion_models.clip.text, so a change to mistralrs_core.diffusion_models.clip.text can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_core.diffusion_models.clip.text.
Position
Below the diagonal: mistralrs_core.vision_models.idefics2 uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.amoe, so a change to mistralrs_core.amoe can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_core.amoe.
Position
Below the diagonal: mistralrs_core.vision_models.idefics2 uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.kv_cache.full_cache, so a change to mistralrs_core.kv_cache.full_cache can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_core.kv_cache.full_cache.
Position
Below the diagonal: mistralrs_core.vision_models.idefics2 uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.pipeline, so a change to mistralrs_core.pipeline can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_core.pipeline.
Position
Below the diagonal: mistralrs_core.vision_models.idefics2 uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.pipeline.loaders.normal_loaders, so a change to mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_core.pipeline.loaders.normal_loaders.
Position
Below the diagonal: mistralrs_core.vision_models.idefics2 uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.pipeline.loaders.multimodal_loaders, so a change to mistralrs_core.pipeline.loaders.multimodal_loaders can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_core.pipeline.loaders.multimodal_loaders.
Position
Below the diagonal: mistralrs_core.vision_models.idefics2 uses a module listed above it, which is the healthy direction.
31→32 mistralrs_core.vision_models.idefics2 uses mistralrs_core.layerspart of a loop✕
Connections
6 pairs of types, where a type in mistralrs_core.vision_models.idefics2 uses a type in mistralrs_core.layers.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.layers, so a change to mistralrs_core.layers can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_core.layers.
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.
31→34 mistralrs_core.vision_models.idefics2 uses mistralrs_core.embedding_models.embedding_gemmapart of a loop✕
Connections
1 pair of types, where a type in mistralrs_core.vision_models.idefics2 uses a type in mistralrs_core.embedding_models.embedding_gemma.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.embedding_models.embedding_gemma, so a change to mistralrs_core.embedding_models.embedding_gemma can break mistralrs_core.vision_models.idefics2, while a change to mistralrs_core.vision_models.idefics2 can't break mistralrs_core.embedding_models.embedding_gemma.
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.
mistralrs_core.layers uses mistralrs_quant, so a change to mistralrs_quant can break mistralrs_core.layers, while a change to mistralrs_core.layers can't break mistralrs_quant.
Position
Below the diagonal: mistralrs_core.layers uses a module listed above it, which is the healthy direction.
mistralrs_core.layers uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.layers, while a change to mistralrs_core.layers can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.layers uses a module listed above it, which is the healthy direction.
mistralrs_core.layers uses mistralrs_core.diffusion_models.flux.autoencoder, so a change to mistralrs_core.diffusion_models.flux.autoencoder can break mistralrs_core.layers, while a change to mistralrs_core.layers can't break mistralrs_core.diffusion_models.flux.autoencoder.
Position
Below the diagonal: mistralrs_core.layers uses a module listed above it, which is the healthy direction.
mistralrs_core.layers uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.layers, while a change to mistralrs_core.layers can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.layers uses a module listed above it, which is the healthy direction.
mistralrs_core.layers uses mistralrs_quant.distributed, so a change to mistralrs_quant.distributed can break mistralrs_core.layers, while a change to mistralrs_core.layers can't break mistralrs_quant.distributed.
Position
Below the diagonal: mistralrs_core.layers uses a module listed above it, which is the healthy direction.
mistralrs_core.layers uses mistralrs_core.diffusion_models.clip.text, so a change to mistralrs_core.diffusion_models.clip.text can break mistralrs_core.layers, while a change to mistralrs_core.layers can't break mistralrs_core.diffusion_models.clip.text.
Position
Below the diagonal: mistralrs_core.layers uses a module listed above it, which is the healthy direction.
mistralrs_core.layers uses mistralrs_core.amoe, so a change to mistralrs_core.amoe can break mistralrs_core.layers, while a change to mistralrs_core.layers can't break mistralrs_core.amoe.
Position
Below the diagonal: mistralrs_core.layers uses a module listed above it, which is the healthy direction.
mistralrs_core.layers uses mistralrs_core.vision_models.idefics2, so a change to mistralrs_core.vision_models.idefics2 can break mistralrs_core.layers, while a change to mistralrs_core.layers can't break mistralrs_core.vision_models.idefics2.
Position
Below the diagonal: mistralrs_core.layers uses a module listed above it, which is the healthy direction.
32→34 mistralrs_core.layers uses mistralrs_core.embedding_models.embedding_gemmapart of a loop✕
Connections
1 pair of types, where a type in mistralrs_core.layers uses a type in mistralrs_core.embedding_models.embedding_gemma.
mistralrs_core.layers uses mistralrs_core.embedding_models.embedding_gemma, so a change to mistralrs_core.embedding_models.embedding_gemma can break mistralrs_core.layers, while a change to mistralrs_core.layers can't break mistralrs_core.embedding_models.embedding_gemma.
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.
mistralrs_core.pipeline.normal uses mistralrs_core.paged_attention.config, so a change to mistralrs_core.paged_attention.config can break mistralrs_core.pipeline.normal, while a change to mistralrs_core.pipeline.normal can't break mistralrs_core.paged_attention.config.
Position
Below the diagonal: mistralrs_core.pipeline.normal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.normal uses mistralrs_core.speculative.target, so a change to mistralrs_core.speculative.target can break mistralrs_core.pipeline.normal, while a change to mistralrs_core.pipeline.normal can't break mistralrs_core.speculative.target.
Position
Below the diagonal: mistralrs_core.pipeline.normal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.normal uses mistralrs_quant, so a change to mistralrs_quant can break mistralrs_core.pipeline.normal, while a change to mistralrs_core.pipeline.normal can't break mistralrs_quant.
Position
Below the diagonal: mistralrs_core.pipeline.normal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.normal uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.pipeline.normal, while a change to mistralrs_core.pipeline.normal can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.pipeline.normal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.normal uses mistralrs_core.lora, so a change to mistralrs_core.lora can break mistralrs_core.pipeline.normal, while a change to mistralrs_core.pipeline.normal can't break mistralrs_core.lora.
Position
Below the diagonal: mistralrs_core.pipeline.normal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.normal uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.pipeline.normal, while a change to mistralrs_core.pipeline.normal can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.pipeline.normal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.normal uses mistralrs_core.paged_attention, so a change to mistralrs_core.paged_attention can break mistralrs_core.pipeline.normal, while a change to mistralrs_core.pipeline.normal can't break mistralrs_core.paged_attention.
Position
Below the diagonal: mistralrs_core.pipeline.normal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.normal uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, so a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.pipeline.normal, while a change to mistralrs_core.pipeline.normal can't break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
Position
Below the diagonal: mistralrs_core.pipeline.normal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.normal uses mistralrs_core.pipeline.isq, so a change to mistralrs_core.pipeline.isq can break mistralrs_core.pipeline.normal, while a change to mistralrs_core.pipeline.normal can't break mistralrs_core.pipeline.isq.
Position
Below the diagonal: mistralrs_core.pipeline.normal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.normal uses mistralrs_core.pipeline.loaders, so a change to mistralrs_core.pipeline.loaders can break mistralrs_core.pipeline.normal, while a change to mistralrs_core.pipeline.normal can't break mistralrs_core.pipeline.loaders.
Position
Below the diagonal: mistralrs_core.pipeline.normal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.normal uses mistralrs_core.amoe, so a change to mistralrs_core.amoe can break mistralrs_core.pipeline.normal, while a change to mistralrs_core.pipeline.normal can't break mistralrs_core.amoe.
Position
Below the diagonal: mistralrs_core.pipeline.normal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.normal uses mistralrs_core.kv_cache.full_cache, so a change to mistralrs_core.kv_cache.full_cache can break mistralrs_core.pipeline.normal, while a change to mistralrs_core.pipeline.normal can't break mistralrs_core.kv_cache.full_cache.
Position
Below the diagonal: mistralrs_core.pipeline.normal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.normal uses mistralrs_core.pipeline, so a change to mistralrs_core.pipeline can break mistralrs_core.pipeline.normal, while a change to mistralrs_core.pipeline.normal can't break mistralrs_core.pipeline.
Position
Below the diagonal: mistralrs_core.pipeline.normal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.normal uses mistralrs_core.xlora_models, so a change to mistralrs_core.xlora_models can break mistralrs_core.pipeline.normal, while a change to mistralrs_core.pipeline.normal can't break mistralrs_core.xlora_models.
Position
Below the diagonal: mistralrs_core.pipeline.normal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.normal uses mistralrs_core.pipeline.loaders.normal_loaders, so a change to mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.pipeline.normal, while a change to mistralrs_core.pipeline.normal can't break mistralrs_core.pipeline.loaders.normal_loaders.
Position
Below the diagonal: mistralrs_core.pipeline.normal uses a module listed above it, which is the healthy direction.
mistralrs_core.pipeline.normal uses mistralrs_core.pipeline.multimodal, so a change to mistralrs_core.pipeline.multimodal can break mistralrs_core.pipeline.normal, while a change to mistralrs_core.pipeline.normal can't break mistralrs_core.pipeline.multimodal.
Position
Below the diagonal: mistralrs_core.pipeline.normal uses a module listed above it, which is the healthy direction.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_quant, so a change to mistralrs_quant can break mistralrs_core.embedding_models.embedding_gemma, while a change to mistralrs_core.embedding_models.embedding_gemma can't break mistralrs_quant.
Position
Below the diagonal: mistralrs_core.embedding_models.embedding_gemma uses a module listed above it, which is the healthy direction.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.embedding_models.embedding_gemma, while a change to mistralrs_core.embedding_models.embedding_gemma can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.embedding_models.embedding_gemma uses a module listed above it, which is the healthy direction.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.embedding_models.embedding_gemma, while a change to mistralrs_core.embedding_models.embedding_gemma can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.embedding_models.embedding_gemma uses a module listed above it, which is the healthy direction.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.paged_attention, so a change to mistralrs_core.paged_attention can break mistralrs_core.embedding_models.embedding_gemma, while a change to mistralrs_core.embedding_models.embedding_gemma can't break mistralrs_core.paged_attention.
Position
Below the diagonal: mistralrs_core.embedding_models.embedding_gemma uses a module listed above it, which is the healthy direction.
3 pairs of types, where a type in mistralrs_core.embedding_models.embedding_gemma uses a type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, so a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.embedding_models.embedding_gemma, while a change to mistralrs_core.embedding_models.embedding_gemma can't break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
Position
Below the diagonal: mistralrs_core.embedding_models.embedding_gemma uses a module listed above it, which is the healthy direction.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.pipeline.isq, so a change to mistralrs_core.pipeline.isq can break mistralrs_core.embedding_models.embedding_gemma, while a change to mistralrs_core.embedding_models.embedding_gemma can't break mistralrs_core.pipeline.isq.
Position
Below the diagonal: mistralrs_core.embedding_models.embedding_gemma uses a module listed above it, which is the healthy direction.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_quant.distributed, so a change to mistralrs_quant.distributed can break mistralrs_core.embedding_models.embedding_gemma, while a change to mistralrs_core.embedding_models.embedding_gemma can't break mistralrs_quant.distributed.
Position
Below the diagonal: mistralrs_core.embedding_models.embedding_gemma uses a module listed above it, which is the healthy direction.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.attention, so a change to mistralrs_core.attention can break mistralrs_core.embedding_models.embedding_gemma, while a change to mistralrs_core.embedding_models.embedding_gemma can't break mistralrs_core.attention.
Position
Below the diagonal: mistralrs_core.embedding_models.embedding_gemma uses a module listed above it, which is the healthy direction.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.diffusion_models.clip.text, so a change to mistralrs_core.diffusion_models.clip.text can break mistralrs_core.embedding_models.embedding_gemma, while a change to mistralrs_core.embedding_models.embedding_gemma can't break mistralrs_core.diffusion_models.clip.text.
Position
Below the diagonal: mistralrs_core.embedding_models.embedding_gemma uses a module listed above it, which is the healthy direction.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.amoe, so a change to mistralrs_core.amoe can break mistralrs_core.embedding_models.embedding_gemma, while a change to mistralrs_core.embedding_models.embedding_gemma can't break mistralrs_core.amoe.
Position
Below the diagonal: mistralrs_core.embedding_models.embedding_gemma uses a module listed above it, which is the healthy direction.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.pipeline.loaders.normal_loaders, so a change to mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.embedding_models.embedding_gemma, while a change to mistralrs_core.embedding_models.embedding_gemma can't break mistralrs_core.pipeline.loaders.normal_loaders.
Position
Below the diagonal: mistralrs_core.embedding_models.embedding_gemma uses a module listed above it, which is the healthy direction.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.layers, so a change to mistralrs_core.layers can break mistralrs_core.embedding_models.embedding_gemma, while a change to mistralrs_core.embedding_models.embedding_gemma can't break mistralrs_core.layers.
Position
Below the diagonal: mistralrs_core.embedding_models.embedding_gemma uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.paged_attention.config, so a change to mistralrs_core.paged_attention.config can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.paged_attention.config.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.speculative.target, so a change to mistralrs_core.speculative.target can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.speculative.target.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_quant, so a change to mistralrs_quant can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_quant.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.paged_attention, so a change to mistralrs_core.paged_attention can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.paged_attention.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, so a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.pipeline.isq, so a change to mistralrs_core.pipeline.isq can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.pipeline.isq.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_quant.distributed, so a change to mistralrs_quant.distributed can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_quant.distributed.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.attention, so a change to mistralrs_core.attention can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.attention.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.diffusion_models.clip.text, so a change to mistralrs_core.diffusion_models.clip.text can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.diffusion_models.clip.text.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.kv_cache, so a change to mistralrs_core.kv_cache can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.kv_cache.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.paged_attention.layers.paged_attention, so a change to mistralrs_core.paged_attention.layers.paged_attention can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.paged_attention.layers.paged_attention.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.amoe, so a change to mistralrs_core.amoe can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.amoe.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.kv_cache.full_cache, so a change to mistralrs_core.kv_cache.full_cache can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.kv_cache.full_cache.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.pipeline, so a change to mistralrs_core.pipeline can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.pipeline.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.xlora_models, so a change to mistralrs_core.xlora_models can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.xlora_models.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.pipeline.loaders.normal_loaders, so a change to mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.pipeline.loaders.normal_loaders.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.layers, so a change to mistralrs_core.layers can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.layers.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.deepseek2 uses mistralrs_core.embedding_models.embedding_gemma, so a change to mistralrs_core.embedding_models.embedding_gemma can break mistralrs_core.models.deepseek2, while a change to mistralrs_core.models.deepseek2 can't break mistralrs_core.embedding_models.embedding_gemma.
Position
Below the diagonal: mistralrs_core.models.deepseek2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.paged_attention.config, so a change to mistralrs_core.paged_attention.config can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.paged_attention.config.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.speculative.target, so a change to mistralrs_core.speculative.target can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.speculative.target.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_quant, so a change to mistralrs_quant can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_quant.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.diffusion_models.flux.autoencoder, so a change to mistralrs_core.diffusion_models.flux.autoencoder can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.diffusion_models.flux.autoencoder.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.paged_attention, so a change to mistralrs_core.paged_attention can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.paged_attention.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, so a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.pipeline.isq, so a change to mistralrs_core.pipeline.isq can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.pipeline.isq.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_quant.distributed, so a change to mistralrs_quant.distributed can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_quant.distributed.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.attention, so a change to mistralrs_core.attention can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.attention.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.diffusion_models.clip.text, so a change to mistralrs_core.diffusion_models.clip.text can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.diffusion_models.clip.text.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.kv_cache, so a change to mistralrs_core.kv_cache can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.kv_cache.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.paged_attention.layers.paged_attention, so a change to mistralrs_core.paged_attention.layers.paged_attention can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.paged_attention.layers.paged_attention.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.amoe, so a change to mistralrs_core.amoe can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.amoe.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.kv_cache.full_cache, so a change to mistralrs_core.kv_cache.full_cache can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.kv_cache.full_cache.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.pipeline, so a change to mistralrs_core.pipeline can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.pipeline.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.xlora_models, so a change to mistralrs_core.xlora_models can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.xlora_models.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.pipeline.loaders.normal_loaders, so a change to mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.pipeline.loaders.normal_loaders.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.layers, so a change to mistralrs_core.layers can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.layers.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.granite uses mistralrs_core.embedding_models.embedding_gemma, so a change to mistralrs_core.embedding_models.embedding_gemma can break mistralrs_core.models.granite, while a change to mistralrs_core.models.granite can't break mistralrs_core.embedding_models.embedding_gemma.
Position
Below the diagonal: mistralrs_core.models.granite uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.paged_attention.config, so a change to mistralrs_core.paged_attention.config can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.paged_attention.config.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.speculative.target, so a change to mistralrs_core.speculative.target can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.speculative.target.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_quant, so a change to mistralrs_quant can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_quant.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.diffusion_models.flux.autoencoder, so a change to mistralrs_core.diffusion_models.flux.autoencoder can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.diffusion_models.flux.autoencoder.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.paged_attention, so a change to mistralrs_core.paged_attention can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.paged_attention.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, so a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.pipeline.isq, so a change to mistralrs_core.pipeline.isq can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.pipeline.isq.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_quant.distributed, so a change to mistralrs_quant.distributed can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_quant.distributed.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.attention, so a change to mistralrs_core.attention can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.attention.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.diffusion_models.clip.text, so a change to mistralrs_core.diffusion_models.clip.text can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.diffusion_models.clip.text.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.kv_cache, so a change to mistralrs_core.kv_cache can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.kv_cache.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.paged_attention.layers.paged_attention, so a change to mistralrs_core.paged_attention.layers.paged_attention can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.paged_attention.layers.paged_attention.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.amoe, so a change to mistralrs_core.amoe can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.amoe.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.kv_cache.full_cache, so a change to mistralrs_core.kv_cache.full_cache can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.kv_cache.full_cache.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.pipeline, so a change to mistralrs_core.pipeline can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.pipeline.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.xlora_models, so a change to mistralrs_core.xlora_models can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.xlora_models.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.pipeline.loaders.normal_loaders, so a change to mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.pipeline.loaders.normal_loaders.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.layers, so a change to mistralrs_core.layers can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.layers.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.embedding_models.embedding_gemma, so a change to mistralrs_core.embedding_models.embedding_gemma can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.embedding_models.embedding_gemma.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.flint uses mistralrs_core.models.deepseek2, so a change to mistralrs_core.models.deepseek2 can break mistralrs_core.models.flint, while a change to mistralrs_core.models.flint can't break mistralrs_core.models.deepseek2.
Position
Below the diagonal: mistralrs_core.models.flint uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.paged_attention.config, so a change to mistralrs_core.paged_attention.config can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.paged_attention.config.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.speculative.target, so a change to mistralrs_core.speculative.target can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.speculative.target.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_quant, so a change to mistralrs_quant can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_quant.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.diffusion_models.flux.autoencoder, so a change to mistralrs_core.diffusion_models.flux.autoencoder can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.diffusion_models.flux.autoencoder.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.paged_attention, so a change to mistralrs_core.paged_attention can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.paged_attention.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, so a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.pipeline.isq, so a change to mistralrs_core.pipeline.isq can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.pipeline.isq.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_quant.distributed, so a change to mistralrs_quant.distributed can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_quant.distributed.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.attention, so a change to mistralrs_core.attention can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.attention.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.kv_cache, so a change to mistralrs_core.kv_cache can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.kv_cache.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.paged_attention.layers.paged_attention, so a change to mistralrs_core.paged_attention.layers.paged_attention can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.paged_attention.layers.paged_attention.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.amoe, so a change to mistralrs_core.amoe can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.amoe.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.kv_cache.full_cache, so a change to mistralrs_core.kv_cache.full_cache can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.kv_cache.full_cache.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.pipeline, so a change to mistralrs_core.pipeline can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.pipeline.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.xlora_models, so a change to mistralrs_core.xlora_models can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.xlora_models.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.pipeline.loaders.normal_loaders, so a change to mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.pipeline.loaders.normal_loaders.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.layers, so a change to mistralrs_core.layers can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.layers.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.embedding_models.embedding_gemma, so a change to mistralrs_core.embedding_models.embedding_gemma can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.embedding_models.embedding_gemma.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.lfm2 uses mistralrs_core.models.flint, so a change to mistralrs_core.models.flint can break mistralrs_core.models.lfm2, while a change to mistralrs_core.models.lfm2 can't break mistralrs_core.models.flint.
Position
Below the diagonal: mistralrs_core.models.lfm2 uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.paged_attention.config, so a change to mistralrs_core.paged_attention.config can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.paged_attention.config.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.speculative.target, so a change to mistralrs_core.speculative.target can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.speculative.target.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_quant, so a change to mistralrs_quant can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_quant.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.diffusion_models.flux.autoencoder, so a change to mistralrs_core.diffusion_models.flux.autoencoder can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.diffusion_models.flux.autoencoder.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.paged_attention, so a change to mistralrs_core.paged_attention can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.paged_attention.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in mistralrs_core.models.qwen3_next uses a type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
mistralrs_core.models.qwen3_next uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, so a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.pipeline.isq, so a change to mistralrs_core.pipeline.isq can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.pipeline.isq.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_quant.distributed, so a change to mistralrs_quant.distributed can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_quant.distributed.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.attention, so a change to mistralrs_core.attention can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.attention.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.diffusion_models.clip.text, so a change to mistralrs_core.diffusion_models.clip.text can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.diffusion_models.clip.text.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.kv_cache, so a change to mistralrs_core.kv_cache can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.kv_cache.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.paged_attention.layers.paged_attention, so a change to mistralrs_core.paged_attention.layers.paged_attention can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.paged_attention.layers.paged_attention.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.amoe, so a change to mistralrs_core.amoe can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.amoe.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.kv_cache.full_cache, so a change to mistralrs_core.kv_cache.full_cache can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.kv_cache.full_cache.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.pipeline, so a change to mistralrs_core.pipeline can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.pipeline.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.xlora_models, so a change to mistralrs_core.xlora_models can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.xlora_models.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.pipeline.loaders.normal_loaders, so a change to mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.pipeline.loaders.normal_loaders.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.layers, so a change to mistralrs_core.layers can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.layers.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.embedding_models.embedding_gemma, so a change to mistralrs_core.embedding_models.embedding_gemma can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.embedding_models.embedding_gemma.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.models.flint, so a change to mistralrs_core.models.flint can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.models.flint.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.models.qwen3_next uses mistralrs_core.models.lfm2, so a change to mistralrs_core.models.lfm2 can break mistralrs_core.models.qwen3_next, while a change to mistralrs_core.models.qwen3_next can't break mistralrs_core.models.lfm2.
Position
Below the diagonal: mistralrs_core.models.qwen3_next uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.paged_attention.config, so a change to mistralrs_core.paged_attention.config can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.paged_attention.config.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.speculative.target, so a change to mistralrs_core.speculative.target can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.speculative.target.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_quant, so a change to mistralrs_quant can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_quant.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_quant.uqff, so a change to mistralrs_quant.uqff can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_quant.uqff.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.utils.model_config, so a change to mistralrs_core.utils.model_config can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.utils.model_config.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.paged_attention, so a change to mistralrs_core.paged_attention can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.paged_attention.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
3 pairs of types, where a type in mistralrs_core.vision_models.qwen3_5.text uses a type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, so a change to mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.pipeline.isq, so a change to mistralrs_core.pipeline.isq can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.pipeline.isq.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_quant.distributed, so a change to mistralrs_quant.distributed can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_quant.distributed.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.attention, so a change to mistralrs_core.attention can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.attention.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.kv_cache, so a change to mistralrs_core.kv_cache can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.kv_cache.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.paged_attention.layers.paged_attention, so a change to mistralrs_core.paged_attention.layers.paged_attention can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.paged_attention.layers.paged_attention.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.amoe, so a change to mistralrs_core.amoe can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.amoe.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.kv_cache.full_cache, so a change to mistralrs_core.kv_cache.full_cache can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.kv_cache.full_cache.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.pipeline, so a change to mistralrs_core.pipeline can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.pipeline.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.xlora_models, so a change to mistralrs_core.xlora_models can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.xlora_models.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.pipeline.loaders.normal_loaders, so a change to mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.pipeline.loaders.normal_loaders.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.vision_models.idefics2, so a change to mistralrs_core.vision_models.idefics2 can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.vision_models.idefics2.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.layers, so a change to mistralrs_core.layers can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.layers.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.embedding_models.embedding_gemma, so a change to mistralrs_core.embedding_models.embedding_gemma can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.embedding_models.embedding_gemma.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.models.flint, so a change to mistralrs_core.models.flint can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.models.flint.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.models.lfm2, so a change to mistralrs_core.models.lfm2 can break mistralrs_core.vision_models.qwen3_5.text, while a change to mistralrs_core.vision_models.qwen3_5.text can't break mistralrs_core.models.lfm2.
Position
Below the diagonal: mistralrs_core.vision_models.qwen3_5.text uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 53% · Adequate · gated by D2, X4 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
128
High / Critical
A03:2025 — Software Supply Chain Failures
32
High / Critical
A02:2025 — Security Misconfiguration
21
High / Critical
A07:2025 — Authentication Failures
5
High / Critical
Roadmap
First, centralize access controls by defining roles and permissions in a single, reviewable location to ensure they are easily testable. Second, secure the server's transport layer by enforcing TLS and adding critical security headers like Strict-Transport-Security. Third, replace interpolated log messages with structured logging to improve observability. Finally, resolve the identified secrets in history and create the missing Architecture Decision Records to complete the compliance baseline.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Name the access rules — roles and permissions declared once (an enum Role/Permission, actix-web-grants #[protect(…)], axum-login's permission_required!, a casbin or oso policy) and consulted where access is checked, so the rule set is reviewable and testable on its own.
Secure the server's transport: serve TLS itself (`HttpServer::bind_rustls_0_23(addr, config)` in actix-web, `axum_server::bind_rustls(addr, RustlsConfig::from_pem_file(…))`, tonic's `Server::builder().tls_config(ServerTlsConfig::new().identity(…))`, Rocket's `[default.tls]`), or run it behind a TLS-terminating proxy and check `X-Forwarded-Proto`; send `Strict-Transport-Security` once it is HTTPS-only.
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 — 131
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 — 4255
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 — 152
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 11
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 85 of 85 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); none rely on LLM judgement. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 85 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, 4474 of 4538 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: this repository's production source spans .ts, .rs, and our analyzer cannot run the .rs test suite(s) — so no coverage was collected for the repository as a whole. The JavaScript/TypeScript half did build and run, and its own line coverage came back at 99.0% — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — coverage is excluded from the score rather than counted as a near-zero. In the meantime, produce a coverage report in a standard format (lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`, or lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures and real coverage will be read. You can widen what we reach: optional: produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then both halves are read on the next scan.
D10 Test Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 6 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 91 test source file(s) (.rs) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability NOT SCORED: this repository's production source includes .rs, and the rust executor ran against the .rs half and did not finish re-running within its tier budget — so reliability was not measured for the repository as a whole. The JavaScript/TypeScript (node:test via `npm ci --ignore-scripts` in website/ (6 tests)): measured (0 flaky) suite(s) did re-run, and came back with 0 flaky across 1 measured tier(s) — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — test reliability is excluded from the score rather than counted. The half was driven by a runner we ship, so this is not a missing-runner gap.
D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Python pyproject.toml/requirements.txt (pip/uv/Poetry), but the licence verdict published here was taken over its crate dependencies. Nothing was read about its Python dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its crate dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
D16 Bus Factor — 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. Single-maintainer repository — bus factor is not applicable (97 contributor(s) across 3493 commit(s) sampled, automation and bot accounts excluded). One of them holds 89% of the history; the other 96 hold 0.1% each on average, below the 5% at which there is somebody to hand the work to. That is a single maintainer with drive-by contributors, not a team whose knowledge has concentrated — so the bus factor is not applicable and there is nothing here for the owner to act on.
D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 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.
D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
D21 Naming Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming 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. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
D27 Navigability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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.
AC6 Visual & motion safety — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Visual & motion safety could not be assessed in this run — the check did not complete, so it is not scored. This is a gap in the analyzer, not a finding about this repository. Engine failure: ArgumentOutOfRangeException: startIndex cannot be larger than length of string. (Parameter 'startIndex').
AXR1 Runtime accessibility — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via REDACTED (REDACTED). docker build failed (exit 1) — ------ REDACTED:1 -------------------- 1 | >>> # syntax=docker/dockerfile:1 2 | # 3 | # Thin CPU runtime image. The prebuilt `mistralrs` binary is staged into `dist/` by the -------------------- ERROR: failed to solve: failed to resolve source metadata for docker.io/docker/dockerfile:1: failed to do request: Head "https://registry-1.docker.io/v2/docker/dockerfile/manifests/1": Forbidden; runtime evidence skipped.
GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Python, Rust, Svelte components, c is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python, Rust, Svelte components, c is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9). 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.
X4 Structured logging — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 475 further occurrence(s) are not listed individually; the score already reflects all 515.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
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.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
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 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
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 is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
D23 Boundary Type-Coupling: Boundary leakage is detected from type references across detected contexts — leaks that flow through primitives, serialization or shared infrastructure may not surface as a typed reference.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
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.
AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
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.
321 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was production_soak.validate_args at 181. A further 46 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 mistralrs_quant::afq::ops::cuda_backend::afq_dequantize_op at 52 — they are counted neither in the figure above nor in this dimension's score. 13 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: mistralrs-code-exec/src/files.rs (mistralrs_code_exec::files::mime_for_format at 29), mistralrs-core/src/gguf/normal_registry.rs (CanonicalGgufArchitecture::from_str at 28), mistralrs-core/src/pipeline/loaders/normal_loaders.rs (NormalLoaderType::from_causal_lm_name at 28), mistralrs-core/src/model_metadata.rs (NormalLoaderType::arch_metadata at 27), mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs (AutoMultimodalLoader::get_loader at 27), and 8 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.
+ 131 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 2 bodies over 120 down to 120 or less in Cyclomatic Complexity — start with production_soak.validate_args (cyclomatic 181), Engine::run (cyclomatic 145). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 2 together lifts Cyclomatic Complexity from 5.4 to about 5.8/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 200 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 3 bodies over 240 down to 240 or less in Cognitive Complexity — start with Engine::run (cognitive 498), production_soak.validate_args (cognitive 332), Gemma4ImageProcessor::process_inputs (cognitive 242). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 3 together lifts Cognitive Complexity from 2.4 to about 3.6/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes7.1 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 221 FileTooLong finding(s) in God Classes — start with REDACTED (25), inputs_processor.rs (15), text.rs (11). — One of this dimension's main actionable groups (221 warning-level).
Resolve the 218 MethodTooLong finding(s) in God Classes — start with REDACTED (35), inputs_processor.rs (27), text.rs (27). — One of this dimension's main actionable groups (218 warning-level).
Resolve the 178 FunctionTooLong finding(s) in God Classes — start with gdn.rs (16), REDACTED (16), ops.rs (10). — One of this dimension's main actionable groups (178 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
2217 duplicated block group(s) detected. A further 197 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 4 of the 2414 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.
+ 555 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 104 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with ops.rs (15), gdn.rs (10), REDACTED (10). — One of this dimension's main actionable groups (104 warning-level).
Resolve the 102 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with REDACTED (16), ops.rs (11), gdn.rs (5). — One of this dimension's main actionable groups (102 warning-level).
Resolve the 100 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with REDACTED (19), ops.rs (16), text.rs (5). — One of this dimension's main actionable groups (100 warning-level).
Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling7.5 / 10Strong✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
16 production modules (Cargo+npm), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 5 module(s) off the main sequence, with abstractness counted on 15 of the 16 (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: mistralrs-audio · ×5
What to do
Resolve the 5 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (5 warning-level).
Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 12 Low cohesion finding(s) in Cohesion (LCOM4) — start with lib.rs (2), gguf.rs, embedding_model.rs. — One of this dimension's main actionable groups (12 warning-level).
Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
3189 test methods: 3080 unit, 109 integration, 0 BDD, 0 e2e. The JavaScript/TypeScript suite contributes 6 `it`/`test` case(s) across 1 test file(s) declaring at least one; its tier split is read from package names and paths only. The Rust suite contributes 2927 `#[test]` function(s) across 395 file(s) declaring at least one; its unit/integration split is Cargo's own — 21 of those file(s) are integration-test targets under a crate's tests/ directory, and the rest are #[test] functions compiled into the crate they test. The Python suite contributes 256 test function(s) across 5 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.
✓ On the Gold path — maintain.
Detailed fixes: d9_recommendation.md.
Do you agree with this assessment?
D10 · Test Quality10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the tests truly assert behaviour rather than just running the code.
Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.
0 skipped, 0 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 6 tests. Measured on the JavaScript/TypeScript suite only — at least 91 test source file(s) (.rs) went unread, so its test quality is unmeasured and is not in these counts.
What it measures: Whether dependencies are current, secure, and not bloated.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.
44 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 REDACTED there.
Outdated: anyhow · ×44
What to do
Enforce Dependency Hygiene in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 762 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's REDACTED closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. A further 5 crate(s) in the closure resolve from git, a path or a private registry and publish no licence this pass can read; they are outside this verdict. This repository publishes itself under MIT, which is its own choice and is not judged here. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares a Python pyproject.toml/requirements.txt (pip/uv/Poetry) and package.json, and the licences of those dependency graphs were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.
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 78 Hotspot finding(s) in Churn × Complexity Hotspots — start with REDACTED (11), inputs_processor.rs (7), text.rs (4). — One of this dimension's main actionable groups (78 warning-level).
Detailed fixes: d15_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.
46 deducted task-comment markers across 520746 LoC (0.0/KLoC) → score 10.0. 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 40 TodoComment finding(s) in Explicit Debt — start with REDACTED (13), varbuilder_utils.rs (3), lib.rs (2). — One of this dimension's main actionable groups (40 warning-level).
Resolve the 4 FixmeComment finding(s) in Explicit Debt — start with sampler.rs, diffusion.rs, embedding.rs. — One of this dimension's main actionable groups (4 warning-level).
Resolve the 2 XxxComment finding(s) in Explicit Debt — start with safetensors.rs (2). — One of this dimension's main actionable groups (2 warning-level).
Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: 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. 98 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: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.
What it measures: Whether domain types (IDs, enums, value objects) leak across bounded-context boundaries.
Method: Cross-context domain-type leakage via Roslyn structural classification (strongly-typed IDs / value objects) over every public surface. Exhaustive, deterministic, type-level aggregate-boundary check.
Coverage: Bounded contexts derived from NAMESPACE prefix (or graph-inferred where available); cross-boundary domain-type leakage then checked exhaustively over every public member of every type.
3 of 18 build units (Cargo, npm) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED 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.
4 finding(s): 0 critical, 4 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
What to do
Resolve the 4 REDACTED finding(s) in Secrets (history) — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (4 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
128 finding(s): 0 critical, 102 high, 16 medium, 10 low. 88 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 4 file(s) — `REDACTED`, `examples/server/phi3_duckduckgo_mistral.rs.ipynb`, `install.sh` (lines 1470–1570), `mistralrs-paged-attn/third_party/flash-attention/hopper/heuristics.h` (line 14) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 3 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 5 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 6 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (5), REDACTED. — One of this dimension's main actionable groups (6 issue-level).
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
No action in Static Analysis (SAST) — all 88 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (88 issue-level, 0 of them charged here).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 9 Medium vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (9). — One of this dimension's main actionable groups (9 warning-level).
Resolve the 2 High vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
Resolve the 2 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 12 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (6), REDACTED (4), REDACTED. — One of this dimension's main actionable groups (12 warning-level).
Resolve the 7 High IaC finding(s) in IaC & Container Security — start with REDACTED (4), REDACTED, REDACTED. — One of this dimension's main actionable groups (7 issue-level).
Resolve the 2 Low IaC finding(s) in IaC & Container Security — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 recommendation-level).
Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
5 of 646 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is mistralrs-core/src/vision_models/llava/utils.rs. Counted over 646 of the 753 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
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 toml_selector.rs. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 8 Change coupling finding(s) in Change Coupling — start with embedding.rs (2), diffusion.rs (2), REDACTED (2). — One of this dimension's main actionable groups (8 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.
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 0 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
✓ On the Gold path — maintain.
Detailed fixes: d44_recommendation.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives10.0 / 10Exemplary○ Nothing flagged
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
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.
Do you agree with this assessment?
AC2 · Forms & labels5.2 / 10Adequate✓ 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. (×4) — mistralrs-cli/webui/src/lib/components/AgentApproval.svelte:94, mistralrs-cli/webui/src/lib/components/ChatInput.svelte:225, mistralrs-cli/webui/src/lib/components/ParamPopover.svelte:99, …
This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×8) — mistralrs-cli/webui/src/lib/components/ParamPopover.svelte:84, mistralrs-cli/webui/src/lib/components/SettingsPanel.svelte:178, mistralrs-cli/webui/src/lib/components/SettingsPanel.svelte:195, …
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.
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. This document's body is only the mount point <div id="app">, so there is no content here to wrap — render the <main> from the component mounted into it. (×2) — mistralrs-cli/static/index.html:2, mistralrs-cli/webui/index.html:2
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.
Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
Do you agree with this assessment?
AC7 · A11y enforcement4.0 / 10Weak✓ Tool-verified
Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.
Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.
Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.
No accessibility enforcement found — no a11y linter (eslint-plugin-svelte (a11y rules are built in)) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 22 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
What to do
Enforce accessibility in the toolchain: add eslint-plugin-svelte (a11y rules are built in), then assert with your test runner's axe binding (jest-axe, vitest-axe, cypress-axe or @axe-core/playwright) in tests, then gate axe/pa11y/Lighthouse in CI.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
What to do
The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
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.
Other · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.
Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.
Authorization IS enforced here (by route guards, auth middleware or checks that refuse a caller) — this is NOT a claim that endpoints are unprotected. What's missing is a NAMED rule set: who may do what is encoded inline where it is checked, so the rules can't be listed, reviewed or tested apart from the code that applies them. Recommendation, not a defect.
Only 1 place(s) refuse an unauthorized caller — too few to demonstrate default-deny across handlers.
What to do
Name the access rules — roles and permissions declared once (an enum Role/Permission, actix-web-grants #[protect(…)], axum-login's permission_required!, a casbin or oso policy) and consulted where access is checked, so the rule set is reviewable and testable on its own.
Enforce authorization at every handler — a guard on each route, or a global authentication guard/middleware with explicit public opt-outs, so protected-by-default is demonstrable.
Other · Event Sourcing — Whether the recovery-replay fold is deterministic — state derived purely from each event's own fields, no clock/random/IO on the replay path.
Method: Roslyn syntax scan (event-sourcing gated): Apply/When folds checked for forbidden tokens (DateTime.Now, Guid.NewGuid, Random, IO), stripped of comments/strings. Deterministic, hard fact per fold.
Other · Event Sourcing — Whether domain events stay immutable (private fields, set once) rather than carrying mutable state.
Method: Roslyn scan (event-sourcing gated): persisted events checked for public setters; immutability verified per property/field. Deterministic, hard fact.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
Add a README to the 6 of 18 project(s) that lack one — worth up to 0.7 pts.
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 README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
mistralrs-mcp/README.md links to `../docs/MCP/README.md`, but `docs/MCP/README.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — mistralrs-mcp/README.md:54
What to do
Reconcile the README with reality: mistralrs-mcp/README.md links to `../docs/MCP/README.md`, but `docs/MCP/README.md` does not exist.
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 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 · Observability8.0 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
What to do
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.
Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.
`reqwest::blocking::Client::new(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — mistralrs-core/src/engine/tool_dispatch.rs:461
`reqwest::blocking::get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×4) — mistralrs-core/src/pipeline/amoe.rs:587, mistralrs-pyo3/src/util.rs:219, mistralrs-pyo3/src/util.rs:272, …
What to do
Give every client a whole-request bound: `reqwest::Client::builder().timeout(Duration::from_secs(10))` (never `reqwest::get` or `Client::new()`, which have none), ureq's `timeout_global`, or wrap the call in `tokio::time::timeout`; add retry with back-off (`reqwest-retry`'s `RetryTransientMiddleware`, `backoff`) around dependencies that fail.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from the language model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Do you agree with this assessment?
R1 · Type Safety10.0 / 10Exemplary✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
React / JS · Code Health — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Deterministic.
mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:536 · mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:586 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:536
mistralrs-cli/webui/src/lib/components/AssistantMessage.svelte:22 · mistralrs-cli/webui/src/lib/components/UserMessage.svelte:56 — 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. — mistralrs-cli/webui/src/lib/components/AssistantMessage.svelte:22
mistralrs-cli/webui/src/lib/components/FileCard.svelte:21 · mistralrs-cli/webui/src/lib/services/streaming.ts:11 — 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. — mistralrs-cli/webui/src/lib/components/FileCard.svelte:21
mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:265 · mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:275 — 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. — mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:265
mistralrs-cli/webui/src/lib/services/api.ts:22 · mistralrs-cli/webui/src/lib/services/api.ts:32 — 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. — mistralrs-cli/webui/src/lib/services/api.ts:22
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.
streamChatCompletion has cyclomatic complexity 42 and cognitive complexity 86; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — mistralrs-cli/webui/src/lib/services/streaming.ts:21
generateAssistant has cyclomatic complexity 20 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:177
editMessage has cyclomatic complexity 18 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:493
handleSend has cyclomatic complexity 16 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — mistralrs-cli/webui/src/lib/components/ChatInput.svelte:27
onToolCallProgress has cyclomatic complexity 15 and cognitive complexity 31; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:285
finalizeStreaming has cyclomatic complexity 13 and cognitive complexity 15; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:419
regenerateAssistant has cyclomatic complexity 12 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:563
What to do
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Do you agree with this assessment?
R3 · Large Files8.5 / 10Strong✓ 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.
mistralrs-cli/webui/src/lib/stores/chat.svelte.ts has 622 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:1
What to do
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).
Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.
What to do
Bump outdated dependencies to current versions to limit upgrade debt.
Do you agree with this assessment?
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.
Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.
Do you agree with this assessment?
R7 · Dead Code9.8 / 10Exemplary✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
Nothing imports this binding — it is safe to review for removal. (×3) — mistralrs-cli/webui/src/lib/services/api.ts:171, mistralrs-cli/webui/src/lib/services/api.ts:183, mistralrs-cli/webui/src/lib/services/api.ts:189
Nothing in its class calls or references this private method — no member access, no string key, no decorator, and no test reaches it by name. A private member cannot be called from outside its class, so this is the whole search: remove it, or call it where it was meant to be used. — mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:83
What to do
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.
Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.
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. This repository commits the configuration that serves its own HTTP surface, so that configuration was read in full for the security response headers it sets. This repository serves HTTP itself (`axum::serve(` (mistralrs-cli/src/commands/config.rs:198)), so its Rust source was also read for the server controls: TLS served or HSTS set, security response headers, cookie flags and inbound validation — each credited where its Rust spelling appears in production source, not proven on every route. A Rocket 0.5 application is credited the headers Rocket's default `Shield` sends unless it attaches its own, and its cookie jar's SameSite=Strict default; a session middleware its default cookie flags.
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.
This repository starts an HTTP server and nothing in its Rust source or committed `Rocket.toml` secures the transport: no TLS served (actix-web `bind_rustls`/`bind_openssl`, axum-server `bind_rustls` with a `RustlsConfig`, tonic `ServerTlsConfig`, a `TlsAcceptor`, Rocket's `[default.tls]`), no `Strict-Transport-Security` header, no `X-Forwarded-Proto` read from a TLS-terminating proxy — so its traffic may cross the network in clear text. (−2.0 on this card.) The server: `axum::serve(` (mistralrs-cli/src/commands/config.rs:198).
What to do
Secure the server's transport: serve TLS itself (`HttpServer::bind_rustls_0_23(addr, config)` in actix-web, `axum_server::bind_rustls(addr, RustlsConfig::from_pem_file(…))`, tonic's `Server::builder().tls_config(ServerTlsConfig::new().identity(…))`, Rocket's `[default.tls]`), or run it behind a TLS-terminating proxy and check `X-Forwarded-Proto`; send `Strict-Transport-Security` once it is HTTPS-only.
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.
Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. 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 `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X15 · Unvalidated length from an untrusted reader2.7 / 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.
`key_len` is read from the bytes being parsed at line 211 (`read_u64`), then used to size a `vec![…; n]` at line 212 — and nowhere in its scope is `key_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 `key_len` against the bytes actually remaining and a maximum the format allows before allocating. — mistralrs-quant/src/imatrix.rs:212
`len_data` is read from the bytes being parsed at line 216 (`read_u64`), then used to size a `Vec::with_capacity` at line 217 — and nowhere in its scope is `len_data` 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_data` against the bytes actually remaining and a maximum the format allows before allocating. — mistralrs-quant/src/imatrix.rs:217
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 loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.
Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. 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 `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X17 · Uncapped recursion over a caller-supplied document3.5 / 10Weak✓ Tool-verified
Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.
Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.
`json_compatible` is public and takes `value: Any` from its caller, and it calls itself at line 14057 (`json_compatible`) with a piece of `value` (and at line 14059) — and nowhere in `json_compatible` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `json_compatible` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — scripts/production_soak.py:14057
What to do
Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.
Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.
Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether async functions that make a cancellable request accept or pass on an AbortSignal (adoption curve).
Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. 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 question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.
Only 1/6 async functions that make a cancellable request (fetch, axios, ky, ofetch) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
`get` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — mistralrs-cli/webui/src/lib/services/api.ts:16
`post` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — mistralrs-cli/webui/src/lib/services/api.ts:22
`postVoid` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — mistralrs-cli/webui/src/lib/services/api.ts:32
`uploadFile` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — mistralrs-cli/webui/src/lib/services/api.ts:157
`resolveAgentApproval` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — mistralrs-cli/webui/src/lib/services/streaming.ts:182
What to do
Thread an AbortSignal through async functions that make requests, so the work stops when its caller gives up.
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.
Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.
Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. 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 `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped5.0 / 10Adequate✓ Tool-verified
Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.
Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.
`safe` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — mistralrs-cli/webui/src/lib/utils/markdown.ts:31
What to do
Each finding names the expression, the attribute it lands in and the line. Confirm the value's origin from the read this analyzer traced, then escape it at the sink or validate it against the shape the attribute accepts before interpolating.
Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.
Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.
Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. 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?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×17) — scripts/production_soak.py:1265, REDACTED:119, REDACTED:130, …
What to do
Swallowed exception (empty catch)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.
`warn!` at line 119 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/chat_completion.rs:119
`warn!` at line 598 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/chat_completion.rs:598
`debug!` at line 441 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/metrics.rs:441
`debug!` at line 483 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/metrics.rs:483
`info!` at line 875 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/metrics.rs:875
`info!` at line 879 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/metrics.rs:879
`info!` at line 884 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/metrics.rs:884
`info!` at line 942 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/metrics.rs:942
`info!` at line 966 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/metrics.rs:966
`info!` at line 1055 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/mistralrs_for_server_builder.rs:1055
`info!` at line 1060 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/mistralrs_for_server_builder.rs:1060
`info!` at line 1137 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/mistralrs_for_server_builder.rs:1137
`info!` at line 1291 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/mistralrs_for_server_builder.rs:1291
`info!` at line 1296 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/mistralrs_for_server_builder.rs:1296
`info!` at line 1312 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/mistralrs_for_server_builder.rs:1312
`info!` at line 1316 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/mistralrs_for_server_builder.rs:1316
`info!` at line 1318 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/mistralrs_for_server_builder.rs:1318
`debug!` at line 1402 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/mistralrs_for_server_builder.rs:1402
`debug!` at line 1411 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/mistralrs_for_server_builder.rs:1411
`warn!` at line 1101 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/openai.rs:1101
`warn!` at line 188 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-server-core/src/streaming.rs:188
`debug!` at line 28 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-sandbox/src/linux/cgroups.rs:28
`debug!` at line 34 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-sandbox/src/linux/cgroups.rs:34
`debug!` at line 37 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-sandbox/src/linux/cgroups.rs:37
`debug!` at line 81 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-sandbox/src/linux/mod.rs:81
`warn!` at line 44 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-sandbox/src/linux/namespaces.rs:44
`debug!` at line 20 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-quant/src/utils/log.rs:20
`info!` at line 33 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-quant/src/utils/log.rs:33
`warn!` at line 46 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-quant/src/utils/log.rs:46
`debug!` at line 365 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-quant/src/gguf/mod.rs:365
`info!` at line 276 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-quant/src/distributed/mod.rs:276
`debug!` at line 577 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-quant/src/distributed/mod.rs:577
`debug!` at line 608 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-quant/src/distributed/mod.rs:608
`debug!` at line 639 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-quant/src/distributed/mod.rs:639
`debug!` at line 726 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-quant/src/distributed/mod.rs:726
`debug!` at line 757 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-quant/src/distributed/mod.rs:757
`debug!` at line 788 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-quant/src/distributed/mod.rs:788
`info!` at line 527 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-quant/src/cutile/fp8_gemm.rs:527
`warn!` at line 543 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-quant/src/cutile/fp8_gemm.rs:543
`info!` at line 840 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — mistralrs-quant/src/cutile/fp8_w8a16.rs:840
Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
1/2 of this repository's type-checking configuration(s) turn on strict null checking (`"strict": true`, or `"strictNullChecks": true`). A configuration that states neither is counted as OFF, because off is tsc's own default; a solution-style one whose `"files"` is empty and whose `"references"` point at other projects is in neither number, because it checks no source itself. Where it is off, `string` admits `null` and `undefined`: passing a value that is null compiles silently and throws on the first property access.
~0.6 `!` null assertions per 1k TypeScript source lines — 1 assertion(s) across the 1637 source line(s) of the 8 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: mistralrs-cli/webui/src/main.ts (1). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
What to do
The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 11 of 55 WCAG 2.2 Level A/AA success criteria (20%; ≈22% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 44 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 — 3 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 — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X6 Hand-rolled structured-format parsing — 4 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 3 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 44 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC4 Keyboard semantics — No interactive element found in the parsed markup — AC4 not applicable here.
AC6 Visual & motion safety — Visual & motion safety could not be assessed in this run — the check did not complete, so it is not scored. This is a gap in the analyzer, not a finding about this repository.
AX1 Captive dependencies — Not applicable: this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one; this repository's TypeScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — docker build failed (exit 1) — ------ REDACTED:1 -------------------- 1 | >>> # syntax=docker/dockerfile:1 2 | # 3 | # Thin CPU runtime image. The prebuilt `mistralrs` binary is staged into `dist/` by the -------------------- ERROR: failed to solve: failed to resolve source metadata for docker.io/docker/dockerfile:1: failed to do request: Head "https://registry-1.docker.io/v2/docker/dockerfile/manifests/1": Forbidden; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
C1 Data Protection — 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.
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.
D11 Test Reliability — Test reliability not scored — polyglot repository, one half's runner produced no measurement
D16 Bus Factor — single-maintainer repository — bus factor is not applicable
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 is measured on C# only; JavaScript, Python, Rust, TypeScript not measured.
D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust surface was not measured.
D24 Comment Value — D24 reads C# and Visual Basic comments only — this repository's production source is .py, .rs, .ts, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D25 ADR Conformance — no ADRs to check
D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.rs), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
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 — polyglot repository, one half has no runner
DM1 Domain Modelling — applicable but not scored (3 signals for this style, 3 needed — the count is met but a required primary signal is absent): 2 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit); 159 value object(s); 2 domain event(s); its domain events are published by services or handlers — no domain entity raises one; no aggregate is declared and no domain structure surrounds the state-guarding types: not claimed as DDD
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
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'.
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — coverage data present for 2 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for `#[bench]`, criterion's `bench_function`/`bench_with_input`, `#[divan::bench]` or `#[library_benchmark]` in any `.rs` file, or criterion, divan, iai or a `[[bench]]` target in a Cargo.toml, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
PF2 Allocation hygiene — Not applicable: Rust spells out every heap allocation and makes borrowed slices (&[T], &str) its ordinary parameter types, so the allocation-aware style this card rewards elsewhere is the language's baseline rather than a rung to climb. TypeScript/JavaScript runs on a garbage-collected runtime that gives a program no allocation-control idiom to choose on a hot path — no pools, stack allocation or value types — so allocation awareness is not something this code can be rated on.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
R4 Test Coverage — the JS/TS workspace (27 production file(s)) has no JavaScript/TypeScript test, but it is 0.85% of this repository's production source and the other 99.15% carries 22,935 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
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
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.
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.
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.
AC2 · Forms & labels· <input> without a programmatic label · ×9
<input> without a programmatic label mistralrs-cli/webui/src/lib/components/AgentApproval.svelte:94— 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 mistralrs-cli/webui/src/lib/components/ParamPopover.svelte:84— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label mistralrs-cli/webui/src/lib/components/ParamPopover.svelte:99— 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 mistralrs-cli/webui/src/lib/components/SettingsPanel.svelte:178— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label mistralrs-cli/webui/src/lib/components/SettingsPanel.svelte:195— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label mistralrs-cli/webui/src/lib/components/SettingsPanel.svelte:212— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label mistralrs-cli/webui/src/lib/components/SettingsPanel.svelte:227— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label mistralrs-cli/webui/src/lib/components/SettingsPanel.svelte:244— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label mistralrs-cli/webui/src/lib/components/Sidebar.svelte:97— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC2 · Forms & labels· <textarea> without a programmatic label · ×3
<textarea> without a programmatic label mistralrs-cli/webui/src/lib/components/ChatInput.svelte:225— 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 mistralrs-cli/webui/src/lib/components/SettingsPanel.svelte:151— 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 mistralrs-cli/webui/src/lib/components/UserMessage.svelte:165— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
Boundary-crossing change coupling: toml_selector.rs ↔ lib.rs mistralrs-core/src/toml_selector.rs:1— `mistralrs-core/src/toml_selector.rs` (context mistralrs-core) and `mistralrs-pyo3/src/lib.rs` (context mistralrs-pyo3) sit in DIFFERENT parts of the tree yet change together 62% of the time (10 of the 16 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 10 shared commits counted here, the most recent 3 are `e124932c` fix(quant): misc fixes, warmup metal kernels (#2353); `3fb22c84` feat(quant): support isq/uqff/imatrix machinery for broader model cla…; `6927a4f2` Parallel + I/O pipelined ISQ (#1870) — run `git show` on any of them.
FileTooLong: scripts/production_soak.py scripts/production_soak.py— FileTooLong — 11907 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 11407 over it, 23.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: loaders/multimodal_loaders.rs mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs— FileTooLong — 7918 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 7418 over it, 15.84× 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: loaders/normal_loaders.rs mistralrs-core/src/pipeline/loaders/normal_loaders.rs— FileTooLong — 5447 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 4947 over it, 10.89× 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 mistralrs-core/src/ops.rs— FileTooLong — 5328 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 77 free functions. The bar is 500 significant lines; this is 4828 over it, 10.66× 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/gdn.rs mistralrs-core/src/cuda/gdn.rs— FileTooLong — 4633 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 52 free functions. The bar is 500 significant lines; this is 4133 over it, 9.27× 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_kernels/mod.rs mistralrs-quant/src/metal_kernels/mod.rs— FileTooLong — 3958 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 72 free functions. The bar is 500 significant lines; this is 3458 over it, 7.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/layers.rs mistralrs-core/src/layers.rs— FileTooLong — 3093 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 37 free functions. The bar is 500 significant lines; this is 2593 over it, 6.19× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: pipeline/cuda_graph.rs mistralrs-core/src/pipeline/cuda_graph.rs— FileTooLong — 3092 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 77 free functions. The bar is 500 significant lines; this is 2592 over it, 6.18× 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: speculative/dflash.rs mistralrs-core/src/speculative/dflash.rs— FileTooLong — 3051 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 2551 over it, 6.10× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: pipeline/multimodal.rs mistralrs-core/src/pipeline/multimodal.rs— FileTooLong — 2577 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 2077 over it, 5.15× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/lib.rs mistralrs-pyo3/src/lib.rs— FileTooLong — 2516 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 61% of them inside a single declaration: Runner (3 blocks, 339-2908). The bar is 500 significant lines; this is 2016 over it, 5.03× 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: utils/ops.rs mistralrs-quant/src/utils/ops.rs— FileTooLong — 2448 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 1948 over it, 4.90× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: afq/ops.rs mistralrs-quant/src/afq/ops.rs— FileTooLong — 2401 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 1901 over it, 4.80× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: layers/paged_attention.rs mistralrs-core/src/paged_attention/layers/paged_attention.rs— FileTooLong — 2392 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 35 free functions. The bar is 500 significant lines; this is 1892 over it, 4.78× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: pipeline/normal.rs mistralrs-core/src/pipeline/normal.rs— FileTooLong — 2366 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 1866 over it, 4.73× 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: pipeline/inputs_processor.rs mistralrs-core/src/pipeline/inputs_processor.rs— FileTooLong — 2293 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 1793 over it, 4.59× 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: pipeline/mod.rs mistralrs-core/src/pipeline/mod.rs— FileTooLong — 2284 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 1784 over it, 4.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: distributed/layers.rs mistralrs-quant/src/distributed/layers.rs— FileTooLong — 2200 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 1700 over it, 4.40× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/lib.rs mistralrs-quant/src/lib.rs— FileTooLong — 2156 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 41 free functions. The bar is 500 significant lines; this is 1656 over it, 4.31× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/lib.rs mistralrs-core/src/lib.rs— FileTooLong — 2105 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 77% of them inside a single declaration: MistralRs (3 blocks, 443-2970). The bar is 500 significant lines; this is 1605 over it, 4.21× 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: gemma4/text.rs mistralrs-core/src/vision_models/gemma4/text.rs— FileTooLong — 2052 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 1552 over it, 4.10× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: engine/mod.rs mistralrs-core/src/engine/mod.rs— FileTooLong — 1967 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 81% of them inside a single declaration: Engine (3 blocks, 202-2562). The bar is 500 significant lines; this is 1467 over it, 3.93× 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: gguf/normal_config.rs mistralrs-core/src/gguf/normal_config.rs— FileTooLong — 1954 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 70 free functions. The bar is 500 significant lines; this is 1454 over it, 3.91× 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/granite.rs mistralrs-core/src/models/granite.rs— FileTooLong — 1950 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 1450 over it, 3.90× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: kv_cache/hybrid_cache.rs mistralrs-core/src/kv_cache/hybrid_cache.rs— FileTooLong — 1949 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 60% of them inside a single declaration: HybridCache (5 blocks, 1053-4154). The bar is 500 significant lines; this is 1449 over it, 3.90× 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.
MethodTooLong: Engine.run mistralrs-core/src/engine/mod.rs:1119— MethodTooLong — run runs 1091 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 991 over it, 10.91× 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: MultimodalLoader.load_model_from_path mistralrs-core/src/pipeline/multimodal.rs:534— MethodTooLong — load_model_from_path runs 880 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 780 over it, 8.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Pipeline.submit_step mistralrs-core/src/pipeline/mod.rs:2019— MethodTooLong — submit_step runs 777 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 677 over it, 7.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.
MethodTooLong: NormalLoader.load_model_from_path mistralrs-core/src/pipeline/normal.rs:662— MethodTooLong — load_model_from_path runs 738 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 638 over it, 7.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: Engine.add_request mistralrs-core/src/engine/add_request.rs:144— MethodTooLong — add_request runs 662 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 562 over it, 6.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: Qwen3VLImageProcessor.process_inputs mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1019— MethodTooLong — process_inputs runs 538 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 438 over it, 5.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: Qwen2_5VLImageProcessor.process_inputs mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:352— MethodTooLong — process_inputs runs 516 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 416 over it, 5.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Qwen2VLImageProcessor.process_inputs mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:918— MethodTooLong — process_inputs runs 516 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 416 over it, 5.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Gemma4ImageProcessor.process_inputs mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1025— MethodTooLong — process_inputs runs 512 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 412 over it, 5.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: Gemma4Model.forward_inner mistralrs-core/src/vision_models/gemma4/mod.rs:341— MethodTooLong — forward_inner runs 436 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 336 over it, 4.36× 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: EmbeddingLoader.load_model_from_path mistralrs-core/src/pipeline/embedding.rs:223— MethodTooLong — load_model_from_path runs 418 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 318 over it, 4.18× 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: ImageEmbedding.forward mistralrs-core/src/vision_models/phi3/mod.rs:697— MethodTooLong — forward runs 346 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 246 over it, 3.46× 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: OpenResponsesStreamer.poll_next mistralrs-server-core/src/responses.rs:1166— MethodTooLong — poll_next runs 326 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 226 over it, 3.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.
MethodTooLong: MistralRsForServerBuilder.build_multi_model mistralrs-server-core/src/mistralrs_for_server_builder.rs:910— MethodTooLong — build_multi_model runs 324 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 224 over it, 3.24× 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: HqqBits.bitpack_type mistralrs-quant/src/hqq/mod.rs:152— MethodTooLong — bitpack_type runs 306 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 206 over it, 3.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Runner.send_chat_completion_request mistralrs-pyo3/src/lib.rs:1288— MethodTooLong — send_chat_completion_request runs 297 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 197 over it, 2.97× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Runner.send_chat_completion_request_to_model mistralrs-pyo3/src/lib.rs:2249— MethodTooLong — send_chat_completion_request_to_model runs 297 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 197 over it, 2.97× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PagedAttentionScheduler.schedule mistralrs-core/src/paged_attention/scheduler.rs:921— MethodTooLong — schedule runs 295 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 195 over it, 2.95× 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: Qwen3_5TextModel.forward_embeds mistralrs-core/src/vision_models/qwen3_5/text.rs:1434— MethodTooLong — forward_embeds runs 294 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 194 over it, 2.94× 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 mistralrs-core/src/vision_models/qwen3_vl/mod.rs:651— MethodTooLong — forward runs 292 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 192 over it, 2.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Qwen3VLMoEModel.forward mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:96— MethodTooLong — forward runs 292 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 192 over it, 2.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: LLaVAInputProcessor.process_inputs mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:273— MethodTooLong — process_inputs runs 291 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 191 over it, 2.91× 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: LLaVANextInputProcessor.process_inputs mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:309— MethodTooLong — process_inputs runs 284 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 184 over it, 2.84× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PagedAttention.metal_fwd mistralrs-paged-attn/src/metal/backend/paged_attention.rs:321— MethodTooLong — metal_fwd runs 280 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 180 over it, 2.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MLlamaImageProcessor.process_inputs mistralrs-core/src/vision_models/mllama/inputs_processor.rs:320— MethodTooLong — process_inputs runs 277 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 177 over it, 2.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: mistralrs_core::model_loader::loader_from_model_selected mistralrs-core/src/model_loader.rs:292— FunctionTooLong — mistralrs_core::model_loader::loader_from_model_selected runs 572 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 472 over it, 5.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.
FunctionTooLong: mistralrs_core::pipeline::inputs_processor::text_models_inputs_processor::make_prompt_chunk mistralrs-core/src/pipeline/inputs_processor.rs:872— FunctionTooLong — mistralrs_core::pipeline::inputs_processor::text_models_inputs_processor::make_prompt_chunk runs 564 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 464 over it, 5.64× 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: mistralrs_quant::afq::ops::cuda_backend::afq_mm_op mistralrs-quant/src/afq/ops.rs:2950— FunctionTooLong — mistralrs_quant::afq::ops::cuda_backend::afq_mm_op runs 522 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 422 over it, 5.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.
FunctionTooLong: mistralrs_pyo3::parse_which mistralrs-pyo3/src/lib.rs:449— FunctionTooLong — mistralrs_pyo3::parse_which runs 414 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 314 over it, 4.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: mistralrs_core::cuda::gdn::speculative_recurrence_checkpoints_cuda mistralrs-core/src/cuda/gdn.rs:3390— FunctionTooLong — mistralrs_core::cuda::gdn::speculative_recurrence_checkpoints_cuda runs 410 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 310 over it, 4.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.
FunctionTooLong: mistralrs_server_core::chat_completion::parse_request mistralrs-server-core/src/chat_completion.rs:566— FunctionTooLong — mistralrs_server_core::chat_completion::parse_request runs 406 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 306 over it, 4.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mistralrs_quant::afq::ops::cuda_backend::afq_dequantize_op mistralrs-quant/src/afq/ops.rs:2463— FunctionTooLong — mistralrs_quant::afq::ops::cuda_backend::afq_dequantize_op runs 400 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 300 over it, 4.00× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mistralrs_core::toml_selector::loader_from_selected mistralrs-core/src/toml_selector.rs:808— FunctionTooLong — mistralrs_core::toml_selector::loader_from_selected runs 398 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 298 over it, 3.98× 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: mistralrs_quant::cutile::routed_lora::routed_lora_kernel::routed_lora_one_shot mistralrs-quant/src/cutile/routed_lora.rs:69— FunctionTooLong — mistralrs_quant::cutile::routed_lora::routed_lora_kernel::routed_lora_one_shot runs 379 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 279 over it, 3.79× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mistralrs_quant::cutile::fused_moe_fp8::fused_moe_fp8::fused_moe_fp8_kernel mistralrs-quant/src/cutile/fused_moe_fp8.rs:48— FunctionTooLong — mistralrs_quant::cutile::fused_moe_fp8::fused_moe_fp8::fused_moe_fp8_kernel runs 358 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 258 over it, 3.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mistralrs_core::pipeline::sampling::finish_or_add_toks_to_seq mistralrs-core/src/pipeline/sampling.rs:189— FunctionTooLong — mistralrs_core::pipeline::sampling::finish_or_add_toks_to_seq runs 356 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 256 over it, 3.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mistralrs_paged_attn::cuda::backend::mla::flashinfer_mla_decode mistralrs-paged-attn/src/cuda/backend/mla.rs:227— FunctionTooLong — mistralrs_paged_attn::cuda::backend::mla::flashinfer_mla_decode runs 350 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 250 over it, 3.50× 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: mistralrs_quant::cutile::fused_moe::fused_moe::fused_moe_kernel mistralrs-quant/src/cutile/fused_moe.rs:37— FunctionTooLong — mistralrs_quant::cutile::fused_moe::fused_moe::fused_moe_kernel runs 329 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 229 over it, 3.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: mistralrs_core::cuda::gdn::deferred_recurrence_rmsnorm_gate_cuda mistralrs-core/src/cuda/gdn.rs:3944— FunctionTooLong — mistralrs_core::cuda::gdn::deferred_recurrence_rmsnorm_gate_cuda runs 324 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 224 over it, 3.24× 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: mistralrs_quant::afq::ops::cuda_backend::afq_quantize_op mistralrs-quant/src/afq/ops.rs:1937— FunctionTooLong — mistralrs_quant::afq::ops::cuda_backend::afq_quantize_op 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.
FunctionTooLong: mistralrs_core::engine::agentic_loop::agentic_loop mistralrs-core/src/engine/agentic_loop.rs:1123— FunctionTooLong — mistralrs_core::engine::agentic_loop::agentic_loop runs 293 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 193 over it, 2.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mistralrs_core::speculative::driver::verify_staged_batch mistralrs-core/src/speculative/driver.rs:348— FunctionTooLong — mistralrs_core::speculative::driver::verify_staged_batch runs 279 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 179 over it, 2.79× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mistralrs_paged_attn::metal::backend::paged_prefill::metal_paged_prefill mistralrs-paged-attn/src/metal/backend/paged_prefill.rs:434— FunctionTooLong — mistralrs_paged_attn::metal::backend::paged_prefill::metal_paged_prefill runs 270 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 170 over it, 2.70× 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: mistralrs_quant::cutile::nvfp4_matmul::launch_gather mistralrs-quant/src/cutile/nvfp4_matmul.rs:1377— FunctionTooLong — mistralrs_quant::cutile::nvfp4_matmul::launch_gather runs 270 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 170 over it, 2.70× 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: mistralrs_quant::cutile::qsa::kernels::qsa_attention mistralrs-quant/src/cutile/qsa.rs:263— FunctionTooLong — mistralrs_quant::cutile::qsa::kernels::qsa_attention runs 260 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 160 over it, 2.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: mistralrs_core::paged_attention::plan::gather_prefill_workspace_bytes mistralrs-core/src/paged_attention/plan.rs:506— FunctionTooLong — mistralrs_core::paged_attention::plan::gather_prefill_workspace_bytes runs 259 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 159 over it, 2.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mistralrs_paged_attn::cuda::backend::fa3::fa3_fp8_decode mistralrs-paged-attn/src/cuda/backend/fa3.rs:318— FunctionTooLong — mistralrs_paged_attn::cuda::backend::fa3::fa3_fp8_decode runs 259 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 159 over it, 2.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mistralrs_core::diagnostics::run_doctor mistralrs-core/src/diagnostics.rs:408— FunctionTooLong — mistralrs_core::diagnostics::run_doctor runs 252 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 152 over it, 2.52× 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: mistralrs_cli::commands::serve::convert_text_model mistralrs-cli/src/commands/serve.rs:536— FunctionTooLong — mistralrs_cli::commands::serve::convert_text_model 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: mistralrs_quant::distributed::layers::load_packed_weights mistralrs-quant/src/distributed/layers.rs:439— FunctionTooLong — mistralrs_quant::distributed::layers::load_packed_weights 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.
mistralrs_core::pipeline::sampling::finish_or_add_toks_to_seq (cognitive 231) mistralrs-core/src/pipeline/sampling.rs:189— mistralrs_core::pipeline::sampling::finish_or_add_toks_to_seq has cognitive complexity 231 (threshold 15). Drivers by points: if/else 68 (184 pts), loops 5 (29 pts), boolean chains 11, match/switch 3 (7 pts) (nesting depth added 144). 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.
mistralrs_core::vision_models::qwen3_vl::get_rope_index (cognitive 177) mistralrs-core/src/vision_models/qwen3_vl/mod.rs:56— mistralrs_core::vision_models::qwen3_vl::get_rope_index has cognitive complexity 177 (threshold 15). Drivers by points: if/else 28 (92 pts), loops 18 (62 pts), match/switch 6 (17 pts), boolean chains 6 (nesting depth added 119). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_core::engine::agentic_loop::agentic_loop (cognitive 152) mistralrs-core/src/engine/agentic_loop.rs:1123— mistralrs_core::engine::agentic_loop::agentic_loop has cognitive complexity 152 (threshold 15). Drivers by points: if/else 43 (118 pts), match/switch 6 (17 pts), loops 6 (12 pts), boolean chains 5 (nesting depth added 92). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_core::pipeline::inputs_processor::text_models_inputs_processor::make_prompt_chunk (cognitive 137) mistralrs-core/src/pipeline/inputs_processor.rs:872— mistralrs_core::pipeline::inputs_processor::text_models_inputs_processor::make_prompt_chunk has cognitive complexity 137 (threshold 15). Drivers by points: if/else 65 (114 pts), loops 7 (18 pts), boolean chains 5 (nesting depth added 60). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_core::pipeline::paths::get_adapter_paths (cognitive 119) mistralrs-core/src/pipeline/paths.rs:71— mistralrs_core::pipeline::paths::get_adapter_paths has cognitive complexity 119 (threshold 15). Drivers by points: if/else 32 (83 pts), loops 9 (30 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 74). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_core::pipeline::paths::get_chat_template (cognitive 83) mistralrs-core/src/pipeline/paths.rs:499— mistralrs_core::pipeline::paths::get_chat_template has cognitive complexity 83 (threshold 15). Drivers by points: if/else 31 (71 pts), loops 1 (7 pts), match/switch 3 (5 pts) (nesting depth added 48). 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.
mistralrs_core::attention::backends::cpu::full::compute_tiled_qblock (cognitive 82) mistralrs-core/src/attention/backends/cpu/full.rs:195— mistralrs_core::attention::backends::cpu::full::compute_tiled_qblock has cognitive complexity 82 (threshold 15). Drivers by points: if/else 16 (43 pts), loops 13 (35 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_core::mla::forward::mla_cache_forward (cognitive 82) mistralrs-core/src/mla/forward.rs:356— mistralrs_core::mla::forward::mla_cache_forward has cognitive complexity 82 (threshold 15). Drivers by points: if/else 33 (66 pts), loops 5 (13 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_core::diagnostics::run_doctor (cognitive 72) mistralrs-core/src/diagnostics.rs:408— mistralrs_core::diagnostics::run_doctor has cognitive complexity 72 (threshold 15). Drivers by points: if/else 41 (61 pts), boolean chains 6, loops 3, match/switch 1 (2 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.
mistralrs_core::cuda::gdn::speculative_recurrence_checkpoints_cuda::cuda_fwd (cognitive 71) mistralrs-core/src/cuda/gdn.rs:3398— mistralrs_core::cuda::gdn::speculative_recurrence_checkpoints_cuda::cuda_fwd has cognitive complexity 71 (threshold 15). Drivers by points: if/else 35 (38 pts), boolean chains 25, match/switch 5 (6 pts), loops 2 (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.
mistralrs_core::pipeline::isq::gguf_imatrix_names (cognitive 68) mistralrs-core/src/pipeline/isq.rs:1405— mistralrs_core::pipeline::isq::gguf_imatrix_names has cognitive complexity 68 (threshold 15). Drivers by points: if/else 57 (61 pts), boolean chains 7 (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.
mistralrs_core::pipeline::sampling::sample_sequence (cognitive 60) mistralrs-core/src/pipeline/sampling.rs:1388— mistralrs_core::pipeline::sampling::sample_sequence has cognitive complexity 60 (threshold 15). Drivers by points: if/else 19 (42 pts), boolean chains 10, loops 1 (5 pts), match/switch 3 (nesting depth added 27). 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.
mistralrs_core::ops::try_cuda_qk_rms_norm_rope_positions (cognitive 56) mistralrs-core/src/ops.rs:6006— mistralrs_core::ops::try_cuda_qk_rms_norm_rope_positions has cognitive complexity 56 (threshold 15). Drivers by points: if/else 34 (40 pts), match/switch 8 (10 pts), boolean chains 5, loops 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
mistralrs_core::pipeline::loaders::auto_device_map::get_device_layers (cognitive 56) mistralrs-core/src/pipeline/loaders/auto_device_map.rs:207— mistralrs_core::pipeline::loaders::auto_device_map::get_device_layers has cognitive complexity 56 (threshold 15). Drivers by points: if/else 27 (46 pts), loops 3 (5 pts), match/switch 3, boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_core::ops::try_cuda_qk_rms_norm_rope (cognitive 55) mistralrs-core/src/ops.rs:5577— mistralrs_core::ops::try_cuda_qk_rms_norm_rope has cognitive complexity 55 (threshold 15). Drivers by points: if/else 32 (38 pts), match/switch 9 (11 pts), boolean chains 5, loops 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
mistralrs_core::pipeline::isq_flow::plan::resolve_and_install_isq_plan (cognitive 54) mistralrs-core/src/pipeline/isq_flow/plan.rs:141— mistralrs_core::pipeline::isq_flow::plan::resolve_and_install_isq_plan has cognitive complexity 54 (threshold 15). Drivers by points: if/else 29 (38 pts), boolean chains 14, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
mistralrs_core::attention::backends::cpu::mask::mask_offset (cognitive 51) mistralrs-core/src/attention/backends/cpu/mask.rs:65— mistralrs_core::attention::backends::cpu::mask::mask_offset has cognitive complexity 51 (threshold 15). Drivers by points: if/else 27 (42 pts), boolean chains 6, loops 1 (2 pts), match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_core::pipeline::inputs_processor::text_models_inputs_processor::make_completion_chunk (cognitive 48) mistralrs-core/src/pipeline/inputs_processor.rs:1582— mistralrs_core::pipeline::inputs_processor::text_models_inputs_processor::make_completion_chunk has cognitive complexity 48 (threshold 15). Drivers by points: if/else 21 (31 pts), loops 3 (7 pts), match/switch 3 (6 pts), boolean chains 4 (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.
mistralrs_core::distributed::prepare_distributed_mapper (cognitive 46) mistralrs-core/src/distributed.rs:569— mistralrs_core::distributed::prepare_distributed_mapper has cognitive complexity 46 (threshold 15). Drivers by points: if/else 26 (35 pts), loops 3 (6 pts), boolean chains 4, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_core::speculative::driver::verify_staged_batch (cognitive 44) mistralrs-core/src/speculative/driver.rs:348— mistralrs_core::speculative::driver::verify_staged_batch has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (31 pts), loops 10 (11 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_core::speculative::hybrid_state::replay_gdn_prefixes (cognitive 43) mistralrs-core/src/speculative/hybrid_state.rs:345— mistralrs_core::speculative::hybrid_state::replay_gdn_prefixes has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (31 pts), loops 4 (7 pts), boolean chains 4, 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.
mistralrs_core::gguf::normal_bindings::bind_block_tensor (cognitive 41) mistralrs-core/src/gguf/normal_bindings.rs:109— mistralrs_core::gguf::normal_bindings::bind_block_tensor has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (21 pts), match/switch 6 (11 pts), boolean chains 9 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_core::paged_attention::plan::prompt_prefill_workspace (cognitive 41) mistralrs-core/src/paged_attention/plan.rs:1091— mistralrs_core::paged_attention::plan::prompt_prefill_workspace has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 11, loops 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.
mistralrs_core::pipeline::chat_template::calculate_eos_tokens (cognitive 41) mistralrs-core/src/pipeline/chat_template.rs:175— mistralrs_core::pipeline::chat_template::calculate_eos_tokens has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 5 (10 pts), match/switch 2 (6 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.
mistralrs_core::pipeline::isq::write_uqff_metadata (cognitive 41) mistralrs-core/src/pipeline/isq.rs:1132— mistralrs_core::pipeline::isq::write_uqff_metadata has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (29 pts), match/switch 2 (9 pts), loops 1 (3 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Duplicated block (5 lines × 2) mistralrs-cli/src/commands/bench.rs:319— mistralrs-cli/src/commands/bench.rs:319-323 | mistralrs-cli/src/commands/bench.rs:336-340 — both copies are in the same file, so extract the block into 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) mistralrs-cli/src/commands/quantize.rs:356— mistralrs-cli/src/commands/quantize.rs:356-360 | mistralrs-cli/src/commands/quantize.rs:366-370 — both copies are in the same file, so extract the block into 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) mistralrs-cli/src/commands/serve.rs:604— mistralrs-cli/src/commands/serve.rs:604-608 | mistralrs-cli/src/commands/serve.rs:664-668 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/attention/backends/cpu/avx.rs:75— mistralrs-core/src/attention/backends/cpu/avx.rs:75-79 | mistralrs-core/src/attention/backends/cpu/avx.rs:334-338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) mistralrs-core/src/attention/backends/cpu/full.rs:401— mistralrs-core/src/attention/backends/cpu/full.rs:401-405 | mistralrs-core/src/attention/backends/cpu/full.rs:576-580 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/attention/backends/cpu/full.rs:516— mistralrs-core/src/attention/backends/cpu/full.rs:516-520 | mistralrs-core/src/attention/backends/cpu/full.rs:623-627 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/cuda/gdn.rs:1909— mistralrs-core/src/cuda/gdn.rs:1909-1913 | mistralrs-core/src/cuda/gdn.rs:3194-3200 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/cuda/gdn.rs:3693— mistralrs-core/src/cuda/gdn.rs:3693-3697 | mistralrs-core/src/cuda/gdn.rs:4189-4193 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/cuda/gdn.rs:5539— mistralrs-core/src/cuda/gdn.rs:5539-5543 | mistralrs-core/src/cuda/gdn.rs:5783-5787 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/gdn/backend.rs:989— mistralrs-core/src/gdn/backend.rs:989-993 | mistralrs-core/src/gdn/backend.rs:1126-1130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) mistralrs-core/src/gguf/multimodal_binding_utils.rs:120— mistralrs-core/src/gguf/multimodal_binding_utils.rs:120-124 | mistralrs-core/src/gguf/qwen_multimodal_bindings.rs:306-310 — before extracting anything, compare `mistralrs-core/src/gguf/multimodal_binding_utils.rs` and `mistralrs-core/src/gguf/qwen_multimodal_bindings.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/kv_cache/hybrid_cache.rs:1655— mistralrs-core/src/kv_cache/hybrid_cache.rs:1655-1659 | mistralrs-core/src/kv_cache/hybrid_cache.rs:1716-1720 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/matformer.rs:101— mistralrs-core/src/matformer.rs:101-105 | mistralrs-core/src/matformer.rs:120-124 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) mistralrs-core/src/metal/gdn.rs:400— mistralrs-core/src/metal/gdn.rs:400-404 | mistralrs-core/src/metal/gdn.rs:669-673 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/models/flint.rs:509— mistralrs-core/src/models/flint.rs:509-513 | mistralrs-core/src/models/qwen3_moe.rs:340-344 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/qwen3_moe.rs` as WHOLE FILES: this scan already matched 43 separate duplicated blocks between them, totalling at least 470 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/gpt_oss.rs:949— mistralrs-core/src/models/gpt_oss.rs:949-953 | mistralrs-core/src/vision_models/mllama/text.rs:980-985 — before extracting anything, compare `mistralrs-core/src/models/gpt_oss.rs` and `mistralrs-core/src/vision_models/mllama/text.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 99 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 × 2) mistralrs-core/src/models/lfm2.rs:1312— mistralrs-core/src/models/lfm2.rs:1312-1316 | mistralrs-core/src/models/lfm2.rs:1355-1360 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/models/llama.rs:513— mistralrs-core/src/models/llama.rs:513-517 | mistralrs-core/src/models/smollm3.rs:532-536 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/ops.rs:597— mistralrs-core/src/ops.rs:597-601 | mistralrs-core/src/ops.rs:759-763 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:613— mistralrs-core/src/ops.rs:613-617 | mistralrs-core/src/ops.rs:771-775 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:1182— mistralrs-core/src/ops.rs:1182-1186 | mistralrs-core/src/ops.rs:1400-1404 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:4664— mistralrs-core/src/ops.rs:4664-4668 | mistralrs-core/src/ops.rs:5497-5501 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:4671— mistralrs-core/src/ops.rs:4671-4675 | mistralrs-core/src/ops.rs:5506-5510 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/inputs_processor.rs:1372— mistralrs-core/src/pipeline/inputs_processor.rs:1372-1376 | mistralrs-core/src/pipeline/inputs_processor.rs:1383-1387 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/mod.rs:1158— mistralrs-core/src/pipeline/mod.rs:1158-1162 | mistralrs-core/src/pipeline/mod.rs:1216-1220 — both copies are in the same file, so extract the block into 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) mistralrs-cli/src/commands/bench.rs:69— mistralrs-cli/src/commands/bench.rs:69-74 | mistralrs-cli/src/commands/serve.rs:920-925 — 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) mistralrs-cli/src/commands/run/interactive.rs:1503— mistralrs-cli/src/commands/run/interactive.rs:1503-1508 | mistralrs-server-core/src/chat_completion.rs:496-501 — 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 (6 lines × 2) mistralrs-cli/src/commands/serve.rs:931— mistralrs-cli/src/commands/serve.rs:931-938 | mistralrs-cli/src/commands/serve.rs:967-972 — both copies are in the same file, so extract the block into 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) mistralrs-code-exec/src/shell.rs:480— mistralrs-code-exec/src/shell.rs:480-485 | mistralrs-server-core/src/skills.rs:673-678 — 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 (6 lines × 2) mistralrs-core/src/attention/backends/cpu/full.rs:515— mistralrs-core/src/attention/backends/cpu/full.rs:515-520 | mistralrs-core/src/attention/backends/cpu/single_q.rs:314-319 — 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) mistralrs-core/src/attention/mod.rs:242— mistralrs-core/src/attention/mod.rs:242-247 | mistralrs-core/src/layers_utils.rs:5-10 — 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 (6 lines × 2) mistralrs-core/src/cuda/gdn.rs:1667— mistralrs-core/src/cuda/gdn.rs:1667-1672 | mistralrs-core/src/cuda/gdn.rs:5541-5546 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/cuda/gdn.rs:1692— mistralrs-core/src/cuda/gdn.rs:1692-1697 | mistralrs-core/src/cuda/gdn.rs:1736-1741 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/cuda/gdn.rs:1911— mistralrs-core/src/cuda/gdn.rs:1911-1916 | mistralrs-core/src/cuda/gdn.rs:2736-2741 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/cuda/gdn.rs:4197— mistralrs-core/src/cuda/gdn.rs:4197-4202 | mistralrs-core/src/cuda/gdn.rs:4204-4209 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/cuda/moe.rs:60— mistralrs-core/src/cuda/moe.rs:60-65 | mistralrs-core/src/cuda/moe.rs:67-72 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/cuda/ssm.rs:40— mistralrs-core/src/cuda/ssm.rs:40-46 | mistralrs-core/src/metal/ssm.rs:136-141 — 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 (6 lines × 2) mistralrs-core/src/diffusion_models/t5/mod.rs:261— mistralrs-core/src/diffusion_models/t5/mod.rs:261-266 | mistralrs-core/src/diffusion_models/t5/mod.rs:275-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) mistralrs-core/src/distributed.rs:465— mistralrs-core/src/distributed.rs:465-470 | mistralrs-core/src/distributed.rs:680-686 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) mistralrs-core/src/embedding_models/embedding_gemma.rs:520— mistralrs-core/src/embedding_models/embedding_gemma.rs:520-525 | mistralrs-core/src/embedding_models/qwen3_embedding.rs:470-475 — before extracting anything, compare `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/embedding_models/qwen3_embedding.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/gdn/backend.rs:1103— mistralrs-core/src/gdn/backend.rs:1103-1108 | mistralrs-core/src/models/granite.rs:1191-1196 — 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 (6 lines × 2) mistralrs-core/src/gguf/gguf_tokenizer.rs:528— mistralrs-core/src/gguf/gguf_tokenizer.rs:528-533 | mistralrs-core/src/gguf/gguf_tokenizer.rs:636-641 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/gguf/normal_config.rs:1131— mistralrs-core/src/gguf/normal_config.rs:1131-1136 | mistralrs-core/src/gguf/normal_config.rs:1252-1257 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/kv_cache/hybrid_cache.rs:1247— mistralrs-core/src/kv_cache/hybrid_cache.rs:1247-1252 | mistralrs-core/src/kv_cache/hybrid_cache.rs:1852-1857 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/models/flint.rs:801— mistralrs-core/src/models/flint.rs:801-806 | mistralrs-core/src/models/lfm2.rs:1060-1065 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/lfm2.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 99 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/gemma.rs:464— mistralrs-core/src/models/gemma.rs:464-469 | mistralrs-core/src/models/gemma2.rs:540-545 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/lfm2.rs:1243— mistralrs-core/src/models/lfm2.rs:1243-1248 | mistralrs-core/src/models/qwen3_next.rs:1053-1059 — before extracting anything, compare `mistralrs-core/src/models/lfm2.rs` and `mistralrs-core/src/models/qwen3_next.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 156 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/moe/experts/backends.rs:1771— mistralrs-core/src/moe/experts/backends.rs:1771-1776 | mistralrs-core/src/ops.rs:6874-6879 — 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 (6 lines × 2) mistralrs-core/src/ops.rs:3909— mistralrs-core/src/ops.rs:3909-3914 | mistralrs-core/src/ops.rs:4036-4041 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:5612— mistralrs-core/src/ops.rs:5612-5617 | mistralrs-core/src/ops.rs:6043-6048 — both copies are in the same file, so extract the block into 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) mistralrs-cli/src/commands/run/interactive.rs:447— mistralrs-cli/src/commands/run/interactive.rs:447-453 | mistralrs-cli/src/commands/run/interactive.rs:1719-1725 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/attention/backends/cpu/avx.rs:68— mistralrs-core/src/attention/backends/cpu/avx.rs:68-74 | mistralrs-core/src/attention/backends/cpu/avx.rs:86-92 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/attention/mod.rs:518— mistralrs-core/src/attention/mod.rs:518-524 | mistralrs-core/src/attention/mod.rs:541-547 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/cuda/dflash_context.rs:97— mistralrs-core/src/cuda/dflash_context.rs:97-103 | mistralrs-core/src/speculative/dflash.rs:868-874 — 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) mistralrs-core/src/cuda/dflash_context.rs:125— mistralrs-core/src/cuda/dflash_context.rs:125-131 | mistralrs-core/src/speculative/dflash.rs:895-901 — 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) mistralrs-core/src/cuda/dflash_context.rs:187— mistralrs-core/src/cuda/dflash_context.rs:187-193 | mistralrs-core/src/cuda/dflash_context.rs:313-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.
Duplicated block (7 lines × 2) mistralrs-core/src/cuda/speculative_rejection.rs:733— mistralrs-core/src/cuda/speculative_rejection.rs:733-739 | mistralrs-core/src/cuda/speculative_rejection.rs:770-776 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/diffusion_models/clip/text.rs:240— mistralrs-core/src/diffusion_models/clip/text.rs:240-246 | mistralrs-core/src/vision_models/clip.rs:271-277 — before extracting anything, compare `mistralrs-core/src/diffusion_models/clip/text.rs` and `mistralrs-core/src/vision_models/clip.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (7 lines × 2) mistralrs-core/src/distributed.rs:175— mistralrs-core/src/distributed.rs:175-181 | mistralrs-core/src/distributed.rs:221-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 (7 lines × 2) mistralrs-core/src/kv_cache/hybrid_cache.rs:110— mistralrs-core/src/kv_cache/hybrid_cache.rs:110-116 | mistralrs-core/src/kv_cache/hybrid_cache.rs:299-305 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/kv_cache/mod.rs:209— mistralrs-core/src/kv_cache/mod.rs:209-215 | mistralrs-core/src/kv_cache/mod.rs:221-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 (7 lines × 2) mistralrs-core/src/kv_cache/mod.rs:1472— mistralrs-core/src/kv_cache/mod.rs:1472-1478 | mistralrs-core/src/kv_cache/mod.rs:1572-1578 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/layers.rs:826— mistralrs-core/src/layers.rs:826-832 | mistralrs-core/src/layers.rs:833-839 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) mistralrs-core/src/lib.rs:2447— mistralrs-core/src/lib.rs:2447-2453 | mistralrs-core/src/lib.rs:2474-2480 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) mistralrs-core/src/lora/loralinear.rs:241— mistralrs-core/src/lora/loralinear.rs:241-247 | mistralrs-core/src/lora/qloralinear.rs:290-296 — before extracting anything, compare `mistralrs-core/src/lora/loralinear.rs` and `mistralrs-core/src/lora/qloralinear.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 2) mistralrs-core/src/metal/gdn.rs:792— mistralrs-core/src/metal/gdn.rs:792-798 | mistralrs-core/src/metal/ssm.rs:182-188 — before extracting anything, compare `mistralrs-core/src/metal/gdn.rs` and `mistralrs-core/src/metal/ssm.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 2) mistralrs-core/src/models/glm4.rs:87— mistralrs-core/src/models/glm4.rs:87-93 | mistralrs-core/src/models/glm4_moe.rs:113-119 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/glm4_moe.rs` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 341 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 2) mistralrs-core/src/models/glm4_moe.rs:408— mistralrs-core/src/models/glm4_moe.rs:408-414 | mistralrs-core/src/models/glm4_moe_lite.rs:501-507 — before extracting anything, compare `mistralrs-core/src/models/glm4_moe.rs` and `mistralrs-core/src/models/glm4_moe_lite.rs` as WHOLE FILES: this scan already matched 43 separate duplicated blocks between them, totalling at least 572 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 2) mistralrs-core/src/models/qwen3_next.rs:633— mistralrs-core/src/models/qwen3_next.rs:633-639 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:469-475 — before extracting anything, compare `mistralrs-core/src/models/qwen3_next.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/text.rs` as WHOLE FILES: this scan already matched 29 separate duplicated blocks between them, totalling at least 433 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 (7 lines × 2) mistralrs-core/src/moe/experts/backends.rs:872— mistralrs-core/src/moe/experts/backends.rs:872-878 | mistralrs-core/src/moe/experts/backends.rs:1028-1034 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:2013— mistralrs-core/src/ops.rs:2013-2019 | mistralrs-core/src/ops.rs:2139-2145 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:4629— mistralrs-core/src/ops.rs:4629-4635 | mistralrs-core/src/ops.rs:6450-6456 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:5775— mistralrs-core/src/ops.rs:5775-5781 | mistralrs-core/src/ops.rs:6211-6217 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/cuda_graph.rs:2605— mistralrs-core/src/pipeline/cuda_graph.rs:2605-2611 | mistralrs-core/src/speculative/dflash.rs:1642-1648 — 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) mistralrs-core/src/pipeline/embedding.rs:262— mistralrs-core/src/pipeline/embedding.rs:262-268 | mistralrs-core/src/pipeline/gguf.rs:1399-1405 — 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) mistralrs-core/src/attention/backends/cpu/avx.rs:34— mistralrs-core/src/attention/backends/cpu/avx.rs:34-42 | mistralrs-core/src/attention/backends/cpu/avx.rs:277-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.
Duplicated block (9 lines × 2) mistralrs-core/src/attention/backends/cpu/neon.rs:3— mistralrs-core/src/attention/backends/cpu/neon.rs:3-11 | mistralrs-core/src/attention/backends/cpu/neon.rs:137-145 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/attention/backends/flash.rs:68— mistralrs-core/src/attention/backends/flash.rs:68-76 | mistralrs-core/src/attention/backends/flash.rs:159-167 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/cuda/gdn.rs:1070— mistralrs-core/src/cuda/gdn.rs:1070-1078 | mistralrs-core/src/cuda/gdn.rs:1183-1192 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/embedding_models/inputs_processor.rs:24— mistralrs-core/src/embedding_models/inputs_processor.rs:24-32 | mistralrs-core/src/pipeline/inputs_processor.rs:162-170 — 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 (9 lines × 2) mistralrs-core/src/lib.rs:851— mistralrs-core/src/lib.rs:851-859 | mistralrs-core/src/lib.rs:899-907 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/metal/gdn.rs:55— mistralrs-core/src/metal/gdn.rs:55-63 | mistralrs-core/src/metal/ssm.rs:45-53 — before extracting anything, compare `mistralrs-core/src/metal/gdn.rs` and `mistralrs-core/src/metal/ssm.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) mistralrs-core/src/metal/gdn.rs:163— mistralrs-core/src/metal/gdn.rs:163-171 | mistralrs-core/src/metal/gdn.rs:274-282 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/metal/gdn.rs:179— mistralrs-core/src/metal/gdn.rs:179-187 | mistralrs-core/src/metal/gdn.rs:294-302 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/metal/gdn.rs:754— mistralrs-core/src/metal/gdn.rs:754-762 | mistralrs-core/src/metal/gdn.rs:939-947 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/model_loader.rs:363— mistralrs-core/src/model_loader.rs:363-371 | mistralrs-core/src/toml_selector.rs:846-854 — before extracting anything, compare `mistralrs-core/src/model_loader.rs` and `mistralrs-core/src/toml_selector.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 156 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) mistralrs-core/src/models/glm4.rs:228— mistralrs-core/src/models/glm4.rs:228-236 | mistralrs-core/src/models/glm4_moe.rs:290-298 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/glm4_moe.rs` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 341 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) mistralrs-core/src/models/hunyuan_v1_dense.rs:514— mistralrs-core/src/models/hunyuan_v1_dense.rs:514-522 | mistralrs-core/src/models/hunyuan_v1_moe.rs:1008-1016 — before extracting anything, compare `mistralrs-core/src/models/hunyuan_v1_dense.rs` and `mistralrs-core/src/models/hunyuan_v1_moe.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 690 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) mistralrs-core/src/models/llama.rs:251— mistralrs-core/src/models/llama.rs:251-259 | mistralrs-core/src/models/smollm3.rs:267-275 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) mistralrs-core/src/models/llama.rs:460— mistralrs-core/src/models/llama.rs:460-468 | mistralrs-core/src/models/smollm3.rs:483-491 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) mistralrs-core/src/models/mixtral.rs:512— mistralrs-core/src/models/mixtral.rs:512-520 | mistralrs-core/src/models/starcoder2.rs:513-521 — before extracting anything, compare `mistralrs-core/src/models/mixtral.rs` and `mistralrs-core/src/models/starcoder2.rs` as WHOLE FILES: this scan already matched 40 separate duplicated blocks between them, totalling at least 477 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) mistralrs-core/src/moe/experts/mod.rs:182— mistralrs-core/src/moe/experts/mod.rs:182-190 | mistralrs-core/src/moe/experts/mod.rs:253-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) mistralrs-core/src/ops.rs:2093— mistralrs-core/src/ops.rs:2093-2101 | mistralrs-core/src/ops.rs:2250-2258 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:2763— mistralrs-core/src/ops.rs:2763-2771 | mistralrs-core/src/ops.rs:2806-2814 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:4483— mistralrs-core/src/ops.rs:4483-4491 | mistralrs-core/src/ops.rs:5450-5458 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:4837— mistralrs-core/src/ops.rs:4837-4845 | mistralrs-quant/src/metal_fp8.rs:76-84 — 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 (9 lines × 2) mistralrs-core/src/paged_attention/scheduler.rs:1064— mistralrs-core/src/paged_attention/scheduler.rs:1064-1072 | mistralrs-core/src/paged_attention/scheduler.rs:1100-1108 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/gguf.rs:1460— mistralrs-core/src/pipeline/gguf.rs:1460-1468 | mistralrs-core/src/pipeline/normal.rs:1383-1391 — before extracting anything, compare `mistralrs-core/src/pipeline/gguf.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7481— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7481-7489 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7997-8005 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/multimodal.rs:1959— mistralrs-core/src/pipeline/multimodal.rs:1959-1967 | mistralrs-core/src/pipeline/normal.rs:2418-2426 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-cli/src/commands/run/mod.rs:136— mistralrs-cli/src/commands/run/mod.rs:136-143 | mistralrs-cli/src/commands/run/mod.rs:165-172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) mistralrs-cli/src/commands/serve.rs:706— mistralrs-cli/src/commands/serve.rs:706-713 | mistralrs-cli/src/commands/serve.rs:763-770 — both copies are in the same file, so extract the block into 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) mistralrs-cli/src/commands/serve.rs:878— mistralrs-cli/src/commands/serve.rs:878-885 | mistralrs-cli/src/commands/serve.rs:890-897 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/attention/backends/cpu/neon.rs:268— mistralrs-core/src/attention/backends/cpu/neon.rs:268-275 | mistralrs-core/src/attention/backends/cpu/neon.rs:511-518 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/attention/backends/cpu/neon.rs:288— mistralrs-core/src/attention/backends/cpu/neon.rs:288-295 | mistralrs-core/src/attention/backends/cpu/neon.rs:532-539 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/cuda/gdn.rs:2749— mistralrs-core/src/cuda/gdn.rs:2749-2756 | mistralrs-core/src/cuda/gdn.rs:2759-2766 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/diffusion_models/t5/mod.rs:525— mistralrs-core/src/diffusion_models/t5/mod.rs:525-532 | mistralrs-core/src/diffusion_models/t5/mod.rs:599-606 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/gdn/layer.rs:213— mistralrs-core/src/gdn/layer.rs:213-220 | mistralrs-core/src/gdn/layer.rs:335-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.
Duplicated block (8 lines × 2) mistralrs-core/src/gguf/normal_config.rs:1605— mistralrs-core/src/gguf/normal_config.rs:1605-1612 | mistralrs-core/src/gguf/normal_config.rs:2225-2232 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/kv_cache/hybrid_cache.rs:1175— mistralrs-core/src/kv_cache/hybrid_cache.rs:1175-1182 | mistralrs-core/src/kv_cache/hybrid_cache.rs:2012-2019 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/kv_cache/hybrid_cache.rs:1242— mistralrs-core/src/kv_cache/hybrid_cache.rs:1242-1249 | mistralrs-core/src/kv_cache/hybrid_cache.rs:2076-2083 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/layers.rs:872— mistralrs-core/src/layers.rs:872-879 | mistralrs-core/src/layers.rs:2208-2215 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/layers.rs:1624— mistralrs-core/src/layers.rs:1624-1631 | mistralrs-core/src/layers.rs:1935-1942 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/lora/loralinear.rs:136— mistralrs-core/src/lora/loralinear.rs:136-143 | mistralrs-core/src/lora/qloralinear.rs:181-188 — before extracting anything, compare `mistralrs-core/src/lora/loralinear.rs` and `mistralrs-core/src/lora/qloralinear.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/metal/gdn.rs:135— mistralrs-core/src/metal/gdn.rs:135-142 | mistralrs-core/src/metal/ssm.rs:96-103 — before extracting anything, compare `mistralrs-core/src/metal/gdn.rs` and `mistralrs-core/src/metal/ssm.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/metal/gdn.rs:319— mistralrs-core/src/metal/gdn.rs:319-326 | mistralrs-core/src/metal/gdn.rs:980-987 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/moe/experts/backends.rs:1572— mistralrs-core/src/moe/experts/backends.rs:1572-1579 | mistralrs-core/src/moe/experts/backends.rs:1638-1645 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:588— mistralrs-core/src/ops.rs:588-595 | mistralrs-core/src/ops.rs:750-757 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) mistralrs-core/src/ops.rs:2041— mistralrs-core/src/ops.rs:2041-2048 | mistralrs-core/src/ops.rs:2174-2181 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:7020— mistralrs-core/src/ops.rs:7020-7027 | mistralrs-core/src/ops.rs:7092-7099 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/paged_attention/cache_engine.rs:450— mistralrs-core/src/paged_attention/cache_engine.rs:450-457 | mistralrs-core/src/paged_attention/cache_engine.rs:488-495 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/chat_template.rs:511— mistralrs-core/src/pipeline/chat_template.rs:511-518 | mistralrs-core/src/pipeline/chat_template.rs:582-589 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/cuda_graph.rs:1034— mistralrs-core/src/pipeline/cuda_graph.rs:1034-1041 | mistralrs-core/src/pipeline/cuda_graph.rs:1044-1051 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1192— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1192-1199 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4811-4818 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6465— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6465-6472 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6744-6751 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
mistralrs_core::gguf::normal_bindings::bind_block_tensor (cyclomatic 69) mistralrs-core/src/gguf/normal_bindings.rs:109— mistralrs_core::gguf::normal_bindings::bind_block_tensor has cyclomatic complexity 69 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mistralrs_core::pipeline::sampling::finish_or_add_toks_to_seq (cyclomatic 68) mistralrs-core/src/pipeline/sampling.rs:189— mistralrs_core::pipeline::sampling::finish_or_add_toks_to_seq has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_core::cuda::gdn::speculative_recurrence_checkpoints_cuda::cuda_fwd (cyclomatic 66) mistralrs-core/src/cuda/gdn.rs:3398— mistralrs_core::cuda::gdn::speculative_recurrence_checkpoints_cuda::cuda_fwd has cyclomatic complexity 66 (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.
mistralrs_core::pipeline::isq::gguf_imatrix_names (cyclomatic 60) mistralrs-core/src/pipeline/isq.rs:1405— mistralrs_core::pipeline::isq::gguf_imatrix_names has cyclomatic complexity 60 (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.
mistralrs_core::engine::agentic_loop::agentic_loop (cyclomatic 58) mistralrs-core/src/engine/agentic_loop.rs:1123— mistralrs_core::engine::agentic_loop::agentic_loop has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_core::vision_models::qwen3_vl::get_rope_index (cyclomatic 55) mistralrs-core/src/vision_models/qwen3_vl/mod.rs:56— mistralrs_core::vision_models::qwen3_vl::get_rope_index has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_core::pipeline::inputs_processor::text_models_inputs_processor::make_prompt_chunk (cyclomatic 54) mistralrs-core/src/pipeline/inputs_processor.rs:872— mistralrs_core::pipeline::inputs_processor::text_models_inputs_processor::make_prompt_chunk has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_core::ops::try_cuda_qk_rms_norm_rope (cyclomatic 43) mistralrs-core/src/ops.rs:5577— mistralrs_core::ops::try_cuda_qk_rms_norm_rope has cyclomatic complexity 43 (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.
mistralrs_core::ops::try_cuda_qk_rms_norm_rope_positions (cyclomatic 43) mistralrs-core/src/ops.rs:6006— mistralrs_core::ops::try_cuda_qk_rms_norm_rope_positions has cyclomatic complexity 43 (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.
mistralrs_core::diagnostics::run_doctor (cyclomatic 41) mistralrs-core/src/diagnostics.rs:408— mistralrs_core::diagnostics::run_doctor has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_core::pipeline::paths::get_adapter_paths (cyclomatic 40) mistralrs-core/src/pipeline/paths.rs:71— mistralrs_core::pipeline::paths::get_adapter_paths has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_core::ops::cuda_dflash_sample_select (cyclomatic 39) mistralrs-core/src/ops.rs:1702— mistralrs_core::ops::cuda_dflash_sample_select has cyclomatic complexity 39 (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.
mistralrs_core::pipeline::isq_flow::plan::resolve_and_install_isq_plan (cyclomatic 38) mistralrs-core/src/pipeline/isq_flow/plan.rs:141— mistralrs_core::pipeline::isq_flow::plan::resolve_and_install_isq_plan has cyclomatic complexity 38 (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.
mistralrs_core::ops::try_cuda_qkv_rms_norm_rope_positions (cyclomatic 37) mistralrs-core/src/ops.rs:6339— mistralrs_core::ops::try_cuda_qkv_rms_norm_rope_positions has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mistralrs_core::ops::cuda_topk_logits_packed_batched_with_workspace (cyclomatic 35) mistralrs-core/src/ops.rs:1032— mistralrs_core::ops::cuda_topk_logits_packed_batched_with_workspace has cyclomatic complexity 35 (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.
mistralrs_core::cuda::gdn::speculative_conv_checkpoints_cuda::cuda_fwd (cyclomatic 34) mistralrs-core/src/cuda/gdn.rs:3094— mistralrs_core::cuda::gdn::speculative_conv_checkpoints_cuda::cuda_fwd has cyclomatic complexity 34 (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.
mistralrs_core::model_loader::loader_from_model_selected (cyclomatic 32) mistralrs-core/src/model_loader.rs:292— mistralrs_core::model_loader::loader_from_model_selected has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_core::ops::cuda_dflash_greedy_select (cyclomatic 32) mistralrs-core/src/ops.rs:1485— mistralrs_core::ops::cuda_dflash_greedy_select has cyclomatic complexity 32 (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.
mistralrs_core::attention::backends::cpu::mask::mask_offset (cyclomatic 31) mistralrs-core/src/attention/backends/cpu/mask.rs:65— mistralrs_core::attention::backends::cpu::mask::mask_offset has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_core::cuda::speculative_rejection::sparse_rejection_cuda_submit (cyclomatic 31) mistralrs-core/src/cuda/speculative_rejection.rs:904— mistralrs_core::cuda::speculative_rejection::sparse_rejection_cuda_submit has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_core::attention::backends::cpu::full::compute_tiled_qblock (cyclomatic 30) mistralrs-core/src/attention/backends/cpu/full.rs:195— mistralrs_core::attention::backends::cpu::full::compute_tiled_qblock has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_core::ops::cuda_rms_norm_residual_then_rms_norm (cyclomatic 30) mistralrs-core/src/ops.rs:5329— mistralrs_core::ops::cuda_rms_norm_residual_then_rms_norm has cyclomatic complexity 30 (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.
mistralrs_core::pipeline::paths::get_chat_template (cyclomatic 30) mistralrs-core/src/pipeline/paths.rs:499— mistralrs_core::pipeline::paths::get_chat_template has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_core::pipeline::sampling::sample_sequence (cyclomatic 30) mistralrs-core/src/pipeline/sampling.rs:1388— mistralrs_core::pipeline::sampling::sample_sequence has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_core::cuda::gdn::speculative_transition_commit_batched_cuda::cuda_commit (cyclomatic 29) mistralrs-core/src/cuda/gdn.rs:4554— mistralrs_core::cuda::gdn::speculative_transition_commit_batched_cuda::cuda_commit has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Hotspot: mistralrs-core/src/engine/mod.rs mistralrs-core/src/engine/mod.rs:1119— mistralrs-core/src/engine/mod.rs changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 145 in Engine::run at line 1119. 4 of those changes were fix/bug commits, and the other 14 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/engine/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/pipeline/multimodal.rs mistralrs-core/src/pipeline/multimodal.rs:534— mistralrs-core/src/pipeline/multimodal.rs changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 98 in MultimodalLoader::load_model_from_path at line 534. 3 of those changes were fix/bug commits, and the other 20 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/pipeline/multimodal.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/pipeline/mod.rs mistralrs-core/src/pipeline/mod.rs:2019— mistralrs-core/src/pipeline/mod.rs changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 104 in Pipeline::submit_step at line 2019. 3 of those changes were fix/bug commits, and the other 16 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/pipeline/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/pipeline/normal.rs mistralrs-core/src/pipeline/normal.rs:662— mistralrs-core/src/pipeline/normal.rs changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 68 in NormalLoader::load_model_from_path at line 662. 2 of those changes were fix/bug commits, and the other 16 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/pipeline/normal.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/vision_models/qwen3_5/text.rs mistralrs-core/src/vision_models/qwen3_5/text.rs:1434— mistralrs-core/src/vision_models/qwen3_5/text.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 49 in Qwen3_5TextModel::forward_embeds at line 1434. 2 of those changes were fix/bug commits, and the other 15 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/vision_models/qwen3_5/text.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/engine/add_request.rs mistralrs-core/src/engine/add_request.rs:144— mistralrs-core/src/engine/add_request.rs changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 103 in Engine::add_request at line 144. 1 of those changes was a fix/bug commit, and the other 7 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/engine/add_request.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/paged_attention/scheduler.rs mistralrs-core/src/paged_attention/scheduler.rs:921— mistralrs-core/src/paged_attention/scheduler.rs changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 50 in PagedAttentionScheduler::schedule at line 921. 1 of those changes was a fix/bug commit, and the other 14 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/paged_attention/scheduler.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/pipeline/sampling.rs mistralrs-core/src/pipeline/sampling.rs:189— mistralrs-core/src/pipeline/sampling.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 68 in mistralrs_core::pipeline::sampling::finish_or_add_toks_to_seq at line 189. 2 of those changes were fix/bug commits, and the other 9 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/pipeline/sampling.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/cuda/gdn.rs mistralrs-core/src/cuda/gdn.rs:3390— mistralrs-core/src/cuda/gdn.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 68 in mistralrs_core::cuda::gdn::speculative_recurrence_checkpoints_cuda at line 3390. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/cuda/gdn.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/paged_attention/layers/paged_attention.rs mistralrs-core/src/paged_attention/layers/paged_attention.rs:1412— mistralrs-core/src/paged_attention/layers/paged_attention.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 51 in PagedAttention::try_prefix_gather_prefill at line 1412. 2 of those changes were fix/bug commits, and the other 10 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/paged_attention/layers/paged_attention.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/pipeline/inputs_processor.rs mistralrs-core/src/pipeline/inputs_processor.rs:872— mistralrs-core/src/pipeline/inputs_processor.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in mistralrs_core::pipeline::inputs_processor::text_models_inputs_processor::make_prompt_chunk at line 872. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/pipeline/inputs_processor.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-server-core/src/chat_completion.rs mistralrs-server-core/src/chat_completion.rs:566— mistralrs-server-core/src/chat_completion.rs changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 60 in mistralrs_server_core::chat_completion::parse_request at line 566. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-server-core/src/chat_completion.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/vision_models/qwen3_5/speculative.rs mistralrs-core/src/vision_models/qwen3_5/speculative.rs:304— mistralrs-core/src/vision_models/qwen3_5/speculative.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 34 in Qwen3_5Model::dflash_propose at line 304. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/vision_models/qwen3_5/speculative.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/vision_models/qwen3_5/mod.rs mistralrs-core/src/vision_models/qwen3_5/mod.rs:115— mistralrs-core/src/vision_models/qwen3_5/mod.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in Qwen3_5Model::forward at line 115. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/vision_models/qwen3_5/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/ops.rs mistralrs-core/src/ops.rs:5577— mistralrs-core/src/ops.rs changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in mistralrs_core::ops::try_cuda_qk_rms_norm_rope at line 5577. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/ops.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/vision_models/qwen3_vl/mod.rs mistralrs-core/src/vision_models/qwen3_vl/mod.rs:56— mistralrs-core/src/vision_models/qwen3_vl/mod.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 55 in mistralrs_core::vision_models::qwen3_vl::get_rope_index at line 56. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/vision_models/qwen3_vl/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-quant/src/lib.rs mistralrs-quant/src/lib.rs:2181— mistralrs-quant/src/lib.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in mistralrs_quant::try_fused_quantized_ffn at line 2181. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-quant/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:464— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in AutoMultimodalLoader::get_loader at line 464. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/pipeline/cuda_graph.rs mistralrs-core/src/pipeline/cuda_graph.rs:89— mistralrs-core/src/pipeline/cuda_graph.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in CudaGraphCaptureMemory::shape at line 89. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/pipeline/cuda_graph.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-quant/src/distributed/layers.rs mistralrs-quant/src/distributed/layers.rs:439— mistralrs-quant/src/distributed/layers.rs changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in mistralrs_quant::distributed::layers::load_packed_weights at line 439. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-quant/src/distributed/layers.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-pyo3/src/lib.rs mistralrs-pyo3/src/lib.rs:976— mistralrs-pyo3/src/lib.rs changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in Runner::new at line 976. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-pyo3/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/vision_models/gemma4/text.rs mistralrs-core/src/vision_models/gemma4/text.rs:2103— mistralrs-core/src/vision_models/gemma4/text.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in TextModel::forward_embeds_scaled at line 2103. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/vision_models/gemma4/text.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1019— mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in Qwen3VLImageProcessor::process_inputs at line 1019. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-server-core/src/responses.rs mistralrs-server-core/src/responses.rs:1166— mistralrs-server-core/src/responses.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in OpenResponsesStreamer::poll_next at line 1166. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-server-core/src/responses.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mistralrs-core/src/paged_attention/plan.rs mistralrs-core/src/paged_attention/plan.rs:1091— mistralrs-core/src/paged_attention/plan.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in mistralrs_core::paged_attention::plan::prompt_prefill_workspace at line 1091. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 16:55:30 -04:00' --until='2026-10-24 16:55:30 -04:00' --full-history --no-merges -- mistralrs-core/src/paged_attention/plan.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.
Duplicated block (10 lines × 2) mistralrs-cli/src/commands/quantize.rs:561— mistralrs-cli/src/commands/quantize.rs:561-570 | mistralrs-cli/src/commands/quantize.rs:608-617 — both copies are in the same file, so extract the block into 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) mistralrs-code-exec/src/lib.rs:459— mistralrs-code-exec/src/lib.rs:459-468 | mistralrs-code-exec/src/shell.rs:255-264 — before extracting anything, compare `mistralrs-code-exec/src/lib.rs` and `mistralrs-code-exec/src/shell.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/cuda/gdn.rs:4010— mistralrs-core/src/cuda/gdn.rs:4010-4019 | mistralrs-core/src/cuda/gdn.rs:4392-4401 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/diffusion_models/clip/text.rs:220— mistralrs-core/src/diffusion_models/clip/text.rs:220-229 | mistralrs-core/src/vision_models/clip.rs:251-260 — before extracting anything, compare `mistralrs-core/src/diffusion_models/clip/text.rs` and `mistralrs-core/src/vision_models/clip.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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) mistralrs-core/src/engine/agentic_loop.rs:534— mistralrs-core/src/engine/agentic_loop.rs:534-543 | mistralrs-core/src/engine/agentic_loop.rs:734-743 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/gguf/normal_config.rs:1358— mistralrs-core/src/gguf/normal_config.rs:1358-1367 | mistralrs-core/src/gguf/normal_config.rs:1404-1413 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/kv_cache/hybrid_cache.rs:2042— mistralrs-core/src/kv_cache/hybrid_cache.rs:2042-2051 | mistralrs-core/src/kv_cache/hybrid_cache.rs:3997-4006 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/models/gpt_oss.rs:837— mistralrs-core/src/models/gpt_oss.rs:837-846 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6347-6356 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) mistralrs-core/src/models/granite.rs:1417— mistralrs-core/src/models/granite.rs:1417-1426 | mistralrs-core/src/models/granite.rs:1437-1446 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/models/qwen3_next.rs:696— mistralrs-core/src/models/qwen3_next.rs:696-705 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:477-486 — before extracting anything, compare `mistralrs-core/src/models/qwen3_next.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/text.rs` as WHOLE FILES: this scan already matched 29 separate duplicated blocks between them, totalling at least 433 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) mistralrs-core/src/moe/experts/backends.rs:805— mistralrs-core/src/moe/experts/backends.rs:805-814 | mistralrs-core/src/moe/experts/backends.rs:852-861 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/moe/experts/mod.rs:111— mistralrs-core/src/moe/experts/mod.rs:111-120 | mistralrs-core/src/moe/experts/mod.rs:202-211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) mistralrs-core/src/ops.rs:3889— mistralrs-core/src/ops.rs:3889-3898 | mistralrs-core/src/ops.rs:4016-4025 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:4510— mistralrs-core/src/ops.rs:4510-4519 | mistralrs-core/src/ops.rs:5488-5497 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:4528— mistralrs-core/src/ops.rs:4528-4537 | mistralrs-core/src/ops.rs:4675-4684 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:6031— mistralrs-core/src/ops.rs:6031-6040 | mistralrs-core/src/ops.rs:6370-6379 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/paged_attention/cache_engine.rs:300— mistralrs-core/src/paged_attention/cache_engine.rs:300-309 | mistralrs-core/src/paged_attention/cache_engine.rs:386-395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) mistralrs-core/src/paged_attention/layers/paged_attention.rs:685— mistralrs-core/src/paged_attention/layers/paged_attention.rs:685-694 | mistralrs-core/src/paged_attention/layers/paged_attention.rs:735-744 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7690— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7690-7699 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8212-8221 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/speculative/dflash.rs:2654— mistralrs-core/src/speculative/dflash.rs:2654-2663 | mistralrs-core/src/speculative/dflash.rs:3533-3542 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/speculative/verifier.rs:562— mistralrs-core/src/speculative/verifier.rs:562-571 | mistralrs-core/src/speculative/verifier.rs:575-584 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:687— mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:687-696 | mistralrs-core/src/vision_models/phi4/inputs_processor.rs:1675-1684 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) mistralrs-core/src/vision_models/gemma3n/text.rs:1830— mistralrs-core/src/vision_models/gemma3n/text.rs:1830-1839 | mistralrs-core/src/vision_models/gemma4/text.rs:2352-2361 — `mistralrs-core/src/vision_models/gemma3n/text.rs` and `mistralrs-core/src/vision_models/gemma4/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 7 separate duplicated blocks between them, totalling at least 70 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 × 2) mistralrs-core/src/vision_models/gemma3n/text.rs:1841— mistralrs-core/src/vision_models/gemma3n/text.rs:1841-1850 | mistralrs-core/src/vision_models/gemma4/text.rs:2363-2372 — `mistralrs-core/src/vision_models/gemma3n/text.rs` and `mistralrs-core/src/vision_models/gemma4/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 7 separate duplicated blocks between them, totalling at least 70 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 × 2) mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:531— mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:531-540 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:538-547 — before extracting anything, compare `mistralrs-core/src/vision_models/llava/llava_llm/llama.rs` and `mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 216 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
ClassTooLong: MistralRs mistralrs-core/src/lib.rs:443— ClassTooLong — 1621 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 80 methods, 3 blocks, lines 443-2970. The bar is 400 significant lines; this is 1221 over it, 4.05× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Engine mistralrs-core/src/engine/mod.rs:202— ClassTooLong — 1600 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 23 methods, 3 blocks, lines 202-2562. The bar is 400 significant lines; this is 1200 over it, 4.00× 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: Runner mistralrs-pyo3/src/lib.rs:339— ClassTooLong — 1529 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 35 methods, 3 blocks, lines 339-2908. The bar is 400 significant lines; this is 1129 over it, 3.82× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DFlashDraftModel mistralrs-core/src/speculative/dflash.rs:1285— ClassTooLong — 1393 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 40 methods, 2 blocks, lines 1285-3860. The bar is 400 significant lines; this is 993 over it, 3.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: MultimodalPipeline mistralrs-core/src/pipeline/multimodal.rs:217— ClassTooLong — 1305 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 12 methods, 10 blocks, lines 217-3331. The bar is 400 significant lines; this is 905 over it, 3.26× 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: HybridCache mistralrs-core/src/kv_cache/hybrid_cache.rs:1053— ClassTooLong — 1177 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 68 methods, 5 blocks, lines 1053-4154. The bar is 400 significant lines; this is 777 over it, 2.94× 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: Sampler mistralrs-core/src/sampler.rs:299— ClassTooLong — 1135 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 44 methods, 2 blocks, lines 299-2232. The bar is 400 significant lines; this is 735 over it, 2.84× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PagedAttentionScheduler mistralrs-core/src/paged_attention/scheduler.rs:100— ClassTooLong — 1114 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 35 methods, 4 blocks, lines 100-1588. The bar is 400 significant lines; this is 714 over it, 2.79× 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: Phi4MMInputsProcessor mistralrs-core/src/vision_models/phi4/inputs_processor.rs:262— ClassTooLong — 1083 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 14 methods, 5 blocks, lines 262-1714. The bar is 400 significant lines; this is 683 over it, 2.71× 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: NormalPipeline mistralrs-core/src/pipeline/normal.rs:113— ClassTooLong — 1053 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 10 methods, 10 blocks, lines 113-2939. The bar is 400 significant lines; this is 653 over it, 2.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Qwen3VLImageProcessor mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:50— ClassTooLong — 1013 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 8 methods, 5 blocks, lines 50-1976. The bar is 400 significant lines; this is 613 over it, 2.53× 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: Sequence mistralrs-core/src/sequence.rs:752— ClassTooLong — 1007 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 150 methods, 2 blocks, lines 752-2267. The bar is 400 significant lines; this is 607 over it, 2.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: Pipeline mistralrs-core/src/pipeline/mod.rs:1766— ClassTooLong — 983 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 29 methods. The bar is 400 significant lines; this is 583 over it, 2.46× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Gemma4ImageProcessor mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:169— ClassTooLong — 981 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 14 methods, 4 blocks, lines 169-1796. The bar is 400 significant lines; this is 581 over it, 2.45× 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: MultimodalLoader mistralrs-core/src/pipeline/multimodal.rs:244— ClassTooLong — 966 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 1 methods, 3 blocks, lines 244-1644. The bar is 400 significant lines; this is 566 over it, 2.42× 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: Qwen3_5TextModel mistralrs-core/src/vision_models/qwen3_5/text.rs:778— ClassTooLong — 931 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 30 methods, 5 blocks, lines 778-2002. The bar is 400 significant lines; this is 531 over it, 2.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: GGUFLoader mistralrs-core/src/pipeline/gguf.rs:147— ClassTooLong — 924 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 11 methods, 3 blocks, lines 147-1562. The bar is 400 significant lines; this is 524 over it, 2.31× 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: Qwen2_5VLImageProcessor mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:55— ClassTooLong — 886 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, 4 blocks, lines 55-1198. The bar is 400 significant lines; this is 486 over it, 2.22× 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: Qwen2VLImageProcessor mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:49— ClassTooLong — 886 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, 4 blocks, lines 49-1763. The bar is 400 significant lines; this is 486 over it, 2.22× 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: FastExpertsWeights mistralrs-core/src/moe/experts/backends.rs:69— ClassTooLong — 849 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 16 methods, 4 blocks, lines 69-1939. The bar is 400 significant lines; this is 449 over it, 2.12× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: TextModel mistralrs-core/src/vision_models/gemma4/text.rs:1528— ClassTooLong — 828 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 21 methods, 4 blocks, lines 1528-2691. The bar is 400 significant lines; this is 428 over it, 2.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: NormalLoader mistralrs-core/src/pipeline/normal.rs:342— ClassTooLong — 812 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 0 methods, 2 blocks, lines 342-1570. The bar is 400 significant lines; this is 412 over it, 2.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Model mistralrs/src/model.rs:80— ClassTooLong — 793 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 66 methods, 2 blocks, lines 80-1278. The bar is 400 significant lines; this is 393 over it, 1.98× 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: Gemma4Model mistralrs-core/src/vision_models/gemma4/mod.rs:201— ClassTooLong — 781 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, 5 blocks, lines 201-1263. The bar is 400 significant lines; this is 381 over it, 1.95× 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: GatedDeltaNet mistralrs-core/src/gdn/layer.rs:185— ClassTooLong — 766 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 30 methods, 2 blocks, lines 185-1094. The bar is 400 significant lines; this is 366 over it, 1.92× 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.
Duplicated block (13 lines × 2) mistralrs-cli/src/commands/doctor.rs:28— mistralrs-cli/src/commands/doctor.rs:28-40 | mistralrs-core/src/diagnostics.rs:426-438 — 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 (13 lines × 2) mistralrs-cli/src/commands/quant/gguf_discovery.rs:136— mistralrs-cli/src/commands/quant/gguf_discovery.rs:136-148 | mistralrs-cli/src/commands/quant/gguf_discovery.rs:161-173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) mistralrs-cli/src/commands/quantize.rs:200— mistralrs-cli/src/commands/quantize.rs:200-212 | mistralrs-cli/src/commands/serve.rs:1110-1122 — before extracting anything, compare `mistralrs-cli/src/commands/quantize.rs` and `mistralrs-cli/src/commands/serve.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 (13 lines × 2) mistralrs-cli/src/commands/run/interactive.rs:1886— mistralrs-cli/src/commands/run/interactive.rs:1886-1898 | mistralrs-cli/src/commands/run/interactive.rs:2011-2023 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) mistralrs-core/src/cuda/gdn.rs:2290— mistralrs-core/src/cuda/gdn.rs:2290-2302 | mistralrs-core/src/cuda/gdn.rs:2549-2561 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/diffusion_models/clip/text.rs:142— mistralrs-core/src/diffusion_models/clip/text.rs:142-154 | mistralrs-core/src/vision_models/clip.rs:175-187 — before extracting anything, compare `mistralrs-core/src/diffusion_models/clip/text.rs` and `mistralrs-core/src/vision_models/clip.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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) mistralrs-core/src/embedding_models/embedding_gemma.rs:185— mistralrs-core/src/embedding_models/embedding_gemma.rs:185-197 | mistralrs-core/src/vision_models/gemma3/text.rs:158-170 — before extracting anything, compare `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/vision_models/gemma3/text.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 268 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) mistralrs-core/src/engine/add_request.rs:1080— mistralrs-core/src/engine/add_request.rs:1080-1092 | mistralrs-core/src/engine/add_request.rs:1117-1129 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/gguf/normal_config.rs:1386— mistralrs-core/src/gguf/normal_config.rs:1386-1398 | mistralrs-core/src/gguf/normal_config.rs:2308-2320 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/kv_cache/mod.rs:1204— mistralrs-core/src/kv_cache/mod.rs:1204-1216 | mistralrs-core/src/kv_cache/mod.rs:1360-1372 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/layers.rs:1028— mistralrs-core/src/layers.rs:1028-1040 | mistralrs-core/src/layers.rs:2306-2318 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/layers.rs:1184— mistralrs-core/src/layers.rs:1184-1196 | mistralrs-core/src/layers.rs:1274-1286 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/lora/loralinear.rs:146— mistralrs-core/src/lora/loralinear.rs:146-158 | mistralrs-core/src/lora/qloralinear.rs:191-203 — before extracting anything, compare `mistralrs-core/src/lora/loralinear.rs` and `mistralrs-core/src/lora/qloralinear.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 2) mistralrs-core/src/model_loader.rs:765— mistralrs-core/src/model_loader.rs:765-777 | mistralrs-core/src/toml_selector.rs:1041-1053 — before extracting anything, compare `mistralrs-core/src/model_loader.rs` and `mistralrs-core/src/toml_selector.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 156 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 2) mistralrs-core/src/models/flint.rs:436— mistralrs-core/src/models/flint.rs:436-448 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:288-300 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 194 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) mistralrs-core/src/models/flint.rs:817— mistralrs-core/src/models/flint.rs:817-829 | mistralrs-core/src/models/qwen3_moe.rs:616-628 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/qwen3_moe.rs` as WHOLE FILES: this scan already matched 43 separate duplicated blocks between them, totalling at least 470 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 2) mistralrs-core/src/models/gemma2.rs:579— mistralrs-core/src/models/gemma2.rs:579-591 | mistralrs-core/src/vision_models/gemma3/text.rs:749-761 — before extracting anything, compare `mistralrs-core/src/models/gemma2.rs` and `mistralrs-core/src/vision_models/gemma3/text.rs` as WHOLE FILES: this scan already matched 30 separate duplicated blocks between them, totalling at least 362 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) mistralrs-core/src/models/glm4_moe.rs:865— mistralrs-core/src/models/glm4_moe.rs:865-877 | mistralrs-core/src/models/glm4_moe.rs:905-917 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/models/quantized_llama.rs:151— mistralrs-core/src/models/quantized_llama.rs:151-163 | mistralrs-core/src/xlora_models/quantized_llama.rs:275-287 — `mistralrs-core/src/models/quantized_llama.rs` and `mistralrs-core/src/xlora_models/quantized_llama.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 5 separate duplicated blocks between them, totalling at least 59 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 (13 lines × 2) mistralrs-core/src/ops.rs:1590— mistralrs-core/src/ops.rs:1590-1602 | mistralrs-core/src/ops.rs:1832-1844 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) mistralrs-core/src/ops.rs:5756— mistralrs-core/src/ops.rs:5756-5768 | mistralrs-core/src/ops.rs:6189-6201 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/amoe.rs:76— mistralrs-core/src/pipeline/amoe.rs:76-88 | mistralrs-core/src/pipeline/amoe.rs:118-130 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/embedding.rs:287— mistralrs-core/src/pipeline/embedding.rs:287-299 | mistralrs-core/src/pipeline/normal.rs:760-772 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 153 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 2) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:506— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:506-518 | mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:708-720 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:885— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:885-897 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:917-929 — both copies are in the same file, so extract the block into 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) mistralrs-cli/src/commands/quantize.rs:223— mistralrs-cli/src/commands/quantize.rs:223-234 | mistralrs-cli/src/commands/serve.rs:1133-1144 — before extracting anything, compare `mistralrs-cli/src/commands/quantize.rs` and `mistralrs-cli/src/commands/serve.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 (12 lines × 2) mistralrs-cli/src/commands/quantize.rs:658— mistralrs-cli/src/commands/quantize.rs:658-669 | mistralrs-cli/src/commands/quantize.rs:693-704 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) mistralrs-core/src/attention/backends/cpu/full.rs:655— mistralrs-core/src/attention/backends/cpu/full.rs:655-666 | mistralrs-core/src/attention/backends/cpu/single_q.rs:342-353 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12 lines × 2) mistralrs-core/src/cuda/dflash_context.rs:237— mistralrs-core/src/cuda/dflash_context.rs:237-248 | mistralrs-core/src/cuda/dflash_context.rs:362-373 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/cuda/gdn.rs:4676— mistralrs-core/src/cuda/gdn.rs:4676-4687 | mistralrs-core/src/cuda/gdn.rs:4712-4723 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/kv_cache/mod.rs:267— mistralrs-core/src/kv_cache/mod.rs:267-278 | mistralrs-core/src/kv_cache/mod.rs:281-292 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/layers.rs:880— mistralrs-core/src/layers.rs:880-891 | mistralrs-core/src/layers.rs:2216-2227 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/model_loader.rs:904— mistralrs-core/src/model_loader.rs:904-915 | mistralrs-core/src/toml_selector.rs:1224-1235 — before extracting anything, compare `mistralrs-core/src/model_loader.rs` and `mistralrs-core/src/toml_selector.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 156 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/deepseek2.rs:110— mistralrs-core/src/models/deepseek2.rs:110-121 | mistralrs-core/src/models/deepseek3.rs:111-122 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/glm4.rs:462— mistralrs-core/src/models/glm4.rs:462-473 | mistralrs-core/src/models/glm4_moe.rs:747-758 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/glm4_moe.rs` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 341 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/glm4_moe.rs:187— mistralrs-core/src/models/glm4_moe.rs:187-198 | mistralrs-core/src/models/gpt_oss.rs:170-181 — before extracting anything, compare `mistralrs-core/src/models/glm4_moe.rs` and `mistralrs-core/src/models/gpt_oss.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 195 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/phi3_5_moe.rs:444— mistralrs-core/src/models/phi3_5_moe.rs:444-455 | mistralrs-core/src/models/starcoder2.rs:369-380 — before extracting anything, compare `mistralrs-core/src/models/phi3_5_moe.rs` and `mistralrs-core/src/models/starcoder2.rs` as WHOLE FILES: this scan already matched 29 separate duplicated blocks between them, totalling at least 344 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/qwen3_next.rs:356— mistralrs-core/src/models/qwen3_next.rs:356-367 | mistralrs-core/src/vision_models/qwen3_5/text.rs:406-417 — before extracting anything, compare `mistralrs-core/src/models/qwen3_next.rs` and `mistralrs-core/src/vision_models/qwen3_5/text.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 158 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) mistralrs-core/src/paged_attention/cache_engine.rs:295— mistralrs-core/src/paged_attention/cache_engine.rs:295-306 | mistralrs-core/src/paged_attention/cache_engine.rs:483-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.
Duplicated block (12 lines × 2) mistralrs-core/src/pipeline/embedding.rs:246— mistralrs-core/src/pipeline/embedding.rs:246-257 | mistralrs-core/src/pipeline/normal.rs:704-715 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 153 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/hf.rs:744— mistralrs-core/src/pipeline/hf.rs:744-755 | mistralrs-core/src/pipeline/hf.rs:772-783 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/checkpoint_inventory.rs:99— mistralrs-core/src/pipeline/loaders/checkpoint_inventory.rs:99-110 | mistralrs-core/src/pipeline/loaders/checkpoint_inventory.rs:128-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 (12 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:748— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:748-759 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5388-5406 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5287— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5287-5298 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5311-5322 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8878— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8878-8889 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8893-8904 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:9978— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:9978-9989 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6862-6873 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3970— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3970-3981 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4221-4232 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5552— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5552-5563 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6806-6817 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/multimodal.rs:674— mistralrs-core/src/pipeline/multimodal.rs:674-685 | mistralrs-core/src/pipeline/normal.rs:710-721 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/multimodal.rs:2750— mistralrs-core/src/pipeline/multimodal.rs:2750-2761 | mistralrs-core/src/pipeline/normal.rs:2483-2494 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) mistralrs-cli/src/args/mod.rs:851— mistralrs-cli/src/args/mod.rs:851-861 | mistralrs-cli/src/args/mod.rs:933-943 — both copies are in the same file, so extract the block into 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) mistralrs-cli/src/commands/run/mod.rs:115— mistralrs-cli/src/commands/run/mod.rs:115-125 | mistralrs-cli/src/commands/serve.rs:128-138 — before extracting anything, compare `mistralrs-cli/src/commands/run/mod.rs` and `mistralrs-cli/src/commands/serve.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (11 lines × 2) mistralrs-core/src/distributed.rs:267— mistralrs-core/src/distributed.rs:267-277 | mistralrs-core/src/distributed.rs:307-317 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/gguf/normal_config.rs:237— mistralrs-core/src/gguf/normal_config.rs:237-247 | mistralrs-core/src/gguf/normal_config.rs:298-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.
Duplicated block (11 lines × 2) mistralrs-core/src/kv_cache/mod.rs:1454— mistralrs-core/src/kv_cache/mod.rs:1454-1464 | mistralrs-core/src/kv_cache/mod.rs:1554-1564 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/model_loader.rs:493— mistralrs-core/src/model_loader.rs:493-503 | mistralrs-core/src/toml_selector.rs:1189-1199 — before extracting anything, compare `mistralrs-core/src/model_loader.rs` and `mistralrs-core/src/toml_selector.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 156 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) mistralrs-core/src/models/deepseek2.rs:938— mistralrs-core/src/models/deepseek2.rs:938-948 | mistralrs-core/src/models/deepseek3.rs:1001-1011 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) mistralrs-core/src/models/glm4_moe.rs:735— mistralrs-core/src/models/glm4_moe.rs:735-745 | mistralrs-core/src/models/granite.rs:1974-1984 — before extracting anything, compare `mistralrs-core/src/models/glm4_moe.rs` and `mistralrs-core/src/models/granite.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 233 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) mistralrs-core/src/models/phi2.rs:442— mistralrs-core/src/models/phi2.rs:442-452 | mistralrs-core/src/xlora_models/phi2.rs:413-423 — `mistralrs-core/src/models/phi2.rs` and `mistralrs-core/src/xlora_models/phi2.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 7 separate duplicated blocks between them, totalling at least 75 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 (11 lines × 2) mistralrs-core/src/ops.rs:926— mistralrs-core/src/ops.rs:926-936 | mistralrs-core/src/ops.rs:1008-1018 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:1058— mistralrs-core/src/ops.rs:1058-1068 | mistralrs-core/src/ops.rs:1293-1303 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:5735— mistralrs-core/src/ops.rs:5735-5745 | mistralrs-core/src/ops.rs:6165-6175 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/paged_attention/layers/paged_attention.rs:1807— mistralrs-core/src/paged_attention/layers/paged_attention.rs:1807-1817 | mistralrs-core/src/paged_attention/layers/paged_attention.rs:1828-1839 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/diffusion.rs:171— mistralrs-core/src/pipeline/diffusion.rs:171-181 | mistralrs-core/src/pipeline/speech.rs:274-284 — 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1212— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1212-1222 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1241-1251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2992— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2992-3002 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3021-3031 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3341— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3341-3351 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3370-3380 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/multimodal.rs:1047— mistralrs-core/src/pipeline/multimodal.rs:1047-1057 | mistralrs-core/src/pipeline/normal.rs:1044-1054 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:2720— mistralrs-core/src/pipeline/multimodal.rs:2720-2730 | mistralrs-core/src/pipeline/normal.rs:2403-2413 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) mistralrs-core/src/pipeline/prompt_chunks.rs:57— mistralrs-core/src/pipeline/prompt_chunks.rs:57-67 | mistralrs-core/src/pipeline/prompt_chunks.rs:93-103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) mistralrs-core/src/prefix_cacher.rs:759— mistralrs-core/src/prefix_cacher.rs:759-769 | mistralrs-core/src/prefix_cacher.rs:771-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.
Duplicated block (11 lines × 2) mistralrs-core/src/vision_models/gemma4/mod.rs:141— mistralrs-core/src/vision_models/gemma4/mod.rs:141-151 | mistralrs-core/src/vision_models/gemma4/mod.rs:153-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.
Duplicated block (11 lines × 2) mistralrs-core/src/vision_models/gemma4/mod.rs:441— mistralrs-core/src/vision_models/gemma4/mod.rs:441-451 | mistralrs-core/src/vision_models/phi3/mod.rs:979-989 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11 lines × 2) REDACTED:490— REDACTED:490-500 | REDACTED:845-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.
Duplicated block (11 lines × 2) REDACTED:593— REDACTED:593-603 | mistralrs-core/src/vision_models/siglip.rs:401-411 — before extracting anything, compare `REDACTED` and `mistralrs-core/src/vision_models/siglip.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 248 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.
mistralrs_quant::distributed::layers::load_packed_weights (cognitive 68) mistralrs-quant/src/distributed/layers.rs:439— mistralrs_quant::distributed::layers::load_packed_weights has cognitive complexity 68 (threshold 15). Drivers by points: if/else 20 (45 pts), loops 5 (12 pts), match/switch 4 (6 pts), boolean chains 5 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_quant::metal_kernels::afq_qmm_dispatch (cognitive 68) mistralrs-quant/src/metal_kernels/mod.rs:946— mistralrs_quant::metal_kernels::afq_qmm_dispatch has cognitive complexity 68 (threshold 15). Drivers by points: if/else 35 (50 pts), boolean chains 16, match/switch 1 (2 pts) (nesting depth added 16). 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.
mistralrs_quant::afq::ops::afq_mm_op (cognitive 58) mistralrs-quant/src/afq/ops.rs:342— mistralrs_quant::afq::ops::afq_mm_op has cognitive complexity 58 (threshold 15). Drivers by points: if/else 23 (42 pts), match/switch 2 (6 pts), boolean chains 5, loops 1 (5 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_quant::cutile::routed_lora::routed_lora_kernel::routed_lora_one_shot (cognitive 56) mistralrs-quant/src/cutile/routed_lora.rs:69— mistralrs_quant::cutile::routed_lora::routed_lora_kernel::routed_lora_one_shot has cognitive complexity 56 (threshold 15). Drivers by points: if/else 20 (43 pts), loops 2 (8 pts), boolean chains 5 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
mistralrs_quant::mxfp4::ops::mxfp4_indexed_moe_gemm (cognitive 50) mistralrs-quant/src/mxfp4/ops.rs:313— mistralrs_quant::mxfp4::ops::mxfp4_indexed_moe_gemm has cognitive complexity 50 (threshold 15). Drivers by points: if/else 28 (36 pts), match/switch 9 (12 pts), boolean chains 2 (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.
mistralrs_quant::gptq::gptq_cuda::gptq_linear (cognitive 47) mistralrs-quant/src/gptq/gptq_cuda.rs:451— mistralrs_quant::gptq::gptq_cuda::gptq_linear has cognitive complexity 47 (threshold 15). Drivers by points: if/else 31 (40 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 11). Of this number, 39 points are the body's own statements and 8 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.
mistralrs_quant::gguf::weight_source::infer_binding_shape (cognitive 39) mistralrs-quant/src/gguf/weight_source.rs:1120— mistralrs_quant::gguf::weight_source::infer_binding_shape has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 4, loops 2 (4 pts), match/switch 1 (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
mistralrs_quant::metal_kernels::call_copy_gpu_inplace (cognitive 36) mistralrs-quant/src/metal_kernels/mod.rs:2379— mistralrs_quant::metal_kernels::call_copy_gpu_inplace has cognitive complexity 36 (threshold 15). Drivers by points: if/else 20 (32 pts), match/switch 4 (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.
mistralrs_quant::bitsandbytes::op::d_dequantize_nf4 (cognitive 35) mistralrs-quant/src/bitsandbytes/op.rs:28— mistralrs_quant::bitsandbytes::op::d_dequantize_nf4 has cognitive complexity 35 (threshold 15). Drivers by points: if/else 23 (35 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_quant::cutile::fused_moe::fused_moe::fused_moe_kernel (cognitive 34) mistralrs-quant/src/cutile/fused_moe.rs:37— mistralrs_quant::cutile::fused_moe::fused_moe::fused_moe_kernel has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (31 pts), loops 1 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_quant::cutile::fused_moe_fp8::fused_moe_fp8::fused_moe_fp8_kernel (cognitive 34) mistralrs-quant/src/cutile/fused_moe_fp8.rs:48— mistralrs_quant::cutile::fused_moe_fp8::fused_moe_fp8::fused_moe_fp8_kernel has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (31 pts), loops 1 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_quant::cutile::nvfp4_matmul::launch_gather (cognitive 34) mistralrs-quant/src/cutile/nvfp4_matmul.rs:1377— mistralrs_quant::cutile::nvfp4_matmul::launch_gather has cognitive complexity 34 (threshold 15). Drivers by points: if/else 33, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mistralrs_quant::lora::dynamic::expert_cuda::launch_projection (cognitive 34) mistralrs-quant/src/lora/dynamic/expert_cuda.rs:784— mistralrs_quant::lora::dynamic::expert_cuda::launch_projection has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 4 (7 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_quant::metal_kernels::prepare::prepare_afq (cognitive 34) mistralrs-quant/src/metal_kernels/prepare.rs:16— mistralrs_quant::metal_kernels::prepare::prepare_afq has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 6 (11 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_quant::cutile::nvfp4::launch (cognitive 32) mistralrs-quant/src/cutile/nvfp4.rs:151— mistralrs_quant::cutile::nvfp4::launch has cognitive complexity 32 (threshold 15). Drivers by points: if/else 20 (23 pts), boolean chains 6, match/switch 1 (2 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.
mistralrs_quant::mxfp4::ops::mxfp4_matmul (cognitive 32) mistralrs-quant/src/mxfp4/ops.rs:16— mistralrs_quant::mxfp4::ops::mxfp4_matmul has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (21 pts), match/switch 8 (11 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
mistralrs_quant::lora::dynamic::expert::add_expert_delta_reference (cognitive 31) mistralrs-quant/src/lora/dynamic/expert.rs:705— mistralrs_quant::lora::dynamic::expert::add_expert_delta_reference has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 4, match/switch 2 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_quant::try_fused_quantized_qkv (cognitive 28) mistralrs-quant/src/lib.rs:2401— mistralrs_quant::try_fused_quantized_qkv has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19 (22 pts), boolean chains 6 (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.
mistralrs_quant::mxfp4::metal_ops::mxfp4_indexed_moe_gemm (cognitive 28) mistralrs-quant/src/mxfp4/metal_ops.rs:173— mistralrs_quant::mxfp4::metal_ops::mxfp4_indexed_moe_gemm has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 4, match/switch 2 (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.
mistralrs_quant::try_fused_quantized_ffn (cognitive 26) mistralrs-quant/src/lib.rs:2181— mistralrs_quant::try_fused_quantized_ffn has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 7, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mistralrs_quant::try_fused_quantized_gate_up (cognitive 26) mistralrs-quant/src/lib.rs:2291— mistralrs_quant::try_fused_quantized_gate_up has cognitive complexity 26 (threshold 15). Drivers by points: if/else 19 (22 pts), boolean chains 4 (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.
mistralrs_quant::cutile::tune::tune (cognitive 26) mistralrs-quant/src/cutile/tune.rs:333— mistralrs_quant::cutile::tune::tune has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 4 (8 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_quant::cutile::nvfp4_matmul::launch_inner (cognitive 25) mistralrs-quant/src/cutile/nvfp4_matmul.rs:1153— mistralrs_quant::cutile::nvfp4_matmul::launch_inner has cognitive complexity 25 (threshold 15). Drivers by points: if/else 21 (22 pts), match/switch 3 (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.
mistralrs_quant::rotary::cuda::launch_rotary (cognitive 25) mistralrs-quant/src/rotary/mod.rs:916— mistralrs_quant::rotary::cuda::launch_rotary has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (17 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.
mistralrs_quant::blockwise_fp8::ops::fused_add_rms_norm_quantized_impl (cognitive 24) mistralrs-quant/src/blockwise_fp8/ops.rs:1764— mistralrs_quant::blockwise_fp8::ops::fused_add_rms_norm_quantized_impl has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19, boolean chains 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.
Duplicated block (15 lines × 2) mistralrs-cli/src/commands/config.rs:81— mistralrs-cli/src/commands/config.rs:81-95 | mistralrs-cli/src/commands/config.rs:245-259 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/attention/backends/cpu/neon.rs:372— mistralrs-core/src/attention/backends/cpu/neon.rs:372-386 | mistralrs-core/src/attention/backends/cpu/neon.rs:611-625 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/cuda/gdn.rs:4564— mistralrs-core/src/cuda/gdn.rs:4564-4578 | mistralrs-core/src/cuda/gdn.rs:4813-4827 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/distributed.rs:650— mistralrs-core/src/distributed.rs:650-664 | mistralrs-core/src/distributed.rs:692-706 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/engine/add_request.rs:1064— mistralrs-core/src/engine/add_request.rs:1064-1078 | mistralrs-core/src/engine/add_request.rs:1101-1115 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/gguf/normal_config.rs:675— mistralrs-core/src/gguf/normal_config.rs:675-689 | mistralrs-core/src/gguf/normal_config.rs:864-878 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/metal/gdn.rs:223— mistralrs-core/src/metal/gdn.rs:223-237 | mistralrs-core/src/metal/gdn.rs:328-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.
Duplicated block (15 lines × 2) mistralrs-core/src/metal/gdn.rs:799— mistralrs-core/src/metal/gdn.rs:799-813 | mistralrs-core/src/metal/gdn.rs:889-903 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) mistralrs-core/src/model_loader.rs:851— mistralrs-core/src/model_loader.rs:851-865 | mistralrs-core/src/toml_selector.rs:1129-1143 — before extracting anything, compare `mistralrs-core/src/model_loader.rs` and `mistralrs-core/src/toml_selector.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 156 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15 lines × 2) mistralrs-core/src/models/granite.rs:1051— mistralrs-core/src/models/granite.rs:1051-1065 | mistralrs-core/src/models/granite.rs:1222-1236 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/models/granite.rs:2138— mistralrs-core/src/models/granite.rs:2138-2152 | mistralrs-core/src/models/qwen3_next.rs:933-947 — before extracting anything, compare `mistralrs-core/src/models/granite.rs` and `mistralrs-core/src/models/qwen3_next.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 167 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15 lines × 2) mistralrs-core/src/ops.rs:2077— mistralrs-core/src/ops.rs:2077-2091 | mistralrs-core/src/ops.rs:2234-2248 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/paged_attention/encoder_cache.rs:227— mistralrs-core/src/paged_attention/encoder_cache.rs:227-241 | mistralrs-core/src/paged_attention/encoder_cache.rs:360-374 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/paged_attention/layers/paged_attention.rs:1445— mistralrs-core/src/paged_attention/layers/paged_attention.rs:1445-1459 | mistralrs-core/src/paged_attention/layers/paged_attention.rs:2128-2142 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3064— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3064-3078 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3413-3427 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:989— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:989-1003 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2369-2383 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5120— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5120-5134 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:7124-7138 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/multimodal.rs:1438— mistralrs-core/src/pipeline/multimodal.rs:1438-1452 | mistralrs-core/src/pipeline/normal.rs:1475-1489 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:1660— mistralrs-core/src/pipeline/multimodal.rs:1660-1674 | mistralrs-core/src/pipeline/normal.rs:1583-1597 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15 lines × 2) mistralrs-core/src/vision_models/gemma3n/text.rs:1364— mistralrs-core/src/vision_models/gemma3n/text.rs:1364-1378 | mistralrs-core/src/vision_models/gemma3n/text.rs:1388-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 (15 lines × 2) mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:258— mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:258-272 | mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:523-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 (15 lines × 2) mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1685— mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1685-1699 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1653-1667 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (15 lines × 2) mistralrs-core/src/vision_models/gemma4/text.rs:601— mistralrs-core/src/vision_models/gemma4/text.rs:601-615 | mistralrs-core/src/vision_models/gemma4/text.rs:634-648 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:349— mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:349-363 | mistralrs-core/src/vision_models/llama4/inputs_processor.rs:201-215 — before extracting anything, compare `mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs` and `mistralrs-core/src/vision_models/llama4/inputs_processor.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 152 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 (15 lines × 2) REDACTED:461— REDACTED:461-475 | REDACTED:816-830 — both copies are in the same file, so extract the block into 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) mistralrs-cli/src/commands/run/interactive.rs:962— mistralrs-cli/src/commands/run/interactive.rs:962-977 | mistralrs-cli/src/commands/run/interactive.rs:1748-1763 — both copies are in the same file, so extract the block into 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) mistralrs-cli/src/commands/run/interactive.rs:1946— mistralrs-cli/src/commands/run/interactive.rs:1946-1961 | mistralrs-cli/src/commands/run/interactive.rs:2068-2083 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/gdn/layer.rs:137— mistralrs-core/src/gdn/layer.rs:137-152 | mistralrs-core/src/gdn/layer.rs:161-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.
Duplicated block (16 lines × 2) mistralrs-core/src/gdn/projection.rs:125— mistralrs-core/src/gdn/projection.rs:125-140 | mistralrs-core/src/gdn/projection.rs:157-172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) mistralrs-core/src/metal/gdn.rs:841— mistralrs-core/src/metal/gdn.rs:841-856 | mistralrs-core/src/metal/gdn.rs:880-895 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/models/qwen2.rs:393— mistralrs-core/src/models/qwen2.rs:393-408 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:473-488 — before extracting anything, compare `mistralrs-core/src/models/qwen2.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 149 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 × 2) mistralrs-core/src/ops.rs:1610— mistralrs-core/src/ops.rs:1610-1625 | mistralrs-core/src/ops.rs:1862-1877 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:5783— mistralrs-core/src/ops.rs:5783-5798 | mistralrs-core/src/ops.rs:6219-6234 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/embedding.rs:490— mistralrs-core/src/pipeline/embedding.rs:490-505 | mistralrs-core/src/pipeline/multimodal.rs:1050-1065 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/inputs_processor.rs:2215— mistralrs-core/src/pipeline/inputs_processor.rs:2215-2230 | mistralrs-core/src/pipeline/inputs_processor.rs:2304-2319 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1593— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1593-1608 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1629-1644 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2240— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2240-2255 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2278-2293 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6828— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6828-6843 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7292-7307 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/multimodal.rs:2633— mistralrs-core/src/pipeline/multimodal.rs:2633-2648 | mistralrs-core/src/pipeline/normal.rs:2271-2286 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/tools/parsers/liquid.rs:300— mistralrs-core/src/tools/parsers/liquid.rs:300-315 | mistralrs-core/src/tools/parsers/liquid.rs:338-353 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/utils/gguf_metadata.rs:329— mistralrs-core/src/utils/gguf_metadata.rs:329-344 | mistralrs-core/src/utils/gguf_metadata.rs:378-393 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/vision_models/gemma4/mod.rs:509— mistralrs-core/src/vision_models/gemma4/mod.rs:509-524 | mistralrs-core/src/vision_models/gemma4/mod.rs:822-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.
Duplicated block (16 lines × 2) mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:634— mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:634-649 | mistralrs-core/src/vision_models/llama4/inputs_processor.rs:577-592 — before extracting anything, compare `mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs` and `mistralrs-core/src/vision_models/llama4/inputs_processor.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 152 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 × 2) mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:468— mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:468-483 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:420-435 — before extracting anything, compare `mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs` and `mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 316 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 × 2) mistralrs-core/src/vision_models/mllama/text.rs:272— mistralrs-core/src/vision_models/mllama/text.rs:272-287 | mistralrs-core/src/vision_models/mllama/text.rs:631-646 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/vision_models/phi3/mod.rs:561— mistralrs-core/src/vision_models/phi3/mod.rs:561-576 | mistralrs-core/src/vision_models/phi4/image_embedding.rs:184-199 — before extracting anything, compare `mistralrs-core/src/vision_models/phi3/mod.rs` and `mistralrs-core/src/vision_models/phi4/image_embedding.rs` as WHOLE FILES: this scan already matched 8 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. 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 × 2) mistralrs-core/src/vision_models/phi3/mod.rs:1333— mistralrs-core/src/vision_models/phi3/mod.rs:1333-1348 | mistralrs-core/src/vision_models/phi4/mod.rs:495-510 — `mistralrs-core/src/vision_models/phi3/mod.rs` and `mistralrs-core/src/vision_models/phi4/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 46 separate duplicated blocks between them, totalling at least 537 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 (16 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:74— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:74-89 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:97-112 — `mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 21 separate duplicated blocks between them, totalling at least 374 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 (16 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:400— mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:400-415 | mistralrs-core/src/vision_models/qwen2vl/text.rs:401-416 — `mistralrs-core/src/vision_models/qwen2_5_vl/text.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 43 separate duplicated blocks between them, totalling at least 650 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 (16 lines × 2) mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:638— mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:638-653 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:578-593 — `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.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 52 separate duplicated blocks between them, totalling at least 1117 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.
mistralrs_quant::afq::ops::cuda_backend::afq_mm_op (cyclomatic 58) mistralrs-quant/src/afq/ops.rs:2950— mistralrs_quant::afq::ops::cuda_backend::afq_mm_op has cyclomatic complexity 58 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mistralrs_quant::metal_kernels::afq_qmm_dispatch (cyclomatic 41) mistralrs-quant/src/metal_kernels/mod.rs:946— mistralrs_quant::metal_kernels::afq_qmm_dispatch has cyclomatic complexity 41 (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.
mistralrs_quant::afq::ops::cuda_backend::afq_quantize_op (cyclomatic 36) mistralrs-quant/src/afq/ops.rs:1937— mistralrs_quant::afq::ops::cuda_backend::afq_quantize_op has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: mistralrs_quant::afq::ops::cuda_backend::afq_dequantize_op (cyclomatic 52) 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.
mistralrs_quant::distributed::layers::load_packed_weights (cyclomatic 36) mistralrs-quant/src/distributed/layers.rs:439— mistralrs_quant::distributed::layers::load_packed_weights 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.
mistralrs_quant::gguf::weight_source::infer_binding_shape (cyclomatic 34) mistralrs-quant/src/gguf/weight_source.rs:1120— mistralrs_quant::gguf::weight_source::infer_binding_shape has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_quant::mxfp4::ops::mxfp4_indexed_moe_gemm (cyclomatic 29) mistralrs-quant/src/mxfp4/ops.rs:313— mistralrs_quant::mxfp4::ops::mxfp4_indexed_moe_gemm has cyclomatic complexity 29 (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.
mistralrs_quant::afq::ops::afq_mm_op (cyclomatic 28) mistralrs-quant/src/afq/ops.rs:342— mistralrs_quant::afq::ops::afq_mm_op 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. This is NOT this file's highest cyclomatic complexity: mistralrs_quant::afq::ops::cuda_backend::afq_dequantize_op (cyclomatic 52) 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.
mistralrs_quant::try_fused_quantized_ffn (cyclomatic 27) mistralrs-quant/src/lib.rs:2181— mistralrs_quant::try_fused_quantized_ffn has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mistralrs_quant::cutile::nvfp4::launch (cyclomatic 26) mistralrs-quant/src/cutile/nvfp4.rs:151— mistralrs_quant::cutile::nvfp4::launch has cyclomatic complexity 26 (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.
mistralrs_quant::lora::dynamic::expert_cuda::launch_projection (cyclomatic 26) mistralrs-quant/src/lora/dynamic/expert_cuda.rs:784— mistralrs_quant::lora::dynamic::expert_cuda::launch_projection 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.
mistralrs_quant::try_fused_quantized_qkv (cyclomatic 25) mistralrs-quant/src/lib.rs:2401— mistralrs_quant::try_fused_quantized_qkv 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.
mistralrs_quant::try_fused_gate_up_metal (cyclomatic 24) mistralrs-quant/src/lib.rs:2568— mistralrs_quant::try_fused_gate_up_metal has cyclomatic complexity 24 (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.
mistralrs_quant::fp8_config::compressed_tensors_spec (cyclomatic 24) mistralrs-quant/src/fp8_config.rs:930— mistralrs_quant::fp8_config::compressed_tensors_spec 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.
mistralrs_quant::mxfp4::metal_ops::mxfp4_indexed_moe_gemm (cyclomatic 24) mistralrs-quant/src/mxfp4/metal_ops.rs:173— mistralrs_quant::mxfp4::metal_ops::mxfp4_indexed_moe_gemm has cyclomatic complexity 24 (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.
mistralrs_quant::try_fused_quantized_gate_up (cyclomatic 23) mistralrs-quant/src/lib.rs:2291— mistralrs_quant::try_fused_quantized_gate_up has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mistralrs_quant::blockwise_fp8::ops::fused_add_rms_norm_quantized_impl (cyclomatic 23) mistralrs-quant/src/blockwise_fp8/ops.rs:1764— mistralrs_quant::blockwise_fp8::ops::fused_add_rms_norm_quantized_impl has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mistralrs_quant::gptq::gptq_cuda::gptq_linear (cyclomatic 23) mistralrs-quant/src/gptq/gptq_cuda.rs:451— mistralrs_quant::gptq::gptq_cuda::gptq_linear has cyclomatic complexity 23 (threshold 15). Of this number, 19 points are the body's own statements and 4 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.
mistralrs_quant::lora::dynamic::expert::add_expert_delta_reference (cyclomatic 23) mistralrs-quant/src/lora/dynamic/expert.rs:705— mistralrs_quant::lora::dynamic::expert::add_expert_delta_reference has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_quant::cutile::fp8_w8a8::launch (cyclomatic 22) mistralrs-quant/src/cutile/fp8_w8a8.rs:510— mistralrs_quant::cutile::fp8_w8a8::launch 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.
mistralrs_quant::gguf::fast_mmq::shared_lhs (cyclomatic 22) mistralrs-quant/src/gguf/fast_mmq.rs:528— mistralrs_quant::gguf::fast_mmq::shared_lhs 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.
mistralrs_quant::try_fused_qkv_metal (cyclomatic 21) mistralrs-quant/src/lib.rs:2706— mistralrs_quant::try_fused_qkv_metal 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. This is NOT this file's highest cyclomatic complexity: IsqType::fmt (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
mistralrs_quant::cutile::fp8_w8a16::launch (cyclomatic 21) mistralrs-quant/src/cutile/fp8_w8a16.rs:503— mistralrs_quant::cutile::fp8_w8a16::launch has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
mistralrs_quant::cutile::nvfp4_matmul::launch_gather (cyclomatic 21) mistralrs-quant/src/cutile/nvfp4_matmul.rs:1377— mistralrs_quant::cutile::nvfp4_matmul::launch_gather 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.
mistralrs_quant::cutile::routed_lora::routed_lora_kernel::routed_lora_one_shot (cyclomatic 21) mistralrs-quant/src/cutile/routed_lora.rs:69— mistralrs_quant::cutile::routed_lora::routed_lora_kernel::routed_lora_one_shot 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.
mistralrs_quant::gguf::fast_mmvq::fused_qkv (cyclomatic 21) mistralrs-quant/src/gguf/fast_mmvq.rs:682— mistralrs_quant::gguf::fast_mmvq::fused_qkv 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. This is NOT this file's highest cyclomatic complexity: mistralrs_quant::gguf::fast_mmvq::fused_glu_launcher (cyclomatic 31) 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.
TodoComment mistralrs-vision/src/ops.rs:18— // TODO(EricLBuehler): https://github.com/huggingface/candle/pull/2223 will make this nicer
TodoComment mistralrs-server-core/src/mistralrs_for_server_builder.rs:1332— // TODO: replace with best device? — 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 mistralrs-quant/src/lib.rs:919— // TODO(EricLBuehler): Optimize this by using the gemm parameter? — 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 mistralrs-quant/src/lib.rs:926— // TODO(EricLBuehler): Optimize this by using the gemm parameter? — 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 mistralrs-quant/src/unquantized/mod.rs:430— // TODO just warn? — 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 mistralrs-quant/src/unquantized/mod.rs:463— // TODO just warn? — 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 mistralrs-quant/src/unquantized/mod.rs:555— // TODO just warn? — 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 mistralrs-quant/src/blockwise_fp8/mod.rs:959— // TODO just warn? — 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 mistralrs-quant/src/blockwise_fp8/mod.rs:993— // TODO just warn? — 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 mistralrs-quant/src/blockwise_fp8/mod.rs:1050— // TODO just warn? — 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 mistralrs-quant/src/hqq/quantize.rs:29— // TODO we need min_all — 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 mistralrs-quant/src/gptq/gptq_cuda.rs:353— // 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 mistralrs-core/src/request.rs:204— // 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 mistralrs-core/src/request.rs:206— // 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 mistralrs-core/src/pipeline/ggml.rs:603— // 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 mistralrs-core/src/models/quantized_llama.rs:221— // 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 mistralrs-quant/src/bitsandbytes/mod.rs:122— // TODO: can `nested_blocksize` be None, default to 64 like bnb? — 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 mistralrs-flash-attn/src/flash.rs:85— // TODO: Handle head sizes that are not a multiple of 8 via some padding. — 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 mistralrs-flash-attn/src/flash.rs:610— // TODO: Handle head sizes that are not a multiple of 8 via some padding. — 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 mistralrs-core/src/utils/model_config.rs:77— // TODO: `from_mmaped_safetensors` has `xlora_paths` as the 2nd param (_valid but params need to be named better_) — 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 mistralrs-core/src/utils/progress.rs:64— // TODO: Should `is_silent` instead be referenced as a global read-only state? (`AtomicBool`) — 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 mistralrs-core/src/utils/varbuilder_utils.rs:181— // TODO(EricLBuehler): separation of concerns. — 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 mistralrs-core/src/utils/varbuilder_utils.rs:212— // TODO(EricLBuehler): separation of concerns. — 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 mistralrs-core/src/utils/varbuilder_utils.rs:314— // TODO: Add better context to describe intent / requirement: — 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 mistralrs-core/src/speech_models/bs1770.rs:390— // TODO: Should this branch be marked cold? — 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 (14 lines × 2) mistralrs-core/src/cuda/gdn.rs:928— mistralrs-core/src/cuda/gdn.rs:928-941 | mistralrs-core/src/cuda/gdn.rs:1054-1067 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/cuda/gdn.rs:4816— mistralrs-core/src/cuda/gdn.rs:4816-4829 | mistralrs-core/src/cuda/gdn.rs:5073-5086 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/gdn/projection.rs:141— mistralrs-core/src/gdn/projection.rs:141-154 | mistralrs-core/src/gdn/projection.rs:216-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 (14 lines × 2) mistralrs-core/src/model_loader.rs:575— mistralrs-core/src/model_loader.rs:575-588 | mistralrs-core/src/toml_selector.rs:907-920 — before extracting anything, compare `mistralrs-core/src/model_loader.rs` and `mistralrs-core/src/toml_selector.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 156 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 2) mistralrs-core/src/models/granite.rs:1292— mistralrs-core/src/models/granite.rs:1292-1305 | mistralrs-core/src/models/granite.rs:1314-1327 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/models/phi2.rs:215— mistralrs-core/src/models/phi2.rs:215-228 | mistralrs-core/src/xlora_models/phi2.rs:179-192 — `mistralrs-core/src/models/phi2.rs` and `mistralrs-core/src/xlora_models/phi2.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 7 separate duplicated blocks between them, totalling at least 75 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 (14 lines × 2) mistralrs-core/src/models/phi2.rs:453— mistralrs-core/src/models/phi2.rs:453-466 | mistralrs-core/src/xlora_models/phi2.rs:426-439 — `mistralrs-core/src/models/phi2.rs` and `mistralrs-core/src/xlora_models/phi2.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 7 separate duplicated blocks between them, totalling at least 75 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 (14 lines × 2) mistralrs-core/src/models/starcoder2.rs:341— mistralrs-core/src/models/starcoder2.rs:341-354 | mistralrs-core/src/xlora_models/starcoder2.rs:328-341 — `mistralrs-core/src/models/starcoder2.rs` and `mistralrs-core/src/xlora_models/starcoder2.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 7 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.
Duplicated block (14 lines × 2) mistralrs-core/src/ops.rs:3063— mistralrs-core/src/ops.rs:3063-3076 | mistralrs-core/src/ops.rs:3522-3535 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1750— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1750-1763 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6090-6103 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4016— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4016-4029 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4279-4292 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/vision_models/gemma3n/text.rs:1790— mistralrs-core/src/vision_models/gemma3n/text.rs:1790-1803 | mistralrs-core/src/vision_models/gemma3n/text.rs:1896-1909 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/vision_models/llama4/inputs_processor.rs:653— mistralrs-core/src/vision_models/llama4/inputs_processor.rs:653-666 | mistralrs-core/src/vision_models/mllama/inputs_processor.rs:509-523 — `mistralrs-core/src/vision_models/llama4/inputs_processor.rs` and `mistralrs-core/src/vision_models/mllama/inputs_processor.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 66 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 (14 lines × 2) mistralrs-core/src/vision_models/phi3/mod.rs:611— mistralrs-core/src/vision_models/phi3/mod.rs:611-624 | mistralrs-core/src/vision_models/phi4/image_embedding.rs:234-247 — before extracting anything, compare `mistralrs-core/src/vision_models/phi3/mod.rs` and `mistralrs-core/src/vision_models/phi4/image_embedding.rs` as WHOLE FILES: this scan already matched 8 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. 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 (14 lines × 2) mistralrs-core/src/vision_models/phi3/mod.rs:1168— mistralrs-core/src/vision_models/phi3/mod.rs:1168-1181 | mistralrs-core/src/vision_models/phi4/image_embedding.rs:825-838 — before extracting anything, compare `mistralrs-core/src/vision_models/phi3/mod.rs` and `mistralrs-core/src/vision_models/phi4/image_embedding.rs` as WHOLE FILES: this scan already matched 8 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. 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 (14 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/config.rs:101— mistralrs-core/src/vision_models/qwen2_5_vl/config.rs:101-114 | mistralrs-core/src/vision_models/qwen2vl/config.rs:75-88 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (14 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:337— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:337-350 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:493-506 — `mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 21 separate duplicated blocks between them, totalling at least 374 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 (14 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:196— mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:196-209 | mistralrs-core/src/vision_models/qwen2vl/vision.rs:167-180 — `mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 18 separate duplicated blocks between them, totalling at least 176 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 (14 lines × 2) mistralrs-core/src/vision_models/qwen3_5/text.rs:1264— mistralrs-core/src/vision_models/qwen3_5/text.rs:1264-1277 | mistralrs-core/src/vision_models/qwen4_exp/text.rs:689-702 — `mistralrs-core/src/vision_models/qwen3_5/text.rs` and `mistralrs-core/src/vision_models/qwen4_exp/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 5 separate duplicated blocks between them, totalling at least 60 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 (14 lines × 2) mistralrs-paged-attn/src/cuda/backend/gather_kv.rs:120— mistralrs-paged-attn/src/cuda/backend/gather_kv.rs:120-133 | mistralrs-paged-attn/src/metal/backend/gather_kv.rs:75-88 — before extracting anything, compare `mistralrs-paged-attn/src/cuda/backend/gather_kv.rs` and `mistralrs-paged-attn/src/metal/backend/gather_kv.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (14 lines × 2) mistralrs-quant/src/afq/ops.rs:1641— mistralrs-quant/src/afq/ops.rs:1641-1654 | mistralrs-quant/src/afq/ops.rs:1706-1719 — both copies are in the same file, so extract the block into 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) mistralrs-quant/src/blockwise_fp8/ops.rs:824— mistralrs-quant/src/blockwise_fp8/ops.rs:824-837 | mistralrs-quant/src/blockwise_fp8/ops.rs:944-957 — both copies are in the same file, so extract the block into 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) mistralrs-quant/src/blockwise_fp8/ops.rs:844— mistralrs-quant/src/blockwise_fp8/ops.rs:844-857 | mistralrs-quant/src/blockwise_fp8/ops.rs:962-975 — both copies are in the same file, so extract the block into 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) mistralrs-quant/src/cutile/nvfp4_glu.rs:48— mistralrs-quant/src/cutile/nvfp4_glu.rs:48-61 | mistralrs-quant/src/cutile/nvfp4_glu.rs:205-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.
Duplicated block (14 lines × 2) mistralrs-quant/src/cutile/nvfp4_glu.rs:492— mistralrs-quant/src/cutile/nvfp4_glu.rs:492-505 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1033-1046 — before extracting anything, compare `mistralrs-quant/src/cutile/nvfp4_glu.rs` and `mistralrs-quant/src/cutile/nvfp4_matmul.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 103 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 lines × 2) mistralrs-cli/src/commands/run/interactive.rs:1900— mistralrs-cli/src/commands/run/interactive.rs:1900-1917 | mistralrs-cli/src/commands/run/interactive.rs:2025-2042 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/adapter/runtime.rs:677— mistralrs-core/src/adapter/runtime.rs:677-694 | mistralrs-core/src/adapter/runtime.rs:718-735 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) mistralrs-core/src/attention/backends/cpu/neon.rs:403— mistralrs-core/src/attention/backends/cpu/neon.rs:403-420 | mistralrs-core/src/attention/backends/cpu/neon.rs:640-657 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) mistralrs-core/src/cuda/gdn.rs:1919— mistralrs-core/src/cuda/gdn.rs:1919-1936 | mistralrs-core/src/cuda/gdn.rs:5786-5803 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/embedding_models/qwen3_embedding.rs:357— mistralrs-core/src/embedding_models/qwen3_embedding.rs:357-374 | mistralrs-core/src/models/qwen3.rs:430-447 — `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/qwen3.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 27 separate duplicated blocks between them, totalling at least 372 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 (18 lines × 2) mistralrs-core/src/models/hunyuan_v1_dense.rs:542— mistralrs-core/src/models/hunyuan_v1_dense.rs:542-559 | mistralrs-core/src/models/hunyuan_v1_moe.rs:1036-1053 — before extracting anything, compare `mistralrs-core/src/models/hunyuan_v1_dense.rs` and `mistralrs-core/src/models/hunyuan_v1_moe.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 690 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 lines × 2) mistralrs-core/src/models/llama.rs:492— mistralrs-core/src/models/llama.rs:492-509 | mistralrs-core/src/models/smollm3.rs:511-528 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 lines × 2) mistralrs-core/src/models/mistral.rs:533— mistralrs-core/src/models/mistral.rs:533-550 | mistralrs-core/src/models/mixtral.rs:488-505 — before extracting anything, compare `mistralrs-core/src/models/mistral.rs` and `mistralrs-core/src/models/mixtral.rs` as WHOLE FILES: this scan already matched 43 separate duplicated blocks between them, totalling at least 564 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 lines × 2) mistralrs-core/src/pipeline/gguf.rs:884— mistralrs-core/src/pipeline/gguf.rs:884-901 | mistralrs-core/src/pipeline/gguf.rs:1036-1053 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) mistralrs-core/src/pipeline/inputs_processor.rs:2242— mistralrs-core/src/pipeline/inputs_processor.rs:2242-2259 | mistralrs-core/src/pipeline/inputs_processor.rs:2278-2295 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1724— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1724-1741 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2024-2041 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/multimodal.rs:1993— mistralrs-core/src/pipeline/multimodal.rs:1993-2010 | mistralrs-core/src/pipeline/normal.rs:2361-2378 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:2179— mistralrs-core/src/pipeline/multimodal.rs:2179-2196 | mistralrs-core/src/pipeline/normal.rs:1991-2008 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 lines × 2) mistralrs-core/src/vision_models/gemma3n/audio.rs:517— mistralrs-core/src/vision_models/gemma3n/audio.rs:517-534 | mistralrs-core/src/vision_models/gemma4/audio.rs:583-600 — `mistralrs-core/src/vision_models/gemma3n/audio.rs` and `mistralrs-core/src/vision_models/gemma4/audio.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 16 separate duplicated blocks between them, totalling at least 279 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 (18 lines × 2) mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1778— mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1778-1795 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:774-791 — `mistralrs-core/src/vision_models/gemma4/inputs_processor.rs` and `mistralrs-core/src/vision_models/mistral3/inputs_processor.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 8 separate duplicated blocks between them, totalling at least 121 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 (18 lines × 2) mistralrs-core/src/vision_models/gemma4/mod.rs:400— mistralrs-core/src/vision_models/gemma4/mod.rs:400-417 | mistralrs-core/src/vision_models/gemma4/mod.rs:713-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.
Duplicated block (18 lines × 2) REDACTED:654— REDACTED:654-671 | mistralrs-core/src/vision_models/siglip.rs:485-502 — before extracting anything, compare `REDACTED` and `mistralrs-core/src/vision_models/siglip.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 248 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 (18 lines × 2) mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:437— mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:437-454 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:269-286 — `mistralrs-core/src/vision_models/idefics3/inputs_processor.rs` and `mistralrs-core/src/vision_models/mistral3/inputs_processor.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 157 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 (18 lines × 2) mistralrs-core/src/vision_models/idefics3/vision.rs:325— mistralrs-core/src/vision_models/idefics3/vision.rs:325-342 | mistralrs-core/src/vision_models/siglip.rs:336-353 — before extracting anything, compare `mistralrs-core/src/vision_models/idefics3/vision.rs` and `mistralrs-core/src/vision_models/siglip.rs` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 263 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 (18 lines × 2) mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:288— mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:288-305 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:324-341 — before extracting anything, compare `mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs` and `mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 206 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 lines × 2) mistralrs-core/src/vision_models/llava/llava_next.rs:442— mistralrs-core/src/vision_models/llava/llava_next.rs:442-459 | mistralrs-core/src/vision_models/phi3/mod.rs:1104-1121 — 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 (18 lines × 2) mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:580— mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:580-597 | mistralrs-core/src/vision_models/phi4/inputs_processor.rs:1374-1391 — `mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs` and `mistralrs-core/src/vision_models/phi4/inputs_processor.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 50 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 (18 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:247— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:247-264 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:813-830 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (18 lines × 2) mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:215— mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:215-232 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:162-179 — `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.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 52 separate duplicated blocks between them, totalling at least 1117 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 (18 lines × 2) mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:327— mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:327-344 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:443-460 — `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.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 52 separate duplicated blocks between them, totalling at least 1117 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 (17 lines × 2) mistralrs-cli/src/commands/run/interactive.rs:278— mistralrs-cli/src/commands/run/interactive.rs:278-294 | mistralrs-cli/src/commands/run/interactive.rs:461-477 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) mistralrs-cli/src/commands/run/mod.rs:95— mistralrs-cli/src/commands/run/mod.rs:95-111 | mistralrs-cli/src/commands/serve.rs:106-122 — before extracting anything, compare `mistralrs-cli/src/commands/run/mod.rs` and `mistralrs-cli/src/commands/serve.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (17 lines × 2) mistralrs-core/src/mla/forward.rs:572— mistralrs-core/src/mla/forward.rs:572-588 | mistralrs-core/src/mla/forward.rs:590-606 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) mistralrs-core/src/models/glm4_moe.rs:235— mistralrs-core/src/models/glm4_moe.rs:235-251 | mistralrs-core/src/models/hunyuan_v1_moe.rs:337-353 — before extracting anything, compare `mistralrs-core/src/models/glm4_moe.rs` and `mistralrs-core/src/models/hunyuan_v1_moe.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 253 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/granite.rs:2245— mistralrs-core/src/models/granite.rs:2245-2261 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:532-548 — before extracting anything, compare `mistralrs-core/src/models/granite.rs` and `mistralrs-core/src/vision_models/llava/llava_llm/llama.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 151 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 (17 lines × 2) mistralrs-core/src/ops.rs:5830— mistralrs-core/src/ops.rs:5830-5846 | mistralrs-core/src/ops.rs:6593-6609 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) mistralrs-core/src/pipeline/ggml.rs:571— mistralrs-core/src/pipeline/ggml.rs:571-587 | mistralrs-core/src/pipeline/gguf.rs:1680-1696 — before extracting anything, compare `mistralrs-core/src/pipeline/ggml.rs` and `mistralrs-core/src/pipeline/gguf.rs` as WHOLE FILES: this scan already matched 7 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.
Duplicated block (17 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4059— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4059-4075 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4094-4110 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:491— mistralrs-core/src/pipeline/multimodal.rs:491-507 | mistralrs-core/src/pipeline/normal.rs:619-635 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/multimodal.rs:863— mistralrs-core/src/pipeline/multimodal.rs:863-879 | mistralrs-core/src/pipeline/normal.rs:863-879 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/multimodal.rs:1694— mistralrs-core/src/pipeline/multimodal.rs:1694-1710 | mistralrs-core/src/pipeline/normal.rs:1617-1633 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/multimodal.rs:1736— mistralrs-core/src/pipeline/multimodal.rs:1736-1752 | mistralrs-core/src/pipeline/normal.rs:1658-1674 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/tools/state.rs:291— mistralrs-core/src/tools/state.rs:291-307 | mistralrs-core/src/tools/state.rs:339-355 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:221— mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:221-237 | mistralrs-core/src/vision_models/qwen2vl/text.rs:222-238 — `mistralrs-core/src/vision_models/qwen2_5_vl/text.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 43 separate duplicated blocks between them, totalling at least 650 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 (17 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:179— mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:179-195 | mistralrs-core/src/vision_models/qwen2vl/vision.rs:150-166 — `mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 18 separate duplicated blocks between them, totalling at least 176 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 (17 lines × 2) mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:249— mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:249-265 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:368-384 — `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.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 52 separate duplicated blocks between them, totalling at least 1117 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 (17 lines × 2) mistralrs-core/src/vision_models/qwen3_5/text.rs:1813— mistralrs-core/src/vision_models/qwen3_5/text.rs:1813-1829 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:933-949 — `mistralrs-core/src/vision_models/qwen3_5/text.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 26 separate duplicated blocks between them, totalling at least 428 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 (17 lines × 2) mistralrs-core/src/vision_models/qwen3_vl/mod.rs:708— mistralrs-core/src/vision_models/qwen3_vl/mod.rs:708-724 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:153-169 — `mistralrs-core/src/vision_models/qwen3_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/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 29 separate duplicated blocks between them, totalling at least 505 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 (17 lines × 2) mistralrs-core/src/vision_models/qwen3_vl/mod.rs:728— mistralrs-core/src/vision_models/qwen3_vl/mod.rs:728-744 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:173-189 — `mistralrs-core/src/vision_models/qwen3_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/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 29 separate duplicated blocks between them, totalling at least 505 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 (17 lines × 2) mistralrs-core/src/vision_models/qwen3_vl/mod.rs:784— mistralrs-core/src/vision_models/qwen3_vl/mod.rs:784-800 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:229-245 — `mistralrs-core/src/vision_models/qwen3_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/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 29 separate duplicated blocks between them, totalling at least 505 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 (17 lines × 2) mistralrs-core/src/vision_models/qwen3_vl/mod.rs:803— mistralrs-core/src/vision_models/qwen3_vl/mod.rs:803-819 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:248-264 — `mistralrs-core/src/vision_models/qwen3_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/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 29 separate duplicated blocks between them, totalling at least 505 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 (17 lines × 2) mistralrs-core/src/xlora_models/gemma.rs:82— mistralrs-core/src/xlora_models/gemma.rs:82-98 | mistralrs-core/src/xlora_models/gemma2.rs:76-92 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/xlora_models/mistral.rs:523— mistralrs-core/src/xlora_models/mistral.rs:523-539 | mistralrs-core/src/xlora_models/mixtral.rs:653-669 — before extracting anything, compare `mistralrs-core/src/xlora_models/mistral.rs` and `mistralrs-core/src/xlora_models/mixtral.rs` as WHOLE FILES: this scan already matched 52 separate duplicated blocks between them, totalling at least 769 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/xlora_models/quantized_llama.rs:734— mistralrs-core/src/xlora_models/quantized_llama.rs:734-750 | mistralrs-core/src/xlora_models/quantized_phi3.rs:396-412 — before extracting anything, compare `mistralrs-core/src/xlora_models/quantized_llama.rs` and `mistralrs-core/src/xlora_models/quantized_phi3.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 221 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:284— mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:284-300 | mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:683-699 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
+ 8 more in this group — see findings.md.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×31
Members sharing a duplicated core (4 members, 50+ identical tokens) mistralrs-cli/src/commands/config.rs:38— mistralrs-cli/src/commands/config.rs:38-201 | mistralrs-cli/src/commands/config.rs:203-316 | mistralrs-cli/src/commands/run/mod.rs:41-191 | mistralrs-cli/src/commands/serve.rs:44-220 — 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) mistralrs-core/src/distributed.rs:174— mistralrs-core/src/distributed.rs:174-218 | mistralrs-core/src/distributed.rs:220-264 | mistralrs-core/src/distributed.rs:266-304 | mistralrs-core/src/distributed.rs:306-344 — 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) mistralrs-core/src/layers.rs:1111— mistralrs-core/src/layers.rs:1111-1216 | mistralrs-core/src/layers.rs:1223-1306 | mistralrs-core/src/layers.rs:1313-1390 | mistralrs-core/src/layers.rs:1470-1575 — 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) mistralrs-core/src/models/deepseek2.rs:615— mistralrs-core/src/models/deepseek2.rs:615-663 | mistralrs-core/src/models/deepseek3.rs:678-726 | mistralrs-core/src/models/glm4_moe.rs:520-566 | mistralrs-core/src/models/glm4_moe_lite.rs:624-672 — 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) mistralrs-core/src/models/deepseek2.rs:665— mistralrs-core/src/models/deepseek2.rs:665-682 | mistralrs-core/src/models/deepseek3.rs:728-745 | mistralrs-core/src/models/glm4_moe.rs:568-582 | mistralrs-core/src/models/glm4_moe_lite.rs:674-691 — 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) mistralrs-core/src/models/deepseek2.rs:779— mistralrs-core/src/models/deepseek2.rs:779-790 | mistralrs-core/src/models/deepseek3.rs:842-853 | mistralrs-core/src/models/glm4_moe.rs:679-690 | mistralrs-core/src/models/glm4_moe_lite.rs:789-800 — 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) mistralrs-core/src/models/granite.rs:648— mistralrs-core/src/models/granite.rs:648-678 | mistralrs-core/src/models/lfm2.rs:589-620 | mistralrs-core/src/models/qwen3_next.rs:543-575 | mistralrs-core/src/vision_models/qwen3_5/packed_gdn.rs:20-50 — 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) mistralrs-core/src/models/granite.rs:1630— mistralrs-core/src/models/granite.rs:1630-1694 | mistralrs-core/src/models/llama.rs:165-231 | mistralrs-core/src/models/smollm3.rs:182-248 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:139-204 — 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) mistralrs-core/src/models/llama.rs:519— mistralrs-core/src/models/llama.rs:519-530 | mistralrs-core/src/models/smollm3.rs:538-549 | mistralrs-core/src/vision_models/llama4/text.rs:1018-1029 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:505-516 — 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) mistralrs-core/src/pipeline/cuda_graph.rs:3846— mistralrs-core/src/pipeline/cuda_graph.rs:3846-3856 | mistralrs-core/src/pipeline/cuda_graph.rs:3864-3874 | mistralrs-core/src/pipeline/cuda_graph.rs:3883-3893 | mistralrs-core/src/pipeline/cuda_graph.rs:3902-3912 — 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3054— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3054-3126 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3403-3468 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3749-3850 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4521-4595 — 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) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:714— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:714-725 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1849-1860 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2541-2552 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4367-4378 — 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) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2983— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2983-3046 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3316-3379 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4557-4615 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4876-4932 — 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) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3158— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3158-3239 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3491-3572 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4718-4799 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5030-5110 — 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) mistralrs-core/src/sampler.rs:1163— mistralrs-core/src/sampler.rs:1163-1190 | mistralrs-core/src/sampler.rs:1199-1270 | mistralrs-core/src/sampler.rs:1649-1739 | mistralrs-core/src/sampler.rs:1858-1885 — 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) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:272— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:272-380 | mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:125-350 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:691-916 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:783-1017 — 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) mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:222— mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:222-264 | mistralrs-core/src/vision_models/llama4/inputs_processor.rs:226-265 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:181-202 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:137-158 — 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) REDACTED:686— REDACTED:686-704 | mistralrs-core/src/vision_models/idefics3/vision.rs:505-523 | mistralrs-core/src/vision_models/lfm2_vl/vision.rs:384-400 | mistralrs-core/src/vision_models/siglip.rs:528-546 — 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) mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:287— mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:287-630 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:323-648 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:296-567 | mistralrs-core/src/vision_models/phi4/inputs_processor.rs:343-572 — 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) mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:243— mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:243-307 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:323-648 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:224-280 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:296-567 — 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) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:471— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:471-488 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:627-644 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:1094-1111 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:523-540 — 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) mistralrs-core/src/xlora_models/gemma.rs:152— mistralrs-core/src/xlora_models/gemma.rs:152-219 | mistralrs-core/src/xlora_models/mistral.rs:146-209 | mistralrs-core/src/xlora_models/mixtral.rs:59-122 | mistralrs-core/src/xlora_models/phi3.rs:58-99 — 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) mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:62— mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:62-93 | mistralrs-quant/src/gguf/cuda.rs:108-135 | mistralrs-quant/src/gguf/fast_mmq.rs:344-368 | mistralrs-quant/src/gguf/fast_mmvq.rs:86-112 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) mistralrs-pyo3/src/lib.rs:1292— mistralrs-pyo3/src/lib.rs:1292-1662 | mistralrs-pyo3/src/lib.rs:1776-1878 | mistralrs-pyo3/src/lib.rs:2253-2623 | mistralrs-pyo3/src/lib.rs:2630-2732 — 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) mistralrs-quant/src/afq/ops.rs:133— mistralrs-quant/src/afq/ops.rs:133-220 | mistralrs-quant/src/afq/ops.rs:229-321 | mistralrs-quant/src/afq/ops.rs:352-633 | mistralrs-quant/src/afq/ops.rs:794-899 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Duplicated block (19 lines × 2) mistralrs-cli/src/commands/run/interactive.rs:886— mistralrs-cli/src/commands/run/interactive.rs:886-904 | mistralrs-cli/src/commands/run/interactive.rs:1566-1584 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) mistralrs-cli/src/commands/run/interactive.rs:931— mistralrs-cli/src/commands/run/interactive.rs:931-949 | mistralrs-cli/src/commands/run/interactive.rs:1611-1629 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) mistralrs-core/src/cuda/gdn.rs:965— mistralrs-core/src/cuda/gdn.rs:965-983 | mistralrs-core/src/cuda/gdn.rs:1211-1229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) mistralrs-core/src/cuda/gdn.rs:3405— mistralrs-core/src/cuda/gdn.rs:3405-3423 | mistralrs-core/src/cuda/gdn.rs:3956-3974 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) mistralrs-core/src/models/gemma.rs:275— mistralrs-core/src/models/gemma.rs:275-293 | mistralrs-core/src/models/gemma2.rs:326-344 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/phi3.rs:298— mistralrs-core/src/models/phi3.rs:298-316 | mistralrs-core/src/vision_models/phi3/mod.rs:389-407 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/vision_models/phi3/mod.rs` as WHOLE FILES: this scan already matched 47 separate duplicated blocks between them, totalling at least 594 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 (19 lines × 2) mistralrs-core/src/models/qwen3_next.rs:416— mistralrs-core/src/models/qwen3_next.rs:416-434 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:322-340 — before extracting anything, compare `mistralrs-core/src/models/qwen3_next.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/text.rs` as WHOLE FILES: this scan already matched 29 separate duplicated blocks between them, totalling at least 433 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 (19 lines × 2) mistralrs-core/src/ops.rs:1672— mistralrs-core/src/ops.rs:1672-1690 | mistralrs-core/src/ops.rs:1943-1961 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) mistralrs-core/src/ops.rs:4697— mistralrs-core/src/ops.rs:4697-4715 | mistralrs-core/src/ops.rs:5540-5558 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) mistralrs-core/src/ops.rs:5800— mistralrs-core/src/ops.rs:5800-5818 | mistralrs-core/src/ops.rs:6236-6254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) mistralrs-core/src/pipeline/embedding.rs:303— mistralrs-core/src/pipeline/embedding.rs:303-321 | mistralrs-core/src/pipeline/embedding.rs:327-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.
Duplicated block (19 lines × 2) mistralrs-core/src/pipeline/inputs_processor.rs:2675— mistralrs-core/src/pipeline/inputs_processor.rs:2675-2693 | mistralrs-core/src/pipeline/inputs_processor.rs:2824-2842 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:724— mistralrs-core/src/pipeline/multimodal.rs:724-742 | mistralrs-core/src/pipeline/normal.rs:1067-1085 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/multimodal.rs:1795— mistralrs-core/src/pipeline/multimodal.rs:1795-1813 | mistralrs-core/src/pipeline/normal.rs:1716-1734 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/multimodal.rs:1815— mistralrs-core/src/pipeline/multimodal.rs:1815-1833 | mistralrs-core/src/pipeline/normal.rs:1736-1754 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/multimodal.rs:2203— mistralrs-core/src/pipeline/multimodal.rs:2203-2221 | mistralrs-core/src/pipeline/normal.rs:2009-2027 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/multimodal.rs:3268— mistralrs-core/src/pipeline/multimodal.rs:3268-3286 | mistralrs-core/src/pipeline/normal.rs:2868-2886 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/prefix_cacher.rs:411— mistralrs-core/src/prefix_cacher.rs:411-429 | mistralrs-core/src/prefix_cacher.rs:439-457 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) mistralrs-core/src/speculative/driver.rs:219— mistralrs-core/src/speculative/driver.rs:219-237 | mistralrs-core/src/speculative/driver.rs:242-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:858— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:858-876 | mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:776-794 — `mistralrs-core/src/vision_models/gemma3/inputs_processor.rs` and `mistralrs-core/src/vision_models/gemma3n/inputs_processor.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 75 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 (19 lines × 2) mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:779— mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:779-797 | mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:1000-1018 — before extracting anything, compare `mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs` and `mistralrs-core/src/vision_models/idefics3/inputs_processor.rs` as WHOLE FILES: this scan already matched 7 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. 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 (19 lines × 2) mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:395— mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:395-413 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:362-380 — before extracting anything, compare `mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs` and `mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 316 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 (19 lines × 2) mistralrs-core/src/vision_models/phi3/mod.rs:1256— mistralrs-core/src/vision_models/phi3/mod.rs:1256-1274 | mistralrs-core/src/vision_models/phi4/mod.rs:371-389 — `mistralrs-core/src/vision_models/phi3/mod.rs` and `mistralrs-core/src/vision_models/phi4/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 46 separate duplicated blocks between them, totalling at least 537 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 (19 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:538— mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:538-556 | mistralrs-core/src/vision_models/qwen2vl/text.rs:540-558 — `mistralrs-core/src/vision_models/qwen2_5_vl/text.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 43 separate duplicated blocks between them, totalling at least 650 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 (19 lines × 2) mistralrs-paged-attn/src/cuda/backend/mla.rs:773— mistralrs-paged-attn/src/cuda/backend/mla.rs:773-791 | mistralrs-paged-attn/src/cuda/backend/mla.rs:811-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.
Duplicated block (11 lines × 3) mistralrs-core/src/cuda/gdn.rs:908— mistralrs-core/src/cuda/gdn.rs:908-918 | mistralrs-core/src/cuda/gdn.rs:1032-1042 | mistralrs-core/src/cuda/gdn.rs:1143-1153 — 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) mistralrs-core/src/gdn/weights.rs:223— mistralrs-core/src/gdn/weights.rs:223-233 | mistralrs-core/src/gdn/weights.rs:252-262 | mistralrs-core/src/gdn/weights.rs:293-303 — 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) mistralrs-core/src/layers.rs:1169— mistralrs-core/src/layers.rs:1169-1179 | mistralrs-core/src/layers.rs:1259-1269 | mistralrs-core/src/layers.rs:1528-1538 — 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) mistralrs-core/src/models/deepseek2.rs:1053— mistralrs-core/src/models/deepseek2.rs:1053-1063 | mistralrs-core/src/models/deepseek3.rs:1118-1128 | mistralrs-core/src/models/glm4_moe_lite.rs:1072-1082 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/phi3.rs:183— mistralrs-core/src/models/phi3.rs:183-193 | mistralrs-core/src/vision_models/phi3/mod.rs:274-284 | mistralrs-core/src/vision_models/phi4/mod.rs:143-153 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/vision_models/phi3/mod.rs` as WHOLE FILES: this scan already matched 47 separate duplicated blocks between them, totalling at least 594 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 (11 lines × 3) mistralrs-core/src/models/qwen3_next.rs:196— mistralrs-core/src/models/qwen3_next.rs:196-208 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:101-113 | mistralrs-core/src/vision_models/qwen4_exp/qsa.rs:104-114 — before extracting anything, compare `mistralrs-core/src/models/qwen3_next.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/text.rs` as WHOLE FILES: this scan already matched 29 separate duplicated blocks between them, totalling at least 433 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 (11 lines × 3) mistralrs-core/src/ops.rs:194— mistralrs-core/src/ops.rs:194-204 | mistralrs-core/src/ops.rs:517-527 | mistralrs-core/src/ops.rs:641-651 — 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1222— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1222-1232 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3002-3012 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3351-3361 — 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2593— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2593-2603 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3302-3312 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4021-4031 — 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7701— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7701-7711 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8223-8233 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6562-6572 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/vision_models/gemma3/text.rs:451— mistralrs-core/src/vision_models/gemma3/text.rs:451-461 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:407-417 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:527-537 — `mistralrs-core/src/vision_models/gemma3/text.rs` and `mistralrs-core/src/vision_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 13 separate duplicated blocks between them, totalling at least 114 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 (11 lines × 3) mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1240— mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1240-1256 | mistralrs-core/src/vision_models/phi4/inputs_processor.rs:630-640 | mistralrs-core/src/vision_models/phi4/inputs_processor.rs:866-881 — `mistralrs-core/src/vision_models/gemma4/inputs_processor.rs` and `mistralrs-core/src/vision_models/phi4/inputs_processor.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 46 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 (11 lines × 3) REDACTED:638— REDACTED:638-648 | mistralrs-core/src/vision_models/idefics3/vision.rs:436-446 | mistralrs-core/src/vision_models/siglip.rs:454-464 — before extracting anything, compare `REDACTED` and `mistralrs-core/src/vision_models/idefics3/vision.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 213 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 (11 lines × 3) mistralrs-core/src/vision_models/muse_glimmer/mod.rs:143— mistralrs-core/src/vision_models/muse_glimmer/mod.rs:143-153 | mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:126-136 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:149-159 — `mistralrs-core/src/vision_models/muse_glimmer/mod.rs` and `mistralrs-core/src/vision_models/qwen2_5_vl/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 5 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.
Duplicated block (11 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1132— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1132-1142 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1697-1707 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1893-1903 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (11 lines × 3) mistralrs-quant/src/afq/ops.rs:2395— mistralrs-quant/src/afq/ops.rs:2395-2405 | mistralrs-quant/src/afq/ops.rs:2421-2431 | mistralrs-quant/src/afq/ops.rs:2447-2457 — 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) mistralrs-quant/src/cutile/fp8_gemm.rs:145— mistralrs-quant/src/cutile/fp8_gemm.rs:145-155 | mistralrs-quant/src/cutile/fp8_w8a16.rs:324-334 | mistralrs-quant/src/cutile/fp8_w8a8.rs:280-290 — before extracting anything, compare `mistralrs-quant/src/cutile/fp8_gemm.rs` and `mistralrs-quant/src/cutile/fp8_w8a16.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 3) mistralrs-quant/src/hqq/mod.rs:264— mistralrs-quant/src/hqq/mod.rs:264-274 | mistralrs-quant/src/hqq/mod.rs:358-368 | mistralrs-quant/src/hqq/mod.rs:507-517 — 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) mistralrs-quant/src/metal_kernels/mod.rs:1718— mistralrs-quant/src/metal_kernels/mod.rs:1718-1728 | mistralrs-quant/src/metal_kernels/mod.rs:1783-1793 | mistralrs-quant/src/metal_kernels/mod.rs:1853-1863 — 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) mistralrs-core/src/models/qwen2.rs:131— mistralrs-core/src/models/qwen2.rs:131-141 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:26-36 | mistralrs-core/src/vision_models/qwen2vl/text.rs:27-37 — before extracting anything, compare `mistralrs-core/src/models/qwen2.rs` and `mistralrs-core/src/vision_models/qwen2_5_vl/text.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 295 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 (11 lines × 3) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:846— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:846-856 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3636-3646 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1832-1842 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/cuda/gdn.rs:4911— mistralrs-core/src/cuda/gdn.rs:4911-4921 | mistralrs-core/src/cuda/gdn.rs:5111-5122 | mistralrs-core/src/cuda/gdn.rs:5338-5348 — 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) mistralrs-core/src/sampler.rs:1293— mistralrs-core/src/sampler.rs:1293-1304 | mistralrs-core/src/sampler.rs:1536-1546 | mistralrs-core/src/sampler.rs:1703-1713 — 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) mistralrs-core/src/ops.rs:4409— mistralrs-core/src/ops.rs:4409-4419 | mistralrs-core/src/ops.rs:4594-4604 | mistralrs-core/src/ops.rs:5357-5367 — 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) mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:808— mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:808-818 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:211-221 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:167-177 — before extracting anything, compare `mistralrs-core/src/vision_models/gemma4/inputs_processor.rs` and `mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 45 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 × 3) mistralrs-core/src/cuda/gdn.rs:1648— mistralrs-core/src/cuda/gdn.rs:1648-1657 | mistralrs-core/src/cuda/gdn.rs:5523-5532 | mistralrs-core/src/cuda/gdn.rs:5767-5776 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) mistralrs-core/src/layers.rs:1207— mistralrs-core/src/layers.rs:1207-1216 | mistralrs-core/src/layers.rs:1297-1306 | mistralrs-core/src/layers.rs:1566-1575 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) mistralrs-core/src/layers.rs:3071— mistralrs-core/src/layers.rs:3071-3080 | mistralrs-core/src/layers.rs:3204-3213 | mistralrs-core/src/vision_models/gemma4/text.rs:149-161 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (10 lines × 3) mistralrs-core/src/metal/gdn.rs:843— mistralrs-core/src/metal/gdn.rs:843-852 | mistralrs-core/src/metal/gdn.rs:882-891 | mistralrs-core/src/metal/ssm.rs:184-193 — before extracting anything, compare `mistralrs-core/src/metal/gdn.rs` and `mistralrs-core/src/metal/ssm.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/ops.rs:5881— mistralrs-core/src/ops.rs:5881-5890 | mistralrs-core/src/ops.rs:6326-6335 | mistralrs-core/src/ops.rs:6644-6653 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) mistralrs-core/src/pipeline/embedding.rs:558— mistralrs-core/src/pipeline/embedding.rs:558-567 | mistralrs-core/src/pipeline/multimodal.rs:1085-1094 | mistralrs-core/src/pipeline/normal.rs:1105-1114 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/ggml.rs:571— mistralrs-core/src/pipeline/ggml.rs:571-580 | mistralrs-core/src/pipeline/gguf.rs:1669-1678 | mistralrs-core/src/pipeline/gguf.rs:1680-1689 — before extracting anything, compare `mistralrs-core/src/pipeline/ggml.rs` and `mistralrs-core/src/pipeline/gguf.rs` as WHOLE FILES: this scan already matched 7 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.
Duplicated block (10 lines × 3) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:634— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:634-643 | mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:653-662 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:422-431 — `mistralrs-core/src/vision_models/gemma3/inputs_processor.rs` and `mistralrs-core/src/vision_models/idefics3/inputs_processor.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 9 separate duplicated blocks between them, totalling at least 138 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 × 3) mistralrs-core/src/vision_models/gemma4/mod.rs:389— mistralrs-core/src/vision_models/gemma4/mod.rs:389-398 | mistralrs-core/src/vision_models/gemma4/mod.rs:565-574 | mistralrs-core/src/vision_models/gemma4/mod.rs:702-711 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) mistralrs-core/src/vision_models/llama4/vision.rs:202— mistralrs-core/src/vision_models/llama4/vision.rs:202-211 | mistralrs-core/src/vision_models/mllama/text.rs:566-575 | mistralrs-core/src/vision_models/mllama/vision.rs:221-230 — `mistralrs-core/src/vision_models/llama4/vision.rs` and `mistralrs-core/src/vision_models/mllama/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 6 separate duplicated blocks between them, totalling at least 67 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 × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:914— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:914-923 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1479-1488 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1601-1610 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1076— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1076-1085 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1641-1650 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1839-1848 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 × 3) mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:139— mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:139-148 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:325-334 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:613-622 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) mistralrs-paged-attn/src/cuda/backend/mla.rs:47— mistralrs-paged-attn/src/cuda/backend/mla.rs:47-56 | mistralrs-paged-attn/src/cuda/backend/mla.rs:334-343 | mistralrs-paged-attn/src/cuda/backend/mla.rs:689-698 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) mistralrs-quant/src/bitsandbytes/op.rs:449— mistralrs-quant/src/bitsandbytes/op.rs:449-458 | mistralrs-quant/src/bitsandbytes/op.rs:462-471 | mistralrs-quant/src/bitsandbytes/op.rs:475-484 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) mistralrs-quant/src/blockwise_fp8/deepgemm.rs:527— mistralrs-quant/src/blockwise_fp8/deepgemm.rs:527-536 | mistralrs-quant/src/blockwise_fp8/deepgemm.rs:630-639 | mistralrs-quant/src/blockwise_fp8/ops.rs:2092-2101 — before extracting anything, compare `mistralrs-quant/src/blockwise_fp8/deepgemm.rs` and `mistralrs-quant/src/blockwise_fp8/ops.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.
Duplicated block (10 lines × 3) mistralrs-quant/src/cutile/routed_lora.rs:166— mistralrs-quant/src/cutile/routed_lora.rs:166-175 | mistralrs-quant/src/cutile/routed_lora.rs:194-203 | mistralrs-quant/src/cutile/routed_lora.rs:217-226 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) mistralrs-quant/src/gemv/mod.rs:381— mistralrs-quant/src/gemv/mod.rs:381-390 | mistralrs-quant/src/gemv/mod.rs:450-459 | mistralrs-quant/src/gemv/mod.rs:518-527 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) mistralrs-quant/src/gguf/fast_mmvq.rs:339— mistralrs-quant/src/gguf/fast_mmvq.rs:339-348 | mistralrs-quant/src/gguf/fast_mmvq.rs:540-549 | mistralrs-quant/src/gguf/fast_mmvq.rs:755-764 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) mistralrs-quant/src/moe/cuda.rs:246— mistralrs-quant/src/moe/cuda.rs:246-255 | mistralrs-quant/src/moe/cuda.rs:282-291 | mistralrs-quant/src/moe/cuda.rs:323-332 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) mistralrs-quant/src/cutile/fused_moe_fp8.rs:281— mistralrs-quant/src/cutile/fused_moe_fp8.rs:281-290 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:292-301 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:302-313 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) mistralrs-quant/src/cutile/fused_moe_fp8.rs:326— mistralrs-quant/src/cutile/fused_moe_fp8.rs:326-335 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:337-346 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:347-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.
Duplicated block (10 lines × 3) mistralrs-quant/src/metal_kernels/mod.rs:2772— mistralrs-quant/src/metal_kernels/mod.rs:2772-2781 | mistralrs-quant/src/metal_kernels/mod.rs:2852-2861 | mistralrs-quant/src/metal_kernels/mod.rs:2887-2896 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) mistralrs-core/src/vision_models/gemma4/mod.rs:526— mistralrs-core/src/vision_models/gemma4/mod.rs:526-535 | mistralrs-core/src/vision_models/gemma4/mod.rs:649-658 | mistralrs-core/src/vision_models/gemma4/mod.rs:839-848 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) mistralrs-core/src/ops.rs:4396— mistralrs-core/src/ops.rs:4396-4405 | mistralrs-core/src/ops.rs:4581-4590 | mistralrs-core/src/ops.rs:5340-5349 — 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) mistralrs-cli/src/commands/bench.rs:157— mistralrs-cli/src/commands/bench.rs:157-162 | mistralrs-cli/src/commands/config.rs:283-288 | mistralrs-cli/src/commands/run/mod.rs:127-132 — 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) mistralrs-core/src/attention/backends/cpu/avx.rs:318— mistralrs-core/src/attention/backends/cpu/avx.rs:318-323 | mistralrs-core/src/attention/backends/cpu/neon.rs:386-391 | mistralrs-core/src/attention/backends/cpu/neon.rs:625-630 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 3) mistralrs-core/src/cuda/gdn.rs:1675— mistralrs-core/src/cuda/gdn.rs:1675-1680 | mistralrs-core/src/cuda/gdn.rs:5561-5566 | mistralrs-core/src/cuda/moe.rs:56-61 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 3) mistralrs-core/src/cuda/gdn.rs:1918— mistralrs-core/src/cuda/gdn.rs:1918-1923 | mistralrs-core/src/cuda/gdn.rs:2745-2750 | mistralrs-core/src/cuda/gdn.rs:5785-5790 — 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) mistralrs-core/src/cuda/gdn.rs:1925— mistralrs-core/src/cuda/gdn.rs:1925-1930 | mistralrs-core/src/cuda/gdn.rs:2755-2760 | mistralrs-core/src/cuda/gdn.rs:5792-5797 — 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) mistralrs-core/src/embedding_models/qwen3_embedding.rs:454— mistralrs-core/src/embedding_models/qwen3_embedding.rs:454-459 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:523-528 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:644-649 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/vision_models/qwen3_vl/text.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 79 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) mistralrs-core/src/layers.rs:1635— mistralrs-core/src/layers.rs:1635-1640 | mistralrs-core/src/layers.rs:1798-1806 | mistralrs-core/src/layers.rs:1946-1951 — 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) mistralrs-core/src/models/granite.rs:1570— mistralrs-core/src/models/granite.rs:1570-1575 | mistralrs-core/src/vision_models/phi3/mod.rs:272-277 | mistralrs-core/src/vision_models/phi4/mod.rs:141-146 — before extracting anything, compare `mistralrs-core/src/models/granite.rs` and `mistralrs-core/src/vision_models/phi3/mod.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 134 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) mistralrs-core/src/moe/experts/backends.rs:923— mistralrs-core/src/moe/experts/backends.rs:923-928 | mistralrs-core/src/moe/experts/backends.rs:1003-1008 | mistralrs-quant/src/moe/cutlass.rs:149-154 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 3) mistralrs-core/src/pipeline/embedding.rs:261— mistralrs-core/src/pipeline/embedding.rs:261-266 | mistralrs-core/src/pipeline/gguf.rs:1398-1403 | mistralrs-core/src/pipeline/multimodal.rs:684-689 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/vision_models/muse_glimmer/mod.rs:338— mistralrs-core/src/vision_models/muse_glimmer/mod.rs:338-343 | mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:432-437 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:588-593 — `mistralrs-core/src/vision_models/muse_glimmer/mod.rs` and `mistralrs-core/src/vision_models/qwen2_5_vl/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 5 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.
Duplicated block (6 lines × 3) mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:28— mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:28-33 | mistralrs-quant/src/utils/ops.rs:2231-2236 | mistralrs-quant/src/utils/ops.rs:2455-2460 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 3) mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:66— mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:66-71 | mistralrs-quant/src/gguf/fast_mmq.rs:353-358 | mistralrs-quant/src/gguf/fast_mmvq.rs:95-100 — before extracting anything, compare `mistralrs-quant/src/gguf/fast_mmq.rs` and `mistralrs-quant/src/gguf/fast_mmvq.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) mistralrs-quant/src/afq/ops.rs:2376— mistralrs-quant/src/afq/ops.rs:2376-2381 | mistralrs-quant/src/afq/ops.rs:2496-2501 | mistralrs-quant/src/afq/ops.rs:3022-3027 — 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) mistralrs-quant/src/metal_kernels/mod.rs:408— mistralrs-quant/src/metal_kernels/mod.rs:408-413 | mistralrs-quant/src/metal_kernels/mod.rs:583-591 | mistralrs-quant/src/metal_kernels/mod.rs:3231-3241 — 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) mistralrs-quant/src/metal_kernels/mod.rs:1314— mistralrs-quant/src/metal_kernels/mod.rs:1314-1319 | mistralrs-quant/src/metal_kernels/mod.rs:1325-1330 | mistralrs-quant/src/metal_kernels/mod.rs:1360-1365 — 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) mistralrs-quant/src/metal_kernels/mod.rs:1528— mistralrs-quant/src/metal_kernels/mod.rs:1528-1533 | mistralrs-quant/src/metal_kernels/mod.rs:1607-1612 | mistralrs-quant/src/metal_kernels/mod.rs:4745-4750 — 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) mistralrs-core/src/gguf/multimodal_binding_utils.rs:131— mistralrs-core/src/gguf/multimodal_binding_utils.rs:131-136 | mistralrs-core/src/gguf/multimodal_bindings.rs:652-657 | mistralrs-core/src/gguf/qwen_multimodal_bindings.rs:817-822 — before extracting anything, compare `mistralrs-core/src/gguf/multimodal_binding_utils.rs` and `mistralrs-core/src/gguf/qwen_multimodal_bindings.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/phi3.rs:281— mistralrs-core/src/models/phi3.rs:281-286 | mistralrs-core/src/vision_models/phi3/mod.rs:372-377 | mistralrs-core/src/vision_models/phi4/mod.rs:235-240 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/vision_models/phi3/mod.rs` as WHOLE FILES: this scan already matched 47 separate duplicated blocks between them, totalling at least 594 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) mistralrs-core/src/pipeline/ggml.rs:521— mistralrs-core/src/pipeline/ggml.rs:521-526 | mistralrs-core/src/pipeline/gguf.rs:1622-1627 | mistralrs-core/src/pipeline/normal.rs:1695-1700 — before extracting anything, compare `mistralrs-core/src/pipeline/ggml.rs` and `mistralrs-core/src/pipeline/gguf.rs` as WHOLE FILES: this scan already matched 7 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.
Duplicated block (6 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:211— mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:211-216 | mistralrs-core/src/vision_models/qwen2vl/vision.rs:182-187 | mistralrs-core/src/vision_models/qwen3_vl/vision.rs:210-215 — `mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 18 separate duplicated blocks between them, totalling at least 176 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 (6 lines × 3) mistralrs-core/src/cuda/speculative_rejection.rs:1329— mistralrs-core/src/cuda/speculative_rejection.rs:1329-1336 | mistralrs-core/src/cuda/speculative_rejection.rs:1337-1342 | mistralrs-core/src/cuda/speculative_rejection.rs:1343-1348 — 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) mistralrs-quant/src/scalar_fp8/ops.rs:140— mistralrs-quant/src/scalar_fp8/ops.rs:140-145 | mistralrs-quant/src/scalar_fp8/ops.rs:299-304 | mistralrs-quant/src/vector_fp8/ops.rs:195-200 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 3) mistralrs-cli/src/ui/handlers/api.rs:202— mistralrs-cli/src/ui/handlers/api.rs:202-207 | mistralrs-cli/src/ui/handlers/api.rs:254-259 | mistralrs-cli/src/ui/handlers/api.rs:306-311 — 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) mistralrs-core/src/tools/parsers/atem.rs:377— mistralrs-core/src/tools/parsers/atem.rs:377-382 | mistralrs-core/src/tools/parsers/deepseek.rs:57-62 | mistralrs-core/src/tools/parsers/harmony.rs:13-18 — 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.
Duplicated block (5 lines × 3) mistralrs-core/src/cuda/gdn.rs:2160— mistralrs-core/src/cuda/gdn.rs:2160-2165 | mistralrs-core/src/cuda/gdn.rs:2171-2175 | mistralrs-core/src/cuda/gdn.rs:2181-2185 — 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) mistralrs-core/src/layers.rs:1198— mistralrs-core/src/layers.rs:1198-1202 | mistralrs-core/src/layers.rs:1288-1292 | mistralrs-core/src/layers.rs:1557-1561 — 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) mistralrs-core/src/metal/gdn.rs:191— mistralrs-core/src/metal/gdn.rs:191-195 | mistralrs-core/src/metal/gdn.rs:306-310 | mistralrs-core/src/metal/ssm.rs:168-172 — before extracting anything, compare `mistralrs-core/src/metal/gdn.rs` and `mistralrs-core/src/metal/ssm.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/metal/gdn.rs:606— mistralrs-core/src/metal/gdn.rs:606-610 | mistralrs-core/src/metal/gdn.rs:782-786 | mistralrs-core/src/metal/gdn.rs:968-972 — 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) mistralrs-core/src/models/deepseek3.rs:504— mistralrs-core/src/models/deepseek3.rs:504-508 | mistralrs-core/src/models/glm4_moe.rs:429-433 | mistralrs-core/src/models/glm4_moe_lite.rs:525-529 — before extracting anything, compare `mistralrs-core/src/models/deepseek3.rs` and `mistralrs-core/src/models/glm4_moe.rs` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 425 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/phi3.rs:144— mistralrs-core/src/models/phi3.rs:144-148 | mistralrs-core/src/vision_models/phi3/mod.rs:236-240 | mistralrs-core/src/vision_models/phi4/mod.rs:105-109 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/vision_models/phi3/mod.rs` as WHOLE FILES: this scan already matched 47 separate duplicated blocks between them, totalling at least 594 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) mistralrs-core/src/ops.rs:4207— mistralrs-core/src/ops.rs:4207-4211 | mistralrs-core/src/ops.rs:4835-4841 | mistralrs-quant/src/metal_fp8.rs:75-80 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:269— mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:269-273 | mistralrs-core/src/vision_models/qwen2vl/vision.rs:241-245 | mistralrs-core/src/vision_models/qwen3_vl/vision.rs:265-269 — `mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 18 separate duplicated blocks between them, totalling at least 176 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 (5 lines × 3) mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:918— mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:918-922 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:543-547 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:664-668 — `mistralrs-core/src/vision_models/qwen3_5_moe/text.rs` and `mistralrs-core/src/vision_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 18 separate duplicated blocks between them, totalling at least 203 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 (5 lines × 3) mistralrs-quant/src/afq/ops.rs:1977— mistralrs-quant/src/afq/ops.rs:1977-1981 | mistralrs-quant/src/afq/ops.rs:2095-2099 | mistralrs-quant/src/afq/ops.rs:2213-2217 — 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) mistralrs-quant/src/cutile/fp8_w8a16.rs:549— mistralrs-quant/src/cutile/fp8_w8a16.rs:549-554 | mistralrs-quant/src/cutile/fp8_w8a8.rs:575-580 | mistralrs-quant/src/cutile/nvfp4_gemv.rs:295-299 — before extracting anything, compare `mistralrs-quant/src/cutile/fp8_w8a16.rs` and `mistralrs-quant/src/cutile/fp8_w8a8.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 212 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-quant/src/gguf/fast_mmvq.rs:356— mistralrs-quant/src/gguf/fast_mmvq.rs:356-360 | mistralrs-quant/src/gguf/fast_mmvq.rs:560-564 | mistralrs-quant/src/gguf/fast_mmvq.rs:777-781 — 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) mistralrs-quant/src/gguf/fast_mmvq.rs:394— mistralrs-quant/src/gguf/fast_mmvq.rs:394-398 | mistralrs-quant/src/gguf/fast_mmvq.rs:599-603 | mistralrs-quant/src/gguf/fast_mmvq.rs:832-836 — 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) mistralrs-quant/src/hqq/mod.rs:474— mistralrs-quant/src/hqq/mod.rs:474-478 | mistralrs-quant/src/hqq/mod.rs:536-541 | mistralrs-quant/src/hqq/mod.rs:559-564 — 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) mistralrs-core/src/kv_cache/mod.rs:510— mistralrs-core/src/kv_cache/mod.rs:510-514 | mistralrs-core/src/kv_cache/mod.rs:541-545 | mistralrs-core/src/kv_cache/mod.rs:654-658 — 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) mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:338— mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:338-342 | mistralrs-core/src/vision_models/qwen2vl/vision.rs:310-314 | mistralrs-core/src/vision_models/qwen3_vl/vision.rs:356-360 — `mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 18 separate duplicated blocks between them, totalling at least 176 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 (5 lines × 3) mistralrs-quant/src/gptq/gptq_cuda.rs:105— mistralrs-quant/src/gptq/gptq_cuda.rs:105-109 | mistralrs-quant/src/gptq/gptq_cuda.rs:128-133 | mistralrs-quant/src/gptq/gptq_cuda.rs:150-155 — 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) mistralrs-core/src/cuda/gdn.rs:2985— mistralrs-core/src/cuda/gdn.rs:2985-2989 | mistralrs-core/src/cuda/gdn.rs:4676-4680 | mistralrs-core/src/cuda/gdn.rs:4712-4716 — 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) mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:75— mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:75-79 | mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:243-247 | mistralrs-quant/src/gptq/marlin_backend.rs:76-80 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 3) mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:499— mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:499-503 | mistralrs-paged-attn/src/cuda/backend/gather_kv.rs:234-238 | mistralrs-paged-attn/src/cuda/backend/gather_kv.rs:245-249 — before extracting anything, compare `mistralrs-paged-attn/src/cuda/backend/flashinfer.rs` and `mistralrs-paged-attn/src/cuda/backend/gather_kv.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 3) mistralrs-core/src/gguf/multimodal_binding_utils.rs:120— mistralrs-core/src/gguf/multimodal_binding_utils.rs:120-124 | mistralrs-core/src/gguf/normal_bindings.rs:907-911 | mistralrs-core/src/gguf/qwen_multimodal_bindings.rs:306-310 — before extracting anything, compare `mistralrs-core/src/gguf/multimodal_binding_utils.rs` and `mistralrs-core/src/gguf/qwen_multimodal_bindings.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-quant/src/blockwise_fp8/deepgemm.rs:446— mistralrs-quant/src/blockwise_fp8/deepgemm.rs:446-450 | mistralrs-quant/src/cutile/fp8_w8a16.rs:525-529 | mistralrs-quant/src/cutile/fp8_w8a8.rs:540-544 — before extracting anything, compare `mistralrs-quant/src/cutile/fp8_w8a16.rs` and `mistralrs-quant/src/cutile/fp8_w8a8.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 212 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:137— mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:137-141 | mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:306-310 | mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:440-444 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 3) mistralrs-core/src/vision_models/gemma3n/mod.rs:85— mistralrs-core/src/vision_models/gemma3n/mod.rs:85-89 | mistralrs-core/src/vision_models/gemma3n/mod.rs:194-198 | mistralrs-core/src/vision_models/multimodal_layout.rs:344-348 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:135— mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:135-139 | mistralrs-core/src/vision_models/qwen2vl/vision.rs:106-110 | mistralrs-core/src/vision_models/qwen3_vl/vision.rs:109-113 — `mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 18 separate duplicated blocks between them, totalling at least 176 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 (21 lines × 2) mistralrs-cli/src/commands/config.rs:102— mistralrs-cli/src/commands/config.rs:102-122 | mistralrs-cli/src/commands/config.rs:262-282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) mistralrs-cli/src/commands/run/interactive.rs:315— mistralrs-cli/src/commands/run/interactive.rs:315-335 | mistralrs-cli/src/commands/run/interactive.rs:498-518 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) mistralrs-core/src/diffusion_models/flux/model.rs:314— mistralrs-core/src/diffusion_models/flux/model.rs:314-334 | mistralrs-core/src/diffusion_models/flux/model.rs:546-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.
Duplicated block (21 lines × 2) mistralrs-core/src/embedding_models/embedding_gemma.rs:523— mistralrs-core/src/embedding_models/embedding_gemma.rs:523-543 | mistralrs-core/src/vision_models/gemma3/text.rs:842-862 — before extracting anything, compare `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/vision_models/gemma3/text.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 268 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 (21 lines × 2) mistralrs-core/src/layers.rs:1115— mistralrs-core/src/layers.rs:1115-1135 | mistralrs-core/src/layers.rs:1474-1494 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) mistralrs-core/src/ops.rs:1498— mistralrs-core/src/ops.rs:1498-1518 | mistralrs-core/src/ops.rs:1720-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.
Duplicated block (21 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4929— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4929-4949 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5340-5360 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6532— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6532-6552 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6933-6953 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7410— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7410-7430 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7885-7905 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:546— mistralrs-core/src/pipeline/multimodal.rs:546-566 | mistralrs-core/src/pipeline/normal.rs:673-693 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:810— mistralrs-core/src/pipeline/multimodal.rs:810-830 | mistralrs-core/src/pipeline/multimodal.rs:875-895 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:1415— mistralrs-core/src/pipeline/multimodal.rs:1415-1435 | mistralrs-core/src/pipeline/normal.rs:1452-1472 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:2222— mistralrs-core/src/pipeline/multimodal.rs:2222-2242 | mistralrs-core/src/pipeline/normal.rs:2027-2047 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) mistralrs-core/src/speculative/dflash.rs:1894— mistralrs-core/src/speculative/dflash.rs:1894-1914 | mistralrs-core/src/speculative/dflash.rs:1987-2007 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:279— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:279-299 | mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:585-605 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:313— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:313-333 | mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:622-642 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1177— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1177-1197 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1742-1762 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (21 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:356— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:356-376 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:512-532 — `mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 21 separate duplicated blocks between them, totalling at least 374 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 (21 lines × 2) mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:845— mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:845-865 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1193-1213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:879— mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:879-899 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1230-1250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) mistralrs-core/src/xlora_models/phi2.rs:315— mistralrs-core/src/xlora_models/phi2.rs:315-335 | mistralrs-core/src/xlora_models/starcoder2.rs:311-331 — before extracting anything, compare `mistralrs-core/src/xlora_models/phi2.rs` and `mistralrs-core/src/xlora_models/starcoder2.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 302 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) mistralrs-quant/src/blockwise_fp8/ops.rs:1104— mistralrs-quant/src/blockwise_fp8/ops.rs:1104-1124 | mistralrs-quant/src/blockwise_fp8/ops.rs:1139-1159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) mistralrs-quant/src/distributed/layers.rs:873— mistralrs-quant/src/distributed/layers.rs:873-893 | mistralrs-quant/src/distributed/layers.rs:1340-1360 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) mistralrs-quant/src/metal_kernels/mod.rs:3873— mistralrs-quant/src/metal_kernels/mod.rs:3873-3893 | mistralrs-quant/src/metal_kernels/mod.rs:3963-3983 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) scripts/production_soak.py:3216— scripts/production_soak.py:3216-3236 | scripts/production_soak.py:4112-4132 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/production_soak.py:3216` 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) mistralrs-core/src/models/gemma2.rs:588— mistralrs-core/src/models/gemma2.rs:588-594 | mistralrs-core/src/vision_models/gemma3/text.rs:758-764 | mistralrs-core/src/vision_models/gemma3n/text.rs:1923-1929 — before extracting anything, compare `mistralrs-core/src/models/gemma2.rs` and `mistralrs-core/src/vision_models/gemma3/text.rs` as WHOLE FILES: this scan already matched 30 separate duplicated blocks between them, totalling at least 362 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 (7 lines × 3) mistralrs-core/src/models/granite.rs:313— mistralrs-core/src/models/granite.rs:313-319 | mistralrs-core/src/xlora_models/mixtral.rs:383-389 | mistralrs-core/src/xlora_models/quantized_llama.rs:123-129 — before extracting anything, compare `mistralrs-core/src/xlora_models/mixtral.rs` and `mistralrs-core/src/xlora_models/quantized_llama.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/embedding.rs:622— mistralrs-core/src/pipeline/embedding.rs:622-628 | mistralrs-core/src/pipeline/multimodal.rs:1384-1390 | mistralrs-core/src/pipeline/normal.rs:1421-1427 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/inputs_processor.rs:1148— mistralrs-core/src/pipeline/inputs_processor.rs:1148-1154 | mistralrs-core/src/pipeline/inputs_processor.rs:1165-1171 | mistralrs-core/src/pipeline/inputs_processor.rs:1245-1251 — 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) mistralrs-core/src/pipeline/isq.rs:1192— mistralrs-core/src/pipeline/isq.rs:1192-1198 | mistralrs-core/src/pipeline/isq.rs:1201-1207 | mistralrs-core/src/pipeline/isq.rs:1210-1216 — 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) mistralrs-core/src/speech_models/dia/model.rs:335— mistralrs-core/src/speech_models/dia/model.rs:335-341 | mistralrs-core/src/speech_models/dia/model.rs:594-600 | mistralrs-core/src/speech_models/dia/model.rs:607-613 — 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) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:408— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:408-414 | mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:448-454 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:280-286 — `mistralrs-core/src/vision_models/gemma3/inputs_processor.rs` and `mistralrs-core/src/vision_models/idefics3/inputs_processor.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 9 separate duplicated blocks between them, totalling at least 138 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 (7 lines × 3) mistralrs-core/src/vision_models/gemma4/mod.rs:374— mistralrs-core/src/vision_models/gemma4/mod.rs:374-380 | mistralrs-core/src/vision_models/gemma4/mod.rs:558-564 | mistralrs-core/src/vision_models/gemma4/mod.rs:686-692 — 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) REDACTED:612— REDACTED:612-618 | mistralrs-core/src/vision_models/idefics3/vision.rs:409-415 | mistralrs-core/src/vision_models/siglip.rs:420-426 — before extracting anything, compare `REDACTED` and `mistralrs-core/src/vision_models/idefics3/vision.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 213 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 (7 lines × 3) REDACTED:698— REDACTED:698-704 | mistralrs-core/src/vision_models/idefics3/vision.rs:517-523 | mistralrs-core/src/vision_models/siglip.rs:540-546 — before extracting anything, compare `REDACTED` and `mistralrs-core/src/vision_models/idefics3/vision.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 213 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 (7 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:321— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:321-327 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:478-484 | mistralrs-core/src/vision_models/qwen4_exp/mod.rs:376-382 — `mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 21 separate duplicated blocks between them, totalling at least 374 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 (7 lines × 3) mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:579— mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:579-585 | mistralrs-paged-attn/src/cuda/backend/gather_kv.rs:109-115 | mistralrs-paged-attn/src/metal/backend/gather_kv.rs:64-70 — before extracting anything, compare `mistralrs-paged-attn/src/cuda/backend/flashinfer.rs` and `mistralrs-paged-attn/src/cuda/backend/gather_kv.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 3) mistralrs-paged-attn/src/cuda/backend/gather_kv.rs:15— mistralrs-paged-attn/src/cuda/backend/gather_kv.rs:15-21 | mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:40-46 | mistralrs-paged-attn/src/metal/backend/mod.rs:51-57 — 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 (7 lines × 3) mistralrs-paged-attn/src/metal/kernels/mod.rs:573— mistralrs-paged-attn/src/metal/kernels/mod.rs:573-579 | mistralrs-paged-attn/src/metal/kernels/mod.rs:717-723 | mistralrs-paged-attn/src/metal/kernels/mod.rs:987-993 — 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) mistralrs-pyo3/src/util.rs:242— mistralrs-pyo3/src/util.rs:242-248 | mistralrs-pyo3/src/util.rs:296-302 | mistralrs-pyo3/src/util.rs:356-362 — 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) mistralrs-quant/src/blockwise_fp8/mod.rs:330— mistralrs-quant/src/blockwise_fp8/mod.rs:330-336 | mistralrs-quant/src/blockwise_fp8/mod.rs:376-382 | mistralrs-quant/src/blockwise_fp8/mod.rs:682-688 — 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) mistralrs-quant/src/lora/dynamic/moe_cuda.rs:1028— mistralrs-quant/src/lora/dynamic/moe_cuda.rs:1028-1034 | mistralrs-quant/src/lora/dynamic/moe_cuda.rs:1047-1053 | mistralrs-quant/src/lora/dynamic/moe_cuda.rs:1066-1072 — 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) mistralrs-quant/src/lora/dynamic/moe_cuda.rs:1091— mistralrs-quant/src/lora/dynamic/moe_cuda.rs:1091-1097 | mistralrs-quant/src/lora/dynamic/moe_cuda.rs:1111-1117 | mistralrs-quant/src/lora/dynamic/moe_cuda.rs:1131-1137 — 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) mistralrs-quant/src/utils/ops.rs:622— mistralrs-quant/src/utils/ops.rs:622-628 | mistralrs-quant/src/utils/ops.rs:635-641 | mistralrs-quant/src/utils/ops.rs:648-654 — 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) mistralrs-core/src/gguf/multimodal_binding_utils.rs:96— mistralrs-core/src/gguf/multimodal_binding_utils.rs:96-102 | mistralrs-core/src/gguf/multimodal_bindings.rs:85-91 | mistralrs-core/src/gguf/qwen_multimodal_bindings.rs:262-268 — before extracting anything, compare `mistralrs-core/src/gguf/multimodal_binding_utils.rs` and `mistralrs-core/src/gguf/qwen_multimodal_bindings.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/llama.rs:590— mistralrs-core/src/models/llama.rs:590-596 | mistralrs-core/src/models/smollm3.rs:609-615 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:603-609 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/llama.rs:597— mistralrs-core/src/models/llama.rs:597-603 | mistralrs-core/src/models/smollm3.rs:616-622 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:610-616 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) REDACTED:620— REDACTED:620-626 | mistralrs-core/src/vision_models/idefics3/vision.rs:417-423 | mistralrs-core/src/vision_models/lfm2_vl/vision.rs:338-344 — before extracting anything, compare `REDACTED` and `mistralrs-core/src/vision_models/idefics3/vision.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 213 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 (7 lines × 3) mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:78— mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:78-84 | mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:246-252 | mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:250-256 — 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.
mistralrs_cli::commands::run::interactive::print_agentic_progress (cognitive 93) mistralrs-cli/src/commands/run/interactive.rs:1104— mistralrs_cli::commands::run::interactive::print_agentic_progress has cognitive complexity 93 (threshold 15). Drivers by points: loops 11 (41 pts), if/else 14 (35 pts), match/switch 7 (17 pts) (nesting depth added 61). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_cli::commands::run::interactive::multimodal_interactive_mode (cognitive 88) mistralrs-cli/src/commands/run/interactive.rs:1521— mistralrs_cli::commands::run::interactive::multimodal_interactive_mode has cognitive complexity 88 (threshold 15). Drivers by points: if/else 15 (38 pts), loops 7 (25 pts), match/switch 7 (23 pts), boolean chains 2 (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_cli::commands::bench::run_bench (cognitive 70) mistralrs-cli/src/commands/bench.rs:80— mistralrs_cli::commands::bench::run_bench has cognitive complexity 70 (threshold 15). Drivers by points: if/else 28 (48 pts), loops 9 (20 pts), boolean chains 2 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_cli::commands::doctor::run_doctor (cognitive 49) mistralrs-cli/src/commands/doctor.rs:6— mistralrs_cli::commands::doctor::run_doctor has cognitive complexity 49 (threshold 15). Drivers by points: if/else 30 (41 pts), match/switch 2 (5 pts), loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_cli::commands::run::interactive::stream_assistant_response (cognitive 35) mistralrs-cli/src/commands/run/interactive.rs:1408— mistralrs_cli::commands::run::interactive::stream_assistant_response has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (30 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_cli::commands::serve::apply_quant_resolution (cognitive 35) mistralrs-cli/src/commands/serve.rs:977— mistralrs_cli::commands::serve::apply_quant_resolution has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 9 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_cli::commands::run::interactive::agent_approval_callback (cognitive 29) mistralrs-cli/src/commands/run/interactive.rs:1314— mistralrs_cli::commands::run::interactive::agent_approval_callback has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (10 pts), match/switch 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_cli::commands::run::interactive::text_interactive_mode (cognitive 28) mistralrs-cli/src/commands/run/interactive.rs:863— mistralrs_cli::commands::run::interactive::text_interactive_mode has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 3 (7 pts), boolean chains 1, loops 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.
mistralrs_cli::commands::quantize::generate_model_card (cognitive 26) mistralrs-cli/src/commands/quantize.rs:378— mistralrs_cli::commands::quantize::generate_model_card has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (24 pts), loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_cli::commands::quantize::run_quantize (cognitive 25) mistralrs-cli/src/commands/quantize.rs:237— mistralrs_cli::commands::quantize::run_quantize has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_cli::commands::tune::run_tune (cognitive 25) mistralrs-cli/src/commands/tune.rs:14— mistralrs_cli::commands::tune::run_tune has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (15 pts), loops 3 (5 pts), match/switch 3 (5 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
mistralrs_cli::commands::uqff::uqff_groups (cognitive 25) mistralrs-cli/src/commands/uqff.rs:332— mistralrs_cli::commands::uqff::uqff_groups has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 4 (7 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.
mistralrs_cli::commands::quantize::resolve_gguf_source (cognitive 24) mistralrs-cli/src/commands/quantize.rs:104— mistralrs_cli::commands::quantize::resolve_gguf_source has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 5 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_cli::commands::quant::gguf_discovery::resolve_gguf_projector (cognitive 23) mistralrs-cli/src/commands/quant/gguf_discovery.rs:208— mistralrs_cli::commands::quant::gguf_discovery::resolve_gguf_projector has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (6 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_cli::commands::run::interactive::handle_sampling_command (cognitive 22) mistralrs-cli/src/commands/run/interactive.rs:737— mistralrs_cli::commands::run::interactive::handle_sampling_command has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 3 (9 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.
mistralrs_cli::commands::serve::convert_to_model_selected (cognitive 21) mistralrs-cli/src/commands/serve.rs:295— mistralrs_cli::commands::serve::convert_to_model_selected has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 4 (9 pts), boolean chains 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
mistralrs_cli::commands::quant::gguf_discovery::build_groups (cognitive 20) mistralrs-cli/src/commands/quant/gguf_discovery.rs:394— mistralrs_cli::commands::quant::gguf_discovery::build_groups has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_cli::commands::uqff::natural_sort_key (cognitive 20) mistralrs-cli/src/commands/uqff.rs:1260— mistralrs_cli::commands::uqff::natural_sort_key has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_cli::commands::run::interactive::oneshot_multimodal (cognitive 18) mistralrs-cli/src/commands/run/interactive.rs:337— mistralrs_cli::commands::run::interactive::oneshot_multimodal has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (8 pts), loops 6, if/else 3, boolean chains 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_cli::config::validate_config (cognitive 18) mistralrs-cli/src/config/mod.rs:152— mistralrs_cli::config::validate_config has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_cli::commands::config::build_model_configs (cognitive 16) mistralrs-cli/src/commands/config.rs:318— mistralrs_cli::commands::config::build_model_configs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 1 (3 pts), loops 2 (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.
mistralrs_cli::commands::quant::gguf_discovery::resolve_group (cognitive 16) mistralrs-cli/src/commands/quant/gguf_discovery.rs:445— mistralrs_cli::commands::quant::gguf_discovery::resolve_group has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Duplicated block (8 lines × 3) mistralrs-cli/src/args/mod.rs:431— mistralrs-cli/src/args/mod.rs:431-438 | mistralrs-cli/src/commands/serve.rs:900-907 | mistralrs-cli/src/commands/serve.rs:910-917 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (8 lines × 3) mistralrs-core/src/models/deepseek2.rs:1065— mistralrs-core/src/models/deepseek2.rs:1065-1072 | mistralrs-core/src/models/deepseek3.rs:1130-1137 | mistralrs-core/src/models/glm4_moe_lite.rs:1084-1091 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/gemma2.rs:573— mistralrs-core/src/models/gemma2.rs:573-580 | mistralrs-core/src/models/qwen2.rs:600-607 | mistralrs-core/src/vision_models/gemma3/text.rs:742-749 — before extracting anything, compare `mistralrs-core/src/models/gemma2.rs` and `mistralrs-core/src/models/qwen2.rs` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 428 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/phi2.rs:452— mistralrs-core/src/models/phi2.rs:452-460 | mistralrs-core/src/vision_models/mllama/text.rs:790-798 | mistralrs-core/src/xlora_models/llama.rs:569-576 — before extracting anything, compare `mistralrs-core/src/models/phi2.rs` and `mistralrs-core/src/vision_models/mllama/text.rs` as WHOLE FILES: this scan already matched 9 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.
Duplicated block (8 lines × 3) mistralrs-core/src/ops.rs:4486— mistralrs-core/src/ops.rs:4486-4493 | mistralrs-core/src/ops.rs:4649-4656 | mistralrs-core/src/ops.rs:5453-5460 — 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) mistralrs-core/src/pipeline/embedding.rs:251— mistralrs-core/src/pipeline/embedding.rs:251-258 | mistralrs-core/src/pipeline/multimodal.rs:673-680 | mistralrs-core/src/pipeline/normal.rs:709-716 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/sampler.rs:1220— mistralrs-core/src/sampler.rs:1220-1227 | mistralrs-core/src/sampler.rs:1752-1759 | mistralrs-core/src/sampler.rs:1923-1930 — 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) REDACTED:229— REDACTED:229-236 | mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:118-125 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:141-148 — `mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 21 separate duplicated blocks between them, totalling at least 374 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 (8 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:150— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:150-157 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:716-723 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:811-818 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (8 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:667— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:667-674 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1275-1282 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1341-1348 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (8 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:82— mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:82-89 | mistralrs-core/src/vision_models/qwen2vl/text.rs:83-90 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:70-77 — `mistralrs-core/src/vision_models/qwen2_5_vl/text.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 43 separate duplicated blocks between them, totalling at least 650 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 (8 lines × 3) mistralrs-quant/src/afq/ops.rs:143— mistralrs-quant/src/afq/ops.rs:143-150 | mistralrs-quant/src/afq/ops.rs:394-401 | mistralrs-quant/src/afq/ops.rs:441-448 — 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) mistralrs-quant/src/cutile/fp8_w8a8.rs:580— mistralrs-quant/src/cutile/fp8_w8a8.rs:580-587 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:902-909 | mistralrs-quant/src/cutile/nvfp4_gemv.rs:300-307 — before extracting anything, compare `mistralrs-quant/src/cutile/fp8_w8a8.rs` and `mistralrs-quant/src/cutile/fused_moe_fp8.rs` as WHOLE FILES: this scan already matched 8 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. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-quant/src/cutile/fp8_w8a8.rs:582— mistralrs-quant/src/cutile/fp8_w8a8.rs:582-589 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:904-911 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1181-1188 — before extracting anything, compare `mistralrs-quant/src/cutile/fp8_w8a8.rs` and `mistralrs-quant/src/cutile/fused_moe_fp8.rs` as WHOLE FILES: this scan already matched 8 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. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-quant/src/gguf/fast_mmvq.rs:820— mistralrs-quant/src/gguf/fast_mmvq.rs:820-827 | mistralrs-quant/src/gguf/fast_mmvq.rs:875-882 | mistralrs-quant/src/gguf/fast_mmvq.rs:930-937 — 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) mistralrs-quant/src/gguf/mod.rs:433— mistralrs-quant/src/gguf/mod.rs:433-440 | mistralrs-quant/src/gptq/gptq_cpu.rs:21-28 | mistralrs-quant/src/gptq/gptq_cuda.rs:338-345 — 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 (8 lines × 3) mistralrs/src/model.rs:319— mistralrs/src/model.rs:319-326 | mistralrs/src/model.rs:388-395 | mistralrs/src/model.rs:475-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.
Duplicated block (8 lines × 3) mistralrs-core/src/cuda/gdn.rs:902— mistralrs-core/src/cuda/gdn.rs:902-909 | mistralrs-core/src/cuda/gdn.rs:1026-1033 | mistralrs-core/src/cuda/gdn.rs:1130-1137 — 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) mistralrs-core/src/pipeline/cuda_graph.rs:3595— mistralrs-core/src/pipeline/cuda_graph.rs:3595-3602 | mistralrs-core/src/pipeline/cuda_graph.rs:3640-3647 | mistralrs-core/src/pipeline/cuda_graph.rs:3685-3692 — 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) mistralrs-core/src/ops.rs:82— mistralrs-core/src/ops.rs:82-89 | mistralrs-core/src/ops.rs:587-594 | mistralrs-core/src/ops.rs:749-756 — 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) mistralrs-core/src/vision_models/muse_glimmer/mod.rs:134— mistralrs-core/src/vision_models/muse_glimmer/mod.rs:134-141 | mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:117-124 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:140-147 — `mistralrs-core/src/vision_models/muse_glimmer/mod.rs` and `mistralrs-core/src/vision_models/qwen2_5_vl/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 5 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.
Duplicated block (17 lines × 3) mistralrs-core/src/models/deepseek2.rs:439— mistralrs-core/src/models/deepseek2.rs:439-455 | mistralrs-core/src/models/deepseek3.rs:440-456 | mistralrs-core/src/models/glm4_moe_lite.rs:404-420 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 3) mistralrs-core/src/models/glm4.rs:535— mistralrs-core/src/models/glm4.rs:535-551 | mistralrs-core/src/models/qwen3.rs:494-510 | mistralrs-core/src/models/qwen3_moe.rs:674-690 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/qwen3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 599 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 3) mistralrs-core/src/models/llama.rs:440— mistralrs-core/src/models/llama.rs:440-456 | mistralrs-core/src/models/smollm3.rs:463-479 | mistralrs-core/src/vision_models/llama4/text.rs:876-892 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 3) mistralrs-core/src/models/llama.rs:614— mistralrs-core/src/models/llama.rs:614-630 | mistralrs-core/src/models/smollm3.rs:633-649 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:627-643 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 3) mistralrs-core/src/ops.rs:123— mistralrs-core/src/ops.rs:123-139 | mistralrs-core/src/ops.rs:161-177 | mistralrs-core/src/ops.rs:199-215 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17 lines × 3) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1032— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1032-1048 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3871-3887 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1944-1960 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:237— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:237-253 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:803-819 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:898-914 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (17 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:256— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:256-272 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:822-838 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:920-936 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (17 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:334— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:334-350 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:900-916 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1001-1017 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (17 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:643— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:643-659 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1251-1267 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1317-1333 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (17 lines × 3) mistralrs-core/src/vision_models/qwen3_5/mod.rs:380— mistralrs-core/src/vision_models/qwen3_5/mod.rs:380-396 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:365-381 | mistralrs-core/src/vision_models/qwen4_exp/mod.rs:361-377 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (17 lines × 3) mistralrs-core/src/vision_models/qwen3_5/mod.rs:526— mistralrs-core/src/vision_models/qwen3_5/mod.rs:526-542 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:520-536 | mistralrs-core/src/vision_models/qwen4_exp/mod.rs:509-525 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (17 lines × 3) mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:79— mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:79-95 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:632-648 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:77-93 — `mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs` and `mistralrs-core/src/vision_models/qwen3_vl/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 17 separate duplicated blocks between them, totalling at least 254 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 (17 lines × 3) mistralrs-quant/src/distributed/mod.rs:561— mistralrs-quant/src/distributed/mod.rs:561-577 | mistralrs-quant/src/distributed/mod.rs:592-608 | mistralrs-quant/src/distributed/mod.rs:623-639 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17 lines × 3) mistralrs-quant/src/distributed/mod.rs:710— mistralrs-quant/src/distributed/mod.rs:710-726 | mistralrs-quant/src/distributed/mod.rs:741-757 | mistralrs-quant/src/distributed/mod.rs:772-788 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17 lines × 3) mistralrs-quant/src/utils/ops.rs:1639— mistralrs-quant/src/utils/ops.rs:1639-1655 | mistralrs-quant/src/utils/ops.rs:1667-1683 | mistralrs-quant/src/utils/ops.rs:1695-1711 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17 lines × 3) mistralrs-quant/src/utils/ops.rs:1774— mistralrs-quant/src/utils/ops.rs:1774-1790 | mistralrs-quant/src/utils/ops.rs:1800-1816 | mistralrs-quant/src/utils/ops.rs:1826-1842 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17 lines × 3) mistralrs-quant/src/utils/ops.rs:2034— mistralrs-quant/src/utils/ops.rs:2034-2050 | mistralrs-quant/src/utils/ops.rs:2063-2079 | mistralrs-quant/src/utils/ops.rs:2092-2108 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17 lines × 3) mistralrs/src/messages.rs:611— mistralrs/src/messages.rs:611-627 | mistralrs/src/messages.rs:645-661 | mistralrs/src/messages.rs:680-696 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17 lines × 3) mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:598— mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:598-614 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:613-629 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:534-550 — before extracting anything, compare `mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs` and `mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 206 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
TooManyFields: PreProcessorConfig mistralrs-core/src/vision_models/preprocessor_config.rs:10— TooManyFields — 76 stored fields beside 2 methods. The bar is 30 stored fields; this is 46 over it, 2.53× 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.
TooManyFields: Sequence mistralrs-core/src/sequence.rs:752— TooManyFields — 65 stored fields beside 150 methods. The bar is 30 stored fields; this is 35 over it, 2.17× 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.
TooManyFields: TextConfig mistralrs-core/src/vision_models/qwen4_exp/config.rs:46— TooManyFields — 44 stored fields beside 14 methods. The bar is 30 stored fields; this is 14 over it, 1.47× 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.
TooManyFields: GgufModelBuilder mistralrs/src/gguf.rs:12— TooManyFields — 43 stored fields beside 49 methods. The bar is 30 stored fields; this is 13 over it, 1.43× 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.
TooManyFields: ResponsesCreateRequest mistralrs-server-core/src/openai.rs:1847— TooManyFields — 42 stored fields. The bar is 30 stored fields; this is 12 over it, 1.40× 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.
TooManyFields: ChatCompletionRequest mistralrs-pyo3/src/requests.rs:296— TooManyFields — 41 stored fields beside 3 methods. The bar is 30 stored fields; this is 11 over it, 1.37× 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.
TooManyFields: OpenResponsesCreateRequest mistralrs-server-core/src/responses.rs:481— TooManyFields — 41 stored fields. The bar is 30 stored fields; this is 11 over it, 1.37× 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.
TooManyFields: ModelBuilder mistralrs/src/auto_model.rs:43— TooManyFields — 40 stored fields beside 10 methods. The bar is 30 stored fields; this is 10 over it, 1.33× 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.
TooManyFields: TextModelBuilder mistralrs/src/text_model.rs:18— TooManyFields — 39 stored fields beside 10 methods. The bar is 30 stored fields; this is 9 over it, 1.30× 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.
TooManyFields: ChatCompletionRequest mistralrs-server-core/src/openai.rs:1127— TooManyFields — 39 stored fields. The bar is 30 stored fields; this is 9 over it, 1.30× 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.
TooManyFields: MultimodalModelBuilder mistralrs/src/multimodal_model.rs:18— TooManyFields — 38 stored fields beside 9 methods. The bar is 30 stored fields; this is 8 over it, 1.27× 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.
TooManyFields: AnthropicMessagesRequest mistralrs-server-core/src/anthropic.rs:84— TooManyFields — 38 stored fields beside 2 methods. The bar is 30 stored fields; this is 8 over it, 1.27× 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.
TooManyFields: MistralRsForServerBuilder mistralrs-server-core/src/mistralrs_for_server_builder.rs:178— TooManyFields — 35 stored fields beside 57 methods. The bar is 30 stored fields; this is 5 over it, 1.17× 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.
TooManyFields: FlashAttnKargs mistralrs-quant/src/metal_kernels/mod.rs:4186— TooManyFields — 35 stored fields. The bar is 30 stored fields; this is 5 over it, 1.17× 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.
TooManyFields: Gemma4TextConfig mistralrs-core/src/vision_models/gemma4/config.rs:53— TooManyFields — 34 stored fields beside 5 methods. The bar is 30 stored fields; this is 4 over it, 1.13× 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.
TooManyFields: Config mistralrs-core/src/models/hunyuan_v1_moe.rs:117— TooManyFields — 34 stored fields beside 4 methods. The bar is 30 stored fields; this is 4 over it, 1.13× 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.
TooManyFields: Fa3Fp8DecodeParams mistralrs-paged-attn/src/cuda/ffi.rs:29— TooManyFields — 33 stored fields. The bar is 30 stored fields; this is 3 over it, 1.10× 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.
TooManyFields: NormalRequest mistralrs-core/src/request.rs:415— TooManyFields — 31 stored fields beside 6 methods. 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.
TooManyFields: ConformerEncoderConfig mistralrs-core/src/vision_models/conformer/config.rs:70— TooManyFields — 31 stored fields beside 1 method. 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.
Duplicated block (20 lines × 2) mistralrs-core/src/cuda/gdn.rs:4982— mistralrs-core/src/cuda/gdn.rs:4982-5001 | mistralrs-core/src/cuda/gdn.rs:5158-5177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) mistralrs-core/src/embedding_models/embedding_gemma.rs:208— mistralrs-core/src/embedding_models/embedding_gemma.rs:208-227 | mistralrs-core/src/embedding_models/qwen3_embedding.rs:181-200 — before extracting anything, compare `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/embedding_models/qwen3_embedding.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (20 lines × 2) mistralrs-core/src/layers.rs:3892— mistralrs-core/src/layers.rs:3892-3911 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:101-120 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (20 lines × 2) mistralrs-core/src/models/gemma.rs:363— mistralrs-core/src/models/gemma.rs:363-382 | mistralrs-core/src/models/gemma2.rs:436-455 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (20 lines × 2) mistralrs-core/src/ops.rs:5699— mistralrs-core/src/ops.rs:5699-5718 | mistralrs-core/src/ops.rs:6122-6141 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) mistralrs-core/src/pipeline/normal.rs:811— mistralrs-core/src/pipeline/normal.rs:811-830 | mistralrs-core/src/pipeline/normal.rs:876-895 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) mistralrs-core/src/tools/parsers/gemma4.rs:293— mistralrs-core/src/tools/parsers/gemma4.rs:293-312 | mistralrs-core/src/tools/parsers/gemma4.rs:334-353 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) mistralrs-core/src/vision_models/gemma4/mod.rs:487— mistralrs-core/src/vision_models/gemma4/mod.rs:487-506 | mistralrs-core/src/vision_models/gemma4/mod.rs:800-819 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) mistralrs-core/src/vision_models/llama4/vision.rs:226— mistralrs-core/src/vision_models/llama4/vision.rs:226-245 | mistralrs-core/src/vision_models/mllama/vision.rs:245-264 — `mistralrs-core/src/vision_models/llama4/vision.rs` and `mistralrs-core/src/vision_models/mllama/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 6 separate duplicated blocks between them, totalling at least 67 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 (20 lines × 2) mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:669— mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:669-688 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:698-717 — before extracting anything, compare `mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs` and `mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 206 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (20 lines × 2) mistralrs-core/src/vision_models/phi3/mod.rs:591— mistralrs-core/src/vision_models/phi3/mod.rs:591-610 | mistralrs-core/src/vision_models/phi3/mod.rs:623-642 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) mistralrs-core/src/vision_models/phi4/image_embedding.rs:214— mistralrs-core/src/vision_models/phi4/image_embedding.rs:214-233 | mistralrs-core/src/vision_models/phi4/image_embedding.rs:246-265 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:302— mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:302-321 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:421-440 — `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.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 52 separate duplicated blocks between them, totalling at least 1117 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 (20 lines × 2) mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:359— mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:359-378 | mistralrs-core/src/vision_models/qwen4_exp/mod.rs:355-374 — `mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs` and `mistralrs-core/src/vision_models/qwen4_exp/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 8 separate duplicated blocks between them, totalling at least 150 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 (20 lines × 2) mistralrs-core/src/xlora_models/mistral.rs:575— mistralrs-core/src/xlora_models/mistral.rs:575-594 | mistralrs-core/src/xlora_models/mixtral.rs:705-724 — before extracting anything, compare `mistralrs-core/src/xlora_models/mistral.rs` and `mistralrs-core/src/xlora_models/mixtral.rs` as WHOLE FILES: this scan already matched 52 separate duplicated blocks between them, totalling at least 769 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (20 lines × 2) mistralrs-quant/src/cublaslt/mod.rs:157— mistralrs-quant/src/cublaslt/mod.rs:157-176 | mistralrs-quant/src/cublaslt/mod.rs:210-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 (20 lines × 2) mistralrs-quant/src/gguf/fast_mmq.rs:346— mistralrs-quant/src/gguf/fast_mmq.rs:346-365 | mistralrs-quant/src/gguf/fast_mmvq.rs:88-107 — before extracting anything, compare `mistralrs-quant/src/gguf/fast_mmq.rs` and `mistralrs-quant/src/gguf/fast_mmvq.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 2) scripts/production_soak.py:5130— scripts/production_soak.py:5130-5149 | scripts/production_soak.py:10153-10172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/production_soak.py:5130` 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) mistralrs-core/src/ops.rs:1116— mistralrs-core/src/ops.rs:1116-1122 | mistralrs-core/src/ops.rs:1345-1351 | mistralrs-core/src/ops.rs:2039-2045 | mistralrs-core/src/ops.rs:2172-2178 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 4) mistralrs-core/src/ops.rs:4465— mistralrs-core/src/ops.rs:4465-4471 | mistralrs-core/src/ops.rs:5425-5431 | mistralrs-core/src/ops.rs:5697-5703 | mistralrs-core/src/ops.rs:6120-6126 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 4) mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:529— mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:529-535 | mistralrs-core/src/vision_models/qwen2vl/text.rs:531-537 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:516-522 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:637-643 — `mistralrs-core/src/vision_models/qwen2_5_vl/text.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 43 separate duplicated blocks between them, totalling at least 650 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 (7 lines × 4) mistralrs-core/src/vision_models/qwen3_5/mod.rs:395— mistralrs-core/src/vision_models/qwen3_5/mod.rs:395-401 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:380-386 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:965-971 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:410-416 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (7 lines × 4) mistralrs-core/src/vision_models/qwen3_5/text.rs:1559— mistralrs-core/src/vision_models/qwen3_5/text.rs:1559-1565 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:826-832 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:569-575 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:690-696 — `mistralrs-core/src/vision_models/qwen3_5/text.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 26 separate duplicated blocks between them, totalling at least 428 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 (7 lines × 4) mistralrs-core/src/vision_models/qwen3_5/text.rs:1811— mistralrs-core/src/vision_models/qwen3_5/text.rs:1811-1817 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:931-937 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:558-564 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:679-685 — `mistralrs-core/src/vision_models/qwen3_5/text.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 26 separate duplicated blocks between them, totalling at least 428 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 (7 lines × 4) mistralrs-quant/src/blockwise_fp8/mod.rs:1072— mistralrs-quant/src/blockwise_fp8/mod.rs:1072-1078 | mistralrs-quant/src/pertensor_fp8/mod.rs:632-638 | mistralrs-quant/src/unquantized/mod.rs:588-594 | mistralrs-quant/src/vector_fp8/mod.rs:212-218 — `mistralrs-quant/src/blockwise_fp8/mod.rs` and `mistralrs-quant/src/pertensor_fp8/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 9 separate duplicated blocks between them, totalling at least 217 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 (7 lines × 4) mistralrs-quant/src/blockwise_fp8/ops.rs:1069— mistralrs-quant/src/blockwise_fp8/ops.rs:1069-1075 | mistralrs-quant/src/blockwise_fp8/ops.rs:1248-1254 | mistralrs-quant/src/mxfp4/ops.rs:67-73 | mistralrs-quant/src/mxfp4/ops.rs:406-412 — `mistralrs-quant/src/blockwise_fp8/ops.rs` and `mistralrs-quant/src/mxfp4/ops.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 6 separate duplicated blocks between them, totalling at least 49 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 (7 lines × 4) mistralrs-quant/src/cutile/fp8_gemm.rs:340— mistralrs-quant/src/cutile/fp8_gemm.rs:340-346 | mistralrs-quant/src/cutile/fp8_w8a8.rs:583-589 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:905-911 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1182-1188 — before extracting anything, compare `mistralrs-quant/src/cutile/fp8_gemm.rs` and `mistralrs-quant/src/cutile/fp8_w8a8.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-quant/src/cutile/nvfp4_glu.rs:57— mistralrs-quant/src/cutile/nvfp4_glu.rs:57-63 | mistralrs-quant/src/cutile/nvfp4_glu.rs:214-220 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:462-468 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:756-762 — before extracting anything, compare `mistralrs-quant/src/cutile/nvfp4_glu.rs` and `mistralrs-quant/src/cutile/nvfp4_matmul.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 103 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-quant/src/cutile/nvfp4_matmul.rs:362— mistralrs-quant/src/cutile/nvfp4_matmul.rs:362-368 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:460-466 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:656-662 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:754-760 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 4) mistralrs-quant/src/mxfp4/ops.rs:95— mistralrs-quant/src/mxfp4/ops.rs:95-101 | mistralrs-quant/src/mxfp4/ops.rs:156-162 | mistralrs-quant/src/mxfp4/ops.rs:440-446 | mistralrs-quant/src/mxfp4/ops.rs:527-533 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 4) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:273— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:273-279 | mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:126-135 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:692-701 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:784-793 — `mistralrs-core/src/vision_models/gemma3/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.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 82 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 (7 lines × 4) mistralrs-core/src/models/granite.rs:658— mistralrs-core/src/models/granite.rs:658-666 | mistralrs-core/src/models/lfm2.rs:599-606 | mistralrs-core/src/models/qwen3_next.rs:552-560 | mistralrs-core/src/vision_models/qwen3_5/packed_gdn.rs:29-35 — before extracting anything, compare `mistralrs-core/src/models/granite.rs` and `mistralrs-core/src/models/lfm2.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-paged-attn/src/metal/backend/gather_kv.rs:97— mistralrs-paged-attn/src/metal/backend/gather_kv.rs:97-103 | mistralrs-paged-attn/src/metal/backend/gather_kv.rs:107-113 | mistralrs-paged-attn/src/metal/backend/paged_attention.rs:789-797 | mistralrs-paged-attn/src/metal/backend/paged_attention.rs:801-809 — before extracting anything, compare `mistralrs-paged-attn/src/metal/backend/gather_kv.rs` and `mistralrs-paged-attn/src/metal/backend/paged_attention.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 (7 lines × 4) mistralrs-core/src/ops.rs:2178— mistralrs-core/src/ops.rs:2178-2184 | mistralrs-core/src/ops.rs:2186-2192 | mistralrs-core/src/ops.rs:3918-3925 | mistralrs-core/src/ops.rs:4045-4052 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 4) mistralrs-core/src/ops.rs:2181— mistralrs-core/src/ops.rs:2181-2187 | mistralrs-core/src/ops.rs:2189-2195 | mistralrs-core/src/ops.rs:3930-3937 | mistralrs-core/src/ops.rs:4057-4064 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 4) mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:223— mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:223-229 | mistralrs-core/src/vision_models/llama4/inputs_processor.rs:227-233 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:182-188 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:138-144 — before extracting anything, compare `mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs` and `mistralrs-core/src/vision_models/llama4/inputs_processor.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 152 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) mistralrs-core/src/lib.rs:1424— mistralrs-core/src/lib.rs:1424-1446 | mistralrs-core/src/lib.rs:1480-1502 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) mistralrs-core/src/lora/loralinear.rs:82— mistralrs-core/src/lora/loralinear.rs:82-104 | mistralrs-core/src/lora/qloralinear.rs:131-153 — before extracting anything, compare `mistralrs-core/src/lora/loralinear.rs` and `mistralrs-core/src/lora/qloralinear.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (23 lines × 2) mistralrs-core/src/ops.rs:5856— mistralrs-core/src/ops.rs:5856-5878 | mistralrs-core/src/ops.rs:6293-6315 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) mistralrs-core/src/pipeline/inputs_processor.rs:2789— mistralrs-core/src/pipeline/inputs_processor.rs:2789-2811 | mistralrs-core/src/pipeline/inputs_processor.rs:2838-2860 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:978— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:978-1000 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3779-3801 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:3244— mistralrs-core/src/pipeline/multimodal.rs:3244-3266 | mistralrs-core/src/pipeline/normal.rs:2844-2866 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (23 lines × 2) mistralrs-core/src/toml_selector.rs:1111— mistralrs-core/src/toml_selector.rs:1111-1133 | mistralrs-core/src/toml_selector.rs:1145-1167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) mistralrs-core/src/vision_models/gemma4/mod.rs:461— mistralrs-core/src/vision_models/gemma4/mod.rs:461-483 | mistralrs-core/src/vision_models/gemma4/mod.rs:774-796 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:976— mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:976-998 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1292-1314 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) mistralrs-quant/src/blockwise_fp8/ops.rs:1291— mistralrs-quant/src/blockwise_fp8/ops.rs:1291-1313 | mistralrs-quant/src/blockwise_fp8/ops.rs:1330-1352 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) mistralrs-quant/src/gguf/fast_mmq.rs:417— mistralrs-quant/src/gguf/fast_mmq.rs:417-439 | mistralrs-quant/src/gguf/fast_mmq.rs:497-519 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) mistralrs-quant/src/gguf/fast_mmvq.rs:386— mistralrs-quant/src/gguf/fast_mmvq.rs:386-408 | mistralrs-quant/src/gguf/fast_mmvq.rs:591-613 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) mistralrs-quant/src/gguf/fast_mmvq.rs:424— mistralrs-quant/src/gguf/fast_mmvq.rs:424-446 | mistralrs-quant/src/gguf/fast_mmvq.rs:630-652 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) mistralrs/src/model_builder_trait.rs:573— mistralrs/src/model_builder_trait.rs:573-595 | mistralrs/src/model_builder_trait.rs:652-674 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) mistralrs/src/model_builder_trait.rs:1278— mistralrs/src/model_builder_trait.rs:1278-1300 | mistralrs/src/model_builder_trait.rs:1345-1367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) scripts/production_soak.py:7709— scripts/production_soak.py:7709-7731 | scripts/production_soak.py:10388-10410 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/production_soak.py:7709` 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) scripts/production_soak.py:12982— scripts/production_soak.py:12982-13004 | scripts/production_soak.py:13153-13175 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/production_soak.py:12982` 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.
Swallowed exception (empty catch) scripts/production_soak.py:1265— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) REDACTED:119— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) REDACTED:130— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) REDACTED:154— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) REDACTED:175— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) mistralrs-cli/webui/src/App.svelte:41— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) mistralrs-cli/webui/src/lib/utils/markdown.ts:12— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) mistralrs-cli/webui/src/lib/stores/settings.svelte.ts:28— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) mistralrs-cli/webui/src/lib/stores/settings.svelte.ts:35— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) mistralrs-cli/webui/src/lib/stores/settings.svelte.ts:44— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) mistralrs-cli/webui/src/lib/services/streaming.ts:164— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) mistralrs-cli/webui/src/lib/services/streaming.ts:208— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) mistralrs-cli/webui/src/lib/components/AssistantMessage.svelte:50— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) mistralrs-cli/webui/src/lib/components/CodeExecution.svelte:52— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) mistralrs-cli/webui/src/lib/components/ShellTool.svelte:30— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) mistralrs-cli/webui/src/lib/components/Sidebar.svelte:17— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) mistralrs-cli/webui/src/lib/components/UserMessage.svelte:29— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Duplicated block (22 lines × 2) mistralrs-cli/src/commands/run/interactive.rs:1184— mistralrs-cli/src/commands/run/interactive.rs:1184-1205 | mistralrs-cli/src/commands/run/interactive.rs:1269-1290 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/model_loader.rs:834— mistralrs-core/src/model_loader.rs:834-855 | mistralrs-core/src/model_loader.rs:867-888 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/models/llama.rs:380— mistralrs-core/src/models/llama.rs:380-401 | mistralrs-core/src/models/smollm3.rs:396-417 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/phi3.rs:206— mistralrs-core/src/models/phi3.rs:206-227 | mistralrs-core/src/models/phi3_5_moe.rs:233-254 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/models/phi3_5_moe.rs` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 312 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/ops.rs:3961— mistralrs-core/src/ops.rs:3961-3982 | mistralrs-core/src/ops.rs:4085-4106 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/ops.rs:5633— mistralrs-core/src/ops.rs:5633-5654 | mistralrs-core/src/ops.rs:6068-6089 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:9287— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:9287-9308 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:10516-10537 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:10331— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:10331-10352 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:7094-7115 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/multimodal.rs:1019— mistralrs-core/src/pipeline/multimodal.rs:1019-1040 | mistralrs-core/src/pipeline/normal.rs:1016-1037 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/multimodal.rs:2994— mistralrs-core/src/pipeline/multimodal.rs:2994-3015 | mistralrs-core/src/pipeline/normal.rs:2683-2704 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:339— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:339-360 | mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:485-506 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/vision_models/gemma4/mod.rs:422— mistralrs-core/src/vision_models/gemma4/mod.rs:422-443 | mistralrs-core/src/vision_models/gemma4/mod.rs:735-756 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) mistralrs-core/src/xlora_models/quantized_llama.rs:418— mistralrs-core/src/xlora_models/quantized_llama.rs:418-439 | mistralrs-core/src/xlora_models/quantized_llama.rs:720-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.
Duplicated block (22 lines × 2) mistralrs-paged-attn/src/cuda/backend/mla.rs:397— mistralrs-paged-attn/src/cuda/backend/mla.rs:397-418 | mistralrs-paged-attn/src/cuda/backend/mla.rs:730-751 — both copies are in the same file, so extract the block into 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) mistralrs-paged-attn/src/metal/backend/paged_attention.rs:436— mistralrs-paged-attn/src/metal/backend/paged_attention.rs:436-457 | mistralrs-paged-attn/src/metal/backend/paged_attention.rs:823-844 — both copies are in the same file, so extract the block into 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) mistralrs-quant/src/cutile/fused_moe.rs:513— mistralrs-quant/src/cutile/fused_moe.rs:513-534 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:954-975 — before extracting anything, compare `mistralrs-quant/src/cutile/fused_moe.rs` and `mistralrs-quant/src/cutile/fused_moe_fp8.rs` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 308 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-cli/src/commands/config.rs:101— mistralrs-cli/src/commands/config.rs:101-108 | mistralrs-cli/src/commands/config.rs:261-268 | mistralrs-cli/src/commands/run/mod.rs:106-113 | mistralrs-cli/src/commands/serve.rs:117-124 — before extracting anything, compare `mistralrs-cli/src/commands/config.rs` and `mistralrs-cli/src/commands/serve.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/models/deepseek2.rs:674— mistralrs-core/src/models/deepseek2.rs:674-682 | mistralrs-core/src/models/deepseek3.rs:737-745 | mistralrs-core/src/models/glm4_moe.rs:575-582 | mistralrs-core/src/models/glm4_moe_lite.rs:683-691 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/models/lfm2.rs:1115— mistralrs-core/src/models/lfm2.rs:1115-1122 | mistralrs-core/src/models/qwen3_next.rs:925-933 | mistralrs-core/src/vision_models/qwen3_5/text.rs:1032-1040 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:733-741 — before extracting anything, compare `mistralrs-core/src/models/lfm2.rs` and `mistralrs-core/src/models/qwen3_next.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 156 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/models/phi3.rs:424— mistralrs-core/src/models/phi3.rs:424-431 | mistralrs-core/src/vision_models/gemma3/text.rs:450-458 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:406-414 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:526-534 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/vision_models/gemma3/text.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 170 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 × 4) mistralrs-core/src/vision_models/qwen3_5/mod.rs:189— mistralrs-core/src/vision_models/qwen3_5/mod.rs:189-196 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:172-179 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:697-704 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:142-149 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (8 lines × 4) mistralrs-core/src/vision_models/qwen3_5/mod.rs:252— mistralrs-core/src/vision_models/qwen3_5/mod.rs:252-259 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:235-242 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:774-781 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:219-226 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (8 lines × 4) mistralrs-pyo3/src/lib.rs:1293— mistralrs-pyo3/src/lib.rs:1293-1300 | mistralrs-pyo3/src/lib.rs:1777-1784 | mistralrs-pyo3/src/lib.rs:2254-2261 | mistralrs-pyo3/src/lib.rs:2631-2638 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) mistralrs-quant/src/cutile/nvfp4_glu.rs:51— mistralrs-quant/src/cutile/nvfp4_glu.rs:51-58 | mistralrs-quant/src/cutile/nvfp4_glu.rs:208-215 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:364-371 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:658-665 — before extracting anything, compare `mistralrs-quant/src/cutile/nvfp4_glu.rs` and `mistralrs-quant/src/cutile/nvfp4_matmul.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 103 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-quant/src/hqq/mod.rs:170— mistralrs-quant/src/hqq/mod.rs:170-177 | mistralrs-quant/src/hqq/mod.rs:254-261 | mistralrs-quant/src/hqq/mod.rs:348-355 | mistralrs-quant/src/hqq/mod.rs:497-504 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) mistralrs-quant/src/metal_kernels/mod.rs:1514— mistralrs-quant/src/metal_kernels/mod.rs:1514-1522 | mistralrs-quant/src/metal_kernels/mod.rs:1590-1598 | mistralrs-quant/src/metal_kernels/mod.rs:2642-2649 | mistralrs-quant/src/metal_kernels/mod.rs:2776-2784 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) mistralrs-server-core/src/chat_completion.rs:1359— mistralrs-server-core/src/chat_completion.rs:1359-1366 | mistralrs-server-core/src/completions.rs:457-464 | mistralrs-server-core/src/image_generation.rs:186-193 | mistralrs-server-core/src/speech_generation.rs:238-245 — before extracting anything, compare `mistralrs-server-core/src/chat_completion.rs` and `mistralrs-server-core/src/completions.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7333— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7333-7340 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7808-7815 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8350-8357 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6649-6656 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-quant/src/utils/ops.rs:156— mistralrs-quant/src/utils/ops.rs:156-163 | mistralrs-quant/src/utils/ops.rs:756-763 | mistralrs-quant/src/utils/ops.rs:857-865 | mistralrs-quant/src/utils/ops.rs:964-972 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:805— mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:805-812 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:208-215 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:164-171 | mistralrs-core/src/vision_models/phi4/inputs_processor.rs:245-252 — before extracting anything, compare `mistralrs-core/src/vision_models/gemma4/inputs_processor.rs` and `mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 45 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 × 4) mistralrs-quant/src/cutile/nvfp4_matmul.rs:130— mistralrs-quant/src/cutile/nvfp4_matmul.rs:130-137 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:283-290 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:545-552 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:839-846 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) scripts/production_soak.py:3966— scripts/production_soak.py:3966-3973 | scripts/production_soak.py:3977-3984 | scripts/production_soak.py:4028-4035 | scripts/production_soak.py:4088-4095 — 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.
mistralrs_server_core::chat_completion::parse_request (cognitive 155) mistralrs-server-core/src/chat_completion.rs:566— mistralrs_server_core::chat_completion::parse_request has cognitive complexity 155 (threshold 15). Drivers by points: if/else 23 (70 pts), match/switch 15 (47 pts), loops 10 (33 pts), boolean chains 5 (nesting depth added 102). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_server_core::responses::create_response (cognitive 64) mistralrs-server-core/src/responses.rs:2055— mistralrs_server_core::responses::create_response has cognitive complexity 64 (threshold 15). Drivers by points: if/else 16 (39 pts), loops 4 (14 pts), match/switch 6 (10 pts), boolean chains 1 (nesting depth added 37). 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.
mistralrs_server_core::responses::convert_input_items_to_messages (cognitive 57) mistralrs-server-core/src/responses.rs:129— mistralrs_server_core::responses::convert_input_items_to_messages has cognitive complexity 57 (threshold 15). Drivers by points: match/switch 7 (31 pts), if/else 8 (21 pts), loops 2 (5 pts) (nesting depth added 40). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
mistralrs_server_core::metrics::observe_http (cognitive 30) mistralrs-server-core/src/metrics.rs:214— mistralrs_server_core::metrics::observe_http has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (17 pts), match/switch 4 (7 pts), boolean chains 6 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
mistralrs_server_core::embeddings::embeddings (cognitive 28) mistralrs-server-core/src/embeddings.rs:62— mistralrs_server_core::embeddings::embeddings has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 5 (9 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_server_core::chat_completion::serialize_agentic_data (cognitive 26) mistralrs-server-core/src/chat_completion.rs:145— mistralrs_server_core::chat_completion::serialize_agentic_data has cognitive complexity 26 (threshold 15). Drivers by points: if/else 20 (25 pts), match/switch 1 (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.
mistralrs_server_core::openai::normalize_openai_tools (cognitive 24) mistralrs-server-core/src/openai.rs:1045— mistralrs_server_core::openai::normalize_openai_tools has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (6 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_server_core::video::decode_video_ffmpeg (cognitive 24) mistralrs-server-core/src/video.rs:167— mistralrs_server_core::video::decode_video_ffmpeg has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), match/switch 2 (4 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_server_core::mistralrs_for_server_builder::init_mapper (cognitive 22) mistralrs-server-core/src/mistralrs_for_server_builder.rs:1359— mistralrs_server_core::mistralrs_for_server_builder::init_mapper has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (7 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.
mistralrs_server_core::chat_completion::process_non_streaming_response_with_model (cognitive 19) mistralrs-server-core/src/chat_completion.rs:1268— mistralrs_server_core::chat_completion::process_non_streaming_response_with_model has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_server_core::handlers::models (cognitive 19) mistralrs-server-core/src/handlers.rs:48— mistralrs_server_core::handlers::models has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), match/switch 4 (8 pts), loops 2, 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.
mistralrs_server_core::chat_completion::record_agentic_progress (cognitive 17) mistralrs-server-core/src/chat_completion.rs:266— mistralrs_server_core::chat_completion::record_agentic_progress has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 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.
mistralrs_server_core::responses::chat_response_to_response_resource (cognitive 17) mistralrs-server-core/src/responses.rs:1722— mistralrs_server_core::responses::chat_response_to_response_resource has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_server_core::skills::parse_upload (cognitive 17) mistralrs-server-core/src/skills.rs:457— mistralrs_server_core::skills::parse_upload has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_server_core::anthropic::anthropic_response_from_chat (cognitive 16) mistralrs-server-core/src/anthropic.rs:1155— mistralrs_server_core::anthropic::anthropic_response_from_chat has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_paged_attn::metal::backend::paged_prefill::metal_paged_prefill (cognitive 61) mistralrs-paged-attn/src/metal/backend/paged_prefill.rs:434— mistralrs_paged_attn::metal::backend::paged_prefill::metal_paged_prefill has cognitive complexity 61 (threshold 15). Drivers by points: if/else 23 (35 pts), boolean chains 13, loops 8 (11 pts), match/switch 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_paged_attn::cuda::backend::flashinfer::flashinfer_decode (cognitive 52) mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:241— mistralrs_paged_attn::cuda::backend::flashinfer::flashinfer_decode has cognitive complexity 52 (threshold 15). Drivers by points: if/else 21 (24 pts), match/switch 19 (21 pts), boolean chains 6, loops 1 (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.
mistralrs_paged_attn::cuda::backend::cache::copy_blocks (cognitive 46) mistralrs-paged-attn/src/cuda/backend/cache.rs:26— mistralrs_paged_attn::cuda::backend::cache::copy_blocks has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 9, loops 5 (7 pts), match/switch 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_paged_attn::cuda::backend::gather_kv::gather_kv_cache (cognitive 31) mistralrs-paged-attn/src/cuda/backend/gather_kv.rs:54— mistralrs_paged_attn::cuda::backend::gather_kv::gather_kv_cache has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 14 (16 pts), if/else 15 (nesting depth added 2). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
mistralrs_paged_attn::cuda::backend::mla::flashinfer_mla_decode (cognitive 30) mistralrs-paged-attn/src/cuda/backend/mla.rs:227— mistralrs_paged_attn::cuda::backend::mla::flashinfer_mla_decode has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 14, if/else 11, boolean chains 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.
mistralrs_paged_attn::cuda::backend::paged_attention::update_cache (cognitive 26) mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:538— mistralrs_paged_attn::cuda::backend::paged_attention::update_cache has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (14 pts), match/switch 9 (11 pts), boolean chains 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.
mistralrs_paged_attn::metal::backend::paged_attention::reshape_and_cache (cognitive 25) mistralrs-paged-attn/src/metal/backend/paged_attention.rs:767— mistralrs_paged_attn::metal::backend::paged_attention::reshape_and_cache has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 9 (11 pts), if/else 8 (10 pts), boolean chains 4 (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.
mistralrs_paged_attn::metal::backend::paged_attention::prepare_decode_kernels (cognitive 22) mistralrs-paged-attn/src/metal/backend/paged_attention.rs:16— mistralrs_paged_attn::metal::backend::paged_attention::prepare_decode_kernels has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 3 (6 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_paged_attn::cuda::backend::fa3::fa3_prepare_paged_metadata (cognitive 20) mistralrs-paged-attn/src/cuda/backend/fa3.rs:108— mistralrs_paged_attn::cuda::backend::fa3::fa3_prepare_paged_metadata has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 7, boolean chains 3, loops 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.
mistralrs_paged_attn::cuda::backend::flashinfer::gather_kv_cache_flashinfer (cognitive 19) mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:550— mistralrs_paged_attn::cuda::backend::flashinfer::gather_kv_cache_flashinfer has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 10, if/else 8, boolean chains 1. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
mistralrs_paged_attn::metal::backend::cache::swap_blocks (cognitive 19) mistralrs-paged-attn/src/metal/backend/cache.rs:112— mistralrs_paged_attn::metal::backend::cache::swap_blocks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (4 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 8). Of this number, 17 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_paged_attn::metal::backend::gather_kv::gather_kv_cache (cognitive 18) mistralrs-paged-attn/src/metal/backend/gather_kv.rs:9— mistralrs_paged_attn::metal::backend::gather_kv::gather_kv_cache has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 10 (12 pts), if/else 6 (nesting depth added 2). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
mistralrs_paged_attn::cuda::backend::cache::swap_blocks (cognitive 17) mistralrs-paged-attn/src/cuda/backend/cache.rs:264— mistralrs_paged_attn::cuda::backend::cache::swap_blocks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
mistralrs_paged_attn::cuda::backend::flashinfer::reshape_and_cache_flashinfer (cognitive 17) mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:71— mistralrs_paged_attn::cuda::backend::flashinfer::reshape_and_cache_flashinfer has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 9, if/else 6, boolean chains 2. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
mistralrs_paged_attn::cuda::backend::mla::concat_and_cache_mla (cognitive 16) mistralrs-paged-attn/src/cuda/backend/mla.rs:10— mistralrs_paged_attn::cuda::backend::mla::concat_and_cache_mla has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, match/switch 7, boolean chains 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.
Model::prepare_inputs_labels_for_multimodal (cognitive 55) mistralrs-core/src/vision_models/llava/llava_next.rs:224— Model::prepare_inputs_labels_for_multimodal has cognitive complexity 55 (threshold 15). Drivers by points: if/else 20 (32 pts), loops 9 (19 pts), boolean chains 4 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model::forward (cognitive 42) mistralrs-core/src/models/qwen3_next.rs:968— Model::forward has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (38 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model::forward_embeds (cognitive 32) mistralrs-core/src/models/lfm2.rs:1171— Model::forward_embeds has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (27 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 15). 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.
Model::create_anymoe_layers (cognitive 27) mistralrs-core/src/models/gemma.rs:575— Model::create_anymoe_layers has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model::create_anymoe_layers (cognitive 27) mistralrs-core/src/models/gemma2.rs:692— Model::create_anymoe_layers has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model::create_anymoe_layers (cognitive 27) mistralrs-core/src/models/glm4.rs:695— Model::create_anymoe_layers has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model::create_anymoe_layers (cognitive 27) mistralrs-core/src/models/hunyuan_v1_dense.rs:663— Model::create_anymoe_layers has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model::create_anymoe_layers (cognitive 27) mistralrs-core/src/models/mistral.rs:703— Model::create_anymoe_layers has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model::create_anymoe_layers (cognitive 27) mistralrs-core/src/models/qwen2.rs:705— Model::create_anymoe_layers has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model::create_anymoe_layers (cognitive 27) mistralrs-core/src/models/qwen3.rs:681— Model::create_anymoe_layers has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model::create_anymoe_layers (cognitive 27) mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:659— Model::create_anymoe_layers has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model::create_anymoe_layers (cognitive 22) mistralrs-core/src/models/phi2.rs:651— Model::create_anymoe_layers has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model::create_anymoe_layers (cognitive 22) mistralrs-core/src/models/phi3.rs:646— Model::create_anymoe_layers has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model::create_anymoe_layers (cognitive 22) mistralrs-core/src/models/starcoder2.rs:642— Model::create_anymoe_layers has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model::create_anymoe_layers (cognitive 22) mistralrs-core/src/vision_models/phi3/mod.rs:1483— Model::create_anymoe_layers has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TooManyMethods: Sequence mistralrs-core/src/sequence.rs:752— TooManyMethods — 150 methods. The bar is 30 methods; this is 120 over it, 5.00× 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: MistralRs mistralrs-core/src/lib.rs:443— TooManyMethods — 80 methods. The bar is 30 methods; this is 50 over it, 2.67× 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: HybridCache mistralrs-core/src/kv_cache/hybrid_cache.rs:1053— TooManyMethods — 68 methods. The bar is 30 methods; this is 38 over it, 2.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.
TooManyMethods: Model mistralrs/src/model.rs:80— TooManyMethods — 66 methods. The bar is 30 methods; this is 36 over it, 2.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: MistralRsForServerBuilder mistralrs-server-core/src/mistralrs_for_server_builder.rs:178— TooManyMethods — 57 methods. The bar is 30 methods; this is 27 over it, 1.90× 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: GgufModelBuilder mistralrs/src/gguf.rs:12— TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: RequestBuilder mistralrs/src/messages.rs:568— TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Sampler mistralrs-core/src/sampler.rs:299— TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: RecurrentStatePool mistralrs-core/src/kv_cache/hybrid_cache.rs:445— TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DFlashDraftModel mistralrs-core/src/speculative/dflash.rs:1285— TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: PagedAttentionScheduler mistralrs-core/src/paged_attention/scheduler.rs:100— TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Runner mistralrs-pyo3/src/lib.rs:339— TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: File mistralrs-core/src/files/mod.rs:90— TooManyMethods — 34 methods. The bar is 30 methods; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BlockPool mistralrs-core/src/paged_attention/block_pool.rs:543— 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.
TooManyMethods: ShardedVarBuilder mistralrs-quant/src/uqff/mod.rs:341— 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.
Duplicated block (15 lines × 3) mistralrs-core/src/models/mistral.rs:536— mistralrs-core/src/models/mistral.rs:536-550 | mistralrs-core/src/models/mixtral.rs:491-505 | mistralrs-core/src/models/starcoder2.rs:492-506 — before extracting anything, compare `mistralrs-core/src/models/mistral.rs` and `mistralrs-core/src/models/mixtral.rs` as WHOLE FILES: this scan already matched 43 separate duplicated blocks between them, totalling at least 564 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15 lines × 3) mistralrs-core/src/models/mixtral.rs:407— mistralrs-core/src/models/mixtral.rs:407-421 | mistralrs-core/src/models/phi3.rs:409-423 | mistralrs-core/src/models/qwen2.rs:434-448 — before extracting anything, compare `mistralrs-core/src/models/mixtral.rs` and `mistralrs-core/src/models/phi3.rs` as WHOLE FILES: this scan already matched 30 separate duplicated blocks between them, totalling at least 308 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15 lines × 3) mistralrs-core/src/models/phi3.rs:340— mistralrs-core/src/models/phi3.rs:340-354 | mistralrs-core/src/vision_models/phi3/mod.rs:431-445 | mistralrs-core/src/vision_models/phi4/mod.rs:260-274 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/vision_models/phi3/mod.rs` as WHOLE FILES: this scan already matched 47 separate duplicated blocks between them, totalling at least 594 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 (15 lines × 3) mistralrs-core/src/models/phi3.rs:504— mistralrs-core/src/models/phi3.rs:504-518 | mistralrs-core/src/models/phi3_5_moe.rs:576-590 | mistralrs-core/src/vision_models/phi3/mod.rs:1285-1300 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/models/phi3_5_moe.rs` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 312 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15 lines × 3) mistralrs-core/src/pipeline/ggml.rs:138— mistralrs-core/src/pipeline/ggml.rs:138-152 | mistralrs-core/src/pipeline/gguf.rs:367-381 | mistralrs-core/src/pipeline/normal.rs:474-488 — before extracting anything, compare `mistralrs-core/src/pipeline/ggml.rs` and `mistralrs-core/src/pipeline/gguf.rs` as WHOLE FILES: this scan already matched 7 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.
Duplicated block (15 lines × 3) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1251— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1251-1265 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3031-3045 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3380-3394 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 3) mistralrs-core/src/utils/gguf_metadata.rs:313— mistralrs-core/src/utils/gguf_metadata.rs:313-327 | mistralrs-core/src/utils/gguf_metadata.rs:346-360 | mistralrs-core/src/utils/gguf_metadata.rs:362-376 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:38— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:38-52 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:586-600 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:755-769 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (15 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:797— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:797-811 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1362-1376 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1476-1490 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (15 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:546— mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:546-560 | mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:563-577 | mistralrs-core/src/vision_models/qwen2vl/vision.rs:421-435 — `mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 18 separate duplicated blocks between them, totalling at least 176 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 (15 lines × 3) mistralrs-core/src/xlora_models/mistral.rs:195— mistralrs-core/src/xlora_models/mistral.rs:195-209 | mistralrs-core/src/xlora_models/mixtral.rs:108-122 | mistralrs-core/src/xlora_models/phi3.rs:85-99 — before extracting anything, compare `mistralrs-core/src/xlora_models/mistral.rs` and `mistralrs-core/src/xlora_models/mixtral.rs` as WHOLE FILES: this scan already matched 52 separate duplicated blocks between them, totalling at least 769 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15 lines × 3) mistralrs-quant/src/blockwise_fp8/ops.rs:208— mistralrs-quant/src/blockwise_fp8/ops.rs:208-222 | mistralrs-quant/src/blockwise_fp8/ops.rs:230-244 | mistralrs-quant/src/blockwise_fp8/ops.rs:252-266 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 3) mistralrs-quant/src/gemv/mod.rs:414— mistralrs-quant/src/gemv/mod.rs:414-428 | mistralrs-quant/src/gemv/mod.rs:482-496 | mistralrs-quant/src/gemv/mod.rs:550-564 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 3) mistralrs-quant/src/gguf/fast_mmq.rs:882— mistralrs-quant/src/gguf/fast_mmq.rs:882-896 | mistralrs-quant/src/gguf/fast_mmq.rs:1090-1104 | mistralrs-quant/src/gguf/fast_mmq.rs:1365-1379 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 3) mistralrs/src/model.rs:281— mistralrs/src/model.rs:281-295 | mistralrs/src/model.rs:350-364 | mistralrs/src/model.rs:437-451 — 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.
mistralrs_paged_attn::cuda::backend::flashinfer::flashinfer_decode (cyclomatic 54) mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:241— mistralrs_paged_attn::cuda::backend::flashinfer::flashinfer_decode has cyclomatic complexity 54 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mistralrs_paged_attn::metal::backend::paged_prefill::metal_paged_prefill (cyclomatic 42) mistralrs-paged-attn/src/metal/backend/paged_prefill.rs:434— mistralrs_paged_attn::metal::backend::paged_prefill::metal_paged_prefill has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_paged_attn::cuda::backend::cache::copy_blocks (cyclomatic 41) mistralrs-paged-attn/src/cuda/backend/cache.rs:26— mistralrs_paged_attn::cuda::backend::cache::copy_blocks has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_paged_attn::cuda::backend::gather_kv::gather_kv_cache (cyclomatic 38) mistralrs-paged-attn/src/cuda/backend/gather_kv.rs:54— mistralrs_paged_attn::cuda::backend::gather_kv::gather_kv_cache has cyclomatic complexity 38 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mistralrs_paged_attn::cuda::backend::mla::flashinfer_mla_decode (cyclomatic 35) mistralrs-paged-attn/src/cuda/backend/mla.rs:227— mistralrs_paged_attn::cuda::backend::mla::flashinfer_mla_decode has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mistralrs_paged_attn::cuda::backend::flashinfer::reshape_and_cache_flashinfer (cyclomatic 28) mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:71— mistralrs_paged_attn::cuda::backend::flashinfer::reshape_and_cache_flashinfer 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.
mistralrs_paged_attn::cuda::backend::flashinfer::gather_kv_cache_flashinfer (cyclomatic 28) mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:550— mistralrs_paged_attn::cuda::backend::flashinfer::gather_kv_cache_flashinfer 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.
mistralrs_paged_attn::cuda::backend::paged_attention::update_cache (cyclomatic 26) mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:538— mistralrs_paged_attn::cuda::backend::paged_attention::update_cache has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mistralrs_paged_attn::metal::backend::paged_attention::reshape_and_cache (cyclomatic 26) mistralrs-paged-attn/src/metal/backend/paged_attention.rs:767— mistralrs_paged_attn::metal::backend::paged_attention::reshape_and_cache has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mistralrs_paged_attn::cuda::backend::mla::concat_and_cache_mla (cyclomatic 21) mistralrs-paged-attn/src/cuda/backend/mla.rs:10— mistralrs_paged_attn::cuda::backend::mla::concat_and_cache_mla has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mistralrs_paged_attn::metal::backend::gather_kv::gather_kv_cache (cyclomatic 21) mistralrs-paged-attn/src/metal/backend/gather_kv.rs:9— mistralrs_paged_attn::metal::backend::gather_kv::gather_kv_cache has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mistralrs_paged_attn::cuda::backend::fa3::fa3_prepare_paged_metadata (cyclomatic 19) mistralrs-paged-attn/src/cuda/backend/fa3.rs:108— mistralrs_paged_attn::cuda::backend::fa3::fa3_prepare_paged_metadata 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.
mistralrs_paged_attn::cuda::backend::mla::gather_mla_cache (cyclomatic 19) mistralrs-paged-attn/src/cuda/backend/mla.rs:643— mistralrs_paged_attn::cuda::backend::mla::gather_mla_cache 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.
mistralrs_paged_attn::metal::backend::cache::swap_blocks (cyclomatic 16) mistralrs-paged-attn/src/metal/backend/cache.rs:112— mistralrs_paged_attn::metal::backend::cache::swap_blocks has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_cli::commands::run::interactive::print_agentic_progress (cyclomatic 38) mistralrs-cli/src/commands/run/interactive.rs:1104— mistralrs_cli::commands::run::interactive::print_agentic_progress has cyclomatic complexity 38 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
mistralrs_cli::commands::bench::run_bench (cyclomatic 36) mistralrs-cli/src/commands/bench.rs:80— mistralrs_cli::commands::bench::run_bench 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.
mistralrs_cli::commands::run::interactive::multimodal_interactive_mode (cyclomatic 33) mistralrs-cli/src/commands/run/interactive.rs:1521— mistralrs_cli::commands::run::interactive::multimodal_interactive_mode has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_cli::commands::doctor::run_doctor (cyclomatic 30) mistralrs-cli/src/commands/doctor.rs:6— mistralrs_cli::commands::doctor::run_doctor has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_cli::commands::run::interactive::stream_assistant_response (cyclomatic 28) mistralrs-cli/src/commands/run/interactive.rs:1408— mistralrs_cli::commands::run::interactive::stream_assistant_response 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.
mistralrs_cli::commands::serve::apply_quant_resolution (cyclomatic 26) mistralrs-cli/src/commands/serve.rs:977— mistralrs_cli::commands::serve::apply_quant_resolution 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.
mistralrs_cli::commands::tune::run_tune (cyclomatic 24) mistralrs-cli/src/commands/tune.rs:14— mistralrs_cli::commands::tune::run_tune has cyclomatic complexity 24 (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.
mistralrs_cli::commands::run::interactive::text_interactive_mode (cyclomatic 17) mistralrs-cli/src/commands/run/interactive.rs:863— mistralrs_cli::commands::run::interactive::text_interactive_mode 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.
mistralrs_cli::commands::serve::convert_to_model_selected (cyclomatic 17) mistralrs-cli/src/commands/serve.rs:295— mistralrs_cli::commands::serve::convert_to_model_selected has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mistralrs_cli::commands::quantize::resolve_gguf_source (cyclomatic 16) mistralrs-cli/src/commands/quantize.rs:104— mistralrs_cli::commands::quantize::resolve_gguf_source 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.
mistralrs_cli::commands::quantize::run_quantize (cyclomatic 16) mistralrs-cli/src/commands/quantize.rs:237— mistralrs_cli::commands::quantize::run_quantize 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.
mistralrs_cli::commands::run::interactive::oneshot_multimodal (cyclomatic 16) mistralrs-cli/src/commands/run/interactive.rs:337— mistralrs_cli::commands::run::interactive::oneshot_multimodal 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.
mistralrs_cli::commands::run::interactive::agent_approval_callback (cyclomatic 16) mistralrs-cli/src/commands/run/interactive.rs:1314— mistralrs_cli::commands::run::interactive::agent_approval_callback 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.
mistralrs_cli::ui::handlers::api::validate_text_upload (cyclomatic 16) mistralrs-cli/src/ui/handlers/api.rs:97— mistralrs_cli::ui::handlers::api::validate_text_upload has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Duplicated block (25 lines × 2) mistralrs-cli/src/commands/run/interactive.rs:1003— mistralrs-cli/src/commands/run/interactive.rs:1003-1027 | mistralrs-cli/src/commands/run/interactive.rs:1789-1813 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) mistralrs-core/src/models/qwen3.rs:480— mistralrs-core/src/models/qwen3.rs:480-504 | mistralrs-core/src/models/qwen3_moe.rs:660-684 — before extracting anything, compare `mistralrs-core/src/models/qwen3.rs` and `mistralrs-core/src/models/qwen3_moe.rs` as WHOLE FILES: this scan already matched 62 separate duplicated blocks between them, totalling at least 799 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (25 lines × 2) mistralrs-core/src/pipeline/inputs_processor.rs:2732— mistralrs-core/src/pipeline/inputs_processor.rs:2732-2756 | mistralrs-core/src/pipeline/inputs_processor.rs:2776-2800 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2705— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2705-2729 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4129-4153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:2072— mistralrs-core/src/pipeline/multimodal.rs:2072-2096 | mistralrs-core/src/pipeline/normal.rs:1904-1928 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (25 lines × 2) mistralrs-core/src/sampler.rs:1166— mistralrs-core/src/sampler.rs:1166-1190 | mistralrs-core/src/sampler.rs:1246-1270 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:754— mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:754-778 | mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:975-999 — before extracting anything, compare `mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs` and `mistralrs-core/src/vision_models/idefics3/inputs_processor.rs` as WHOLE FILES: this scan already matched 7 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. 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 (25 lines × 2) mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:608— mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:608-632 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:543-567 — `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.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 52 separate duplicated blocks between them, totalling at least 1117 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 (25 lines × 2) mistralrs-core/src/vision_models/qwen3_5/text.rs:852— mistralrs-core/src/vision_models/qwen3_5/text.rs:852-876 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:537-561 — `mistralrs-core/src/vision_models/qwen3_5/text.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 26 separate duplicated blocks between them, totalling at least 428 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 (25 lines × 2) mistralrs-core/src/vision_models/qwen3_vl/mod.rs:975— mistralrs-core/src/vision_models/qwen3_vl/mod.rs:975-999 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:420-444 — `mistralrs-core/src/vision_models/qwen3_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/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 29 separate duplicated blocks between them, totalling at least 505 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 (25 lines × 2) mistralrs-core/src/xlora_models/classifier.rs:118— mistralrs-core/src/xlora_models/classifier.rs:118-142 | mistralrs-core/src/xlora_models/classifier.rs:210-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) mistralrs-pyo3/src/lib.rs:1926— mistralrs-pyo3/src/lib.rs:1926-1950 | mistralrs-pyo3/src/lib.rs:1992-2016 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) mistralrs-quant/src/distributed/layers.rs:2741— mistralrs-quant/src/distributed/layers.rs:2741-2765 | mistralrs-quant/src/distributed/layers.rs:2906-2930 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) mistralrs-quant/src/moe/cutlass.rs:261— mistralrs-quant/src/moe/cutlass.rs:261-285 | mistralrs-quant/src/moe/cutlass.rs:305-329 — both copies are in the same file, so extract the block into 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 × 4) mistralrs-core/src/models/deepseek2.rs:521— mistralrs-core/src/models/deepseek2.rs:521-525 | mistralrs-core/src/models/deepseek3.rs:534-538 | mistralrs-core/src/models/glm4_moe.rs:454-458 | mistralrs-core/src/models/glm4_moe_lite.rs:552-556 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/deepseek2.rs:667— mistralrs-core/src/models/deepseek2.rs:667-673 | mistralrs-core/src/models/deepseek3.rs:730-736 | mistralrs-core/src/models/glm4_moe.rs:570-574 | mistralrs-core/src/models/glm4_moe_lite.rs:676-682 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/phi3.rs:559— mistralrs-core/src/models/phi3.rs:559-563 | mistralrs-core/src/models/phi3_5_moe.rs:632-636 | mistralrs-core/src/vision_models/phi3/mod.rs:1362-1366 | mistralrs-core/src/vision_models/phi4/mod.rs:524-528 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/models/phi3_5_moe.rs` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 312 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/pipeline/cuda_graph.rs:3850— mistralrs-core/src/pipeline/cuda_graph.rs:3850-3854 | mistralrs-core/src/pipeline/cuda_graph.rs:3868-3872 | mistralrs-core/src/pipeline/cuda_graph.rs:3887-3891 | mistralrs-core/src/pipeline/cuda_graph.rs:3906-3910 — 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) REDACTED:513— REDACTED:513-518 | mistralrs-core/src/vision_models/idefics3/vision.rs:309-314 | mistralrs-core/src/vision_models/lfm2_vl/vision.rs:242-246 | mistralrs-core/src/vision_models/siglip.rs:320-325 — before extracting anything, compare `REDACTED` and `mistralrs-core/src/vision_models/idefics3/vision.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 213 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 × 4) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:318— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:318-322 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:475-479 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:962-966 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:407-411 — `mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 21 separate duplicated blocks between them, totalling at least 374 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 (5 lines × 4) mistralrs-paged-attn/src/cuda/backend/cache.rs:139— mistralrs-paged-attn/src/cuda/backend/cache.rs:139-143 | mistralrs-paged-attn/src/cuda/backend/cache.rs:146-150 | mistralrs-paged-attn/src/cuda/backend/cache.rs:153-157 | mistralrs-paged-attn/src/cuda/backend/cache.rs:160-164 — 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) mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:67— mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:67-71 | mistralrs-quant/src/gguf/cuda.rs:113-117 | mistralrs-quant/src/gguf/fast_mmq.rs:354-358 | mistralrs-quant/src/gguf/fast_mmvq.rs:96-100 — before extracting anything, compare `mistralrs-quant/src/gguf/fast_mmq.rs` and `mistralrs-quant/src/gguf/fast_mmvq.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 4) mistralrs-pyo3/src/util.rs:159— mistralrs-pyo3/src/util.rs:159-163 | mistralrs-pyo3/src/util.rs:181-185 | mistralrs-server-core/src/chat_completion.rs:1357-1361 | mistralrs-server-core/src/completions.rs:455-459 — before extracting anything, compare `mistralrs-server-core/src/chat_completion.rs` and `mistralrs-server-core/src/completions.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/vision_models/gemma4/vision.rs:56— mistralrs-core/src/vision_models/gemma4/vision.rs:56-60 | mistralrs-core/src/vision_models/gemma4/vision.rs:62-66 | mistralrs-core/src/vision_models/gemma4/vision.rs:68-72 | mistralrs-core/src/vision_models/gemma4/vision.rs:73-77 — 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) mistralrs-core/src/ops.rs:1179— mistralrs-core/src/ops.rs:1179-1184 | mistralrs-core/src/ops.rs:1397-1402 | mistralrs-core/src/ops.rs:1416-1420 | mistralrs-core/src/ops.rs:2981-2985 — 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) mistralrs-quant/src/cutile/fused_moe.rs:482— mistralrs-quant/src/cutile/fused_moe.rs:482-487 | mistralrs-quant/src/moe/cuda.rs:236-240 | mistralrs-quant/src/moe/cuda.rs:272-276 | mistralrs-quant/src/moe/cuda.rs:312-316 — 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 (5 lines × 4) mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:225— mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:225-229 | mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:234-238 | mistralrs-quant/src/gptq/marlin_backend.rs:66-70 | mistralrs-quant/src/gptq/marlin_backend.rs:258-262 — 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 (5 lines × 4) mistralrs-quant/src/cutile/fused_moe.rs:476— mistralrs-quant/src/cutile/fused_moe.rs:476-480 | mistralrs-quant/src/moe/cuda.rs:235-239 | mistralrs-quant/src/moe/cuda.rs:271-275 | mistralrs-quant/src/moe/cuda.rs:311-315 — 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.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×13
Members sharing a duplicated core (5 members, 50+ identical tokens) mistralrs-core/src/gguf/base_model.rs:138— mistralrs-core/src/gguf/base_model.rs:138-151 | mistralrs-core/src/gguf/multimodal_binding_utils.rs:108-124 | mistralrs-core/src/gguf/normal_bindings.rs:898-911 | mistralrs-core/src/gguf/qwen_multimodal_bindings.rs:294-310 | mistralrs-quant/src/gguf/archive.rs:1265-1281 — 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) mistralrs-core/src/gguf/gemma3_bindings.rs:149— mistralrs-core/src/gguf/gemma3_bindings.rs:149-192 | mistralrs-core/src/gguf/idefics3_bindings.rs:41-84 | mistralrs-core/src/gguf/lfm2_vl_bindings.rs:69-119 | mistralrs-core/src/gguf/llama4_bindings.rs:170-242 | mistralrs-core/src/gguf/muse_glimmer_bindings.rs:114-154 — 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) mistralrs-core/src/models/granite.rs:1947— mistralrs-core/src/models/granite.rs:1947-2178 | mistralrs-core/src/models/lfm2.rs:1009-1161 | mistralrs-core/src/models/qwen3_next.rs:733-966 | mistralrs-core/src/vision_models/qwen3_5/text.rs:811-1078 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:532-771 — 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) mistralrs-core/src/ops.rs:2117— mistralrs-core/src/ops.rs:2117-2267 | mistralrs-core/src/ops.rs:3862-3982 | mistralrs-core/src/ops.rs:3989-4106 | mistralrs-flash-attn/src/flash.rs:34-224 | mistralrs-flash-attn/src/flash.rs:482-832 — 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2628— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2628-2659 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6605-6637 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7047-7079 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7524-7552 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8046-8074 — 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2665— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2665-2694 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6643-6672 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7085-7114 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7558-7585 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8080-8107 — 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4127— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4127-4196 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6681-6770 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7123-7212 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7594-7680 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8116-8202 — 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) mistralrs-core/src/vision_models/diffusion_gemma/mod.rs:257— mistralrs-core/src/vision_models/diffusion_gemma/mod.rs:257-299 | mistralrs-core/src/vision_models/gemma3/mod.rs:118-193 | mistralrs-core/src/vision_models/gemma4/mod.rs:360-891 | mistralrs-core/src/vision_models/lfm2_vl/mod.rs:193-230 | mistralrs-core/src/vision_models/mistral3/mod.rs:238-335 — 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) REDACTED:509— REDACTED:509-518 | REDACTED:864-873 | mistralrs-core/src/vision_models/idefics3/vision.rs:305-314 | mistralrs-core/src/vision_models/lfm2_vl/vision.rs:239-246 | mistralrs-core/src/vision_models/siglip.rs:316-325 — 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) mistralrs-quant/src/cutile/fp8_gemm.rs:466— mistralrs-quant/src/cutile/fp8_gemm.rs:466-495 | mistralrs-quant/src/cutile/fp8_w8a16.rs:772-804 | mistralrs-quant/src/cutile/fp8_w8a8.rs:768-823 | mistralrs-quant/src/cutile/fused_moe.rs:791-848 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:706-764 — 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) mistralrs-quant/src/gguf/fast_mmq.rs:528— mistralrs-quant/src/gguf/fast_mmq.rs:528-635 | mistralrs-quant/src/gguf/fast_mmq.rs:642-759 | mistralrs-quant/src/gguf/fast_mmq.rs:838-1008 | mistralrs-quant/src/gguf/fast_mmq.rs:1025-1180 | mistralrs-quant/src/gguf/fast_mmq.rs:1301-1499 — 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) mistralrs-quant/src/hqq/hqq_op.rs:36— mistralrs-quant/src/hqq/hqq_op.rs:36-58 | mistralrs-quant/src/hqq/hqq_op.rs:143-167 | mistralrs-quant/src/hqq/hqq_op.rs:256-280 | mistralrs-quant/src/hqq/hqq_op.rs:373-397 | mistralrs-quant/src/hqq/hqq_op.rs:492-516 — 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) mistralrs-quant/src/metal_kernels/mod.rs:1502— mistralrs-quant/src/metal_kernels/mod.rs:1502-1544 | mistralrs-quant/src/metal_kernels/mod.rs:1572-1623 | mistralrs-quant/src/metal_kernels/mod.rs:2730-2954 | mistralrs-quant/src/metal_kernels/mod.rs:4721-4761 | mistralrs-quant/src/metal_kernels/mod.rs:4792-4832 — 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 (11 lines × 4) mistralrs-cli/src/commands/run/interactive.rs:888— mistralrs-cli/src/commands/run/interactive.rs:888-898 | mistralrs-cli/src/commands/run/interactive.rs:1568-1578 | mistralrs-cli/src/commands/run/interactive.rs:1875-1885 | mistralrs-cli/src/commands/run/interactive.rs:1998-2008 — 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 (11 lines × 4) mistralrs-core/src/embedding_models/embedding_gemma.rs:427— mistralrs-core/src/embedding_models/embedding_gemma.rs:427-438 | mistralrs-core/src/vision_models/gemma3/text.rs:486-497 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:424-434 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:544-554 — before extracting anything, compare `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/vision_models/gemma3/text.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 268 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 (11 lines × 4) mistralrs-core/src/layers.rs:927— mistralrs-core/src/layers.rs:927-937 | mistralrs-core/src/layers.rs:944-954 | mistralrs-core/src/layers.rs:2250-2260 | mistralrs-core/src/layers.rs:2267-2277 — 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 (11 lines × 4) mistralrs-core/src/models/deepseek2.rs:780— mistralrs-core/src/models/deepseek2.rs:780-790 | mistralrs-core/src/models/deepseek3.rs:843-853 | mistralrs-core/src/models/glm4_moe.rs:680-690 | mistralrs-core/src/models/glm4_moe_lite.rs:790-800 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4669— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4669-4679 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8303-8313 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1060-1070 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6617-6627 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/vision_models/phi3/mod.rs:594— mistralrs-core/src/vision_models/phi3/mod.rs:594-604 | mistralrs-core/src/vision_models/phi3/mod.rs:626-636 | mistralrs-core/src/vision_models/phi4/image_embedding.rs:217-227 | mistralrs-core/src/vision_models/phi4/image_embedding.rs:249-259 — before extracting anything, compare `mistralrs-core/src/vision_models/phi3/mod.rs` and `mistralrs-core/src/vision_models/phi4/image_embedding.rs` as WHOLE FILES: this scan already matched 8 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. 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 (11 lines × 4) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:228— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:228-238 | mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:270-280 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:385-395 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:427-437 — `mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 21 separate duplicated blocks between them, totalling at least 374 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 (11 lines × 4) mistralrs-core/src/vision_models/qwen3_vl/mod.rs:735— mistralrs-core/src/vision_models/qwen3_vl/mod.rs:735-745 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:810-820 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:180-190 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:255-265 — `mistralrs-core/src/vision_models/qwen3_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/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 29 separate duplicated blocks between them, totalling at least 505 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 (11 lines × 4) mistralrs-core/src/xlora_models/gemma2.rs:646— mistralrs-core/src/xlora_models/gemma2.rs:646-656 | mistralrs-core/src/xlora_models/phi2.rs:569-579 | mistralrs-core/src/xlora_models/quantized_llama.rs:805-815 | mistralrs-core/src/xlora_models/quantized_phi3.rs:473-483 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma2.rs` and `mistralrs-core/src/xlora_models/phi2.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 297 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-quant/src/blockwise_fp8/mod.rs:1037— mistralrs-quant/src/blockwise_fp8/mod.rs:1037-1047 | mistralrs-quant/src/pertensor_fp8/mod.rs:598-608 | mistralrs-quant/src/unquantized/mod.rs:542-552 | mistralrs-quant/src/vector_fp8/mod.rs:178-188 — `mistralrs-quant/src/blockwise_fp8/mod.rs` and `mistralrs-quant/src/pertensor_fp8/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 9 separate duplicated blocks between them, totalling at least 217 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 (11 lines × 4) mistralrs-quant/src/blockwise_fp8/mod.rs:1099— mistralrs-quant/src/blockwise_fp8/mod.rs:1099-1109 | mistralrs-quant/src/pertensor_fp8/mod.rs:658-668 | mistralrs-quant/src/unquantized/mod.rs:600-610 | mistralrs-quant/src/vector_fp8/mod.rs:239-249 — `mistralrs-quant/src/blockwise_fp8/mod.rs` and `mistralrs-quant/src/pertensor_fp8/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 9 separate duplicated blocks between them, totalling at least 217 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 (11 lines × 4) mistralrs-quant/src/cutile/fp8_gemm.rs:159— mistralrs-quant/src/cutile/fp8_gemm.rs:159-169 | mistralrs-quant/src/cutile/fp8_w8a16.rs:338-348 | mistralrs-quant/src/cutile/fp8_w8a8.rs:294-304 | mistralrs-quant/src/cutile/mod.rs:340-350 — before extracting anything, compare `mistralrs-quant/src/cutile/fp8_gemm.rs` and `mistralrs-quant/src/cutile/fp8_w8a16.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 4) mistralrs-quant/src/cutile/nvfp4_gemv.rs:318— mistralrs-quant/src/cutile/nvfp4_gemv.rs:318-328 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1190-1200 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1234-1244 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1448-1458 — before extracting anything, compare `mistralrs-quant/src/cutile/nvfp4_gemv.rs` and `mistralrs-quant/src/cutile/nvfp4_matmul.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-cli/src/commands/serve.rs:730— mistralrs-cli/src/commands/serve.rs:730-738 | mistralrs-cli/src/commands/serve.rs:762-770 | mistralrs-cli/src/commands/serve.rs:795-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.
Duplicated block (9 lines × 3) mistralrs-core/src/lib.rs:2488— mistralrs-core/src/lib.rs:2488-2496 | mistralrs-core/src/lib.rs:2551-2559 | mistralrs-core/src/lib.rs:2568-2576 — 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) mistralrs-core/src/lora/mod.rs:163— mistralrs-core/src/lora/mod.rs:163-171 | mistralrs-core/src/lora/mod.rs:215-223 | mistralrs-core/src/lora/qloralinear.rs:41-49 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (9 lines × 3) mistralrs-core/src/paged_attention/cache_engine.rs:251— mistralrs-core/src/paged_attention/cache_engine.rs:251-260 | mistralrs-core/src/paged_attention/cache_engine.rs:300-308 | mistralrs-core/src/paged_attention/cache_engine.rs:386-394 — 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) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7248— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7248-7256 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8264-8272 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5332-5340 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:328— mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:328-336 | mistralrs-core/src/vision_models/qwen2vl/vision.rs:300-308 | mistralrs-core/src/vision_models/qwen3_vl/vision.rs:346-354 — `mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 18 separate duplicated blocks between them, totalling at least 176 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 (9 lines × 3) mistralrs-quant/src/afq/ops.rs:2367— mistralrs-quant/src/afq/ops.rs:2367-2375 | mistralrs-quant/src/afq/ops.rs:2489-2497 | mistralrs-quant/src/afq/ops.rs:3015-3023 — 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) mistralrs-quant/src/cutile/fp8_gemm.rs:361— mistralrs-quant/src/cutile/fp8_gemm.rs:361-369 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:926-934 | mistralrs-quant/src/cutile/gdn_prefill.rs:717-725 — before extracting anything, compare `mistralrs-quant/src/cutile/fp8_gemm.rs` and `mistralrs-quant/src/cutile/fused_moe_fp8.rs` as WHOLE FILES: this scan already matched 7 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. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-quant/src/cutile/fused_moe.rs:376— mistralrs-quant/src/cutile/fused_moe.rs:376-384 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:372-380 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:410-418 — before extracting anything, compare `mistralrs-quant/src/cutile/fused_moe.rs` and `mistralrs-quant/src/cutile/fused_moe_fp8.rs` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 308 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-quant/src/hqq/mod.rs:183— mistralrs-quant/src/hqq/mod.rs:183-191 | mistralrs-quant/src/hqq/mod.rs:268-276 | mistralrs-quant/src/hqq/mod.rs:438-446 — 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) mistralrs-quant/src/hqq/mod.rs:465— mistralrs-quant/src/hqq/mod.rs:465-473 | mistralrs-quant/src/hqq/mod.rs:529-537 | mistralrs-quant/src/hqq/mod.rs:552-560 — 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) mistralrs-quant/src/afq/mod.rs:219— mistralrs-quant/src/afq/mod.rs:219-227 | mistralrs-quant/src/gguf/mod.rs:755-763 | mistralrs-quant/src/unquantized/mod.rs:637-645 — 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) mistralrs-quant/src/gguf/fast_mmq.rs:588— mistralrs-quant/src/gguf/fast_mmq.rs:588-596 | mistralrs-quant/src/gguf/fast_mmq.rs:872-880 | mistralrs-quant/src/gguf/fast_mmq.rs:1355-1363 — 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 × 4) mistralrs-code-exec/src/lib.rs:463— mistralrs-code-exec/src/lib.rs:463-469 | mistralrs-code-exec/src/lib.rs:530-536 | mistralrs-code-exec/src/shell.rs:201-206 | mistralrs-code-exec/src/shell.rs:260-265 — before extracting anything, compare `mistralrs-code-exec/src/lib.rs` and `mistralrs-code-exec/src/shell.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/cuda/gdn.rs:1915— mistralrs-core/src/cuda/gdn.rs:1915-1920 | mistralrs-core/src/cuda/gdn.rs:1922-1927 | mistralrs-core/src/cuda/gdn.rs:5789-5794 | mistralrs-core/src/cuda/moe.rs:53-58 — 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) mistralrs-core/src/models/gemma2.rs:572— mistralrs-core/src/models/gemma2.rs:572-577 | mistralrs-core/src/models/qwen2.rs:599-604 | mistralrs-core/src/vision_models/gemma3/text.rs:741-746 | mistralrs-core/src/xlora_models/gemma2.rs:641-646 — before extracting anything, compare `mistralrs-core/src/models/gemma2.rs` and `mistralrs-core/src/models/qwen2.rs` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 428 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/llama.rs:524— mistralrs-core/src/models/llama.rs:524-530 | mistralrs-core/src/models/smollm3.rs:543-549 | mistralrs-core/src/vision_models/llama4/text.rs:1023-1029 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:511-516 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/vision_models/gemma4/mod.rs:394— mistralrs-core/src/vision_models/gemma4/mod.rs:394-399 | REDACTED:232-237 | mistralrs-core/src/vision_models/llava/llava_next.rs:290-295 | mistralrs-core/src/vision_models/mistral3/mod.rs:261-266 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 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 4 times.
Duplicated block (6 lines × 4) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1008— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1008-1013 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1573-1578 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1702-1707 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1751-1756 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (6 lines × 4) mistralrs-core/src/vision_models/qwen3_5/mod.rs:181— mistralrs-core/src/vision_models/qwen3_5/mod.rs:181-186 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:164-169 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:688-693 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:133-138 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (6 lines × 4) mistralrs-quant/src/blockwise_fp8/mma.rs:172— mistralrs-quant/src/blockwise_fp8/mma.rs:172-177 | mistralrs-quant/src/blockwise_fp8/ops.rs:881-886 | mistralrs-quant/src/blockwise_fp8/ops.rs:1710-1715 | mistralrs-quant/src/cutile/nvfp4_glu.rs:629-634 — there are 4 copies across 3 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) REDACTED:408— REDACTED:408-415 | mistralrs-core/src/vision_models/idefics3/vision.rs:220-227 | mistralrs-core/src/vision_models/lfm2_vl/vision.rs:169-174 | mistralrs-core/src/vision_models/siglip.rs:224-231 — before extracting anything, compare `REDACTED` and `mistralrs-core/src/vision_models/idefics3/vision.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 213 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 × 4) mistralrs-quant/src/utils/ops.rs:160— mistralrs-quant/src/utils/ops.rs:160-165 | mistralrs-quant/src/utils/ops.rs:606-611 | mistralrs-quant/src/utils/ops.rs:760-765 | mistralrs-quant/src/utils/ops.rs:1523-1528 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 4) mistralrs-cli/src/ui/handlers/api.rs:207— mistralrs-cli/src/ui/handlers/api.rs:207-212 | mistralrs-cli/src/ui/handlers/api.rs:259-264 | mistralrs-cli/src/ui/handlers/api.rs:311-316 | mistralrs-cli/src/ui/handlers/api.rs:367-372 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 4) mistralrs-quant/src/blockwise_fp8/mod.rs:331— mistralrs-quant/src/blockwise_fp8/mod.rs:331-336 | mistralrs-quant/src/blockwise_fp8/mod.rs:377-382 | mistralrs-quant/src/blockwise_fp8/mod.rs:683-688 | mistralrs-quant/src/lib.rs:1661-1666 — 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) mistralrs-quant/src/hqq/hqq_op.rs:119— mistralrs-quant/src/hqq/hqq_op.rs:119-124 | mistralrs-quant/src/hqq/hqq_op.rs:230-235 | mistralrs-quant/src/hqq/hqq_op.rs:343-348 | mistralrs-quant/src/hqq/hqq_op.rs:460-465 — 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 (16 lines × 3) mistralrs-core/src/model_loader.rs:199— mistralrs-core/src/model_loader.rs:199-214 | mistralrs-core/src/model_loader.rs:224-239 | mistralrs-core/src/model_loader.rs:248-263 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16 lines × 3) mistralrs-core/src/models/phi3.rs:195— mistralrs-core/src/models/phi3.rs:195-210 | mistralrs-core/src/vision_models/phi3/mod.rs:286-301 | mistralrs-core/src/vision_models/phi4/mod.rs:155-170 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/vision_models/phi3/mod.rs` as WHOLE FILES: this scan already matched 47 separate duplicated blocks between them, totalling at least 594 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) mistralrs-core/src/models/phi3.rs:481— mistralrs-core/src/models/phi3.rs:481-496 | mistralrs-core/src/vision_models/phi3/mod.rs:1262-1277 | mistralrs-core/src/vision_models/phi4/mod.rs:377-392 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/vision_models/phi3/mod.rs` as WHOLE FILES: this scan already matched 47 separate duplicated blocks between them, totalling at least 594 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) mistralrs-core/src/ops.rs:5828— mistralrs-core/src/ops.rs:5828-5843 | mistralrs-core/src/ops.rs:6265-6280 | mistralrs-core/src/ops.rs:6591-6606 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16 lines × 3) mistralrs-core/src/pipeline/embedding.rs:470— mistralrs-core/src/pipeline/embedding.rs:470-485 | mistralrs-core/src/pipeline/multimodal.rs:1030-1045 | mistralrs-core/src/pipeline/normal.rs:1027-1042 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:298— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:298-313 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:864-879 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:961-976 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (16 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:886— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:886-901 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1451-1466 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1570-1585 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (16 lines × 3) mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:213— mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:213-228 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:214-229 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:320-335 — `mistralrs-core/src/vision_models/qwen3_5_moe/text.rs` and `mistralrs-core/src/vision_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 18 separate duplicated blocks between them, totalling at least 203 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 (16 lines × 3) mistralrs-core/src/xlora_models/mistral.rs:523— mistralrs-core/src/xlora_models/mistral.rs:523-538 | mistralrs-core/src/xlora_models/mixtral.rs:653-668 | mistralrs-core/src/xlora_models/starcoder2.rs:506-521 — before extracting anything, compare `mistralrs-core/src/xlora_models/mistral.rs` and `mistralrs-core/src/xlora_models/mixtral.rs` as WHOLE FILES: this scan already matched 52 separate duplicated blocks between them, totalling at least 769 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 3) mistralrs-core/src/xlora_models/quantized_llama.rs:429— mistralrs-core/src/xlora_models/quantized_llama.rs:429-444 | mistralrs-core/src/xlora_models/quantized_llama.rs:731-746 | mistralrs-core/src/xlora_models/quantized_phi3.rs:393-408 — before extracting anything, compare `mistralrs-core/src/xlora_models/quantized_llama.rs` and `mistralrs-core/src/xlora_models/quantized_phi3.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 221 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 3) mistralrs-quant/src/utils/ops.rs:2837— mistralrs-quant/src/utils/ops.rs:2837-2852 | mistralrs-quant/src/utils/ops.rs:2864-2879 | mistralrs-quant/src/utils/ops.rs:2891-2906 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16 lines × 3) mistralrs/src/model_builder_trait.rs:783— mistralrs/src/model_builder_trait.rs:783-798 | mistralrs/src/model_builder_trait.rs:936-951 | mistralrs/src/model_builder_trait.rs:1560-1575 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) mistralrs-cli/src/commands/run/interactive.rs:1780— mistralrs-cli/src/commands/run/interactive.rs:1780-1792 | mistralrs-cli/src/commands/run/interactive.rs:1946-1958 | mistralrs-cli/src/commands/run/interactive.rs:2068-2080 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) mistralrs-core/src/embedding_models/embedding_gemma.rs:536— mistralrs-core/src/embedding_models/embedding_gemma.rs:536-548 | mistralrs-core/src/models/gemma2.rs:608-620 | mistralrs-core/src/vision_models/gemma3/text.rs:855-867 — before extracting anything, compare `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 156 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 × 3) mistralrs-core/src/models/gemma.rs:208— mistralrs-core/src/models/gemma.rs:208-223 | mistralrs-core/src/models/phi2.rs:304-319 | mistralrs-core/src/vision_models/gemma3/text.rs:258-270 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/phi2.rs` as WHOLE FILES: this scan already matched 34 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.
Duplicated block (13 lines × 3) mistralrs-core/src/models/llama.rs:691— mistralrs-core/src/models/llama.rs:691-703 | mistralrs-core/src/models/smollm3.rs:710-722 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:707-719 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/moe/experts/backends.rs:959— mistralrs-core/src/moe/experts/backends.rs:959-971 | mistralrs-core/src/moe/experts/backends.rs:1038-1050 | mistralrs-quant/src/moe/cutlass.rs:157-169 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (13 lines × 3) mistralrs-core/src/pipeline/cuda_graph.rs:3604— mistralrs-core/src/pipeline/cuda_graph.rs:3604-3616 | mistralrs-core/src/pipeline/cuda_graph.rs:3649-3661 | mistralrs-core/src/pipeline/cuda_graph.rs:3694-3706 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1555— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1555-1567 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1863-1875 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4792-4804 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4670— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4670-4682 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1061-1073 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6618-6630 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:129— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:129-141 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:695-707 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:787-799 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (13 lines × 3) mistralrs-core/src/vision_models/qwen3_5/config.rs:382— mistralrs-core/src/vision_models/qwen3_5/config.rs:382-394 | mistralrs-core/src/vision_models/qwen3_5_moe/config.rs:192-204 | mistralrs-core/src/vision_models/qwen4_exp/config.rs:363-375 — 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 (13 lines × 3) mistralrs-core/src/xlora_models/classifier.rs:46— mistralrs-core/src/xlora_models/classifier.rs:46-58 | mistralrs-core/src/xlora_models/classifier.rs:109-121 | mistralrs-core/src/xlora_models/classifier.rs:201-213 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) mistralrs-quant/src/safetensors.rs:614— mistralrs-quant/src/safetensors.rs:614-626 | mistralrs-quant/src/safetensors.rs:664-676 | mistralrs-quant/src/safetensors.rs:740-752 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) mistralrs-core/src/layers.rs:1149— mistralrs-core/src/layers.rs:1149-1160 | mistralrs-core/src/layers.rs:1239-1250 | mistralrs-core/src/layers.rs:1508-1519 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) mistralrs-core/src/models/deepseek2.rs:457— mistralrs-core/src/models/deepseek2.rs:457-468 | mistralrs-core/src/models/deepseek3.rs:458-469 | mistralrs-core/src/models/glm4_moe_lite.rs:422-433 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/granite.rs:1487— mistralrs-core/src/models/granite.rs:1487-1498 | mistralrs-core/src/models/granite.rs:1773-1784 | mistralrs-core/src/vision_models/llama4/text.rs:696-707 — before extracting anything, compare `mistralrs-core/src/models/granite.rs` and `mistralrs-core/src/vision_models/llama4/text.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 151 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 × 3) mistralrs-core/src/models/llama.rs:220— mistralrs-core/src/models/llama.rs:220-231 | mistralrs-core/src/models/smollm3.rs:237-248 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:193-204 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/qwen3_next.rs:922— mistralrs-core/src/models/qwen3_next.rs:922-933 | mistralrs-core/src/vision_models/qwen3_5/text.rs:1029-1040 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:730-741 — before extracting anything, compare `mistralrs-core/src/models/qwen3_next.rs` and `mistralrs-core/src/vision_models/qwen3_5/text.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 158 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 × 3) mistralrs-core/src/ops.rs:5589— mistralrs-core/src/ops.rs:5589-5600 | mistralrs-core/src/ops.rs:6018-6029 | mistralrs-core/src/ops.rs:6354-6365 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) mistralrs-core/src/vision_models/gemma4/mod.rs:539— mistralrs-core/src/vision_models/gemma4/mod.rs:539-550 | mistralrs-core/src/vision_models/gemma4/mod.rs:662-673 | mistralrs-core/src/vision_models/gemma4/mod.rs:852-863 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:336— mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:336-347 | mistralrs-core/src/vision_models/mllama/text.rs:280-291 | mistralrs-core/src/vision_models/mllama/text.rs:639-650 — before extracting anything, compare `mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs` and `mistralrs-core/src/vision_models/mllama/text.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 45 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 × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1023— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1023-1034 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1588-1599 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1767-1778 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (12 lines × 3) mistralrs-quant/src/moe/cuda.rs:231— mistralrs-quant/src/moe/cuda.rs:231-242 | mistralrs-quant/src/moe/cuda.rs:267-278 | mistralrs-quant/src/moe/cuda.rs:307-318 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) mistralrs/src/model_builder_trait.rs:869— mistralrs/src/model_builder_trait.rs:869-880 | mistralrs/src/model_builder_trait.rs:1232-1243 | mistralrs/src/model_builder_trait.rs:1648-1659 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) mistralrs-core/src/vision_models/llama4/text.rs:844— mistralrs-core/src/vision_models/llama4/text.rs:844-855 | mistralrs-core/src/vision_models/phi3/mod.rs:1239-1250 | mistralrs-core/src/vision_models/phi4/mod.rs:354-365 — before extracting anything, compare `mistralrs-core/src/vision_models/llama4/text.rs` and `mistralrs-core/src/vision_models/phi3/mod.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. 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 × 4) mistralrs-core/src/embedding_models/qwen3_embedding.rs:138— mistralrs-core/src/embedding_models/qwen3_embedding.rs:138-147 | mistralrs-core/src/models/flint.rs:279-288 | mistralrs-core/src/models/qwen3.rs:149-158 | mistralrs-core/src/models/qwen3_moe.rs:152-161 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/flint.rs` as WHOLE FILES: this scan already matched 6 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 (10 lines × 4) mistralrs-core/src/ops.rs:5713— mistralrs-core/src/ops.rs:5713-5722 | mistralrs-core/src/ops.rs:5925-5934 | mistralrs-core/src/ops.rs:6136-6145 | mistralrs-core/src/ops.rs:6454-6463 — 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 (10 lines × 4) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:716— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:716-725 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1851-1860 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2543-2552 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4369-4378 — 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 (10 lines × 4) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1147— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1147-1156 | mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1176-1185 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1712-1721 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1741-1750 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:479— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:479-488 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:635-644 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:1102-1111 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:531-540 — `mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 21 separate duplicated blocks between them, totalling at least 374 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) mistralrs-quant/src/blockwise_fp8/mod.rs:981— mistralrs-quant/src/blockwise_fp8/mod.rs:981-990 | mistralrs-quant/src/pertensor_fp8/mod.rs:543-552 | mistralrs-quant/src/unquantized/mod.rs:452-461 | mistralrs-quant/src/vector_fp8/mod.rs:123-132 — `mistralrs-quant/src/blockwise_fp8/mod.rs` and `mistralrs-quant/src/pertensor_fp8/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 9 separate duplicated blocks between them, totalling at least 217 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) mistralrs-quant/src/blockwise_fp8/mod.rs:1055— mistralrs-quant/src/blockwise_fp8/mod.rs:1055-1064 | mistralrs-quant/src/pertensor_fp8/mod.rs:615-624 | mistralrs-quant/src/unquantized/mod.rs:560-569 | mistralrs-quant/src/vector_fp8/mod.rs:195-204 — `mistralrs-quant/src/blockwise_fp8/mod.rs` and `mistralrs-quant/src/pertensor_fp8/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 9 separate duplicated blocks between them, totalling at least 217 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) mistralrs-quant/src/cutile/fused_moe.rs:270— mistralrs-quant/src/cutile/fused_moe.rs:270-279 | mistralrs-quant/src/cutile/fused_moe.rs:281-290 | mistralrs-quant/src/cutile/fused_moe.rs:292-301 | mistralrs-quant/src/cutile/fused_moe.rs:303-312 — 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 (10 lines × 4) mistralrs-quant/src/cutile/fused_moe.rs:315— mistralrs-quant/src/cutile/fused_moe.rs:315-324 | mistralrs-quant/src/cutile/fused_moe.rs:326-335 | mistralrs-quant/src/cutile/fused_moe.rs:337-346 | mistralrs-quant/src/cutile/fused_moe.rs:348-357 — 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 (10 lines × 4) mistralrs-quant/src/distributed/layers.rs:876— mistralrs-quant/src/distributed/layers.rs:876-885 | mistralrs-quant/src/distributed/layers.rs:1343-1352 | mistralrs-quant/src/distributed/layers.rs:2003-2012 | mistralrs-quant/src/distributed/layers.rs:2219-2228 — 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 (10 lines × 4) mistralrs-quant/src/gguf/packed_affine.rs:703— mistralrs-quant/src/gguf/packed_affine.rs:703-712 | mistralrs-quant/src/gguf/packed_affine.rs:716-725 | mistralrs-quant/src/gguf/packed_affine.rs:729-738 | mistralrs-quant/src/gguf/packed_affine.rs:742-751 — 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 (10 lines × 4) mistralrs-quant/src/mxfp4/ops.rs:138— mistralrs-quant/src/mxfp4/ops.rs:138-147 | mistralrs-quant/src/mxfp4/ops.rs:199-208 | mistralrs-quant/src/mxfp4/ops.rs:509-518 | mistralrs-quant/src/mxfp4/ops.rs:596-605 — 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 (9 lines × 4) mistralrs-cli/src/ui/handlers/api.rs:172— mistralrs-cli/src/ui/handlers/api.rs:172-180 | mistralrs-cli/src/ui/handlers/api.rs:224-232 | mistralrs-cli/src/ui/handlers/api.rs:276-284 | mistralrs-cli/src/ui/handlers/api.rs:328-336 — 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 (9 lines × 4) mistralrs-core/src/gdn/weights.rs:225— mistralrs-core/src/gdn/weights.rs:225-233 | mistralrs-core/src/gdn/weights.rs:254-262 | mistralrs-core/src/gdn/weights.rs:295-303 | mistralrs-core/src/layers.rs:3657-3665 — 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 (9 lines × 4) mistralrs-core/src/models/lfm2.rs:500— mistralrs-core/src/models/lfm2.rs:500-508 | mistralrs-core/src/models/qwen3.rs:212-220 | mistralrs-core/src/models/qwen3_moe.rs:215-223 | mistralrs-core/src/models/qwen3_next.rs:298-306 — before extracting anything, compare `mistralrs-core/src/models/lfm2.rs` and `mistralrs-core/src/models/qwen3.rs` as WHOLE FILES: this scan already matched 11 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 (9 lines × 4) mistralrs-core/src/models/llama.rs:166— mistralrs-core/src/models/llama.rs:166-174 | mistralrs-core/src/models/smollm3.rs:183-191 | mistralrs-core/src/vision_models/llama4/text.rs:332-340 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:140-148 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/ops.rs:4312— mistralrs-core/src/ops.rs:4312-4320 | mistralrs-core/src/ops.rs:5718-5726 | mistralrs-core/src/ops.rs:6146-6154 | mistralrs-core/src/ops.rs:6494-6502 — 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 (9 lines × 4) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2467— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2467-2475 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3177-3185 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3519-3527 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8301-8309 — 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 (9 lines × 4) mistralrs-core/src/vision_models/qwen3_5/mod.rs:313— mistralrs-core/src/vision_models/qwen3_5/mod.rs:313-321 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:296-304 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:849-857 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:294-302 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (9 lines × 4) mistralrs-quant/src/blockwise_fp8/deepgemm.rs:517— mistralrs-quant/src/blockwise_fp8/deepgemm.rs:517-525 | mistralrs-quant/src/blockwise_fp8/deepgemm.rs:601-609 | mistralrs-quant/src/blockwise_fp8/deepgemm.rs:620-628 | mistralrs-quant/src/nvfp4/cutlass.rs:254-262 — 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 (9 lines × 4) mistralrs-quant/src/cutile/nvfp4_glu.rs:86— mistralrs-quant/src/cutile/nvfp4_glu.rs:86-94 | mistralrs-quant/src/cutile/nvfp4_glu.rs:243-251 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:380-388 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:674-682 — before extracting anything, compare `mistralrs-quant/src/cutile/nvfp4_glu.rs` and `mistralrs-quant/src/cutile/nvfp4_matmul.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 103 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-server-core/src/responses_types/content.rs:236— mistralrs-server-core/src/responses_types/content.rs:236-244 | mistralrs-server-core/src/responses_types/content.rs:507-515 | mistralrs-server-core/src/responses_types/items.rs:182-190 | mistralrs-server-core/src/responses_types/items.rs:483-491 — 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 (9 lines × 4) mistralrs-quant/src/hqq/hqq_op.rs:184— mistralrs-quant/src/hqq/hqq_op.rs:184-192 | mistralrs-quant/src/hqq/hqq_op.rs:297-305 | mistralrs-quant/src/hqq/hqq_op.rs:414-422 | mistralrs-quant/src/hqq/hqq_op.rs:533-541 — 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 (9 lines × 4) mistralrs-core/src/models/granite.rs:2221— mistralrs-core/src/models/granite.rs:2221-2229 | mistralrs-core/src/models/lfm2.rs:1210-1218 | mistralrs-core/src/models/qwen3_next.rs:1014-1022 | mistralrs-core/src/vision_models/qwen3_5/packed_gdn.rs:95-103 — before extracting anything, compare `mistralrs-core/src/models/granite.rs` and `mistralrs-core/src/models/lfm2.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/layers.rs:872— mistralrs-core/src/layers.rs:872-876 | mistralrs-core/src/layers.rs:2208-2212 | mistralrs-core/src/layers.rs:2359-2363 | mistralrs-core/src/layers.rs:2457-2461 | mistralrs-core/src/layers.rs:2504-2508 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 5) mistralrs-core/src/models/flint.rs:536— mistralrs-core/src/models/flint.rs:536-540 | mistralrs-core/src/models/lfm2.rs:284-288 | mistralrs-core/src/models/qwen3_moe.rs:365-369 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:318-322 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:104-108 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/lfm2.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 99 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:244— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:244-248 | mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:286-290 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:401-405 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:443-447 | mistralrs-core/src/vision_models/qwen4_exp/mod.rs:342-346 — `mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 21 separate duplicated blocks between them, totalling at least 374 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 (5 lines × 5) mistralrs-paged-attn/src/metal/kernels/mod.rs:428— mistralrs-paged-attn/src/metal/kernels/mod.rs:428-433 | mistralrs-paged-attn/src/metal/kernels/mod.rs:817-822 | mistralrs-paged-attn/src/metal/kernels/mod.rs:896-901 | mistralrs-quant/src/metal_kernels/mod.rs:1663-1667 | mistralrs-quant/src/metal_kernels/mod.rs:5161-5165 — before extracting anything, compare `mistralrs-paged-attn/src/metal/kernels/mod.rs` and `mistralrs-quant/src/metal_kernels/mod.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 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 × 5) mistralrs-quant/src/cutile/fp8_gemm.rs:485— mistralrs-quant/src/cutile/fp8_gemm.rs:485-489 | mistralrs-quant/src/cutile/fp8_w8a16.rs:794-798 | mistralrs-quant/src/cutile/fp8_w8a8.rs:813-817 | mistralrs-quant/src/cutile/fused_moe.rs:837-842 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:753-758 — before extracting anything, compare `mistralrs-quant/src/cutile/fp8_gemm.rs` and `mistralrs-quant/src/cutile/fp8_w8a16.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 5) mistralrs-quant/src/gguf/fast_mmq.rs:599— mistralrs-quant/src/gguf/fast_mmq.rs:599-603 | mistralrs-quant/src/gguf/fast_mmq.rs:707-711 | mistralrs-quant/src/gguf/fast_mmq.rs:884-889 | mistralrs-quant/src/gguf/fast_mmq.rs:1092-1097 | mistralrs-quant/src/gguf/fast_mmq.rs:1367-1372 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 5) mistralrs-quant/src/metal_kernels/mod.rs:1287— mistralrs-quant/src/metal_kernels/mod.rs:1287-1292 | mistralrs-quant/src/metal_kernels/mod.rs:1435-1440 | mistralrs-quant/src/metal_kernels/mod.rs:4733-4738 | mistralrs-quant/src/metal_kernels/mod.rs:4796-4801 | mistralrs-quant/src/metal_kernels/mod.rs:4981-4985 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 5) mistralrs-quant/src/metal_kernels/mod.rs:1528— mistralrs-quant/src/metal_kernels/mod.rs:1528-1532 | mistralrs-quant/src/metal_kernels/mod.rs:1607-1611 | mistralrs-quant/src/metal_kernels/mod.rs:2867-2872 | mistralrs-quant/src/metal_kernels/mod.rs:2904-2909 | mistralrs-quant/src/metal_kernels/mod.rs:4745-4749 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 5) mistralrs-quant/src/utils/ops.rs:47— mistralrs-quant/src/utils/ops.rs:47-51 | mistralrs-quant/src/utils/ops.rs:56-60 | mistralrs-quant/src/utils/ops.rs:65-69 | mistralrs-quant/src/utils/ops.rs:74-78 | mistralrs-quant/src/utils/ops.rs:83-87 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 5) mistralrs-quant/src/utils/ops.rs:697— mistralrs-quant/src/utils/ops.rs:697-701 | mistralrs-quant/src/utils/ops.rs:706-710 | mistralrs-quant/src/utils/ops.rs:715-719 | mistralrs-quant/src/utils/ops.rs:724-728 | mistralrs-quant/src/utils/ops.rs:733-737 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 5) mistralrs-core/src/ops.rs:1171— mistralrs-core/src/ops.rs:1171-1176 | mistralrs-core/src/ops.rs:1191-1196 | mistralrs-core/src/ops.rs:1201-1206 | mistralrs-core/src/ops.rs:1389-1394 | mistralrs-core/src/ops.rs:1409-1413 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 5) REDACTED:513— REDACTED:513-518 | REDACTED:868-873 | mistralrs-core/src/vision_models/idefics3/vision.rs:309-314 | mistralrs-core/src/vision_models/lfm2_vl/vision.rs:242-246 | mistralrs-core/src/vision_models/siglip.rs:320-325 — before extracting anything, compare `REDACTED` and `mistralrs-core/src/vision_models/idefics3/vision.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 213 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.
Low cohesion: GgufModelBuilder (LCOM4 38) mistralrs/src/gguf.rs:12— GgufModelBuilder's methods fall into 38 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 38 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: EmbeddingModelBuilder (LCOM4 19) mistralrs/src/embedding_model.rs:15— EmbeddingModelBuilder's methods fall into 19 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 19 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: RequestBuilder (LCOM4 18) mistralrs/src/messages.rs:568— RequestBuilder's methods fall into 18 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 18 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: ResponseResource (LCOM4 18) mistralrs-server-core/src/responses_types/resource.rs:122— ResponseResource's methods fall into 18 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 18 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: ModelBuilder (LCOM4 9) mistralrs/src/auto_model.rs:43— ModelBuilder's methods fall into 9 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 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: TextModelBuilder (LCOM4 9) mistralrs/src/text_model.rs:18— TextModelBuilder's methods fall into 9 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 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: MultimodalModelBuilder (LCOM4 8) mistralrs/src/multimodal_model.rs:18— MultimodalModelBuilder'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.
Low cohesion: SpeechModelBuilder (LCOM4 8) mistralrs/src/speech_model.rs:7— SpeechModelBuilder'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.
Low cohesion: DiffusionModelBuilder (LCOM4 7) mistralrs/src/diffusion_model.rs:7— DiffusionModelBuilder's methods fall into 7 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 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: QuantizeOntoGuard (LCOM4 5) mistralrs-quant/src/lib.rs:1482— QuantizeOntoGuard's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: MistralRs (LCOM4 4) mistralrs-core/src/lib.rs:443— MistralRs's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: ChatTemplate (LCOM4 4) mistralrs-core/src/pipeline/chat_template.rs:72— ChatTemplate's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
TextModel::forward_embeds_scaled (cognitive 66) mistralrs-core/src/vision_models/gemma4/text.rs:2103— TextModel::forward_embeds_scaled has cognitive complexity 66 (threshold 15). Drivers by points: if/else 33 (46 pts), boolean chains 10, match/switch 6 (9 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TextModel::forward_embeds (cognitive 34) mistralrs-core/src/vision_models/gemma3/text.rs:596— TextModel::forward_embeds has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (15 pts), match/switch 6 (10 pts), boolean chains 8, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TextModel::create_anymoe_layers (cognitive 27) mistralrs-core/src/vision_models/gemma3/text.rs:916— TextModel::create_anymoe_layers has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TextModel::new (cognitive 27) mistralrs-core/src/vision_models/gemma4/text.rs:1618— TextModel::new has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (21 pts), loops 3 (4 pts), boolean chains 1, match/switch 1 (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.
TextModel::new (cognitive 26) mistralrs-core/src/vision_models/gemma3n/text.rs:1307— TextModel::new has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (22 pts), loops 3, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TextModel::forward_embeds (cognitive 25) mistralrs-core/src/vision_models/gemma3n/text.rs:1737— TextModel::forward_embeds has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (22 pts), loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TextModel::create_anymoe_layers (cognitive 23) mistralrs-core/src/vision_models/muse_glimmer/text.rs:673— TextModel::create_anymoe_layers has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (4 pts), match/switch 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TextModel::apply_image_bidirectional_mask (cognitive 18) mistralrs-core/src/vision_models/gemma4/text.rs:2439— TextModel::apply_image_bidirectional_mask has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TextModel::residual_tensors (cognitive 17) mistralrs-core/src/vision_models/gemma4/text.rs:2574— TextModel::residual_tensors has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TextModel::apply_image_bidirectional_mask (cognitive 16) mistralrs-core/src/vision_models/gemma3/text.rs:769— TextModel::apply_image_bidirectional_mask has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TextModel::forward_embeds (cognitive 16) mistralrs-core/src/vision_models/llama4/text.rs:912— TextModel::forward_embeds has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
Duplicated block (12 lines × 4) mistralrs-core/src/model_loader.rs:752— mistralrs-core/src/model_loader.rs:752-763 | mistralrs-core/src/model_loader.rs:786-797 | mistralrs-core/src/toml_selector.rs:1028-1039 | mistralrs-core/src/toml_selector.rs:1062-1073 — before extracting anything, compare `mistralrs-core/src/model_loader.rs` and `mistralrs-core/src/toml_selector.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 156 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/models/flint.rs:867— mistralrs-core/src/models/flint.rs:867-879 | mistralrs-core/src/models/glm4.rs:534-545 | mistralrs-core/src/models/qwen3.rs:493-504 | mistralrs-core/src/models/qwen3_moe.rs:673-684 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/models/gemma.rs:365— mistralrs-core/src/models/gemma.rs:365-376 | mistralrs-core/src/models/gemma2.rs:438-449 | mistralrs-core/src/xlora_models/gemma.rs:445-456 | mistralrs-core/src/xlora_models/gemma2.rs:476-487 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/models/granite.rs:1544— mistralrs-core/src/models/granite.rs:1544-1555 | mistralrs-core/src/models/llama.rs:81-92 | mistralrs-core/src/models/smollm3.rs:96-107 | mistralrs-core/src/xlora_models/llama.rs:77-88 — before extracting anything, compare `mistralrs-core/src/models/granite.rs` and `mistralrs-core/src/models/llama.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 244 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/models/phi3.rs:149— mistralrs-core/src/models/phi3.rs:149-160 | mistralrs-core/src/vision_models/phi3/mod.rs:241-252 | mistralrs-core/src/vision_models/phi4/mod.rs:110-121 | mistralrs-core/src/xlora_models/phi3.rs:124-135 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/vision_models/phi3/mod.rs` as WHOLE FILES: this scan already matched 47 separate duplicated blocks between them, totalling at least 594 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 × 4) mistralrs-core/src/vision_models/qwen3_5/mod.rs:94— mistralrs-core/src/vision_models/qwen3_5/mod.rs:94-105 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:82-93 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:635-646 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:80-91 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (12 lines × 4) mistralrs-core/src/xlora_models/gemma.rs:379— mistralrs-core/src/xlora_models/gemma.rs:379-390 | mistralrs-core/src/xlora_models/mistral.rs:375-386 | mistralrs-core/src/xlora_models/phi3.rs:341-353 | mistralrs-core/src/xlora_models/starcoder2.rs:364-375 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/mistral.rs` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-quant/src/blockwise_fp8/ops.rs:1110— mistralrs-quant/src/blockwise_fp8/ops.rs:1110-1121 | mistralrs-quant/src/blockwise_fp8/ops.rs:1145-1156 | mistralrs-quant/src/blockwise_fp8/ops.rs:1299-1310 | mistralrs-quant/src/blockwise_fp8/ops.rs:1338-1349 — 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 (12 lines × 4) mistralrs-quant/src/cutile/nvfp4_matmul.rs:151— mistralrs-quant/src/cutile/nvfp4_matmul.rs:151-162 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:304-315 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:567-578 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:861-872 — 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 (12 lines × 4) mistralrs-quant/src/hqq/hqq_op.rs:156— mistralrs-quant/src/hqq/hqq_op.rs:156-167 | mistralrs-quant/src/hqq/hqq_op.rs:269-280 | mistralrs-quant/src/hqq/hqq_op.rs:386-397 | mistralrs-quant/src/hqq/hqq_op.rs:505-516 — 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 (12 lines × 4) mistralrs/src/model_builder_trait.rs:854— mistralrs/src/model_builder_trait.rs:854-865 | mistralrs/src/model_builder_trait.rs:1014-1025 | mistralrs/src/model_builder_trait.rs:1217-1228 | mistralrs/src/model_builder_trait.rs:1633-1644 — 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 (32 lines × 2) mistralrs-core/src/embedding_models/embedding_gemma.rs:404— mistralrs-core/src/embedding_models/embedding_gemma.rs:404-435 | mistralrs-core/src/vision_models/gemma3/text.rs:463-494 — before extracting anything, compare `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/vision_models/gemma3/text.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 268 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 (32 lines × 2) mistralrs-core/src/layers.rs:1639— mistralrs-core/src/layers.rs:1639-1670 | mistralrs-core/src/layers.rs:1950-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.
Duplicated block (32 lines × 2) mistralrs-core/src/model_loader.rs:703— mistralrs-core/src/model_loader.rs:703-734 | mistralrs-core/src/toml_selector.rs:980-1011 — before extracting anything, compare `mistralrs-core/src/model_loader.rs` and `mistralrs-core/src/toml_selector.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 156 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (32 lines × 2) mistralrs-core/src/models/phi3.rs:98— mistralrs-core/src/models/phi3.rs:98-129 | mistralrs-core/src/vision_models/phi3/mod.rs:189-220 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/vision_models/phi3/mod.rs` as WHOLE FILES: this scan already matched 47 separate duplicated blocks between them, totalling at least 594 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 (32 lines × 2) mistralrs-core/src/ops.rs:1631— mistralrs-core/src/ops.rs:1631-1662 | mistralrs-core/src/ops.rs:1894-1925 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (32 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:3091— mistralrs-core/src/pipeline/multimodal.rs:3091-3122 | mistralrs-core/src/pipeline/normal.rs:2729-2760 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (32 lines × 2) mistralrs-core/src/speculative/hybrid_state.rs:429— mistralrs-core/src/speculative/hybrid_state.rs:429-460 | mistralrs-core/src/speculative/hybrid_state.rs:493-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.
Duplicated block (32 lines × 2) mistralrs-core/src/vision_models/gemma4/audio.rs:271— mistralrs-core/src/vision_models/gemma4/audio.rs:271-302 | mistralrs-core/src/vision_models/gemma4/vision.rs:102-133 — 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 (32 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:258— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:258-289 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:415-446 — `mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 21 separate duplicated blocks between them, totalling at least 374 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 (32 lines × 2) mistralrs-core/src/vision_models/qwen3_vl/text.rs:560— mistralrs-core/src/vision_models/qwen3_vl/text.rs:560-591 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:681-712 — `mistralrs-core/src/vision_models/qwen3_vl/text.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/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 42 separate duplicated blocks between them, totalling at least 613 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 (18 lines × 3) mistralrs-core/src/models/gemma.rs:417— mistralrs-core/src/models/gemma.rs:417-434 | mistralrs-core/src/models/gemma2.rs:490-507 | mistralrs-core/src/models/starcoder2.rs:481-498 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 lines × 3) mistralrs-core/src/models/phi2.rs:675— mistralrs-core/src/models/phi2.rs:675-692 | mistralrs-core/src/models/starcoder2.rs:666-683 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:683-700 — before extracting anything, compare `mistralrs-core/src/models/phi2.rs` and `mistralrs-core/src/models/starcoder2.rs` as WHOLE FILES: this scan already matched 29 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 lines × 3) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:848— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:848-865 | mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:766-783 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:757-774 — `mistralrs-core/src/vision_models/gemma3/inputs_processor.rs` and `mistralrs-core/src/vision_models/gemma3n/inputs_processor.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 75 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 (18 lines × 3) mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:756— mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:756-773 | mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:977-994 | mistralrs-core/src/vision_models/mllama/inputs_processor.rs:1039-1056 — before extracting anything, compare `mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs` and `mistralrs-core/src/vision_models/idefics3/inputs_processor.rs` as WHOLE FILES: this scan already matched 7 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. 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 (18 lines × 3) mistralrs-core/src/vision_models/muse_glimmer/text.rs:350— mistralrs-core/src/vision_models/muse_glimmer/text.rs:350-367 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:320-337 | mistralrs-core/src/vision_models/qwen2vl/text.rs:321-338 — `mistralrs-core/src/vision_models/muse_glimmer/text.rs` and `mistralrs-core/src/vision_models/qwen2_5_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 10 separate duplicated blocks between them, totalling at least 145 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 (18 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:985— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:985-1002 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1550-1567 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1679-1696 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (18 lines × 3) mistralrs-core/src/xlora_models/gemma.rs:107— mistralrs-core/src/xlora_models/gemma.rs:107-124 | mistralrs-core/src/xlora_models/gemma2.rs:101-118 | mistralrs-core/src/xlora_models/mistral.rs:100-117 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 lines × 3) mistralrs-core/src/xlora_models/gemma.rs:499— mistralrs-core/src/xlora_models/gemma.rs:499-516 | mistralrs-core/src/xlora_models/gemma2.rs:529-546 | mistralrs-core/src/xlora_models/mistral.rs:495-512 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 lines × 3) mistralrs-paged-attn/src/cuda/backend/mla.rs:773— mistralrs-paged-attn/src/cuda/backend/mla.rs:773-790 | mistralrs-paged-attn/src/cuda/backend/mla.rs:811-828 | mistralrs-paged-attn/src/cuda/backend/mla.rs:849-866 — 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 (18 lines × 3) mistralrs-quant/src/metal_kernels/mod.rs:449— mistralrs-quant/src/metal_kernels/mod.rs:449-466 | mistralrs-quant/src/metal_kernels/mod.rs:495-512 | mistralrs-quant/src/metal_kernels/mod.rs:541-558 — 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 (14 lines × 3) mistralrs-core/src/cuda/gdn.rs:4978— mistralrs-core/src/cuda/gdn.rs:4978-4991 | mistralrs-core/src/cuda/gdn.rs:5154-5167 | mistralrs-core/src/cuda/gdn.rs:5424-5437 — 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 (14 lines × 3) mistralrs-core/src/models/deepseek2.rs:473— mistralrs-core/src/models/deepseek2.rs:473-486 | mistralrs-core/src/models/deepseek3.rs:474-487 | mistralrs-core/src/models/glm4_moe_lite.rs:438-451 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 3) mistralrs-core/src/models/gemma.rs:404— mistralrs-core/src/models/gemma.rs:404-417 | mistralrs-core/src/models/gemma2.rs:477-490 | mistralrs-core/src/vision_models/gemma3/text.rs:517-530 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 3) mistralrs-core/src/models/hunyuan_v1_dense.rs:157— mistralrs-core/src/models/hunyuan_v1_dense.rs:157-170 | mistralrs-core/src/models/qwen3.rs:158-171 | mistralrs-core/src/models/qwen3_moe.rs:161-174 — before extracting anything, compare `mistralrs-core/src/models/hunyuan_v1_dense.rs` and `mistralrs-core/src/models/qwen3.rs` as WHOLE FILES: this scan already matched 56 separate duplicated blocks between them, totalling at least 684 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 3) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7493— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7493-7506 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8009-8022 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8495-8508 — 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 (14 lines × 3) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3249— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3249-3262 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3582-3595 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4809-4822 — 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 (14 lines × 3) mistralrs-core/src/vision_models/llava/llava_next.rs:444— mistralrs-core/src/vision_models/llava/llava_next.rs:444-457 | mistralrs-core/src/vision_models/mistral3/mod.rs:309-322 | mistralrs-core/src/vision_models/phi3/mod.rs:1106-1119 — 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 (14 lines × 3) mistralrs-quant/src/lora/dynamic/moe_cuda.rs:868— mistralrs-quant/src/lora/dynamic/moe_cuda.rs:868-881 | mistralrs-quant/src/lora/dynamic/moe_cuda.rs:891-904 | mistralrs-quant/src/lora/dynamic/moe_cuda.rs:914-927 — 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 (14 lines × 3) mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:291— mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:291-304 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:327-340 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:300-313 — before extracting anything, compare `mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs` and `mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 206 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 3) mistralrs-core/src/models/granite.rs:2224— mistralrs-core/src/models/granite.rs:2224-2237 | mistralrs-core/src/models/lfm2.rs:1213-1226 | mistralrs-core/src/models/qwen3_next.rs:1017-1030 — before extracting anything, compare `mistralrs-core/src/models/granite.rs` and `mistralrs-core/src/models/lfm2.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-cli/src/commands/run/interactive.rs:2039— mistralrs-cli/src/commands/run/interactive.rs:2039-2050 | mistralrs/src/model.rs:698-710 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (12–13 lines × 2) mistralrs-core/src/gguf/normal_config.rs:1766— mistralrs-core/src/gguf/normal_config.rs:1766-1777 | mistralrs-core/src/gguf/normal_config.rs:1836-1848 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–13 lines × 2) mistralrs-core/src/mla/forward.rs:241— mistralrs-core/src/mla/forward.rs:241-253 | mistralrs-core/src/mla/forward.rs:397-408 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–13 lines × 2) mistralrs-core/src/pipeline/inputs_processor.rs:1318— mistralrs-core/src/pipeline/inputs_processor.rs:1318-1329 | mistralrs-core/src/pipeline/inputs_processor.rs:1356-1368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–13 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:793— mistralrs-core/src/pipeline/multimodal.rs:793-805 | mistralrs-core/src/pipeline/normal.rs:799-810 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/sampler.rs:1486— mistralrs-core/src/sampler.rs:1486-1498 | mistralrs-core/src/sampler.rs:1656-1667 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–13 lines × 2) mistralrs-core/src/utils/gguf_metadata.rs:416— mistralrs-core/src/utils/gguf_metadata.rs:416-427 | mistralrs-core/src/utils/gguf_metadata.rs:641-653 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–13 lines × 2) mistralrs-core/src/vision_models/phi4/mod.rs:507— mistralrs-core/src/vision_models/phi4/mod.rs:507-518 | mistralrs-core/src/vision_models/voxtral/mod.rs:884-896 — `mistralrs-core/src/vision_models/phi4/mod.rs` and `mistralrs-core/src/vision_models/voxtral/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 7 separate duplicated blocks between them, totalling at least 66 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 (12–13 lines × 2) mistralrs-quant/src/cutile/fused_moe.rs:581— mistralrs-quant/src/cutile/fused_moe.rs:581-593 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:1022-1033 — before extracting anything, compare `mistralrs-quant/src/cutile/fused_moe.rs` and `mistralrs-quant/src/cutile/fused_moe_fp8.rs` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 308 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-quant/src/cutile/nvfp4_gemv.rs:338— mistralrs-quant/src/cutile/nvfp4_gemv.rs:338-350 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1496-1507 — before extracting anything, compare `mistralrs-quant/src/cutile/nvfp4_gemv.rs` and `mistralrs-quant/src/cutile/nvfp4_matmul.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/gguf/multimodal_binding_utils.rs:84— mistralrs-core/src/gguf/multimodal_binding_utils.rs:84-94 | mistralrs-core/src/gguf/qwen_multimodal_bindings.rs:251-260 — before extracting anything, compare `mistralrs-core/src/gguf/multimodal_binding_utils.rs` and `mistralrs-core/src/gguf/qwen_multimodal_bindings.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/gemma2.rs:561— mistralrs-core/src/models/gemma2.rs:561-571 | mistralrs-core/src/models/qwen2.rs:589-598 — before extracting anything, compare `mistralrs-core/src/models/gemma2.rs` and `mistralrs-core/src/models/qwen2.rs` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 428 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/glm4.rs:342— mistralrs-core/src/models/glm4.rs:342-352 | mistralrs-core/src/vision_models/gemma4/text.rs:993-1002 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/vision_models/gemma4/text.rs` as WHOLE FILES: this scan already matched 6 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. 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–11 lines × 2) mistralrs-core/src/models/phi3.rs:421— mistralrs-core/src/models/phi3.rs:421-430 | mistralrs-core/src/vision_models/gemma3/text.rs:447-457 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/vision_models/gemma3/text.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 170 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–11 lines × 2) mistralrs-core/src/models/qwen3_next.rs:280— mistralrs-core/src/models/qwen3_next.rs:280-290 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:196-205 — before extracting anything, compare `mistralrs-core/src/models/qwen3_next.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/text.rs` as WHOLE FILES: this scan already matched 29 separate duplicated blocks between them, totalling at least 433 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–11 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:888— mistralrs-core/src/pipeline/multimodal.rs:888-898 | mistralrs-core/src/pipeline/normal.rs:888-897 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/speculative/dflash.rs:3337— mistralrs-core/src/speculative/dflash.rs:3337-3347 | mistralrs-core/src/speculative/dflash.rs:3559-3568 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) mistralrs-core/src/vision_models/voxtral/encoder.rs:80— mistralrs-core/src/vision_models/voxtral/encoder.rs:80-90 | mistralrs-core/src/vision_models/voxtral/mod.rs:127-136 — before extracting anything, compare `mistralrs-core/src/vision_models/voxtral/encoder.rs` and `mistralrs-core/src/vision_models/voxtral/mod.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.
Duplicated block (10–11 lines × 2) mistralrs-quant/src/afq/mod.rs:263— mistralrs-quant/src/afq/mod.rs:263-273 | mistralrs-quant/src/gguf/mod.rs:521-530 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10–11 lines × 2) mistralrs/src/gguf_lora_model.rs:71— mistralrs/src/gguf_lora_model.rs:71-80 | mistralrs/src/gguf_xlora_model.rs:80-90 — 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.
D30 · Dependency Vulnerabilities· Medium vulnerability · ×9
Duplicated block (28 lines × 2) mistralrs-core/src/models/glm4_moe.rs:378— mistralrs-core/src/models/glm4_moe.rs:378-405 | mistralrs-core/src/models/glm4_moe_lite.rs:471-498 — before extracting anything, compare `mistralrs-core/src/models/glm4_moe.rs` and `mistralrs-core/src/models/glm4_moe_lite.rs` as WHOLE FILES: this scan already matched 43 separate duplicated blocks between them, totalling at least 572 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/moe/experts/mod.rs:141— mistralrs-core/src/moe/experts/mod.rs:141-168 | mistralrs-core/src/moe/experts/mod.rs:215-242 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (28 lines × 2) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:740— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:740-767 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3766-3793 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/embedding_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 206 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:913— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:913-940 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1478-1505 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (28 lines × 2) mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:273— mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:273-300 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:392-419 — `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.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 52 separate duplicated blocks between them, totalling at least 1117 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 (28 lines × 2) mistralrs-core/src/vision_models/qwen3_5/mod.rs:405— mistralrs-core/src/vision_models/qwen3_5/mod.rs:405-432 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:390-417 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (28 lines × 2) mistralrs-core/src/vision_models/qwen3_vl/text.rs:459— mistralrs-core/src/vision_models/qwen3_vl/text.rs:459-486 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:580-607 — `mistralrs-core/src/vision_models/qwen3_vl/text.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/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 42 separate duplicated blocks between them, totalling at least 613 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 (28 lines × 2) mistralrs-core/src/vision_models/qwen3_vl/text.rs:517— mistralrs-core/src/vision_models/qwen3_vl/text.rs:517-544 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:638-665 — `mistralrs-core/src/vision_models/qwen3_vl/text.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/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 42 separate duplicated blocks between them, totalling at least 613 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 (28 lines × 2) mistralrs-quant/src/cutile/fused_moe.rs:388— mistralrs-quant/src/cutile/fused_moe.rs:388-415 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:421-448 — before extracting anything, compare `mistralrs-quant/src/cutile/fused_moe.rs` and `mistralrs-quant/src/cutile/fused_moe_fp8.rs` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 308 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (26 lines × 2) mistralrs-core/src/attention/backends/cpu/neon.rs:331— mistralrs-core/src/attention/backends/cpu/neon.rs:331-356 | mistralrs-core/src/attention/backends/cpu/neon.rs:571-596 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26 lines × 2) mistralrs-core/src/cuda/speculative_rejection.rs:834— mistralrs-core/src/cuda/speculative_rejection.rs:834-859 | mistralrs-core/src/cuda/speculative_rejection.rs:870-895 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26 lines × 2) mistralrs-core/src/layers.rs:1134— mistralrs-core/src/layers.rs:1134-1159 | mistralrs-core/src/layers.rs:1224-1249 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26 lines × 2) mistralrs-core/src/models/phi3.rs:250— mistralrs-core/src/models/phi3.rs:250-275 | mistralrs-core/src/vision_models/phi3/mod.rs:341-366 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/vision_models/phi3/mod.rs` as WHOLE FILES: this scan already matched 47 separate duplicated blocks between them, totalling at least 594 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 (26 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:1253— mistralrs-core/src/pipeline/multimodal.rs:1253-1278 | mistralrs-core/src/pipeline/normal.rs:1323-1348 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (26 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:2684— mistralrs-core/src/pipeline/multimodal.rs:2684-2709 | mistralrs-core/src/pipeline/normal.rs:2319-2344 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (26 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1148— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1148-1173 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1713-1738 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (26 lines × 2) mistralrs-quant/src/safetensors.rs:697— mistralrs-quant/src/safetensors.rs:697-722 | mistralrs-quant/src/safetensors.rs:764-789 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26 lines × 2) scripts/production_soak.py:10440— scripts/production_soak.py:10440-10465 | scripts/production_soak.py:10851-10876 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/production_soak.py:10440` 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 lines × 3) mistralrs-core/src/layers.rs:2356— mistralrs-core/src/layers.rs:2356-2374 | mistralrs-core/src/layers.rs:2454-2472 | mistralrs-core/src/layers.rs:2501-2519 — 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 (19 lines × 3) mistralrs-core/src/model_loader.rs:543— mistralrs-core/src/model_loader.rs:543-561 | mistralrs-core/src/toml_selector.rs:875-893 | mistralrs-core/src/toml_selector.rs:922-940 — before extracting anything, compare `mistralrs-core/src/model_loader.rs` and `mistralrs-core/src/toml_selector.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 156 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 3) mistralrs-core/src/model_loader.rs:745— mistralrs-core/src/model_loader.rs:745-763 | mistralrs-core/src/model_loader.rs:779-797 | mistralrs-core/src/toml_selector.rs:1055-1073 — before extracting anything, compare `mistralrs-core/src/model_loader.rs` and `mistralrs-core/src/toml_selector.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 156 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 3) mistralrs-core/src/models/qwen3_next.rs:902— mistralrs-core/src/models/qwen3_next.rs:902-920 | mistralrs-core/src/vision_models/qwen3_5/text.rs:1009-1027 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:710-728 — before extracting anything, compare `mistralrs-core/src/models/qwen3_next.rs` and `mistralrs-core/src/vision_models/qwen3_5/text.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 158 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 (19 lines × 3) mistralrs-core/src/pipeline/embedding.rs:202— mistralrs-core/src/pipeline/embedding.rs:202-220 | mistralrs-core/src/pipeline/multimodal.rs:513-531 | mistralrs-core/src/pipeline/normal.rs:641-659 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 3) mistralrs-core/src/vision_models/gemma4/mod.rs:445— mistralrs-core/src/vision_models/gemma4/mod.rs:445-463 | mistralrs-core/src/vision_models/gemma4/mod.rs:598-616 | mistralrs-core/src/vision_models/gemma4/mod.rs:758-776 — 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 (19 lines × 3) REDACTED:572— REDACTED:572-590 | mistralrs-core/src/vision_models/idefics3/vision.rs:369-387 | mistralrs-core/src/vision_models/siglip.rs:380-398 — before extracting anything, compare `REDACTED` and `mistralrs-core/src/vision_models/idefics3/vision.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 213 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 (19 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:604— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:604-622 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1212-1230 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1274-1292 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (19 lines × 3) mistralrs-core/src/vision_models/qwen3_5/mod.rs:134— mistralrs-core/src/vision_models/qwen3_5/mod.rs:134-152 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:117-135 | mistralrs-core/src/vision_models/qwen4_exp/mod.rs:242-260 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (11–12 lines × 2) mistralrs-cli/src/commands/config.rs:120— mistralrs-cli/src/commands/config.rs:120-130 | mistralrs-cli/src/commands/serve.rs:136-147 — before extracting anything, compare `mistralrs-cli/src/commands/config.rs` and `mistralrs-cli/src/commands/serve.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–12 lines × 2) mistralrs-code-exec/src/lib.rs:312— mistralrs-code-exec/src/lib.rs:312-323 | mistralrs-code-exec/src/shell.rs:336-346 — before extracting anything, compare `mistralrs-code-exec/src/lib.rs` and `mistralrs-code-exec/src/shell.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–12 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:1124— mistralrs-core/src/pipeline/multimodal.rs:1124-1134 | mistralrs-core/src/pipeline/multimodal.rs:1228-1239 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/vision_models/gemma4/mod.rs:383— mistralrs-core/src/vision_models/gemma4/mod.rs:383-393 | mistralrs-core/src/vision_models/gemma4/mod.rs:695-706 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/vision_models/qwen3_5/speculative.rs:172— mistralrs-core/src/vision_models/qwen3_5/speculative.rs:172-182 | mistralrs-core/src/vision_models/qwen3_5/speculative.rs:622-633 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/xlora_models/classifier.rs:55— mistralrs-core/src/xlora_models/classifier.rs:55-65 | mistralrs-core/src/xlora_models/classifier.rs:68-79 — both copies are in the same file, so extract the block into 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) mistralrs-paged-attn/src/metal/backend/paged_attention.rs:589— mistralrs-paged-attn/src/metal/backend/paged_attention.rs:589-599 | mistralrs-paged-attn/src/metal/backend/paged_attention.rs:649-660 — both copies are in the same file, so extract the block into 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) mistralrs-quant/src/distributed/layers.rs:2033— mistralrs-quant/src/distributed/layers.rs:2033-2043 | mistralrs-quant/src/distributed/layers.rs:2263-2274 — both copies are in the same file, so extract the block into 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) mistralrs-quant/src/utils/ops.rs:2405— mistralrs-quant/src/utils/ops.rs:2405-2416 | mistralrs-quant/src/utils/ops.rs:2575-2585 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Sampler::apply_dry_penalty (cognitive 39) mistralrs-core/src/sampler.rs:2035— Sampler::apply_dry_penalty has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (32 pts), loops 3 (7 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sampler::apply_freq_pres_rep_penalty (cognitive 25) mistralrs-core/src/sampler.rs:1984— Sampler::apply_freq_pres_rep_penalty has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sampler::sample_topk_on_device_metal (cognitive 24) mistralrs-core/src/sampler.rs:1644— Sampler::sample_topk_on_device_metal has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4, loops 2 (4 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sampler::sample_cuda_topk_probabilities (cognitive 23) mistralrs-core/src/sampler.rs:950— Sampler::sample_cuda_topk_probabilities has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sampler::sample_topk_on_device (cognitive 23) mistralrs-core/src/sampler.rs:1465— Sampler::sample_topk_on_device has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4, loops 2 (4 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sampler::cuda_batch_sampling_plan (cognitive 18) mistralrs-core/src/sampler.rs:749— Sampler::cuda_batch_sampling_plan has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 7, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sampler::sample_top_kp_min_p (cognitive 17) mistralrs-core/src/sampler.rs:1898— Sampler::sample_top_kp_min_p has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sampler::sample (cognitive 16) mistralrs-core/src/sampler.rs:2127— Sampler::sample has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
Change coupling: embedding.rs ↔ multimodal.rs mistralrs-core/src/pipeline/embedding.rs:1— `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` change together 87% of the time (13 of the 15 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 13 shared commits counted here, the most recent 3 are `d1ffbe7e` fix(qwen3.5): better support for hybrid models and auto device map (#…; `b7956205` feat(uqff): no dummy run for uqff generation pass (#2316); `cf55746a` feat(multi-model): support planning for loading multi-model (#2299) — run `git show` on any of them.
Change coupling: diffusion.rs ↔ multimodal.rs mistralrs-core/src/pipeline/diffusion.rs:1— `mistralrs-core/src/pipeline/diffusion.rs` and `mistralrs-core/src/pipeline/multimodal.rs` change together 83% of the time (10 of the 12 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 10 shared commits counted here, the most recent 3 are `b7956205` feat(uqff): no dummy run for uqff generation pass (#2316); `cf55746a` feat(multi-model): support planning for loading multi-model (#2299); `91bad109` feat(core): support HF_HUB_OFFLINE for loading pre-downloaded models … — run `git show` on any of them.
Change coupling: embedding.rs ↔ normal.rs mistralrs-core/src/pipeline/embedding.rs:1— `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/normal.rs` change together 80% of the time (12 of the 15 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 12 shared commits counted here, the most recent 3 are `d1ffbe7e` fix(qwen3.5): better support for hybrid models and auto device map (#…; `b7956205` feat(uqff): no dummy run for uqff generation pass (#2316); `cf55746a` feat(multi-model): support planning for loading multi-model (#2299) — run `git show` on any of them.
Change coupling: REDACTED ↔ REDACTED mistralrs-quant/src/fp8/mod.rs:1— `mistralrs-quant/src/fp8/mod.rs` and `mistralrs-quant/src/gguf/mod.rs` change together 76% of the time (13 of the 17 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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `aed0b295` feat(quant): add isq executor and planning (#2283); `392a7567` feat(uqff): support ser/de for unquant layers, handle afq fallback (#…; `bdaf6eec` Add new quant method: F8Q8 (#1883) — run `git show` on any of them.
Change coupling: diffusion.rs ↔ normal.rs mistralrs-core/src/pipeline/diffusion.rs:1— `mistralrs-core/src/pipeline/diffusion.rs` and `mistralrs-core/src/pipeline/normal.rs` change together 75% of the time (9 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 9 shared commits counted here, the most recent 3 are `b7956205` feat(uqff): no dummy run for uqff generation pass (#2316); `cf55746a` feat(multi-model): support planning for loading multi-model (#2299); `91bad109` feat(core): support HF_HUB_OFFLINE for loading pre-downloaded models … — run `git show` on any of them.
Change coupling: model_selected.rs ↔ toml_selector.rs mistralrs-core/src/model_selected.rs:1— `mistralrs-core/src/model_selected.rs` and `mistralrs-core/src/toml_selector.rs` change together 69% of the time (11 of the 16 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 11 shared commits counted here, the most recent 3 are `3fb22c84` feat(quant): support isq/uqff/imatrix machinery for broader model cla…; `6927a4f2` Parallel + I/O pipelined ISQ (#1870); `fd2456cd` Support sharding for UQFF (#1276) — run `git show` on any of them.
Change coupling: REDACTED ↔ config.rs mistralrs-core/src/pipeline/mod.rs:1— `mistralrs-core/src/pipeline/mod.rs` and `mistralrs-core/src/xlora_models/config.rs` change together 58% of the time (7 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `91eb3816` Xlora sanity check; `512b485d` Use the ordering; `978c5b67` Make xlora variant untagged — run `git show` on any of them.
Change coupling: layers.rs ↔ REDACTED mistralrs-quant/src/distributed/layers.rs:1— `mistralrs-quant/src/distributed/layers.rs` and `mistralrs-quant/src/fp8/mod.rs` change together 53% of the time (9 of the 17 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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `aed0b295` feat(quant): add isq executor and planning (#2283); `392a7567` feat(uqff): support ser/de for unquant layers, handle afq fallback (#…; `bdaf6eec` Add new quant method: F8Q8 (#1883) — run `git show` on any of them.
Duplicated block (15 lines × 4) mistralrs-core/src/embedding_models/qwen3_embedding.rs:360— mistralrs-core/src/embedding_models/qwen3_embedding.rs:360-374 | mistralrs-core/src/models/hunyuan_v1_dense.rs:439-453 | mistralrs-core/src/models/hunyuan_v1_moe.rs:933-947 | mistralrs-core/src/models/qwen3.rs:433-447 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/hunyuan_v1_dense.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 116 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 (15 lines × 4) mistralrs-core/src/models/glm4.rs:185— mistralrs-core/src/models/glm4.rs:185-199 | mistralrs-core/src/models/mixtral.rs:128-142 | mistralrs-core/src/models/phi3_5_moe.rs:155-169 | mistralrs-core/src/models/starcoder2.rs:204-218 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/mixtral.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 313 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15 lines × 4) mistralrs-core/src/models/mixtral.rs:482— mistralrs-core/src/models/mixtral.rs:482-496 | mistralrs-core/src/vision_models/phi3/mod.rs:1276-1291 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:464-478 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:585-599 — before extracting anything, compare `mistralrs-core/src/models/mixtral.rs` and `mistralrs-core/src/vision_models/phi3/mod.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 290 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 (15 lines × 4) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6756— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6756-6770 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7198-7212 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7666-7680 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8188-8202 — 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 (15 lines × 4) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:658— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:658-672 | mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1631-1645 | mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:678-692 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:448-462 — `mistralrs-core/src/vision_models/gemma3/inputs_processor.rs` and `mistralrs-core/src/vision_models/gemma4/inputs_processor.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 5 separate duplicated blocks between them, totalling at least 76 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 (15 lines × 4) mistralrs-core/src/vision_models/qwen3_5/mod.rs:74— mistralrs-core/src/vision_models/qwen3_5/mod.rs:74-88 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:63-77 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:616-630 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:61-75 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (15 lines × 4) mistralrs-core/src/xlora_models/llama.rs:353— mistralrs-core/src/xlora_models/llama.rs:353-367 | mistralrs-core/src/xlora_models/mistral.rs:333-347 | mistralrs-core/src/xlora_models/mixtral.rs:460-474 | mistralrs-core/src/xlora_models/phi3.rs:298-312 — before extracting anything, compare `mistralrs-core/src/xlora_models/llama.rs` and `mistralrs-core/src/xlora_models/mistral.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 273 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15 lines × 4) mistralrs-core/src/xlora_models/mistral.rs:522— mistralrs-core/src/xlora_models/mistral.rs:522-536 | mistralrs-core/src/xlora_models/mixtral.rs:652-666 | mistralrs-core/src/xlora_models/phi2.rs:496-510 | mistralrs-core/src/xlora_models/phi3.rs:472-486 — before extracting anything, compare `mistralrs-core/src/xlora_models/mistral.rs` and `mistralrs-core/src/xlora_models/mixtral.rs` as WHOLE FILES: this scan already matched 52 separate duplicated blocks between them, totalling at least 769 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-cli/src/commands/run/interactive.rs:1502— mistralrs-cli/src/commands/run/interactive.rs:1502-1506 | mistralrs-pyo3/src/stream.rs:59-63 | mistralrs-pyo3/src/util.rs:158-162 | mistralrs-pyo3/src/util.rs:180-184 | mistralrs-server-core/src/chat_completion.rs:495-499 | mistralrs-server-core/src/chat_completion.rs:1356-1360 — there are 6 copies across 4 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.
Duplicated block (5 lines × 6) mistralrs-core/src/embedding_models/qwen3_embedding.rs:451— mistralrs-core/src/embedding_models/qwen3_embedding.rs:451-456 | mistralrs-core/src/xlora_models/mistral.rs:593-597 | mistralrs-core/src/xlora_models/mixtral.rs:723-727 | mistralrs-core/src/xlora_models/phi2.rs:563-567 | mistralrs-core/src/xlora_models/phi3.rs:544-549 | mistralrs-core/src/xlora_models/starcoder2.rs:577-582 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/xlora_models/mistral.rs` as WHOLE FILES: this scan already matched 8 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. 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 × 6) mistralrs-core/src/layers.rs:880— mistralrs-core/src/layers.rs:880-884 | mistralrs-core/src/layers.rs:2042-2046 | mistralrs-core/src/layers.rs:2216-2220 | mistralrs-core/src/layers.rs:3070-3075 | mistralrs-core/src/layers.rs:3203-3208 | mistralrs-core/src/vision_models/gemma4/text.rs:148-156 — 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.
Duplicated block (5 lines × 6) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1145— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1145-1149 | mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1174-1178 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1710-1714 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1739-1743 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1906-1910 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1952-1956 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (5 lines × 6) mistralrs-quant/src/cutile/nvfp4_glu.rs:117— mistralrs-quant/src/cutile/nvfp4_glu.rs:117-121 | mistralrs-quant/src/cutile/nvfp4_glu.rs:274-278 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:29-33 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:182-186 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:392-396 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:686-690 — before extracting anything, compare `mistralrs-quant/src/cutile/nvfp4_glu.rs` and `mistralrs-quant/src/cutile/nvfp4_matmul.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 103 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-quant/src/distributed/mod.rs:561— mistralrs-quant/src/distributed/mod.rs:561-565 | mistralrs-quant/src/distributed/mod.rs:592-596 | mistralrs-quant/src/distributed/mod.rs:623-627 | mistralrs-quant/src/distributed/mod.rs:710-714 | mistralrs-quant/src/distributed/mod.rs:741-745 | mistralrs-quant/src/distributed/mod.rs:772-776 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 6) mistralrs-quant/src/utils/ops.rs:2027— mistralrs-quant/src/utils/ops.rs:2027-2032 | mistralrs-quant/src/utils/ops.rs:2056-2061 | mistralrs-quant/src/utils/ops.rs:2085-2090 | mistralrs-quant/src/utils/ops.rs:2831-2835 | mistralrs-quant/src/utils/ops.rs:2858-2862 | mistralrs-quant/src/utils/ops.rs:2885-2889 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 6) mistralrs-core/src/ops.rs:1169— mistralrs-core/src/ops.rs:1169-1174 | mistralrs-core/src/ops.rs:1189-1194 | mistralrs-core/src/ops.rs:1199-1204 | mistralrs-core/src/ops.rs:1209-1213 | mistralrs-core/src/ops.rs:1387-1392 | mistralrs-core/src/ops.rs:1407-1411 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (29 lines × 2) mistralrs-core/src/models/gemma.rs:200— mistralrs-core/src/models/gemma.rs:200-228 | mistralrs-core/src/models/phi2.rs:296-324 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/phi2.rs` as WHOLE FILES: this scan already matched 34 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.
Duplicated block (29 lines × 2) mistralrs-core/src/models/qwen3_moe.rs:369— mistralrs-core/src/models/qwen3_moe.rs:369-397 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:108-136 — before extracting anything, compare `mistralrs-core/src/models/qwen3_moe.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 316 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 (29 lines × 2) mistralrs-core/src/paged_attention/cache_engine.rs:459— mistralrs-core/src/paged_attention/cache_engine.rs:459-487 | mistralrs-core/src/paged_attention/cache_engine.rs:497-525 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29 lines × 2) mistralrs-core/src/paged_attention/layers/paged_attention.rs:1710— mistralrs-core/src/paged_attention/layers/paged_attention.rs:1710-1738 | mistralrs-core/src/paged_attention/layers/paged_attention.rs:1848-1876 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:1384— mistralrs-core/src/pipeline/multimodal.rs:1384-1412 | mistralrs-core/src/pipeline/normal.rs:1421-1449 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (29 lines × 2) mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:332— mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:332-360 | mistralrs-paged-attn/src/cuda/backend/mla.rs:341-369 — before extracting anything, compare `mistralrs-paged-attn/src/cuda/backend/flashinfer.rs` and `mistralrs-paged-attn/src/cuda/backend/mla.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (29 lines × 2) mistralrs-quant/src/lib.rs:2919— mistralrs-quant/src/lib.rs:2919-2947 | mistralrs-quant/src/lib.rs:2985-3013 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) mistralrs-core/src/models/hunyuan_v1_dense.rs:430— mistralrs-core/src/models/hunyuan_v1_dense.rs:430-453 | mistralrs-core/src/models/hunyuan_v1_moe.rs:924-947 — before extracting anything, compare `mistralrs-core/src/models/hunyuan_v1_dense.rs` and `mistralrs-core/src/models/hunyuan_v1_moe.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 690 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (24 lines × 2) mistralrs-core/src/models/hunyuan_v1_dense.rs:486— mistralrs-core/src/models/hunyuan_v1_dense.rs:486-509 | mistralrs-core/src/models/hunyuan_v1_moe.rs:980-1003 — before extracting anything, compare `mistralrs-core/src/models/hunyuan_v1_dense.rs` and `mistralrs-core/src/models/hunyuan_v1_moe.rs` as WHOLE FILES: this scan already matched 53 separate duplicated blocks between them, totalling at least 690 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (24 lines × 2) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1497— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1497-1520 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2881-2904 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3067— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3067-3090 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3400-3423 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:221— mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:221-244 | mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:648-671 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) mistralrs-paged-attn/src/metal/kernels/mod.rs:108— mistralrs-paged-attn/src/metal/kernels/mod.rs:108-131 | mistralrs-quant/src/metal_kernels/mod.rs:105-128 — before extracting anything, compare `mistralrs-paged-attn/src/metal/kernels/mod.rs` and `mistralrs-quant/src/metal_kernels/mod.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 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 (24 lines × 2) mistralrs-paged-attn/src/metal/kernels/mod.rs:461— mistralrs-paged-attn/src/metal/kernels/mod.rs:461-484 | mistralrs-paged-attn/src/metal/kernels/mod.rs:856-879 — both copies are in the same file, so extract the block into 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–16 lines × 2) mistralrs-core/src/attention/backends/metal_flash_attn.rs:127— mistralrs-core/src/attention/backends/metal_flash_attn.rs:127-142 | mistralrs-core/src/attention/backends/metal_flash_attn.rs:270-284 — both copies are in the same file, so extract the block into 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–16 lines × 2) mistralrs-core/src/gguf/normal_config.rs:1445— mistralrs-core/src/gguf/normal_config.rs:1445-1459 | mistralrs-core/src/gguf/normal_config.rs:1542-1557 — both copies are in the same file, so extract the block into 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–16 lines × 2) mistralrs-core/src/models/gpt_oss.rs:906— mistralrs-core/src/models/gpt_oss.rs:906-921 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:584-598 — before extracting anything, compare `mistralrs-core/src/models/gpt_oss.rs` and `mistralrs-core/src/vision_models/muse_glimmer/text.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 97 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 (15–16 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:760— mistralrs-core/src/pipeline/multimodal.rs:760-775 | mistralrs-core/src/pipeline/normal.rs:768-782 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15–16 lines × 2) mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:334— mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:334-349 | mistralrs-core/src/vision_models/qwen4_exp/text.rs:115-129 — `mistralrs-core/src/vision_models/qwen3_5_moe/text.rs` and `mistralrs-core/src/vision_models/qwen4_exp/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 3 separate duplicated blocks between them, totalling at least 34 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 (15–16 lines × 2) mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:351— mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:351-365 | mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:404-419 — both copies are in the same file, so extract the block into 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–16 lines × 2) mistralrs-server-core/src/responses.rs:2371— mistralrs-server-core/src/responses.rs:2371-2386 | mistralrs-server-core/src/responses.rs:2447-2461 — both copies are in the same file, so extract the block into 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–10 lines × 2) mistralrs-core/src/models/mixtral.rs:282— mistralrs-core/src/models/mixtral.rs:282-291 | mistralrs-core/src/vision_models/qwen4_exp/text.rs:154-162 — 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 (9–10 lines × 2) mistralrs-core/src/pipeline/chat_template.rs:612— mistralrs-core/src/pipeline/chat_template.rs:612-621 | mistralrs-core/src/pipeline/chat_template.rs:645-653 — both copies are in the same file, so extract the block into 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–10 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1021— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1021-1029 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1932-1941 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–10 lines × 2) mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:458— mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:458-466 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:289-298 — `mistralrs-core/src/vision_models/idefics3/inputs_processor.rs` and `mistralrs-core/src/vision_models/mistral3/inputs_processor.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 157 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 (9–10 lines × 2) mistralrs-core/src/vision_models/phi4/audio_embedding.rs:316— mistralrs-core/src/vision_models/phi4/audio_embedding.rs:316-324 | mistralrs-core/src/vision_models/phi4/image_embedding.rs:806-815 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9–10 lines × 2) mistralrs/src/anymoe.rs:141— mistralrs/src/anymoe.rs:141-150 | mistralrs/src/model_builder_trait.rs:1083-1091 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9–10 lines × 2) mistralrs/src/model.rs:401— mistralrs/src/model.rs:401-409 | mistralrs/src/model.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.
Duplicated block (7 lines × 5) mistralrs-core/src/gdn/weights.rs:226— mistralrs-core/src/gdn/weights.rs:226-232 | mistralrs-core/src/gdn/weights.rs:255-261 | mistralrs-core/src/gdn/weights.rs:296-302 | mistralrs-core/src/layers.rs:3658-3664 | mistralrs-core/src/layers.rs:3720-3726 — 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.
Duplicated block (7 lines × 5) mistralrs-core/src/vision_models/gemma4/mod.rs:392— mistralrs-core/src/vision_models/gemma4/mod.rs:392-398 | mistralrs-core/src/vision_models/gemma4/mod.rs:568-574 | mistralrs-core/src/vision_models/gemma4/mod.rs:705-711 | REDACTED:230-236 | mistralrs-core/src/vision_models/mistral3/mod.rs:259-265 — there are 5 copies across 3 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.
Duplicated block (7 lines × 5) mistralrs-quant/src/hqq/hqq_op.rs:39— mistralrs-quant/src/hqq/hqq_op.rs:39-45 | mistralrs-quant/src/hqq/hqq_op.rs:148-154 | mistralrs-quant/src/hqq/hqq_op.rs:261-267 | mistralrs-quant/src/hqq/hqq_op.rs:378-384 | mistralrs-quant/src/hqq/hqq_op.rs:497-503 — 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) mistralrs-paged-attn/src/metal/backend/gather_kv.rs:94— mistralrs-paged-attn/src/metal/backend/gather_kv.rs:94-100 | mistralrs-paged-attn/src/metal/backend/gather_kv.rs:104-110 | mistralrs-paged-attn/src/metal/backend/gather_kv.rs:114-120 | mistralrs-paged-attn/src/metal/backend/paged_attention.rs:792-799 | mistralrs-paged-attn/src/metal/backend/paged_attention.rs:804-811 — before extracting anything, compare `mistralrs-paged-attn/src/metal/backend/gather_kv.rs` and `mistralrs-paged-attn/src/metal/backend/paged_attention.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 (7 lines × 5) mistralrs-quant/src/hqq/hqq_op.rs:73— mistralrs-quant/src/hqq/hqq_op.rs:73-79 | mistralrs-quant/src/hqq/hqq_op.rs:184-190 | mistralrs-quant/src/hqq/hqq_op.rs:297-303 | mistralrs-quant/src/hqq/hqq_op.rs:414-420 | mistralrs-quant/src/hqq/hqq_op.rs:533-539 — 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) mistralrs-core/src/ops.rs:1596— mistralrs-core/src/ops.rs:1596-1602 | mistralrs-core/src/ops.rs:1838-1844 | mistralrs-core/src/ops.rs:4473-4479 | mistralrs-core/src/ops.rs:4637-4643 | mistralrs-core/src/ops.rs:5433-5439 — 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) mistralrs-quant/src/afq/ops.rs:146— mistralrs-quant/src/afq/ops.rs:146-152 | mistralrs-quant/src/afq/ops.rs:256-262 | mistralrs-quant/src/afq/ops.rs:397-403 | mistralrs-quant/src/afq/ops.rs:846-852 | mistralrs-quant/src/afq/ops.rs:854-860 — 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.
mistralrs_server_core::chat_completion::parse_request (cyclomatic 60) mistralrs-server-core/src/chat_completion.rs:566— mistralrs_server_core::chat_completion::parse_request has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mistralrs_server_core::responses::create_response (cyclomatic 36) mistralrs-server-core/src/responses.rs:2055— mistralrs_server_core::responses::create_response 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.
mistralrs_server_core::chat_completion::serialize_agentic_data (cyclomatic 24) mistralrs-server-core/src/chat_completion.rs:145— mistralrs_server_core::chat_completion::serialize_agentic_data has cyclomatic complexity 24 (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.
mistralrs_server_core::responses::convert_input_items_to_messages (cyclomatic 24) mistralrs-server-core/src/responses.rs:129— mistralrs_server_core::responses::convert_input_items_to_messages has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
mistralrs_server_core::metrics::observe_http (cyclomatic 22) mistralrs-server-core/src/metrics.rs:214— mistralrs_server_core::metrics::observe_http 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.
mistralrs_server_core::openai::normalize_openai_tools (cyclomatic 16) mistralrs-server-core/src/openai.rs:1045— mistralrs_server_core::openai::normalize_openai_tools 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.
Attention::forward (cognitive 53) mistralrs-core/src/vision_models/gemma4/text.rs:507— Attention::forward has cognitive complexity 53 (threshold 15). Drivers by points: if/else 33 (46 pts), match/switch 3 (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.
Attention::forward (cognitive 30) mistralrs-core/src/vision_models/gemma3n/text.rs:434— Attention::forward has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (24 pts), match/switch 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Attention::forward (cognitive 27) mistralrs-core/src/models/deepseek2.rs:287— Attention::forward has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 2 (7 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Attention::forward (cognitive 27) mistralrs-core/src/models/deepseek3.rs:288— Attention::forward has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 2 (7 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Attention::forward (cognitive 27) mistralrs-core/src/models/glm4_moe_lite.rs:248— Attention::forward has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 2 (7 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Attention::new (cognitive 20) mistralrs-core/src/vision_models/gemma4/text.rs:313— Attention::new has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 2, 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.
Near-duplicate member pair (32 shared lines) mistralrs-core/src/models/phi3.rs:407— mistralrs-core/src/models/phi3.rs:407-532 | mistralrs-core/src/vision_models/gemma3/text.rs:432-581 — These two members are variants of one another: 32 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 (32 shared lines) mistralrs-quant/src/distributed/mod.rs:549— mistralrs-quant/src/distributed/mod.rs:549-658 | mistralrs-quant/src/distributed/mod.rs:695-807 — These two members are variants of one another: 32 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 (32 shared lines) mistralrs-core/src/models/qwen3_next.rs:632— mistralrs-core/src/models/qwen3_next.rs:632-705 | mistralrs-core/src/vision_models/qwen3_5/packed_gdn.rs:122-176 — These two members are variants of one another: 32 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 (32 shared lines) mistralrs-quant/src/distributed/layers.rs:940— mistralrs-quant/src/distributed/layers.rs:940-1026 | mistralrs-quant/src/distributed/layers.rs:1424-1515 — These two members are variants of one another: 32 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 (32 shared lines) mistralrs-quant/src/utils/ops.rs:2001— mistralrs-quant/src/utils/ops.rs:2001-2111 | mistralrs-quant/src/utils/ops.rs:2798-2909 — These two members are variants of one another: 32 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 (32 shared lines) mistralrs/src/model.rs:347— mistralrs/src/model.rs:347-416 | mistralrs/src/model.rs:434-502 — These two members are variants of one another: 32 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.
Duplicated block (20 lines × 3) mistralrs-core/src/models/phi3.rs:115— mistralrs-core/src/models/phi3.rs:115-134 | mistralrs-core/src/vision_models/phi3/mod.rs:206-225 | mistralrs-core/src/vision_models/phi4/mod.rs:76-95 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/vision_models/phi3/mod.rs` as WHOLE FILES: this scan already matched 47 separate duplicated blocks between them, totalling at least 594 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 (20 lines × 3) mistralrs-core/src/pipeline/embedding.rs:636— mistralrs-core/src/pipeline/embedding.rs:636-655 | mistralrs-core/src/pipeline/multimodal.rs:1401-1420 | mistralrs-core/src/pipeline/normal.rs:1438-1457 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (20 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:92— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:92-111 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:193-212 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:140-159 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (20 lines × 3) mistralrs-quant/src/gguf/fast_mmvq.rs:372— mistralrs-quant/src/gguf/fast_mmvq.rs:372-391 | mistralrs-quant/src/gguf/fast_mmvq.rs:410-429 | mistralrs-quant/src/gguf/fast_mmvq.rs:448-467 — 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 (20 lines × 3) mistralrs-quant/src/utils/ops.rs:268— mistralrs-quant/src/utils/ops.rs:268-287 | mistralrs-quant/src/utils/ops.rs:372-391 | mistralrs-quant/src/utils/ops.rs:585-604 — 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 (20 lines × 3) mistralrs/src/model_builder_trait.rs:1287— mistralrs/src/model_builder_trait.rs:1287-1306 | mistralrs/src/model_builder_trait.rs:1354-1373 | mistralrs/src/model_builder_trait.rs:1452-1471 — 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 (19–20 lines × 2) mistralrs-core/src/cuda/gdn.rs:3832— mistralrs-core/src/cuda/gdn.rs:3832-3850 | mistralrs-core/src/cuda/gdn.rs:4289-4308 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19–20 lines × 2) mistralrs-core/src/models/phi3.rs:499— mistralrs-core/src/models/phi3.rs:499-517 | mistralrs-core/src/vision_models/phi3/mod.rs:1280-1299 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/vision_models/phi3/mod.rs` as WHOLE FILES: this scan already matched 47 separate duplicated blocks between them, totalling at least 594 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 (19–20 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:2299— mistralrs-core/src/pipeline/multimodal.rs:2299-2318 | mistralrs-core/src/pipeline/normal.rs:2078-2096 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–20 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:428— mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:428-446 | mistralrs-core/src/vision_models/qwen2vl/text.rs:429-448 — `mistralrs-core/src/vision_models/qwen2_5_vl/text.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 43 separate duplicated blocks between them, totalling at least 650 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 (19–20 lines × 2) mistralrs-quant/src/cutile/fp8_w8a16.rs:809— mistralrs-quant/src/cutile/fp8_w8a16.rs:809-827 | mistralrs-quant/src/cutile/fp8_w8a8.rs:828-847 — before extracting anything, compare `mistralrs-quant/src/cutile/fp8_w8a16.rs` and `mistralrs-quant/src/cutile/fp8_w8a8.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 212 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–20 lines × 2) mistralrs-quant/src/metal_kernels/mod.rs:4273— mistralrs-quant/src/metal_kernels/mod.rs:4273-4292 | mistralrs-quant/src/metal_kernels/mod.rs:5026-5044 — both copies are in the same file, so extract the block into 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–17 lines × 2) mistralrs-core/src/models/gpt_oss.rs:819— mistralrs-core/src/models/gpt_oss.rs:819-835 | mistralrs-core/src/models/phi3.rs:489-504 — before extracting anything, compare `mistralrs-core/src/models/gpt_oss.rs` and `mistralrs-core/src/models/phi3.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 158 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–17 lines × 2) mistralrs-core/src/moe/experts/backends.rs:957— mistralrs-core/src/moe/experts/backends.rs:957-973 | mistralrs-core/src/moe/experts/backends.rs:1036-1051 — both copies are in the same file, so extract the block into 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–17 lines × 2) mistralrs-core/src/vision_models/gemma3n/text.rs:1715— mistralrs-core/src/vision_models/gemma3n/text.rs:1715-1730 | mistralrs-core/src/vision_models/gemma4/text.rs:2045-2061 — `mistralrs-core/src/vision_models/gemma3n/text.rs` and `mistralrs-core/src/vision_models/gemma4/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 7 separate duplicated blocks between them, totalling at least 70 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 (16–17 lines × 2) mistralrs-core/src/xlora_models/gemma.rs:528— mistralrs-core/src/xlora_models/gemma.rs:528-544 | mistralrs-core/src/xlora_models/phi3.rs:473-488 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/phi3.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 228 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–17 lines × 2) mistralrs-quant/src/cutile/fused_moe.rs:490— mistralrs-quant/src/cutile/fused_moe.rs:490-506 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:935-950 — before extracting anything, compare `mistralrs-quant/src/cutile/fused_moe.rs` and `mistralrs-quant/src/cutile/fused_moe_fp8.rs` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 308 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–17 lines × 2) mistralrs-quant/src/rotary/mod.rs:583— mistralrs-quant/src/rotary/mod.rs:583-598 | mistralrs-quant/src/rotary/mod.rs:690-706 — both copies are in the same file, so extract the block into 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–15 lines × 2) mistralrs-core/src/kv_cache/mod.rs:1271— mistralrs-core/src/kv_cache/mod.rs:1271-1285 | mistralrs-core/src/kv_cache/mod.rs:1334-1347 — both copies are in the same file, so extract the block into 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–15 lines × 2) mistralrs-core/src/models/gemma2.rs:380— mistralrs-core/src/models/gemma2.rs:380-393 | mistralrs-core/src/vision_models/gemma3/text.rs:390-404 — before extracting anything, compare `mistralrs-core/src/models/gemma2.rs` and `mistralrs-core/src/vision_models/gemma3/text.rs` as WHOLE FILES: this scan already matched 30 separate duplicated blocks between them, totalling at least 362 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 (14–15 lines × 2) mistralrs-core/src/models/mixtral.rs:286— mistralrs-core/src/models/mixtral.rs:286-299 | mistralrs-core/src/xlora_models/mixtral.rs:363-377 — `mistralrs-core/src/models/mixtral.rs` and `mistralrs-core/src/xlora_models/mixtral.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 12 separate duplicated blocks between them, totalling at least 126 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 (14–15 lines × 2) mistralrs-core/src/models/phi2.rs:259— mistralrs-core/src/models/phi2.rs:259-272 | mistralrs-core/src/xlora_models/phi2.rs:236-250 — `mistralrs-core/src/models/phi2.rs` and `mistralrs-core/src/xlora_models/phi2.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 7 separate duplicated blocks between them, totalling at least 75 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 (14–15 lines × 2) mistralrs-core/src/pipeline/paths.rs:172— mistralrs-core/src/pipeline/paths.rs:172-186 | mistralrs-core/src/pipeline/paths.rs:245-258 — both copies are in the same file, so extract the block into 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–15 lines × 2) mistralrs-quant/src/blockwise_fp8/ops.rs:1057— mistralrs-quant/src/blockwise_fp8/ops.rs:1057-1071 | mistralrs-quant/src/blockwise_fp8/ops.rs:1236-1249 — both copies are in the same file, so extract the block into 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 × 5) mistralrs-core/src/embedding_models/qwen3_embedding.rs:103— mistralrs-core/src/embedding_models/qwen3_embedding.rs:103-114 | mistralrs-core/src/models/glm4.rs:136-147 | mistralrs-core/src/models/glm4_moe.rs:188-199 | mistralrs-core/src/models/qwen3.rs:114-125 | mistralrs-core/src/models/qwen3_moe.rs:117-128 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 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 × 5) mistralrs-core/src/embedding_models/qwen3_embedding.rs:125— mistralrs-core/src/embedding_models/qwen3_embedding.rs:125-136 | mistralrs-core/src/models/glm4.rs:158-169 | mistralrs-core/src/models/glm4_moe.rs:210-221 | mistralrs-core/src/models/qwen3.rs:136-147 | mistralrs-core/src/models/qwen3_moe.rs:139-150 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 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 × 5) mistralrs-core/src/embedding_models/qwen3_embedding.rs:145— mistralrs-core/src/embedding_models/qwen3_embedding.rs:145-156 | mistralrs-core/src/models/qwen3.rs:156-167 | mistralrs-core/src/models/qwen3_moe.rs:159-170 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:156-167 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:262-273 — `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/qwen3.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 27 separate duplicated blocks between them, totalling at least 372 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 (12 lines × 5) mistralrs-core/src/models/flint.rs:537— mistralrs-core/src/models/flint.rs:537-548 | mistralrs-core/src/models/qwen3_moe.rs:366-377 | mistralrs-core/src/models/qwen3_next.rs:413-424 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:319-330 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:105-116 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/qwen3_moe.rs` as WHOLE FILES: this scan already matched 43 separate duplicated blocks between them, totalling at least 470 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 5) mistralrs-core/src/xlora_models/gemma.rs:599— mistralrs-core/src/xlora_models/gemma.rs:599-610 | mistralrs-core/src/xlora_models/mistral.rs:595-606 | mistralrs-core/src/xlora_models/mixtral.rs:725-736 | mistralrs-core/src/xlora_models/phi2.rs:565-576 | mistralrs-core/src/xlora_models/starcoder2.rs:580-591 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/mistral.rs` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 5) mistralrs-quant/src/metal_kernels/mod.rs:402— mistralrs-quant/src/metal_kernels/mod.rs:402-413 | mistralrs-quant/src/metal_kernels/mod.rs:440-451 | mistralrs-quant/src/metal_kernels/mod.rs:486-497 | mistralrs-quant/src/metal_kernels/mod.rs:532-543 | mistralrs-quant/src/metal_kernels/mod.rs:577-588 — 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 (9 lines × 6) mistralrs-core/src/embedding_models/embedding_gemma.rs:393— mistralrs-core/src/embedding_models/embedding_gemma.rs:393-402 | mistralrs-core/src/models/gemma.rs:362-370 | mistralrs-core/src/models/gemma2.rs:435-443 | mistralrs-core/src/vision_models/gemma3/text.rs:452-461 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:408-417 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:528-537 — `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/models/gemma.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 7 separate duplicated blocks between them, totalling at least 113 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 (9 lines × 6) mistralrs-core/src/embedding_models/qwen3_embedding.rs:371— mistralrs-core/src/embedding_models/qwen3_embedding.rs:371-379 | mistralrs-core/src/models/glm4.rs:485-493 | mistralrs-core/src/models/hunyuan_v1_dense.rs:450-458 | mistralrs-core/src/models/hunyuan_v1_moe.rs:944-952 | mistralrs-core/src/models/qwen2.rs:476-484 | mistralrs-core/src/models/qwen3.rs:444-452 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 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 (9 lines × 6) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1442— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1442-1450 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1750-1758 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2050-2058 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5038-5046 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6828-6836 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7292-7300 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 6) mistralrs-core/src/xlora_models/classifier.rs:55— mistralrs-core/src/xlora_models/classifier.rs:55-63 | mistralrs-core/src/xlora_models/classifier.rs:68-76 | mistralrs-core/src/xlora_models/classifier.rs:118-126 | mistralrs-core/src/xlora_models/classifier.rs:131-139 | mistralrs-core/src/xlora_models/classifier.rs:210-218 | mistralrs-core/src/xlora_models/classifier.rs:223-231 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 6) mistralrs-quant/src/cutile/fp8_w8a16.rs:67— mistralrs-quant/src/cutile/fp8_w8a16.rs:67-75 | mistralrs-quant/src/cutile/fp8_w8a16.rs:120-128 | mistralrs-quant/src/cutile/fp8_w8a16.rs:172-180 | mistralrs-quant/src/cutile/fp8_w8a16.rs:225-233 | mistralrs-quant/src/cutile/fp8_w8a8.rs:72-80 | mistralrs-quant/src/cutile/fp8_w8a8.rs:130-138 — before extracting anything, compare `mistralrs-quant/src/cutile/fp8_w8a16.rs` and `mistralrs-quant/src/cutile/fp8_w8a8.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 212 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 6) mistralrs-quant/src/cutile/nvfp4_glu.rs:147— mistralrs-quant/src/cutile/nvfp4_glu.rs:147-155 | mistralrs-quant/src/cutile/nvfp4_glu.rs:304-312 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:62-70 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:215-223 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:426-434 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:720-728 — before extracting anything, compare `mistralrs-quant/src/cutile/nvfp4_glu.rs` and `mistralrs-quant/src/cutile/nvfp4_matmul.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 103 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/embedding_models/qwen3_embedding.rs:413— mistralrs-core/src/embedding_models/qwen3_embedding.rs:413-421 | mistralrs-core/src/models/glm4.rs:556-564 | mistralrs-core/src/models/mistral.rs:557-565 | mistralrs-core/src/models/qwen3.rs:515-523 | mistralrs-core/src/models/qwen3_moe.rs:695-703 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 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 (9 lines × 5) mistralrs-core/src/models/llama.rs:382— mistralrs-core/src/models/llama.rs:382-390 | mistralrs-core/src/models/mistral.rs:436-444 | mistralrs-core/src/models/phi3.rs:428-436 | mistralrs-core/src/models/phi3_5_moe.rs:497-505 | mistralrs-core/src/models/smollm3.rs:398-406 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/mistral.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 355 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/models/qwen3_moe.rs:408— mistralrs-core/src/models/qwen3_moe.rs:408-416 | mistralrs-core/src/models/qwen3_next.rs:479-487 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:383-391 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:147-155 | mistralrs-core/src/vision_models/qwen4_exp/text.rs:157-165 — before extracting anything, compare `mistralrs-core/src/models/qwen3_moe.rs` and `mistralrs-core/src/models/qwen3_next.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:219— mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:219-227 | mistralrs-core/src/vision_models/qwen2vl/text.rs:220-228 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:211-219 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:212-220 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:318-326 — `mistralrs-core/src/vision_models/qwen2_5_vl/text.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 43 separate duplicated blocks between them, totalling at least 650 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 (9 lines × 5) mistralrs-core/src/vision_models/qwen3_5/text.rs:870— mistralrs-core/src/vision_models/qwen3_5/text.rs:870-878 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:555-563 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:401-409 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:521-529 | mistralrs-core/src/vision_models/qwen4_exp/text.rs:256-264 — `mistralrs-core/src/vision_models/qwen3_5/text.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 26 separate duplicated blocks between them, totalling at least 428 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 (9 lines × 5) mistralrs-quant/src/utils/ops.rs:292— mistralrs-quant/src/utils/ops.rs:292-300 | mistralrs-quant/src/utils/ops.rs:306-314 | mistralrs-quant/src/utils/ops.rs:320-328 | mistralrs-quant/src/utils/ops.rs:334-342 | mistralrs-quant/src/utils/ops.rs:348-356 — 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 (8–9 lines × 2) mistralrs-core/src/attention/backends/cpu/avx.rs:644— mistralrs-core/src/attention/backends/cpu/avx.rs:644-652 | mistralrs-core/src/attention/backends/cpu/avx.rs:787-794 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) mistralrs-core/src/models/gemma2.rs:573— mistralrs-core/src/models/gemma2.rs:573-580 | mistralrs-core/src/models/qwen2.rs:600-608 — before extracting anything, compare `mistralrs-core/src/models/gemma2.rs` and `mistralrs-core/src/models/qwen2.rs` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 428 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–9 lines × 2) mistralrs-core/src/models/gpt_oss.rs:358— mistralrs-core/src/models/gpt_oss.rs:358-365 | mistralrs-core/src/models/gpt_oss.rs:396-404 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) mistralrs-core/src/xlora_models/classifier.rs:177— mistralrs-core/src/xlora_models/classifier.rs:177-184 | mistralrs-core/src/xlora_models/classifier.rs:187-195 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) mistralrs-core/src/xlora_models/quantized_llama.rs:792— mistralrs-core/src/xlora_models/quantized_llama.rs:792-799 | mistralrs-core/src/xlora_models/quantized_phi3.rs:460-468 — before extracting anything, compare `mistralrs-core/src/xlora_models/quantized_llama.rs` and `mistralrs-core/src/xlora_models/quantized_phi3.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 221 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–9 lines × 2) mistralrs-quant/src/metal_kernels/mod.rs:1325— mistralrs-quant/src/metal_kernels/mod.rs:1325-1333 | mistralrs-quant/src/metal_kernels/mod.rs:1356-1363 — both copies are in the same file, so extract the block into 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 × 5) mistralrs-core/src/cuda/gdn.rs:1929— mistralrs-core/src/cuda/gdn.rs:1929-1934 | mistralrs-core/src/cuda/gdn.rs:1936-1941 | mistralrs-core/src/cuda/gdn.rs:2769-2774 | mistralrs-core/src/cuda/gdn.rs:5796-5801 | mistralrs-core/src/cuda/gdn.rs:5803-5808 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 5) mistralrs-core/src/metal/gdn.rs:204— mistralrs-core/src/metal/gdn.rs:204-209 | mistralrs-core/src/metal/gdn.rs:319-324 | mistralrs-core/src/metal/gdn.rs:792-797 | mistralrs-core/src/metal/gdn.rs:980-985 | mistralrs-core/src/metal/ssm.rs:182-187 — before extracting anything, compare `mistralrs-core/src/metal/gdn.rs` and `mistralrs-core/src/metal/ssm.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/ops.rs:4464— mistralrs-core/src/ops.rs:4464-4469 | mistralrs-core/src/ops.rs:4750-4755 | mistralrs-core/src/ops.rs:5424-5429 | mistralrs-core/src/ops.rs:5696-5701 | mistralrs-core/src/ops.rs:6119-6124 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 5) mistralrs-quant/src/cutile/fp8_gemm.rs:490— mistralrs-quant/src/cutile/fp8_gemm.rs:490-495 | mistralrs-quant/src/cutile/fp8_w8a16.rs:799-804 | mistralrs-quant/src/cutile/fp8_w8a8.rs:818-823 | mistralrs-quant/src/cutile/fused_moe.rs:843-848 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:759-764 — before extracting anything, compare `mistralrs-quant/src/cutile/fp8_gemm.rs` and `mistralrs-quant/src/cutile/fp8_w8a16.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 5) mistralrs-quant/src/hqq/mod.rs:377— mistralrs-quant/src/hqq/mod.rs:377-382 | mistralrs-quant/src/hqq/mod.rs:392-397 | mistralrs-quant/src/hqq/mod.rs:466-471 | mistralrs-quant/src/hqq/mod.rs:530-535 | mistralrs-quant/src/hqq/mod.rs:553-558 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 5) mistralrs-quant/src/metal_kernels/mod.rs:1516— mistralrs-quant/src/metal_kernels/mod.rs:1516-1522 | mistralrs-quant/src/metal_kernels/mod.rs:1592-1598 | mistralrs-quant/src/metal_kernels/mod.rs:1661-1666 | mistralrs-quant/src/metal_kernels/mod.rs:2642-2649 | mistralrs-quant/src/metal_kernels/mod.rs:2778-2784 — 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.
Engine::run (cognitive 498) mistralrs-core/src/engine/mod.rs:1119— Engine::run has cognitive complexity 498 (threshold 15). Drivers by points: if/else 111 (364 pts), loops 19 (71 pts), match/switch 9 (35 pts), boolean chains 28 (nesting depth added 331). 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.
Engine::add_request (cognitive 230) mistralrs-core/src/engine/add_request.rs:144— Engine::add_request has cognitive complexity 230 (threshold 15). Drivers by points: if/else 75 (165 pts), match/switch 22 (46 pts), boolean chains 11, loops 4 (8 pts) (nesting depth added 118). 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.
Engine::new (cognitive 26) mistralrs-core/src/engine/mod.rs:537— Engine::new has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 6, match/switch 4 (5 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.
Engine::handle_request (cognitive 19) mistralrs-core/src/engine/add_request.rs:66— Engine::handle_request has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, match/switch 2 (3 pts) (nesting depth added 6). 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.
Engine::free_finished_scheduler_sequences (cognitive 16) mistralrs-core/src/engine/mod.rs:763— Engine::free_finished_scheduler_sequences has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PagedAttention::try_prefix_gather_prefill (cognitive 77) mistralrs-core/src/paged_attention/layers/paged_attention.rs:1412— PagedAttention::try_prefix_gather_prefill has cognitive complexity 77 (threshold 15). Drivers by points: if/else 40 (58 pts), boolean chains 14, match/switch 4 (5 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PagedAttention::try_metal_prefill (cognitive 56) mistralrs-core/src/paged_attention/layers/paged_attention.rs:1142— PagedAttention::try_metal_prefill has cognitive complexity 56 (threshold 15). Drivers by points: if/else 34 (40 pts), boolean chains 9, loops 2 (5 pts), match/switch 2 (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.
PagedAttention::cuda_fwd_t (cognitive 42) mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:112— PagedAttention::cuda_fwd_t has cognitive complexity 42 (threshold 15). Drivers by points: if/else 22 (23 pts), match/switch 11 (16 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PagedAttention::metal_fwd (cognitive 41) mistralrs-paged-attn/src/metal/backend/paged_attention.rs:321— PagedAttention::metal_fwd has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (22 pts), match/switch 10 (14 pts), boolean chains 5 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PagedAttention::run_standard_paged_decode (cognitive 20) mistralrs-core/src/paged_attention/layers/paged_attention.rs:2584— PagedAttention::run_standard_paged_decode has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (19 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.
DFlashDraftModel::prepare_ctx_batch (cognitive 24) mistralrs-core/src/speculative/dflash.rs:2999— DFlashDraftModel::prepare_ctx_batch has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 4 (11 pts) (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DFlashDraftModel::geometry_mask (cognitive 22) mistralrs-core/src/speculative/dflash.rs:3808— DFlashDraftModel::geometry_mask has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DFlashDraftModel::precapture_cuda_graphs (cognitive 19) mistralrs-core/src/speculative/dflash.rs:2459— DFlashDraftModel::precapture_cuda_graphs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, loops 2 (3 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DFlashDraftModel::draft_hidden_batch (cognitive 18) mistralrs-core/src/speculative/dflash.rs:3257— DFlashDraftModel::draft_hidden_batch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 5 (6 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.
DFlashDraftModel::run_draft_layers (cognitive 18) mistralrs-core/src/speculative/dflash.rs:3378— DFlashDraftModel::run_draft_layers has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 6 (10 pts), if/else 4 (7 pts), loops 1 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D30 · Dependency Vulnerabilities· Medium advisory (unmaintained) · ×5
Duplicated block (40 lines × 2) mistralrs-cli/src/commands/config.rs:162— mistralrs-cli/src/commands/config.rs:162-201 | mistralrs-cli/src/commands/serve.rs:181-220 — before extracting anything, compare `mistralrs-cli/src/commands/config.rs` and `mistralrs-cli/src/commands/serve.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (40 lines × 2) mistralrs-core/src/models/phi3.rs:683— mistralrs-core/src/models/phi3.rs:683-722 | mistralrs-core/src/vision_models/phi3/mod.rs:1519-1558 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/vision_models/phi3/mod.rs` as WHOLE FILES: this scan already matched 47 separate duplicated blocks between them, totalling at least 594 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 (40 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:902— mistralrs-core/src/pipeline/multimodal.rs:902-941 | mistralrs-core/src/pipeline/normal.rs:899-938 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (40 lines × 2) mistralrs-core/src/vision_models/qwen3_vl/text.rs:392— mistralrs-core/src/vision_models/qwen3_vl/text.rs:392-431 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:512-551 — `mistralrs-core/src/vision_models/qwen3_vl/text.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/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 42 separate duplicated blocks between them, totalling at least 613 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 (40 lines × 2) mistralrs-macros/src/lib.rs:266— mistralrs-macros/src/lib.rs:266-305 | mistralrs-macros/src/lib.rs:329-368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (37 lines × 2) mistralrs-core/src/lora/loralinear.rs:37— mistralrs-core/src/lora/loralinear.rs:37-73 | mistralrs-core/src/lora/qloralinear.rs:80-116 — before extracting anything, compare `mistralrs-core/src/lora/loralinear.rs` and `mistralrs-core/src/lora/qloralinear.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (37 lines × 2) mistralrs-core/src/models/gemma.rs:400— mistralrs-core/src/models/gemma.rs:400-436 | mistralrs-core/src/models/gemma2.rs:473-509 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (37 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:254— mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:254-290 | mistralrs-core/src/vision_models/qwen2vl/text.rs:255-291 — `mistralrs-core/src/vision_models/qwen2_5_vl/text.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 43 separate duplicated blocks between them, totalling at least 650 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 (37 lines × 2) mistralrs-core/src/xlora_models/gemma2.rs:154— mistralrs-core/src/xlora_models/gemma2.rs:154-190 | mistralrs-core/src/xlora_models/starcoder2.rs:133-169 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma2.rs` and `mistralrs-core/src/xlora_models/starcoder2.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 385 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (37 lines × 2) mistralrs-server-core/src/embeddings.rs:123— mistralrs-server-core/src/embeddings.rs:123-159 | mistralrs-server-core/src/embeddings.rs:166-202 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (35 lines × 2) mistralrs-core/src/embedding_models/embedding_gemma.rs:148— mistralrs-core/src/embedding_models/embedding_gemma.rs:148-182 | mistralrs-core/src/vision_models/gemma3/text.rs:120-154 — before extracting anything, compare `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/vision_models/gemma3/text.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 268 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 (35 lines × 2) mistralrs-core/src/ops.rs:1519— mistralrs-core/src/ops.rs:1519-1553 | mistralrs-core/src/ops.rs:1741-1775 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (35 lines × 2) mistralrs-core/src/paged_attention/cache_engine.rs:311— mistralrs-core/src/paged_attention/cache_engine.rs:311-345 | mistralrs-core/src/paged_attention/cache_engine.rs:397-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 (35 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1664— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1664-1698 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1964-1998 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (35 lines × 2) mistralrs-quant/src/utils/ops.rs:875— mistralrs-quant/src/utils/ops.rs:875-909 | mistralrs-quant/src/utils/ops.rs:982-1016 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34 lines × 2) mistralrs-core/src/lora/mod.rs:163— mistralrs-core/src/lora/mod.rs:163-196 | mistralrs-core/src/lora/mod.rs:215-248 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34 lines × 2) mistralrs-core/src/ops.rs:652— mistralrs-core/src/ops.rs:652-685 | mistralrs-core/src/ops.rs:799-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.
Duplicated block (34 lines × 2) mistralrs-core/src/pipeline/hf.rs:585— mistralrs-core/src/pipeline/hf.rs:585-618 | mistralrs-core/src/pipeline/hf.rs:649-682 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:688— mistralrs-core/src/pipeline/multimodal.rs:688-721 | mistralrs-core/src/pipeline/normal.rs:724-757 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (34 lines × 2) mistralrs-core/src/vision_models/qwen3_5/text.rs:1020— mistralrs-core/src/vision_models/qwen3_5/text.rs:1020-1053 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:721-754 — `mistralrs-core/src/vision_models/qwen3_5/text.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 26 separate duplicated blocks between them, totalling at least 428 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 (33 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:1327— mistralrs-core/src/pipeline/multimodal.rs:1327-1359 | mistralrs-core/src/pipeline/normal.rs:1383-1415 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (33 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:3293— mistralrs-core/src/pipeline/multimodal.rs:3293-3325 | mistralrs-core/src/pipeline/normal.rs:2893-2925 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (33 lines × 2) mistralrs-core/src/vision_models/gemma3n/vision.rs:950— mistralrs-core/src/vision_models/gemma3n/vision.rs:950-982 | mistralrs-core/src/vision_models/gemma3n/vision.rs:994-1026 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (33 lines × 2) mistralrs-core/src/vision_models/qwen3_vl/mod.rs:670— mistralrs-core/src/vision_models/qwen3_vl/mod.rs:670-702 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:115-147 — `mistralrs-core/src/vision_models/qwen3_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/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 29 separate duplicated blocks between them, totalling at least 505 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 (33 lines × 2) mistralrs-quant/src/utils/ops.rs:1131— mistralrs-quant/src/utils/ops.rs:1131-1163 | mistralrs-quant/src/utils/ops.rs:1203-1235 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (30 lines × 2) mistralrs-core/src/lora/loralinear.rs:211— mistralrs-core/src/lora/loralinear.rs:211-240 | mistralrs-core/src/lora/qloralinear.rs:260-289 — before extracting anything, compare `mistralrs-core/src/lora/loralinear.rs` and `mistralrs-core/src/lora/qloralinear.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (30 lines × 2) mistralrs-core/src/model_metadata.rs:395— mistralrs-core/src/model_metadata.rs:395-424 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:277-306 — 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 (30 lines × 2) mistralrs-core/src/models/deepseek2.rs:732— mistralrs-core/src/models/deepseek2.rs:732-761 | mistralrs-core/src/models/deepseek3.rs:795-824 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (30 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4836— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4836-4865 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4882-4911 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (30 lines × 2) mistralrs-core/src/vision_models/gemma3n/audio.rs:476— mistralrs-core/src/vision_models/gemma3n/audio.rs:476-505 | mistralrs-core/src/vision_models/gemma4/audio.rs:549-578 — `mistralrs-core/src/vision_models/gemma3n/audio.rs` and `mistralrs-core/src/vision_models/gemma4/audio.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 16 separate duplicated blocks between them, totalling at least 279 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 (27 lines × 2) mistralrs-core/src/models/llama.rs:429— mistralrs-core/src/models/llama.rs:429-455 | mistralrs-core/src/models/smollm3.rs:452-478 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (27 lines × 2) mistralrs-core/src/vision_models/llava/llava15.rs:91— mistralrs-core/src/vision_models/llava/llava15.rs:91-117 | mistralrs-core/src/vision_models/llava/llava_next.rs:50-76 — before extracting anything, compare `mistralrs-core/src/vision_models/llava/llava15.rs` and `mistralrs-core/src/vision_models/llava/llava_next.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (27 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:397— mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:397-423 | mistralrs-core/src/vision_models/qwen2vl/vision.rs:361-387 — `mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 18 separate duplicated blocks between them, totalling at least 176 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 (27 lines × 2) mistralrs-core/src/xlora_models/classifier.rs:82— mistralrs-core/src/xlora_models/classifier.rs:82-108 | mistralrs-core/src/xlora_models/classifier.rs:145-171 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (27 lines × 2) mistralrs-core/src/xlora_models/gemma.rs:326— mistralrs-core/src/xlora_models/gemma.rs:326-352 | mistralrs-core/src/xlora_models/gemma2.rs:335-361 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (25 lines × 3) mistralrs-core/src/models/deepseek2.rs:295— mistralrs-core/src/models/deepseek2.rs:295-319 | mistralrs-core/src/models/deepseek3.rs:296-320 | mistralrs-core/src/models/glm4_moe_lite.rs:256-280 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (25 lines × 3) REDACTED:301— REDACTED:301-325 | mistralrs-core/src/vision_models/idefics3/vision.rs:113-137 | mistralrs-core/src/vision_models/siglip.rs:104-128 — before extracting anything, compare `REDACTED` and `mistralrs-core/src/vision_models/idefics3/vision.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 213 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 (25 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:405— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:405-429 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:970-994 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1071-1095 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (25 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:334— mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:334-358 | mistralrs-core/src/vision_models/qwen2vl/text.rs:335-359 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:316-340 — `mistralrs-core/src/vision_models/qwen2_5_vl/text.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 43 separate duplicated blocks between them, totalling at least 650 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 (25 lines × 3) examples/python/shell_skills.py:18— examples/python/shell_skills.py:18-42 | REDACTED:25-52 | examples/server/skills.py:29-53 — 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 `REDACTED:25` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (20–21 lines × 2) mistralrs-core/src/models/glm4_moe.rs:429— mistralrs-core/src/models/glm4_moe.rs:429-448 | mistralrs-core/src/models/glm4_moe_lite.rs:525-545 — before extracting anything, compare `mistralrs-core/src/models/glm4_moe.rs` and `mistralrs-core/src/models/glm4_moe_lite.rs` as WHOLE FILES: this scan already matched 43 separate duplicated blocks between them, totalling at least 572 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (20–21 lines × 2) mistralrs-core/src/paged_attention/block_hash.rs:243— mistralrs-core/src/paged_attention/block_hash.rs:243-263 | mistralrs-core/src/paged_attention/block_hash.rs:288-307 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–21 lines × 2) mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:396— mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:396-415 | mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:530-550 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–21 lines × 2) mistralrs-quant/src/blockwise_fp8/ops.rs:588— mistralrs-quant/src/blockwise_fp8/ops.rs:588-607 | mistralrs-quant/src/blockwise_fp8/ops.rs:735-755 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–21 lines × 2) mistralrs-quant/src/cutile/fused_moe.rs:60— mistralrs-quant/src/cutile/fused_moe.rs:60-80 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:74-93 — before extracting anything, compare `mistralrs-quant/src/cutile/fused_moe.rs` and `mistralrs-quant/src/cutile/fused_moe_fp8.rs` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 308 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 2) mistralrs-core/src/models/mixtral.rs:480— mistralrs-core/src/models/mixtral.rs:480-497 | mistralrs-core/src/vision_models/phi3/mod.rs:1274-1292 — before extracting anything, compare `mistralrs-core/src/models/mixtral.rs` and `mistralrs-core/src/vision_models/phi3/mod.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 290 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 (18–19 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7491— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7491-7508 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8007-8025 — both copies are in the same file, so extract the block into 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–19 lines × 2) mistralrs-quant/src/afq/ops.rs:882— mistralrs-quant/src/afq/ops.rs:882-899 | mistralrs-quant/src/afq/ops.rs:1008-1026 — both copies are in the same file, so extract the block into 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–19 lines × 2) mistralrs-quant/src/lora/dynamic/loader/expert.rs:322— mistralrs-quant/src/lora/dynamic/loader/expert.rs:322-339 | mistralrs-quant/src/lora/dynamic/loader/expert.rs:349-367 — both copies are in the same file, so extract the block into 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–19 lines × 2) mistralrs/src/model_builder_trait.rs:1257— mistralrs/src/model_builder_trait.rs:1257-1275 | mistralrs/src/model_builder_trait.rs:1324-1341 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/embedding_models/embedding_gemma.rs:373— mistralrs-core/src/embedding_models/embedding_gemma.rs:373-386 | mistralrs-core/src/embedding_models/qwen3_embedding.rs:329-341 — before extracting anything, compare `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/embedding_models/qwen3_embedding.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 2) mistralrs-core/src/models/quantized_llama.rs:355— mistralrs-core/src/models/quantized_llama.rs:355-368 | mistralrs-core/src/xlora_models/quantized_llama.rs:795-807 — `mistralrs-core/src/models/quantized_llama.rs` and `mistralrs-core/src/xlora_models/quantized_llama.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 5 separate duplicated blocks between them, totalling at least 59 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 (13–14 lines × 2) mistralrs-core/src/sampler.rs:1230— mistralrs-core/src/sampler.rs:1230-1242 | mistralrs-core/src/sampler.rs:1938-1951 — both copies are in the same file, so extract the block into 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) mistralrs-core/src/vision_models/gemma3/text.rs:143— mistralrs-core/src/vision_models/gemma3/text.rs:143-156 | mistralrs-core/src/vision_models/gemma3n/text.rs:385-397 — `mistralrs-core/src/vision_models/gemma3/text.rs` and `mistralrs-core/src/vision_models/gemma3n/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 12 separate duplicated blocks between them, totalling at least 154 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 (13–14 lines × 2) mistralrs-quant/src/distributed/layers.rs:974— mistralrs-quant/src/distributed/layers.rs:974-987 | mistralrs-quant/src/distributed/layers.rs:1468-1480 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 4) mistralrs-core/src/distributed.rs:206— mistralrs-core/src/distributed.rs:206-218 | mistralrs-core/src/distributed.rs:252-264 | mistralrs-core/src/distributed.rs:292-304 | mistralrs-core/src/distributed.rs:332-344 — 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 (13 lines × 4) mistralrs-core/src/models/gemma.rs:416— mistralrs-core/src/models/gemma.rs:416-428 | mistralrs-core/src/models/gemma2.rs:489-501 | mistralrs-core/src/models/starcoder2.rs:480-492 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:513-525 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/models/glm4_moe.rs:879— mistralrs-core/src/models/glm4_moe.rs:879-891 | mistralrs-core/src/models/glm4_moe.rs:924-936 | mistralrs-core/src/models/glm4_moe_lite.rs:1013-1025 | mistralrs-core/src/models/glm4_moe_lite.rs:1056-1068 — before extracting anything, compare `mistralrs-core/src/models/glm4_moe.rs` and `mistralrs-core/src/models/glm4_moe_lite.rs` as WHOLE FILES: this scan already matched 43 separate duplicated blocks between them, totalling at least 572 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/vision_models/phi3/mod.rs:606— mistralrs-core/src/vision_models/phi3/mod.rs:606-618 | mistralrs-core/src/vision_models/phi3/mod.rs:638-650 | mistralrs-core/src/vision_models/phi4/image_embedding.rs:229-241 | mistralrs-core/src/vision_models/phi4/image_embedding.rs:261-273 — before extracting anything, compare `mistralrs-core/src/vision_models/phi3/mod.rs` and `mistralrs-core/src/vision_models/phi4/image_embedding.rs` as WHOLE FILES: this scan already matched 8 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. 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 × 4) mistralrs-quant/src/hqq/mod.rs:155— mistralrs-quant/src/hqq/mod.rs:155-167 | mistralrs-quant/src/hqq/mod.rs:238-250 | mistralrs-quant/src/hqq/mod.rs:332-344 | mistralrs-quant/src/hqq/mod.rs:481-493 — 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 (12–13 lines × 3) mistralrs-core/src/models/flint.rs:867— mistralrs-core/src/models/flint.rs:867-879 | mistralrs-core/src/models/qwen3.rs:493-504 | mistralrs-core/src/models/qwen3_moe.rs:673-684 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/qwen3.rs` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 392 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 3) mistralrs-core/src/sampler.rs:961— mistralrs-core/src/sampler.rs:961-972 | mistralrs-core/src/sampler.rs:1510-1522 | mistralrs-core/src/sampler.rs:1678-1689 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12–13 lines × 3) mistralrs-core/src/sampler.rs:1174— mistralrs-core/src/sampler.rs:1174-1186 | mistralrs-core/src/sampler.rs:1254-1266 | mistralrs-core/src/sampler.rs:1724-1735 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12–13 lines × 3) mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:288— mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:288-300 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:525-537 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:457-468 — before extracting anything, compare `mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs` and `mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 316 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 × 3) REDACTED:20— REDACTED:20-31 | REDACTED:84-96 | REDACTED:20-31 — 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (6–7 lines × 2) mistralrs-cli/src/commands/bench.rs:157— mistralrs-cli/src/commands/bench.rs:157-163 | mistralrs-cli/src/commands/run/mod.rs:127-132 — 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 (6–7 lines × 2) mistralrs-core/src/cuda/gdn.rs:5650— mistralrs-core/src/cuda/gdn.rs:5650-5655 | mistralrs-core/src/cuda/gdn.rs:5664-5670 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6–7 lines × 2) mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:310— mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:310-316 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:379-384 — `mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs` and `mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.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 8 separate duplicated blocks between them, totalling at least 156 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 (6–7 lines × 2) mistralrs-quant/src/blockwise_fp8/ops.rs:1275— mistralrs-quant/src/blockwise_fp8/ops.rs:1275-1281 | mistralrs-quant/src/mxfp4/ops.rs:436-441 — `mistralrs-quant/src/blockwise_fp8/ops.rs` and `mistralrs-quant/src/mxfp4/ops.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 6 separate duplicated blocks between them, totalling at least 49 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 (6–7 lines × 2) mistralrs-quant/src/blockwise_fp8/ops.rs:1314— mistralrs-quant/src/blockwise_fp8/ops.rs:1314-1320 | mistralrs-quant/src/mxfp4/ops.rs:523-528 — `mistralrs-quant/src/blockwise_fp8/ops.rs` and `mistralrs-quant/src/mxfp4/ops.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 6 separate duplicated blocks between them, totalling at least 49 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 (5 lines × 7) mistralrs-core/src/embedding_models/qwen3_embedding.rs:454— mistralrs-core/src/embedding_models/qwen3_embedding.rs:454-458 | mistralrs-core/src/models/gemma2.rs:572-576 | mistralrs-core/src/models/qwen2.rs:599-603 | mistralrs-core/src/vision_models/gemma3/text.rs:741-745 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:523-527 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:644-648 | mistralrs-core/src/xlora_models/gemma2.rs:641-645 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/qwen2.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 130 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 × 7) mistralrs-core/src/layers.rs:1621— mistralrs-core/src/layers.rs:1621-1625 | mistralrs-core/src/layers.rs:1761-1765 | mistralrs-core/src/layers.rs:1932-1936 | mistralrs-core/src/layers.rs:3062-3066 | mistralrs-core/src/layers.rs:3195-3199 | mistralrs-core/src/models/glm4.rs:81-85 | mistralrs-core/src/models/glm4_moe.rs:107-111 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/glm4_moe.rs` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 341 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 7) mistralrs-core/src/models/flint.rs:597— mistralrs-core/src/models/flint.rs:597-601 | mistralrs-core/src/models/lfm2.rs:330-334 | mistralrs-core/src/models/phi3_5_moe.rs:366-370 | mistralrs-core/src/models/qwen3_moe.rs:403-407 | mistralrs-core/src/models/qwen3_next.rs:474-478 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:378-382 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:142-146 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/lfm2.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 99 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 7) mistralrs-core/src/vision_models/diffusion_gemma/mod.rs:293— mistralrs-core/src/vision_models/diffusion_gemma/mod.rs:293-297 | mistralrs-core/src/vision_models/gemma3/mod.rs:183-187 | mistralrs-core/src/vision_models/gemma4/mod.rs:545-549 | mistralrs-core/src/vision_models/gemma4/mod.rs:668-672 | mistralrs-core/src/vision_models/gemma4/mod.rs:858-862 | mistralrs-core/src/vision_models/lfm2_vl/mod.rs:223-227 | mistralrs-core/src/vision_models/mistral3/mod.rs:327-331 — 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.
Duplicated block (5 lines × 7) mistralrs-quant/src/cutile/fp8_gemm.rs:69— mistralrs-quant/src/cutile/fp8_gemm.rs:69-73 | mistralrs-quant/src/cutile/fp8_w8a16.rs:59-63 | mistralrs-quant/src/cutile/fp8_w8a16.rs:112-116 | mistralrs-quant/src/cutile/fp8_w8a16.rs:164-168 | mistralrs-quant/src/cutile/fp8_w8a16.rs:217-221 | mistralrs-quant/src/cutile/fp8_w8a8.rs:64-68 | mistralrs-quant/src/cutile/fp8_w8a8.rs:122-126 — before extracting anything, compare `mistralrs-quant/src/cutile/fp8_gemm.rs` and `mistralrs-quant/src/cutile/fp8_w8a16.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Off the main sequence: mistralrs-audio — mistralrs-audio: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
Off the main sequence: mistralrs-flash-attn — mistralrs-flash-attn: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
Off the main sequence: mistralrs-metal-compile — mistralrs-metal-compile: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Off the main sequence: mistralrs-mcp — mistralrs-mcp: abstractness 0.06, instability 0.00, distance 0.94 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Off the main sequence: mistralrs-sandbox — mistralrs-sandbox: abstractness 0.14, instability 0.00, distance 0.86 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Outbound HTTP without resilience mistralrs-core/src/engine/tool_dispatch.rs:461— `reqwest::blocking::Client::new(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience mistralrs-core/src/pipeline/amoe.rs:587— `reqwest::blocking::get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience mistralrs-pyo3/src/util.rs:219— `reqwest::blocking::get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience mistralrs-pyo3/src/util.rs:272— `reqwest::blocking::get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience mistralrs-pyo3/src/util.rs:332— `reqwest::blocking::get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
X2 · Cancellation propagation· Async function without AbortSignal · ×5
Async function without AbortSignal: get mistralrs-cli/webui/src/lib/services/api.ts:16— `get` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: post mistralrs-cli/webui/src/lib/services/api.ts:22— `post` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: postVoid mistralrs-cli/webui/src/lib/services/api.ts:32— `postVoid` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: uploadFile mistralrs-cli/webui/src/lib/services/api.ts:157— `uploadFile` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: resolveAgentApproval mistralrs-cli/webui/src/lib/services/streaming.ts:182— `resolveAgentApproval` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Engine::run (cyclomatic 145) mistralrs-core/src/engine/mod.rs:1119— Engine::run has cyclomatic complexity 145 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Engine::add_request (cyclomatic 103) mistralrs-core/src/engine/add_request.rs:144— Engine::add_request has cyclomatic complexity 103 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Engine::handle_request (cyclomatic 19) mistralrs-core/src/engine/add_request.rs:66— Engine::handle_request 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.
Engine::new (cyclomatic 19) mistralrs-core/src/engine/mod.rs:537— Engine::new 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.
PagedAttention::try_prefix_gather_prefill (cyclomatic 51) mistralrs-core/src/paged_attention/layers/paged_attention.rs:1412— PagedAttention::try_prefix_gather_prefill has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PagedAttention::try_metal_prefill (cyclomatic 40) mistralrs-core/src/paged_attention/layers/paged_attention.rs:1142— PagedAttention::try_metal_prefill has cyclomatic complexity 40 (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.
PagedAttention::cuda_fwd_t (cyclomatic 38) mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:112— PagedAttention::cuda_fwd_t has cyclomatic complexity 38 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
PagedAttention::metal_fwd (cyclomatic 35) mistralrs-paged-attn/src/metal/backend/paged_attention.rs:321— PagedAttention::metal_fwd has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
MultimodalPipeline::try_cuda_decode_graph_forward (cyclomatic 29) mistralrs-core/src/pipeline/multimodal.rs:2026— MultimodalPipeline::try_cuda_decode_graph_forward has cyclomatic complexity 29 (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.
MultimodalPipeline::precapture_cuda_decode_graphs_impl (cyclomatic 21) mistralrs-core/src/pipeline/multimodal.rs:2257— MultimodalPipeline::precapture_cuda_decode_graphs_impl has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: MultimodalLoaderBuilder::build_inner (cyclomatic 25) 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.
MultimodalPipeline::capture_cuda_decode_graph_step (cyclomatic 17) mistralrs-core/src/pipeline/multimodal.rs:2446— MultimodalPipeline::capture_cuda_decode_graph_step 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: MultimodalLoaderBuilder::build_inner (cyclomatic 25) 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.
MultimodalPipeline::forward_step (cyclomatic 16) mistralrs-core/src/pipeline/multimodal.rs:2810— MultimodalPipeline::forward_step has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: MultimodalLoaderBuilder::build_inner (cyclomatic 25) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
FixmeComment mistralrs-core/src/sampler.rs:243— // FIXME: This is a hack. See https://github.com/LostRuins/koboldcpp/pull/982
FixmeComment mistralrs-core/src/pipeline/diffusion.rs:238— // FIXME(EricLBuehler): we know this is only for caching, so its OK. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment mistralrs-core/src/pipeline/embedding.rs:708— // FIXME(EricLBuehler): we know this is only for caching, so its OK. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment mistralrs-core/src/pipeline/speech.rs:317— // FIXME(EricLBuehler): we know this is only for caching, so its OK. — 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.
Phi4MMInputsProcessor::process_image_batch (cognitive 47) mistralrs-core/src/vision_models/phi4/inputs_processor.rs:754— Phi4MMInputsProcessor::process_image_batch has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (40 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Phi4MMInputsProcessor::process_audio_batch (cognitive 20) mistralrs-core/src/vision_models/phi4/inputs_processor.rs:950— Phi4MMInputsProcessor::process_audio_batch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 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.
Phi4MMInputsProcessor::process_inputs (cognitive 17) mistralrs-core/src/vision_models/phi4/inputs_processor.rs:329— Phi4MMInputsProcessor::process_inputs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, match/switch 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Phi4MMInputsProcessor::prepare_prompt_plans (cognitive 16) mistralrs-core/src/vision_models/phi4/inputs_processor.rs:576— Phi4MMInputsProcessor::prepare_prompt_plans has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockwiseFP8Linear::forward_raw (cognitive 41) mistralrs-quant/src/blockwise_fp8/mod.rs:308— BlockwiseFP8Linear::forward_raw has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20 (33 pts), boolean chains 4, match/switch 2 (4 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.
BlockwiseFP8Linear::apply_isq (cognitive 30) mistralrs-quant/src/blockwise_fp8/mod.rs:940— BlockwiseFP8Linear::apply_isq has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (25 pts), match/switch 3 (5 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
BlockwiseFP8Linear::prepare_provider (cognitive 22) mistralrs-quant/src/blockwise_fp8/mod.rs:99— BlockwiseFP8Linear::prepare_provider has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockwiseFP8Linear::try_forward_fused_split_glu (cognitive 20) mistralrs-quant/src/blockwise_fp8/mod.rs:800— BlockwiseFP8Linear::try_forward_fused_split_glu has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, match/switch 2 (3 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.
Nvfp4Layer::from_normalized_parts (cognitive 37) mistralrs-quant/src/nvfp4/mod.rs:94— Nvfp4Layer::from_normalized_parts has cognitive complexity 37 (threshold 15). Drivers by points: if/else 23 (28 pts), boolean chains 8, loops 1 (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.
Nvfp4Layer::load_shape (cognitive 33) mistralrs-quant/src/nvfp4/mod.rs:256— Nvfp4Layer::load_shape has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (21 pts), match/switch 4 (6 pts), boolean chains 5, loops 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Nvfp4Layer::reference_forward (cognitive 17) mistralrs-quant/src/nvfp4/mod.rs:596— Nvfp4Layer::reference_forward has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (8 pts), if/else 4 (7 pts), match/switch 2 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
Nvfp4Layer::gather_forward_raw (cognitive 17) mistralrs-quant/src/nvfp4/mod.rs:758— Nvfp4Layer::gather_forward_raw has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 6, match/switch 2 (3 pts), loops 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.
MultimodalPipeline::try_cuda_decode_graph_forward (cognitive 34) mistralrs-core/src/pipeline/multimodal.rs:2026— MultimodalPipeline::try_cuda_decode_graph_forward has cognitive complexity 34 (threshold 15). Drivers by points: if/else 23 (28 pts), boolean chains 6 (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.
MultimodalPipeline::precapture_cuda_decode_graphs_impl (cognitive 29) mistralrs-core/src/pipeline/multimodal.rs:2257— MultimodalPipeline::precapture_cuda_decode_graphs_impl has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (24 pts), loops 3, boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MultimodalPipeline::capture_cuda_decode_graph_step (cognitive 22) mistralrs-core/src/pipeline/multimodal.rs:2446— MultimodalPipeline::capture_cuda_decode_graph_step has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14, match/switch 3 (6 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MultimodalPipeline::forward_step (cognitive 17) mistralrs-core/src/pipeline/multimodal.rs:2810— MultimodalPipeline::forward_step has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities· Medium advisory (unsound) · ×4
Near-duplicate member pair (35 shared lines) mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:25— mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:25-122 | mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:164-291 — 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 (35 shared lines) mistralrs-quant/src/utils/ops.rs:44— mistralrs-quant/src/utils/ops.rs:44-93 | mistralrs-quant/src/utils/ops.rs:690-743 — 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 (35 shared lines) mistralrs-core/src/layers.rs:903— mistralrs-core/src/layers.rs:903-966 | mistralrs-core/src/layers.rs:2236-2290 — 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 (35 shared lines) mistralrs-quant/src/blockwise_fp8/deepgemm.rs:574— mistralrs-quant/src/blockwise_fp8/deepgemm.rs:574-668 | mistralrs-quant/src/blockwise_fp8/ops.rs:2023-2129 — 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 (29 shared lines) mistralrs-core/src/vision_models/gemma3/text.rs:182— mistralrs-core/src/vision_models/gemma3/text.rs:182-302 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:194-294 — These two members are variants of one another: 29 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (29 shared lines) mistralrs-core/src/vision_models/gemma3/text.rs:182— mistralrs-core/src/vision_models/gemma3/text.rs:182-302 | mistralrs-core/src/vision_models/qwen2vl/text.rs:195-295 — These two members are variants of one another: 29 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (29 shared lines) mistralrs-core/src/vision_models/gemma3/text.rs:182— mistralrs-core/src/vision_models/gemma3/text.rs:182-302 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:194-287 — These two members are variants of one another: 29 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (29 shared lines) mistralrs-core/src/vision_models/gemma3/text.rs:182— mistralrs-core/src/vision_models/gemma3/text.rs:182-302 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:300-390 — These two members are variants of one another: 29 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×4
Members sharing a duplicated core (7 members, 50+ identical tokens) mistralrs-core/src/models/flint.rs:471— mistralrs-core/src/models/flint.rs:471-505 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:219-252 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:42-76 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:46-79 | mistralrs-core/src/vision_models/qwen2vl/text.rs:47-80 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:34-67 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:40-74 — 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) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:414— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:414-458 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:570-614 | mistralrs-core/src/vision_models/qwen3_5/mod.rs:452-496 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:439-483 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:1037-1081 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:466-510 | mistralrs-core/src/vision_models/qwen4_exp/mod.rs:425-469 — 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) mistralrs-quant/src/cutile/fp8_gemm.rs:61— mistralrs-quant/src/cutile/fp8_gemm.rs:61-100 | mistralrs-quant/src/cutile/fp8_w8a16.rs:54-87 | mistralrs-quant/src/cutile/fp8_w8a16.rs:107-139 | mistralrs-quant/src/cutile/fp8_w8a16.rs:159-192 | mistralrs-quant/src/cutile/fp8_w8a16.rs:212-244 | mistralrs-quant/src/cutile/fp8_w8a8.rs:58-95 | mistralrs-quant/src/cutile/fp8_w8a8.rs:116-153 — 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) mistralrs-quant/src/cutile/fp8_gemm.rs:290— mistralrs-quant/src/cutile/fp8_gemm.rs:290-448 | mistralrs-quant/src/cutile/fp8_w8a16.rs:503-755 | mistralrs-quant/src/cutile/fp8_w8a8.rs:514-751 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:880-1033 | mistralrs-quant/src/cutile/nvfp4_gemv.rs:252-501 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1159-1372 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1382-1708 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×4
Members sharing a duplicated core (6 members, 50+ identical tokens) mistralrs-core/src/layers.rs:868— mistralrs-core/src/layers.rs:868-891 | mistralrs-core/src/layers.rs:2030-2049 | mistralrs-core/src/layers.rs:2204-2227 | mistralrs-core/src/layers.rs:3061-3080 | mistralrs-core/src/layers.rs:3194-3213 | mistralrs-core/src/vision_models/gemma4/text.rs:133-161 — 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) mistralrs-core/src/pipeline/diffusion.rs:132— mistralrs-core/src/pipeline/diffusion.rs:132-258 | mistralrs-core/src/pipeline/embedding.rs:232-732 | mistralrs-core/src/pipeline/gguf.rs:1318-1550 | mistralrs-core/src/pipeline/multimodal.rs:543-1635 | mistralrs-core/src/pipeline/normal.rs:671-1561 | mistralrs-core/src/pipeline/speech.rs:247-340 — 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) mistralrs-quant/src/bitsandbytes/op.rs:417— mistralrs-quant/src/bitsandbytes/op.rs:417-494 | mistralrs-quant/src/hqq/hqq_op.rs:68-106 | mistralrs-quant/src/hqq/hqq_op.rs:177-217 | mistralrs-quant/src/hqq/hqq_op.rs:290-330 | mistralrs-quant/src/hqq/hqq_op.rs:407-447 | mistralrs-quant/src/hqq/hqq_op.rs:526-566 — 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) mistralrs-quant/src/cutile/fused_moe.rs:59— mistralrs-quant/src/cutile/fused_moe.rs:59-415 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:73-448 | mistralrs-quant/src/cutile/gdn_prefill.rs:233-434 | mistralrs-quant/src/cutile/qsa.rs:48-257 | mistralrs-quant/src/cutile/qsa.rs:280-544 | mistralrs-quant/src/cutile/routed_lora.rs:99-489 — 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.
Duplicated block (43–44 lines × 2) mistralrs-core/src/models/qwen3_next.rs:195— mistralrs-core/src/models/qwen3_next.rs:195-238 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:100-142 — before extracting anything, compare `mistralrs-core/src/models/qwen3_next.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/text.rs` as WHOLE FILES: this scan already matched 29 separate duplicated blocks between them, totalling at least 433 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 (43–44 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:2873— mistralrs-core/src/pipeline/multimodal.rs:2873-2915 | mistralrs-core/src/pipeline/normal.rs:2563-2606 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (43–44 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:292— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:292-335 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:449-491 — `mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 21 separate duplicated blocks between them, totalling at least 374 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 (43–44 lines × 2) scripts/production_soak.py:13670— scripts/production_soak.py:13670-13712 | scripts/production_soak.py:13828-13871 — both copies are in the same file, so extract the 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, `scripts/production_soak.py:13714` calls `ValueError` and `scripts/production_soak.py:13872` 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 (27 lines × 3) mistralrs-core/src/models/qwen3_next.rs:1144— mistralrs-core/src/models/qwen3_next.rs:1144-1170 | mistralrs-core/src/vision_models/qwen3_5/text.rs:1844-1870 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:960-986 — before extracting anything, compare `mistralrs-core/src/models/qwen3_next.rs` and `mistralrs-core/src/vision_models/qwen3_5/text.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 158 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 (27 lines × 3) mistralrs-core/src/pipeline/embedding.rs:442— mistralrs-core/src/pipeline/embedding.rs:442-468 | mistralrs-core/src/pipeline/multimodal.rs:983-1009 | mistralrs-core/src/pipeline/normal.rs:980-1006 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (27 lines × 3) REDACTED:271— REDACTED:271-297 | mistralrs-core/src/vision_models/idefics3/vision.rs:83-109 | mistralrs-core/src/vision_models/siglip.rs:74-100 — before extracting anything, compare `REDACTED` and `mistralrs-core/src/vision_models/idefics3/vision.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 213 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 (27 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:562— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:562-588 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1170-1196 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1234-1260 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (20 lines × 4) mistralrs-cli/src/ui/handlers/api.rs:182— mistralrs-cli/src/ui/handlers/api.rs:182-201 | mistralrs-cli/src/ui/handlers/api.rs:234-253 | mistralrs-cli/src/ui/handlers/api.rs:286-305 | mistralrs-cli/src/ui/handlers/api.rs:338-357 — 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 (20 lines × 4) mistralrs-core/src/embedding_models/embedding_gemma.rs:294— mistralrs-core/src/embedding_models/embedding_gemma.rs:294-313 | mistralrs-core/src/models/gemma2.rs:339-358 | mistralrs-core/src/vision_models/gemma3/text.rs:347-366 | mistralrs-core/src/xlora_models/gemma2.rs:356-375 — before extracting anything, compare `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 156 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 (20 lines × 4) mistralrs-core/src/models/deepseek2.rs:719— mistralrs-core/src/models/deepseek2.rs:719-738 | mistralrs-core/src/models/deepseek3.rs:782-801 | mistralrs-core/src/models/glm4_moe.rs:619-638 | mistralrs-core/src/models/glm4_moe_lite.rs:728-747 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (20 lines × 4) mistralrs-core/src/models/phi2.rs:708— mistralrs-core/src/models/phi2.rs:708-727 | mistralrs-core/src/models/phi3.rs:703-722 | mistralrs-core/src/models/starcoder2.rs:699-718 | mistralrs-core/src/vision_models/phi3/mod.rs:1539-1558 — before extracting anything, compare `mistralrs-core/src/models/phi2.rs` and `mistralrs-core/src/models/phi3.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 207 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17–18 lines × 2) mistralrs-core/src/models/llama.rs:403— mistralrs-core/src/models/llama.rs:403-420 | mistralrs-core/src/models/smollm3.rs:419-435 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17–18 lines × 2) mistralrs-core/src/models/qwen3_next.rs:677— mistralrs-core/src/models/qwen3_next.rs:677-693 | mistralrs-core/src/vision_models/qwen3_5/packed_gdn.rs:158-175 — before extracting anything, compare `mistralrs-core/src/models/qwen3_next.rs` and `mistralrs-core/src/vision_models/qwen3_5/packed_gdn.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 64 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 (17–18 lines × 2) mistralrs-core/src/moe/experts/backends.rs:1582— mistralrs-core/src/moe/experts/backends.rs:1582-1599 | mistralrs-core/src/moe/experts/backends.rs:1754-1770 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–18 lines × 2) mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1235— mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1235-1252 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:297-313 — `mistralrs-core/src/vision_models/gemma4/inputs_processor.rs` and `mistralrs-core/src/vision_models/mistral3/inputs_processor.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 8 separate duplicated blocks between them, totalling at least 121 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 (16 lines × 6) mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:379— mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:379-394 | mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1586-1601 | mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:483-498 | mistralrs-core/src/vision_models/lfm2_vl/inputs_processor.rs:735-750 | mistralrs-core/src/vision_models/llama4/inputs_processor.rs:461-476 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:388-403 — before extracting anything, compare `mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs` and `mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 98 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 × 6) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:188— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:188-203 | mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:478-493 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:754-769 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1086-1101 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:849-864 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1146-1161 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (16 lines × 6) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:205— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:205-220 | mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:495-510 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:771-786 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1103-1118 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:866-881 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1163-1178 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (16 lines × 6) mistralrs-core/src/xlora_models/gemma.rs:426— mistralrs-core/src/xlora_models/gemma.rs:426-441 | mistralrs-core/src/xlora_models/gemma2.rs:457-472 | mistralrs-core/src/xlora_models/mistral.rs:422-437 | mistralrs-core/src/xlora_models/mixtral.rs:552-567 | mistralrs-core/src/xlora_models/phi3.rs:389-404 | mistralrs-core/src/xlora_models/starcoder2.rs:411-426 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–15 lines × 2) mistralrs-core/src/models/deepseek2.rs:1005— mistralrs-core/src/models/deepseek2.rs:1005-1017 | mistralrs-core/src/models/deepseek3.rs:1067-1081 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–15 lines × 2) mistralrs-core/src/vision_models/gemma3n/audio.rs:545— mistralrs-core/src/vision_models/gemma3n/audio.rs:545-559 | mistralrs-core/src/vision_models/gemma4/audio.rs:612-624 — `mistralrs-core/src/vision_models/gemma3n/audio.rs` and `mistralrs-core/src/vision_models/gemma4/audio.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 16 separate duplicated blocks between them, totalling at least 279 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 (13–15 lines × 2) mistralrs-paged-attn/src/metal/backend/gather_kv.rs:93— mistralrs-paged-attn/src/metal/backend/gather_kv.rs:93-105 | mistralrs-paged-attn/src/metal/backend/paged_attention.rs:803-817 — before extracting anything, compare `mistralrs-paged-attn/src/metal/backend/gather_kv.rs` and `mistralrs-paged-attn/src/metal/backend/paged_attention.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 (13–15 lines × 2) mistralrs-quant/src/cutile/fused_moe.rs:536— mistralrs-quant/src/cutile/fused_moe.rs:536-550 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:977-989 — before extracting anything, compare `mistralrs-quant/src/cutile/fused_moe.rs` and `mistralrs-quant/src/cutile/fused_moe_fp8.rs` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 308 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 5) mistralrs-core/src/embedding_models/qwen3_embedding.rs:366— mistralrs-core/src/embedding_models/qwen3_embedding.rs:366-379 | mistralrs-core/src/models/glm4.rs:480-493 | mistralrs-core/src/models/hunyuan_v1_dense.rs:445-458 | mistralrs-core/src/models/hunyuan_v1_moe.rs:939-952 | mistralrs-core/src/models/qwen3.rs:439-452 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 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 (14 lines × 5) mistralrs-core/src/models/deepseek2.rs:886— mistralrs-core/src/models/deepseek2.rs:886-899 | mistralrs-core/src/models/deepseek3.rs:949-962 | mistralrs-core/src/models/glm4_moe.rs:785-798 | mistralrs-core/src/models/glm4_moe_lite.rs:896-909 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:565-578 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 5) mistralrs-core/src/xlora_models/gemma.rs:491— mistralrs-core/src/xlora_models/gemma.rs:491-504 | mistralrs-core/src/xlora_models/gemma2.rs:521-534 | mistralrs-core/src/xlora_models/mistral.rs:487-500 | mistralrs-core/src/xlora_models/mixtral.rs:618-631 | mistralrs-core/src/xlora_models/starcoder2.rs:475-488 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 5) mistralrs-core/src/xlora_models/gemma.rs:604— mistralrs-core/src/xlora_models/gemma.rs:604-617 | mistralrs-core/src/xlora_models/mistral.rs:600-613 | mistralrs-core/src/xlora_models/mixtral.rs:730-743 | mistralrs-core/src/xlora_models/phi3.rs:553-566 | mistralrs-core/src/xlora_models/starcoder2.rs:585-598 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/mistral.rs` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–14 lines × 2) mistralrs-core/src/engine/add_request.rs:704— mistralrs-core/src/engine/add_request.rs:704-715 | mistralrs-core/src/engine/add_request.rs:720-733 — both copies are in the same file, so extract the block into 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–14 lines × 2) mistralrs-paged-attn/src/metal/kernels/mod.rs:531— mistralrs-paged-attn/src/metal/kernels/mod.rs:531-542 | mistralrs-paged-attn/src/metal/kernels/mod.rs:671-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 (12–14 lines × 2) mistralrs-quant/src/distributed/layers.rs:915— mistralrs-quant/src/distributed/layers.rs:915-926 | mistralrs-quant/src/distributed/layers.rs:1010-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 (12–14 lines × 2) mistralrs-quant/src/distributed/layers.rs:1381— mistralrs-quant/src/distributed/layers.rs:1381-1394 | mistralrs-quant/src/distributed/layers.rs:1501-1512 — both copies are in the same file, so extract the block into 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 × 12) mistralrs-core/src/models/flint.rs:788— mistralrs-core/src/models/flint.rs:788-796 | mistralrs-core/src/models/glm4.rs:450-458 | mistralrs-core/src/models/granite.rs:1958-1966 | mistralrs-core/src/models/hunyuan_v1_dense.rs:419-427 | mistralrs-core/src/models/hunyuan_v1_moe.rs:913-921 | mistralrs-core/src/models/llama.rs:356-364 | mistralrs-core/src/models/mistral.rs:425-433 | mistralrs-core/src/models/qwen3.rs:413-421 | mistralrs-core/src/models/qwen3_moe.rs:587-595 | mistralrs-core/src/models/qwen3_next.rs:752-760 | mistralrs-core/src/models/smollm3.rs:372-380 | mistralrs-core/src/vision_models/llama4/text.rs:805-813 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 12) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1404— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1404-1412 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1711-1719 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2011-2019 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2427-2435 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3139-3147 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3481-3489 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4998-5006 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5429-5437 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:799-807 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1243-1251 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1487-1495 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5780-5788 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 12) mistralrs-quant/src/cutile/fused_moe.rs:82— mistralrs-quant/src/cutile/fused_moe.rs:82-90 | mistralrs-quant/src/cutile/fused_moe.rs:123-131 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:95-103 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:134-142 | mistralrs-quant/src/cutile/gdn_prefill.rs:267-275 | mistralrs-quant/src/cutile/qsa.rs:65-73 | mistralrs-quant/src/cutile/qsa.rs:76-84 | mistralrs-quant/src/cutile/qsa.rs:87-95 | mistralrs-quant/src/cutile/qsa.rs:98-106 | mistralrs-quant/src/cutile/qsa.rs:293-301 | mistralrs-quant/src/cutile/qsa.rs:304-312 | mistralrs-quant/src/cutile/qsa.rs:361-369 — before extracting anything, compare `mistralrs-quant/src/cutile/fused_moe.rs` and `mistralrs-quant/src/cutile/fused_moe_fp8.rs` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 308 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 12) mistralrs-quant/src/metal_kernels/mod.rs:207— mistralrs-quant/src/metal_kernels/mod.rs:207-215 | mistralrs-quant/src/metal_kernels/mod.rs:246-254 | mistralrs-quant/src/metal_kernels/mod.rs:285-293 | mistralrs-quant/src/metal_kernels/mod.rs:324-332 | mistralrs-quant/src/metal_kernels/mod.rs:363-371 | mistralrs-quant/src/metal_kernels/mod.rs:616-624 | mistralrs-quant/src/metal_kernels/mod.rs:663-671 | mistralrs-quant/src/metal_kernels/mod.rs:710-718 | mistralrs-quant/src/metal_kernels/mod.rs:1948-1956 | mistralrs-quant/src/metal_kernels/mod.rs:4859-4867 | mistralrs-quant/src/metal_kernels/mod.rs:4930-4938 | mistralrs-quant/src/metal_kernels/mod.rs:4972-4980 — all 12 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7–8 lines × 2) mistralrs-core/src/cuda/dflash_context.rs:165— mistralrs-core/src/cuda/dflash_context.rs:165-172 | mistralrs-core/src/cuda/dflash_context.rs:294-300 — both copies are in the same file, so extract the block into 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–8 lines × 2) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:503— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:503-509 | mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:523-530 — `mistralrs-core/src/vision_models/gemma3/inputs_processor.rs` and `mistralrs-core/src/vision_models/idefics3/inputs_processor.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 9 separate duplicated blocks between them, totalling at least 138 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 (7–8 lines × 2) mistralrs-mcp/src/client.rs:441— mistralrs-mcp/src/client.rs:441-448 | mistralrs-mcp/src/client.rs:595-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.
Duplicated block (7–8 lines × 2) mistralrs-server-core/src/openai.rs:139— mistralrs-server-core/src/openai.rs:139-146 | mistralrs-server-core/src/openai.rs:158-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
TextModel::forward_embeds_scaled (cyclomatic 39) mistralrs-core/src/vision_models/gemma4/text.rs:2103— TextModel::forward_embeds_scaled has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TextModel::forward_embeds (cyclomatic 22) mistralrs-core/src/vision_models/gemma3/text.rs:596— TextModel::forward_embeds has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
TextModel::new (cyclomatic 17) mistralrs-core/src/vision_models/gemma4/text.rs:1618— TextModel::new 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.
Runner::new (cyclomatic 35) mistralrs-pyo3/src/lib.rs:976— Runner::new has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Runner::send_chat_completion_request (cyclomatic 30) mistralrs-pyo3/src/lib.rs:1288— Runner::send_chat_completion_request has cyclomatic complexity 30 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This shape REPEATS in the file: one other method here (Runner::send_chat_completion_request_to_model) 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.
Runner::send_chat_completion_request_to_model (cyclomatic 30) mistralrs-pyo3/src/lib.rs:2249— Runner::send_chat_completion_request_to_model has cyclomatic complexity 30 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This shape REPEATS in the file: one other method here (Runner::send_chat_completion_request) 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.
Model::prepare_inputs_labels_for_multimodal (cyclomatic 32) mistralrs-core/src/vision_models/llava/llava_next.rs:224— Model::prepare_inputs_labels_for_multimodal has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Model::forward (cyclomatic 18) mistralrs-core/src/models/qwen3_next.rs:968— Model::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.
Model::forward_embeds (cyclomatic 16) mistralrs-core/src/models/lfm2.rs:1171— Model::forward_embeds 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.
Nvfp4Layer::from_normalized_parts (cyclomatic 31) mistralrs-quant/src/nvfp4/mod.rs:94— Nvfp4Layer::from_normalized_parts 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.
Nvfp4Layer::load_shape (cyclomatic 23) mistralrs-quant/src/nvfp4/mod.rs:256— Nvfp4Layer::load_shape has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Nvfp4Layer::gather_forward_raw (cyclomatic 18) mistralrs-quant/src/nvfp4/mod.rs:758— Nvfp4Layer::gather_forward_raw 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.
TextConfig::validate (cyclomatic 26) mistralrs-core/src/vision_models/qwen3_5_moe/config.rs:71— TextConfig::validate has cyclomatic complexity 26 (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.
TextConfig::validate (cyclomatic 24) mistralrs-core/src/vision_models/qwen3_5/config.rs:266— TextConfig::validate has cyclomatic complexity 24 (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.
TextConfig::validate (cyclomatic 21) mistralrs-core/src/vision_models/qwen4_exp/config.rs:185— TextConfig::validate 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.
BlockwiseFP8Linear::forward_raw (cyclomatic 24) mistralrs-quant/src/blockwise_fp8/mod.rs:308— BlockwiseFP8Linear::forward_raw 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.
BlockwiseFP8Linear::apply_isq (cyclomatic 24) mistralrs-quant/src/blockwise_fp8/mod.rs:940— BlockwiseFP8Linear::apply_isq 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.
BlockwiseFP8Linear::try_forward_fused_split_glu (cyclomatic 16) mistralrs-quant/src/blockwise_fp8/mod.rs:800— BlockwiseFP8Linear::try_forward_fused_split_glu 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.
ImageEmbedding::forward (cognitive 136) mistralrs-core/src/vision_models/phi3/mod.rs:697— ImageEmbedding::forward has cognitive complexity 136 (threshold 15). Drivers by points: if/else 37 (96 pts), loops 8 (26 pts), match/switch 4 (8 pts), boolean chains 6 (nesting depth added 81). 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.
ImageEmbedding::forward (cognitive 74) mistralrs-core/src/vision_models/phi4/image_embedding.rs:465— ImageEmbedding::forward has cognitive complexity 74 (threshold 15). Drivers by points: if/else 16 (44 pts), loops 3 (15 pts), match/switch 3 (13 pts), boolean chains 2 (nesting depth added 50). 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.
ImageEmbedding::new (cognitive 17) mistralrs-core/src/vision_models/phi4/image_embedding.rs:124— ImageEmbedding::new has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PagedAttentionScheduler::schedule (cognitive 113) mistralrs-core/src/paged_attention/scheduler.rs:921— PagedAttentionScheduler::schedule has cognitive complexity 113 (threshold 15). Drivers by points: if/else 41 (88 pts), loops 7 (12 pts), boolean chains 8, match/switch 2 (5 pts) (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PagedAttentionScheduler::select_prompt_batch (cognitive 28) mistralrs-core/src/paged_attention/scheduler.rs:318— PagedAttentionScheduler::select_prompt_batch has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 12, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
PagedAttentionScheduler::bucket_and_preempt_sequences (cognitive 18) mistralrs-core/src/paged_attention/scheduler.rs:777— PagedAttentionScheduler::bucket_and_preempt_sequences has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 3, boolean chains 2, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Runner::send_chat_completion_request (cognitive 82) mistralrs-pyo3/src/lib.rs:1288— Runner::send_chat_completion_request has cognitive complexity 82 (threshold 15). Drivers by points: match/switch 10 (32 pts), loops 9 (29 pts), if/else 9 (20 pts), boolean chains 1 (nesting depth added 53). To reduce it, split the body into named stages: move each independent 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 (Runner::send_chat_completion_request_to_model) 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.
Runner::send_chat_completion_request_to_model (cognitive 82) mistralrs-pyo3/src/lib.rs:2249— Runner::send_chat_completion_request_to_model has cognitive complexity 82 (threshold 15). Drivers by points: match/switch 10 (32 pts), loops 9 (29 pts), if/else 9 (20 pts), boolean chains 1 (nesting depth added 53). To reduce it, split the body into named stages: move each independent 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 (Runner::send_chat_completion_request) 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.
Runner::new (cognitive 58) mistralrs-pyo3/src/lib.rs:976— Runner::new has cognitive complexity 58 (threshold 15). Drivers by points: if/else 25 (34 pts), loops 3 (9 pts), boolean chains 8, match/switch 6 (7 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Idefics3ImageProcessor::process_inputs (cognitive 64) mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:422— Idefics3ImageProcessor::process_inputs has cognitive complexity 64 (threshold 15). Drivers by points: if/else 31 (57 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Idefics3ImageProcessor::preprocess (cognitive 20) mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:890— Idefics3ImageProcessor::preprocess has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 5 (7 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Idefics3ImageProcessor::planned_image_grids (cognitive 17) mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:274— Idefics3ImageProcessor::planned_image_grids has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AudioProcessor::extract_spectrogram (cognitive 32) mistralrs-core/src/vision_models/gemma4/audio_processing.rs:237— AudioProcessor::extract_spectrogram has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 5 (14 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AudioProcessor::normalize_mel_spectrogram (cognitive 21) mistralrs-core/src/vision_models/gemma3n/audio_processing.rs:313— AudioProcessor::normalize_mel_spectrogram has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (10 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AudioProcessor::create_mel_filterbank (cognitive 18) mistralrs-core/src/vision_models/gemma3n/audio_processing.rs:258— AudioProcessor::create_mel_filterbank has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NormalCacheManager::set_none_cache (cognitive 27) mistralrs-core/src/kv_cache/mod.rs:731— NormalCacheManager::set_none_cache has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 4 (6 pts), match/switch 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NormalCacheManager::clone_in_cache (cognitive 25) mistralrs-core/src/kv_cache/mod.rs:486— NormalCacheManager::clone_in_cache has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 3 (5 pts), loops 3 (4 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.
NormalCacheManager::clone_out_cache (cognitive 24) mistralrs-core/src/kv_cache/mod.rs:634— NormalCacheManager::clone_out_cache has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (6 pts), match/switch 2 (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.
TextConfig::validate (cognitive 26) mistralrs-core/src/vision_models/qwen3_5_moe/config.rs:71— TextConfig::validate has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 10 (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.
TextConfig::validate (cognitive 24) mistralrs-core/src/vision_models/qwen3_5/config.rs:266— TextConfig::validate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 9 (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.
TextConfig::validate (cognitive 22) mistralrs-core/src/vision_models/qwen4_exp/config.rs:185— TextConfig::validate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 7 (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.
NormalPipeline::try_cuda_decode_graph_forward (cognitive 23) mistralrs-core/src/pipeline/normal.rs:1854— NormalPipeline::try_cuda_decode_graph_forward has cognitive complexity 23 (threshold 15). Drivers by points: if/else 19 (20 pts), boolean chains 3 (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.
NormalPipeline::forward_step (cognitive 19) mistralrs-core/src/pipeline/normal.rs:2508— NormalPipeline::forward_step has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 3 (5 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.
NormalPipeline::precapture_cuda_decode_graphs_impl (cognitive 18) mistralrs-core/src/pipeline/normal.rs:2056— NormalPipeline::precapture_cuda_decode_graphs_impl has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Near-duplicate member family (5 members, 27 shared lines) · ×3
Near-duplicate member family (5 members, 27 shared lines) mistralrs-core/src/models/gemma.rs:346— mistralrs-core/src/models/gemma.rs:346-456 | mistralrs-core/src/models/gemma2.rs:419-532 | mistralrs-core/src/models/phi2.rs:430-540 | mistralrs-core/src/models/phi3_5_moe.rs:479-605 | mistralrs-core/src/models/starcoder2.rs:404-521 — These 5 members are variants of one another: a block of 27 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Near-duplicate member family (5 members, 27 shared lines) mistralrs-core/src/xlora_models/gemma.rs:576— mistralrs-core/src/xlora_models/gemma.rs:576-617 | mistralrs-core/src/xlora_models/mistral.rs:570-613 | mistralrs-core/src/xlora_models/mixtral.rs:700-743 | mistralrs-core/src/xlora_models/phi3.rs:521-566 | mistralrs-core/src/xlora_models/starcoder2.rs:553-598 — These 5 members are variants of one another: a block of 27 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Near-duplicate member family (5 members, 27 shared lines) mistralrs-core/src/xlora_models/gemma.rs:576— mistralrs-core/src/xlora_models/gemma.rs:576-617 | mistralrs-core/src/xlora_models/mistral.rs:570-613 | mistralrs-core/src/xlora_models/mixtral.rs:700-743 | mistralrs-core/src/xlora_models/phi2.rs:543-583 | mistralrs-core/src/xlora_models/starcoder2.rs:553-598 — These 5 members are variants of one another: a block of 27 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, 24 shared lines) · ×3
Near-duplicate member family (4 members, 24 shared lines) mistralrs-core/src/embedding_models/embedding_gemma.rs:274— mistralrs-core/src/embedding_models/embedding_gemma.rs:274-320 | mistralrs-core/src/models/gemma2.rs:320-365 | mistralrs-core/src/vision_models/gemma3/text.rs:326-373 | mistralrs-core/src/xlora_models/gemma2.rs:330-382 — 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.
Near-duplicate member family (4 members, 24 shared lines) mistralrs-core/src/models/mixtral.rs:405— mistralrs-core/src/models/mixtral.rs:405-520 | mistralrs-core/src/vision_models/phi3/mod.rs:1209-1317 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:391-500 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:511-621 — 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.
Near-duplicate member family (4 members, 24 shared lines) mistralrs-quant/src/cutile/nvfp4_matmul.rs:111— mistralrs-quant/src/cutile/nvfp4_matmul.rs:111-166 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:264-319 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:515-612 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:809-906 — 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· Members sharing a duplicated core (11 members, 50+ identical tokens) · ×3
Members sharing a duplicated core (11 members, 50+ identical tokens) mistralrs-core/src/cuda/dflash_context.rs:263— mistralrs-core/src/cuda/dflash_context.rs:263-379 | mistralrs-core/src/cuda/speculative_rejection.rs:474-630 | mistralrs-core/src/ops.rs:1037-1263 | mistralrs-core/src/ops.rs:1279-1470 | mistralrs-core/src/ops.rs:1491-1699 | mistralrs-core/src/ops.rs:1704-1994 | mistralrs-core/src/ops.rs:4113-4179 | mistralrs-core/src/ops.rs:4264-4384 | mistralrs-core/src/ops.rs:5588-5890 | mistralrs-core/src/ops.rs:6017-6335 | mistralrs-core/src/ops.rs:6353-6653 — These 11 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 11 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 11 times.
Members sharing a duplicated core (11 members, 50+ identical tokens) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:396— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:396-690 | mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1039-1699 | mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:436-712 | mistralrs-core/src/vision_models/llama4/inputs_processor.rs:406-613 | mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:287-630 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:323-648 | mistralrs-core/src/vision_models/minicpmo/inputs_processor.rs:311-585 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:268-481 | mistralrs-core/src/vision_models/mllama/inputs_processor.rs:334-663 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:296-567 | mistralrs-core/src/vision_models/voxtral/inputs_processor.rs:209-363 — These 11 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 11 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 11 times.
Members sharing a duplicated core (11 members, 50+ identical tokens) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:396— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:396-690 | mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:323-458 | mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:423-670 | mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:436-712 | mistralrs-core/src/vision_models/llama4/inputs_processor.rs:406-613 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:268-481 | mistralrs-core/src/vision_models/mllama/inputs_processor.rs:334-663 | mistralrs-core/src/vision_models/muse_glimmer/inputs_processor.rs:918-1102 | mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:366-973 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:932-1538 | mistralrs-core/src/vision_models/voxtral/inputs_processor.rs:209-363 — These 11 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 11 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 11 times.
Duplicated block (54 lines × 2) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2993— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2993-3046 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3326-3379 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (54 lines × 2) REDACTED:1181— REDACTED:1181-1234 | REDACTED:146-199 — `REDACTED` and `REDACTED` 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 87 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 (54 lines × 2) mistralrs-core/src/xlora_models/mistral.rs:151— mistralrs-core/src/xlora_models/mistral.rs:151-204 | mistralrs-core/src/xlora_models/mixtral.rs:64-117 — before extracting anything, compare `mistralrs-core/src/xlora_models/mistral.rs` and `mistralrs-core/src/xlora_models/mixtral.rs` as WHOLE FILES: this scan already matched 52 separate duplicated blocks between them, totalling at least 769 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (43 lines × 2) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4573— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4573-4615 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4890-4932 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (43 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:951— mistralrs-core/src/pipeline/multimodal.rs:951-993 | mistralrs-core/src/pipeline/normal.rs:948-990 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (43 lines × 2) mistralrs-quant/src/metal_kernels/mod.rs:1717— mistralrs-quant/src/metal_kernels/mod.rs:1717-1759 | mistralrs-quant/src/metal_kernels/mod.rs:1782-1824 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (39 lines × 2) mistralrs-core/src/models/phi3.rs:426— mistralrs-core/src/models/phi3.rs:426-464 | mistralrs-core/src/models/phi3_5_moe.rs:495-533 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/models/phi3_5_moe.rs` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 312 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (39 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:823— mistralrs-core/src/pipeline/multimodal.rs:823-861 | mistralrs-core/src/pipeline/normal.rs:823-861 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (39 lines × 2) mistralrs-core/src/vision_models/qwen3_5/text.rs:980— mistralrs-core/src/vision_models/qwen3_5/text.rs:980-1018 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:681-719 — `mistralrs-core/src/vision_models/qwen3_5/text.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 26 separate duplicated blocks between them, totalling at least 428 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 (31 lines × 2) mistralrs-core/src/models/deepseek2.rs:555— mistralrs-core/src/models/deepseek2.rs:555-585 | mistralrs-core/src/models/deepseek3.rs:605-635 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (31 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:98— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:98-128 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:121-151 — `mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 21 separate duplicated blocks between them, totalling at least 374 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 (31 lines × 2) mistralrs-flash-attn/src/flash.rs:100— mistralrs-flash-attn/src/flash.rs:100-130 | mistralrs-flash-attn/src/flash.rs:667-697 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29–30 lines × 2) mistralrs-core/src/sampler.rs:1513— mistralrs-core/src/sampler.rs:1513-1542 | mistralrs-core/src/sampler.rs:1681-1709 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29–30 lines × 2) mistralrs-pyo3/src/lib.rs:1104— mistralrs-pyo3/src/lib.rs:1104-1133 | mistralrs-server-core/src/mistralrs_for_server_builder.rs:1366-1394 — 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 (29–30 lines × 2) mistralrs-quant/src/cutile/fused_moe.rs:164— mistralrs-quant/src/cutile/fused_moe.rs:164-193 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:169-197 — before extracting anything, compare `mistralrs-quant/src/cutile/fused_moe.rs` and `mistralrs-quant/src/cutile/fused_moe_fp8.rs` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 308 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (23 lines × 3) mistralrs-cli/src/commands/run/interactive.rs:526— mistralrs-cli/src/commands/run/interactive.rs:526-548 | mistralrs-cli/src/commands/run/interactive.rs:1018-1040 | mistralrs-cli/src/commands/run/interactive.rs:1804-1826 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (23 lines × 3) mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:363— mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:363-385 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:349-371 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:318-340 — before extracting anything, compare `mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs` and `mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 206 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (23 lines × 3) mistralrs-quant/src/metal_kernels/mod.rs:623— mistralrs-quant/src/metal_kernels/mod.rs:623-645 | mistralrs-quant/src/metal_kernels/mod.rs:670-692 | mistralrs-quant/src/metal_kernels/mod.rs:717-739 — 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 (20 lines × 6) mistralrs-core/src/models/deepseek2.rs:980— mistralrs-core/src/models/deepseek2.rs:980-999 | mistralrs-core/src/models/deepseek2.rs:1020-1039 | mistralrs-core/src/models/deepseek3.rs:1043-1062 | mistralrs-core/src/models/deepseek3.rs:1084-1103 | mistralrs-core/src/models/glm4_moe_lite.rs:995-1014 | mistralrs-core/src/models/glm4_moe_lite.rs:1038-1057 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (20 lines × 6) mistralrs-core/src/models/mistral.rs:162— mistralrs-core/src/models/mistral.rs:162-181 | mistralrs-core/src/models/mixtral.rs:108-127 | mistralrs-core/src/models/qwen2.rs:196-215 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:182-201 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:153-172 | mistralrs-core/src/vision_models/qwen2vl/text.rs:154-173 — before extracting anything, compare `mistralrs-core/src/models/mistral.rs` and `mistralrs-core/src/models/mixtral.rs` as WHOLE FILES: this scan already matched 43 separate duplicated blocks between them, totalling at least 564 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (20 lines × 6) mistralrs-quant/src/cutile/nvfp4_glu.rs:123— mistralrs-quant/src/cutile/nvfp4_glu.rs:123-142 | mistralrs-quant/src/cutile/nvfp4_glu.rs:280-299 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:35-54 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:188-207 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:399-418 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:693-712 — before extracting anything, compare `mistralrs-quant/src/cutile/nvfp4_glu.rs` and `mistralrs-quant/src/cutile/nvfp4_matmul.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 103 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17–18 lines × 3) mistralrs-core/src/models/flint.rs:705— mistralrs-core/src/models/flint.rs:705-721 | mistralrs-core/src/models/qwen3_moe.rs:487-503 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:435-452 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/qwen3_moe.rs` as WHOLE FILES: this scan already matched 43 separate duplicated blocks between them, totalling at least 470 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17–18 lines × 3) mistralrs-core/src/xlora_models/gemma.rs:193— mistralrs-core/src/xlora_models/gemma.rs:193-210 | mistralrs-core/src/xlora_models/mistral.rs:183-199 | mistralrs-core/src/xlora_models/mixtral.rs:96-112 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/mistral.rs` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17–18 lines × 3) mistralrs-pyo3/src/util.rs:203— mistralrs-pyo3/src/util.rs:203-219 | mistralrs-pyo3/src/util.rs:257-274 | mistralrs-pyo3/src/util.rs:317-334 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17 lines × 6) mistralrs-core/src/embedding_models/qwen3_embedding.rs:242— mistralrs-core/src/embedding_models/qwen3_embedding.rs:242-258 | mistralrs-core/src/models/llama.rs:276-292 | mistralrs-core/src/models/mistral.rs:323-339 | mistralrs-core/src/models/qwen2.rs:355-371 | mistralrs-core/src/models/qwen3.rs:311-327 | mistralrs-core/src/models/smollm3.rs:292-308 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/llama.rs` as WHOLE FILES: this scan already matched 5 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. 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 (17 lines × 6) mistralrs-paged-attn/src/cuda/backend/mla.rs:455— mistralrs-paged-attn/src/cuda/backend/mla.rs:455-471 | mistralrs-paged-attn/src/cuda/backend/mla.rs:514-530 | mistralrs-paged-attn/src/cuda/backend/mla.rs:573-589 | mistralrs-paged-attn/src/cuda/backend/mla.rs:772-788 | mistralrs-paged-attn/src/cuda/backend/mla.rs:810-826 | mistralrs-paged-attn/src/cuda/backend/mla.rs:848-864 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17 lines × 6) mistralrs-quant/src/afq/ops.rs:2631— mistralrs-quant/src/afq/ops.rs:2631-2647 | mistralrs-quant/src/afq/ops.rs:2779-2795 | mistralrs-quant/src/afq/ops.rs:2927-2943 | mistralrs-quant/src/afq/ops.rs:3190-3206 | mistralrs-quant/src/afq/ops.rs:3370-3386 | mistralrs-quant/src/afq/ops.rs:3553-3569 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17 lines × 4) mistralrs-core/src/models/qwen3_moe.rs:405— mistralrs-core/src/models/qwen3_moe.rs:405-421 | mistralrs-core/src/models/qwen3_next.rs:476-492 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:380-396 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:144-160 — before extracting anything, compare `mistralrs-core/src/models/qwen3_moe.rs` and `mistralrs-core/src/models/qwen3_next.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/pipeline/multimodal.rs:3233— mistralrs-core/src/pipeline/multimodal.rs:3233-3249 | mistralrs-core/src/pipeline/multimodal.rs:3282-3298 | mistralrs-core/src/pipeline/normal.rs:2833-2849 | mistralrs-core/src/pipeline/normal.rs:2882-2898 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:240— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:240-256 | mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:282-298 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:397-413 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:439-455 — `mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 21 separate duplicated blocks between them, totalling at least 374 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 (16–17 lines × 3) mistralrs-core/src/tools/parsers/gemma4.rs:295— mistralrs-core/src/tools/parsers/gemma4.rs:295-310 | mistralrs-core/src/tools/parsers/gemma4.rs:336-351 | mistralrs-core/src/tools/parsers/gemma4.rs:372-388 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16–17 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:779— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:779-794 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1344-1359 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1457-1473 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (16–17 lines × 3) mistralrs-core/src/xlora_models/gemma.rs:526— mistralrs-core/src/xlora_models/gemma.rs:526-542 | mistralrs-core/src/xlora_models/gemma2.rs:556-572 | mistralrs-core/src/xlora_models/starcoder2.rs:504-519 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–17 lines × 2) mistralrs-core/src/models/granite.rs:1104— mistralrs-core/src/models/granite.rs:1104-1115 | mistralrs-core/src/models/granite.rs:1138-1154 — both copies are in the same file, so extract the block into 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–17 lines × 2) mistralrs-core/src/moe/experts/backends.rs:1558— mistralrs-core/src/moe/experts/backends.rs:1558-1569 | mistralrs-core/src/moe/experts/backends.rs:1656-1672 — both copies are in the same file, so extract the block into 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–17 lines × 2) mistralrs-core/src/vision_models/gemma3n/audio.rs:749— mistralrs-core/src/vision_models/gemma3n/audio.rs:749-765 | mistralrs-core/src/vision_models/gemma4/audio.rs:757-768 — `mistralrs-core/src/vision_models/gemma3n/audio.rs` and `mistralrs-core/src/vision_models/gemma4/audio.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 16 separate duplicated blocks between them, totalling at least 279 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 (16 lines × 5) mistralrs-core/src/models/gemma.rs:143— mistralrs-core/src/models/gemma.rs:143-158 | mistralrs-core/src/models/glm4_moe.rs:248-263 | mistralrs-core/src/models/hunyuan_v1_dense.rs:167-182 | mistralrs-core/src/models/hunyuan_v1_moe.rs:350-365 | mistralrs-core/src/models/lfm2.rs:457-472 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/glm4_moe.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 203 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 5) mistralrs-core/src/models/gemma.rs:348— mistralrs-core/src/models/gemma.rs:348-363 | mistralrs-core/src/models/gemma2.rs:421-436 | mistralrs-core/src/models/phi2.rs:432-447 | mistralrs-core/src/models/phi3_5_moe.rs:481-496 | mistralrs-core/src/models/starcoder2.rs:406-421 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 5) mistralrs-core/src/models/qwen2.rs:215— mistralrs-core/src/models/qwen2.rs:215-230 | mistralrs-core/src/models/qwen3.rs:168-183 | mistralrs-core/src/models/qwen3_moe.rs:171-186 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:172-187 | mistralrs-core/src/vision_models/qwen2vl/text.rs:173-188 — before extracting anything, compare `mistralrs-core/src/models/qwen2.rs` and `mistralrs-core/src/models/qwen3.rs` as WHOLE FILES: this scan already matched 42 separate duplicated blocks between them, totalling at least 542 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15–16 lines × 4) mistralrs-core/src/vision_models/qwen3_5/mod.rs:193— mistralrs-core/src/vision_models/qwen3_5/mod.rs:193-208 | mistralrs-core/src/vision_models/qwen3_5/mod.rs:256-270 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:176-191 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:239-253 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (15–16 lines × 4) mistralrs-core/src/vision_models/qwen3_vl/mod.rs:701— mistralrs-core/src/vision_models/qwen3_vl/mod.rs:701-716 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:778-792 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:146-161 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:223-237 — `mistralrs-core/src/vision_models/qwen3_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/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 29 separate duplicated blocks between them, totalling at least 505 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 (15–16 lines × 4) mistralrs-core/src/vision_models/qwen3_vl/mod.rs:718— mistralrs-core/src/vision_models/qwen3_vl/mod.rs:718-733 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:794-808 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:163-178 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:239-253 — `mistralrs-core/src/vision_models/qwen3_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/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 29 separate duplicated blocks between them, totalling at least 505 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 (14–16 lines × 2) mistralrs-core/src/ops.rs:2020— mistralrs-core/src/ops.rs:2020-2033 | mistralrs-core/src/ops.rs:2151-2166 — both copies are in the same file, so extract the block into 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–16 lines × 2) mistralrs-core/src/pipeline/mod.rs:2160— mistralrs-core/src/pipeline/mod.rs:2160-2175 | mistralrs-core/src/pipeline/mod.rs:2826-2839 — both copies are in the same file, so extract the block into 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–16 lines × 2) mistralrs-quant/src/blockwise_fp8/deepgemm.rs:207— mistralrs-quant/src/blockwise_fp8/deepgemm.rs:207-222 | mistralrs-quant/src/blockwise_fp8/ops.rs:1369-1382 — before extracting anything, compare `mistralrs-quant/src/blockwise_fp8/deepgemm.rs` and `mistralrs-quant/src/blockwise_fp8/ops.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.
Duplicated block (13–16 lines × 2) mistralrs-core/src/vision_models/gemma3n/audio_processing.rs:280— mistralrs-core/src/vision_models/gemma3n/audio_processing.rs:280-295 | mistralrs-core/src/vision_models/gemma4/audio_processing.rs:395-407 — `mistralrs-core/src/vision_models/gemma3n/audio_processing.rs` and `mistralrs-core/src/vision_models/gemma4/audio_processing.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 38 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 (13–16 lines × 2) mistralrs-quant/src/lib.rs:2188— mistralrs-quant/src/lib.rs:2188-2203 | mistralrs-quant/src/lib.rs:2407-2419 — both copies are in the same file, so extract the block into 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–16 lines × 2) mistralrs-server-core/src/mistralrs_for_server_builder.rs:844— mistralrs-server-core/src/mistralrs_for_server_builder.rs:844-859 | mistralrs-server-core/src/mistralrs_for_server_builder.rs:1067-1079 — both copies are in the same file, so extract the block into 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 × 6) mistralrs-core/src/embedding_models/qwen3_embedding.rs:353— mistralrs-core/src/embedding_models/qwen3_embedding.rs:353-367 | mistralrs-core/src/models/mixtral.rs:429-443 | mistralrs-core/src/models/qwen2.rs:457-471 | mistralrs-core/src/models/qwen3.rs:426-440 | mistralrs-core/src/models/qwen3_moe.rs:600-614 | mistralrs-core/src/models/starcoder2.rs:427-441 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/mixtral.rs` as WHOLE FILES: this scan already matched 7 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. 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 (15 lines × 6) mistralrs-core/src/models/gemma.rs:133— mistralrs-core/src/models/gemma.rs:133-147 | mistralrs-core/src/models/mixtral.rs:117-131 | mistralrs-core/src/models/qwen2.rs:205-219 | mistralrs-core/src/models/starcoder2.rs:193-207 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:162-176 | mistralrs-core/src/vision_models/qwen2vl/text.rs:163-177 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/mixtral.rs` as WHOLE FILES: this scan already matched 29 separate duplicated blocks between them, totalling at least 304 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15 lines × 6) mistralrs/src/model_builder_trait.rs:548— mistralrs/src/model_builder_trait.rs:548-562 | mistralrs/src/model_builder_trait.rs:625-639 | mistralrs/src/model_builder_trait.rs:775-789 | mistralrs/src/model_builder_trait.rs:928-942 | mistralrs/src/model_builder_trait.rs:1098-1112 | mistralrs/src/model_builder_trait.rs:1552-1566 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14–15 lines × 4) mistralrs-core/src/models/deepseek2.rs:624— mistralrs-core/src/models/deepseek2.rs:624-638 | mistralrs-core/src/models/deepseek3.rs:687-701 | mistralrs-core/src/models/glm4_moe.rs:529-542 | mistralrs-core/src/models/glm4_moe_lite.rs:633-647 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14–15 lines × 4) mistralrs-core/src/vision_models/qwen3_5/mod.rs:210— mistralrs-core/src/vision_models/qwen3_5/mod.rs:210-224 | mistralrs-core/src/vision_models/qwen3_5/mod.rs:272-285 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:193-207 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:255-268 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (14–15 lines × 4) mistralrs-core/src/xlora_models/gemma.rs:375— mistralrs-core/src/xlora_models/gemma.rs:375-388 | mistralrs-core/src/xlora_models/mistral.rs:371-384 | mistralrs-core/src/xlora_models/mixtral.rs:498-512 | mistralrs-core/src/xlora_models/starcoder2.rs:360-373 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/mistral.rs` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 11) mistralrs-core/src/models/flint.rs:718— mistralrs-core/src/models/flint.rs:718-730 | mistralrs-core/src/models/gpt_oss.rs:659-672 | mistralrs-core/src/models/hunyuan_v1_moe.rs:807-819 | mistralrs-core/src/models/mixtral.rs:347-359 | mistralrs-core/src/models/qwen3_moe.rs:500-512 | mistralrs-core/src/vision_models/phi4/mod.rs:271-284 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:449-461 | mistralrs-core/src/xlora_models/llama.rs:365-377 | mistralrs-core/src/xlora_models/mistral.rs:345-357 | mistralrs-core/src/xlora_models/mixtral.rs:472-484 | mistralrs-core/src/xlora_models/phi3.rs:310-322 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gpt_oss.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 259 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 11) mistralrs-core/src/models/flint.rs:846— mistralrs-core/src/models/flint.rs:846-858 | mistralrs-core/src/models/glm4.rs:513-525 | mistralrs-core/src/models/hunyuan_v1_dense.rs:478-490 | mistralrs-core/src/models/hunyuan_v1_moe.rs:972-984 | mistralrs-core/src/models/mistral.rs:519-531 | mistralrs-core/src/models/mixtral.rs:474-486 | mistralrs-core/src/models/qwen2.rs:505-517 | mistralrs-core/src/models/qwen3.rs:472-484 | mistralrs-core/src/models/qwen3_moe.rs:652-664 | mistralrs-core/src/vision_models/phi3/mod.rs:1268-1280 | mistralrs-core/src/vision_models/phi4/mod.rs:383-395 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 11) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:397— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:397-409 | mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1040-1052 | mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:437-449 | mistralrs-core/src/vision_models/llama4/inputs_processor.rs:407-419 | mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:288-300 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:324-336 | mistralrs-core/src/vision_models/minicpmo/inputs_processor.rs:312-324 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:269-281 | mistralrs-core/src/vision_models/mllama/inputs_processor.rs:335-347 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:297-309 | mistralrs-core/src/vision_models/voxtral/inputs_processor.rs:210-222 — `mistralrs-core/src/vision_models/gemma3/inputs_processor.rs` and `mistralrs-core/src/vision_models/gemma4/inputs_processor.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 5 separate duplicated blocks between them, totalling at least 76 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 (13 lines × 7) mistralrs-core/src/embedding_models/qwen3_embedding.rs:257— mistralrs-core/src/embedding_models/qwen3_embedding.rs:257-269 | mistralrs-core/src/models/hunyuan_v1_dense.rs:317-329 | mistralrs-core/src/models/mistral.rs:338-350 | mistralrs-core/src/models/phi3.rs:351-363 | mistralrs-core/src/models/qwen2.rs:370-382 | mistralrs-core/src/models/qwen3.rs:326-338 | mistralrs-core/src/vision_models/phi3/mod.rs:442-454 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/hunyuan_v1_dense.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 116 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 × 7) mistralrs-core/src/models/glm4_moe.rs:239— mistralrs-core/src/models/glm4_moe.rs:239-252 | mistralrs-core/src/models/hunyuan_v1_dense.rs:158-171 | mistralrs-core/src/models/hunyuan_v1_moe.rs:341-354 | mistralrs-core/src/models/qwen3.rs:159-172 | mistralrs-core/src/models/qwen3_moe.rs:162-175 | mistralrs-core/src/models/qwen3_next.rs:243-255 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:158-170 — before extracting anything, compare `mistralrs-core/src/models/glm4_moe.rs` and `mistralrs-core/src/models/hunyuan_v1_dense.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 247 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 7) mistralrs-core/src/xlora_models/gemma.rs:577— mistralrs-core/src/xlora_models/gemma.rs:577-589 | mistralrs-core/src/xlora_models/gemma2.rs:611-623 | mistralrs-core/src/xlora_models/mistral.rs:571-583 | mistralrs-core/src/xlora_models/mixtral.rs:701-713 | mistralrs-core/src/xlora_models/phi2.rs:545-557 | mistralrs-core/src/xlora_models/phi3.rs:523-535 | mistralrs-core/src/xlora_models/starcoder2.rs:556-568 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 5) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1285— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1285-1297 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6694-6706 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7136-7148 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7607-7619 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8129-8141 — 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 (13 lines × 5) mistralrs-core/src/xlora_models/llama.rs:552— mistralrs-core/src/xlora_models/llama.rs:552-564 | mistralrs-core/src/xlora_models/mistral.rs:519-531 | mistralrs-core/src/xlora_models/mixtral.rs:649-661 | mistralrs-core/src/xlora_models/phi2.rs:493-505 | mistralrs-core/src/xlora_models/phi3.rs:469-481 — before extracting anything, compare `mistralrs-core/src/xlora_models/llama.rs` and `mistralrs-core/src/xlora_models/mistral.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 273 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 5) mistralrs-paged-attn/src/cuda/backend/fa3.rs:495— mistralrs-paged-attn/src/cuda/backend/fa3.rs:495-507 | mistralrs-quant/src/cutile/gdn_prefill.rs:707-719 | mistralrs-quant/src/cutile/nvfp4_gemv.rs:326-338 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1198-1210 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1456-1468 — before extracting anything, compare `mistralrs-paged-attn/src/cuda/backend/fa3.rs` and `mistralrs-quant/src/cutile/nvfp4_gemv.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. 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 (11–13 lines × 2) mistralrs-core/src/models/flint.rs:776— mistralrs-core/src/models/flint.rs:776-786 | mistralrs-core/src/models/qwen3_next.rs:734-746 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/qwen3_next.rs` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 225 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–13 lines × 2) mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1138— mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1138-1150 | mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1391-1401 — both copies are in the same file, so extract the block into 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–13 lines × 2) mistralrs-quant/src/distributed/layers.rs:1233— mistralrs-quant/src/distributed/layers.rs:1233-1245 | mistralrs-quant/src/distributed/layers.rs:1888-1898 — both copies are in the same file, so extract the block into 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 × 9) mistralrs-core/src/embedding_models/qwen3_embedding.rs:352— mistralrs-core/src/embedding_models/qwen3_embedding.rs:352-363 | mistralrs-core/src/models/mixtral.rs:428-439 | mistralrs-core/src/models/qwen2.rs:456-467 | mistralrs-core/src/models/qwen3.rs:425-436 | mistralrs-core/src/models/qwen3_moe.rs:599-610 | mistralrs-core/src/models/starcoder2.rs:426-437 | mistralrs-core/src/xlora_models/mistral.rs:442-453 | mistralrs-core/src/xlora_models/mixtral.rs:572-583 | mistralrs-core/src/xlora_models/starcoder2.rs:431-442 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/mixtral.rs` as WHOLE FILES: this scan already matched 7 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. 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 × 9) mistralrs-core/src/models/deepseek2.rs:725— mistralrs-core/src/models/deepseek2.rs:725-736 | mistralrs-core/src/models/deepseek3.rs:788-799 | mistralrs-core/src/models/glm4_moe.rs:625-636 | mistralrs-core/src/models/glm4_moe_lite.rs:734-745 | mistralrs-core/src/models/mixtral.rs:339-350 | mistralrs-core/src/xlora_models/llama.rs:357-368 | mistralrs-core/src/xlora_models/mistral.rs:337-348 | mistralrs-core/src/xlora_models/mixtral.rs:464-475 | mistralrs-core/src/xlora_models/phi3.rs:302-313 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 9) mistralrs-core/src/models/deepseek2.rs:953— mistralrs-core/src/models/deepseek2.rs:953-965 | mistralrs-core/src/models/deepseek3.rs:1016-1028 | mistralrs-core/src/models/gemma.rs:466-478 | mistralrs-core/src/models/glm4_moe.rs:832-843 | mistralrs-core/src/models/glm4_moe_lite.rs:969-980 | mistralrs-core/src/models/llama.rs:494-506 | mistralrs-core/src/models/phi2.rs:545-557 | mistralrs-core/src/models/qwen2.rs:571-582 | mistralrs-core/src/models/smollm3.rs:513-525 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 6) mistralrs-core/src/embedding_models/embedding_gemma.rs:290— mistralrs-core/src/embedding_models/embedding_gemma.rs:290-301 | mistralrs-core/src/models/gemma.rs:284-295 | mistralrs-core/src/models/gemma2.rs:335-346 | mistralrs-core/src/vision_models/gemma3/text.rs:343-354 | mistralrs-core/src/xlora_models/gemma.rs:343-354 | mistralrs-core/src/xlora_models/gemma2.rs:352-363 — `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/models/gemma.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 7 separate duplicated blocks between them, totalling at least 113 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 (12 lines × 6) mistralrs-core/src/embedding_models/qwen3_embedding.rs:101— mistralrs-core/src/embedding_models/qwen3_embedding.rs:101-112 | mistralrs-core/src/models/qwen3.rs:112-123 | mistralrs-core/src/models/qwen3_moe.rs:115-126 | mistralrs-core/src/vision_models/llama4/text.rs:338-349 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:113-124 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:219-230 — `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/qwen3.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 27 separate duplicated blocks between them, totalling at least 372 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 (12 lines × 6) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:230— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:230-241 | mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:520-531 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:796-807 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1128-1139 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:891-902 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1188-1199 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (11 lines × 6) mistralrs-core/src/embedding_models/qwen3_embedding.rs:103— mistralrs-core/src/embedding_models/qwen3_embedding.rs:103-113 | mistralrs-core/src/models/glm4.rs:136-146 | mistralrs-core/src/models/glm4_moe.rs:188-198 | mistralrs-core/src/models/gpt_oss.rs:171-181 | mistralrs-core/src/models/qwen3.rs:114-124 | mistralrs-core/src/models/qwen3_moe.rs:117-127 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 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 (11 lines × 6) mistralrs-core/src/models/gemma.rs:272— mistralrs-core/src/models/gemma.rs:272-282 | mistralrs-core/src/models/gemma2.rs:323-333 | mistralrs-core/src/models/mistral.rs:320-330 | mistralrs-core/src/models/qwen2.rs:352-362 | mistralrs-core/src/vision_models/gemma3/text.rs:331-341 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:361-371 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 6) mistralrs/src/model_builder_trait.rs:580— mistralrs/src/model_builder_trait.rs:580-590 | mistralrs/src/model_builder_trait.rs:659-669 | mistralrs/src/model_builder_trait.rs:802-813 | mistralrs/src/model_builder_trait.rs:957-968 | mistralrs/src/model_builder_trait.rs:1130-1141 | mistralrs/src/model_builder_trait.rs:1579-1590 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10–11 lines × 3) mistralrs-core/src/models/llama.rs:499— mistralrs-core/src/models/llama.rs:499-509 | mistralrs-core/src/models/smollm3.rs:518-528 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:541-550 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 3) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:897— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:897-907 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3688-3698 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4475-4484 — 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–11 lines × 3) mistralrs-core/src/vision_models/muse_glimmer/text.rs:227— mistralrs-core/src/vision_models/muse_glimmer/text.rs:227-236 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:195-205 | mistralrs-core/src/vision_models/qwen2vl/text.rs:196-206 — `mistralrs-core/src/vision_models/muse_glimmer/text.rs` and `mistralrs-core/src/vision_models/qwen2_5_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 10 separate duplicated blocks between them, totalling at least 145 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 (9 lines × 10) mistralrs-core/src/layers.rs:1183— mistralrs-core/src/layers.rs:1183-1191 | mistralrs-core/src/layers.rs:1206-1214 | mistralrs-core/src/layers.rs:1273-1281 | mistralrs-core/src/layers.rs:1296-1304 | mistralrs-core/src/layers.rs:1373-1381 | mistralrs-core/src/layers.rs:1542-1550 | mistralrs-core/src/layers.rs:1565-1573 | mistralrs-core/src/layers.rs:2370-2378 | mistralrs-core/src/layers.rs:2468-2476 | mistralrs-core/src/layers.rs:2515-2523 — 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.
Duplicated block (9 lines × 10) mistralrs-core/src/models/deepseek2.rs:957— mistralrs-core/src/models/deepseek2.rs:957-966 | mistralrs-core/src/models/deepseek3.rs:1020-1029 | mistralrs-core/src/models/gemma.rs:470-479 | mistralrs-core/src/models/glm4_moe.rs:836-844 | mistralrs-core/src/models/glm4_moe_lite.rs:973-981 | mistralrs-core/src/models/granite.rs:2252-2261 | mistralrs-core/src/models/llama.rs:498-507 | mistralrs-core/src/models/phi2.rs:549-558 | mistralrs-core/src/models/smollm3.rs:517-526 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:539-548 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 10) mistralrs-core/src/models/flint.rs:742— mistralrs-core/src/models/flint.rs:742-750 | mistralrs-core/src/models/gemma.rs:314-322 | mistralrs-core/src/models/hunyuan_v1_dense.rs:341-349 | mistralrs-core/src/models/hunyuan_v1_moe.rs:831-839 | mistralrs-core/src/models/mistral.rs:362-370 | mistralrs-core/src/models/phi3.rs:375-383 | mistralrs-core/src/models/qwen3.rs:350-358 | mistralrs-core/src/models/qwen3_moe.rs:524-532 | mistralrs-core/src/vision_models/phi3/mod.rs:466-474 | mistralrs-core/src/vision_models/phi4/mod.rs:296-304 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–9 lines × 3) mistralrs-core/src/models/granite.rs:1417— mistralrs-core/src/models/granite.rs:1417-1424 | mistralrs-core/src/models/granite.rs:1437-1444 | mistralrs-core/src/models/granite.rs:1722-1730 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8–9 lines × 3) mistralrs-core/src/ops.rs:1153— mistralrs-core/src/ops.rs:1153-1161 | mistralrs-core/src/ops.rs:1372-1380 | mistralrs-core/src/ops.rs:2959-2966 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8–9 lines × 3) mistralrs/src/model.rs:964— mistralrs/src/model.rs:964-971 | mistralrs/src/model.rs:1073-1081 | mistralrs/src/model.rs:1106-1113 — 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–9 lines × 2) mistralrs-core/src/ops.rs:4205— mistralrs-core/src/ops.rs:4205-4211 | mistralrs-core/src/ops.rs:4833-4841 — both copies are in the same file, so extract the block into 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–9 lines × 2) mistralrs-core/src/pipeline/auto.rs:174— mistralrs-core/src/pipeline/auto.rs:174-180 | mistralrs-core/src/pipeline/auto.rs:190-198 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–9 lines × 2) mistralrs-core/src/vision_models/phi4/inputs_processor.rs:928— mistralrs-core/src/vision_models/phi4/inputs_processor.rs:928-936 | mistralrs-core/src/vision_models/phi4/inputs_processor.rs:1030-1036 — both copies are in the same file, so extract the block into 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 × 6) mistralrs-core/src/models/gpt_oss.rs:518— mistralrs-core/src/models/gpt_oss.rs:518-526 | mistralrs-core/src/models/lfm2.rs:331-338 | mistralrs-core/src/models/qwen3_moe.rs:404-411 | mistralrs-core/src/models/qwen3_next.rs:475-482 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:379-386 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:143-150 — before extracting anything, compare `mistralrs-core/src/models/gpt_oss.rs` and `mistralrs-core/src/models/lfm2.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 6) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:536— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:536-543 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4619-4626 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1021-1028 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2401-2408 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2872-2879 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6295-6302 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/embedding_loaders.rs` and `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 6) mistralrs-core/src/xlora_models/gemma.rs:497— mistralrs-core/src/xlora_models/gemma.rs:497-504 | mistralrs-core/src/xlora_models/gemma2.rs:527-534 | mistralrs-core/src/xlora_models/mistral.rs:493-500 | mistralrs-core/src/xlora_models/mixtral.rs:624-631 | mistralrs-core/src/xlora_models/phi2.rs:479-486 | mistralrs-core/src/xlora_models/starcoder2.rs:481-488 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 13) mistralrs-core/src/embedding_models/qwen3_embedding.rs:476— mistralrs-core/src/embedding_models/qwen3_embedding.rs:476-482 | mistralrs-core/src/models/deepseek2.rs:987-994 | mistralrs-core/src/models/deepseek2.rs:1027-1034 | mistralrs-core/src/models/deepseek3.rs:1050-1057 | mistralrs-core/src/models/deepseek3.rs:1091-1098 | mistralrs-core/src/models/flint.rs:988-994 | mistralrs-core/src/models/glm4_moe_lite.rs:1002-1009 | mistralrs-core/src/models/glm4_moe_lite.rs:1045-1052 | mistralrs-core/src/models/hunyuan_v1_dense.rs:580-586 | mistralrs-core/src/models/qwen3.rs:582-588 | mistralrs-core/src/models/qwen3_moe.rs:763-769 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:606-613 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:727-734 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/deepseek2.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (7 lines × 13) mistralrs-core/src/models/gemma.rs:561— mistralrs-core/src/models/gemma.rs:561-567 | mistralrs-core/src/models/gemma2.rs:678-684 | mistralrs-core/src/models/glm4.rs:681-687 | mistralrs-core/src/models/hunyuan_v1_dense.rs:649-655 | mistralrs-core/src/models/mistral.rs:689-695 | mistralrs-core/src/models/phi2.rs:637-643 | mistralrs-core/src/models/phi3.rs:632-638 | mistralrs-core/src/models/qwen2.rs:691-697 | mistralrs-core/src/models/qwen3.rs:667-673 | mistralrs-core/src/models/starcoder2.rs:628-634 | mistralrs-core/src/vision_models/gemma3/text.rs:902-908 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:645-651 | mistralrs-core/src/vision_models/phi3/mod.rs:1469-1475 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 13) mistralrs-core/src/models/gemma.rs:568— mistralrs-core/src/models/gemma.rs:568-574 | mistralrs-core/src/models/gemma2.rs:685-691 | mistralrs-core/src/models/glm4.rs:688-694 | mistralrs-core/src/models/hunyuan_v1_dense.rs:656-662 | mistralrs-core/src/models/mistral.rs:696-702 | mistralrs-core/src/models/phi2.rs:644-650 | mistralrs-core/src/models/phi3.rs:639-645 | mistralrs-core/src/models/qwen2.rs:698-704 | mistralrs-core/src/models/qwen3.rs:674-680 | mistralrs-core/src/models/starcoder2.rs:635-641 | mistralrs-core/src/vision_models/gemma3/text.rs:909-915 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:652-658 | mistralrs-core/src/vision_models/phi3/mod.rs:1476-1482 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/ops.rs:1116— mistralrs-core/src/ops.rs:1116-1120 | mistralrs-core/src/ops.rs:1345-1349 | mistralrs-core/src/ops.rs:1590-1594 | mistralrs-core/src/ops.rs:1832-1836 | mistralrs-core/src/ops.rs:2039-2043 | mistralrs-core/src/ops.rs:2172-2176 | mistralrs-core/src/ops.rs:3912-3916 | mistralrs-core/src/ops.rs:4039-4043 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 8) mistralrs-core/src/vision_models/qwen3_5/mod.rs:212— mistralrs-core/src/vision_models/qwen3_5/mod.rs:212-217 | mistralrs-core/src/vision_models/qwen3_5/mod.rs:274-278 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:195-200 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:257-261 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:724-729 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:800-804 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:169-174 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:245-249 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (5 lines × 8) mistralrs-paged-attn/src/cuda/backend/fa3.rs:187— mistralrs-paged-attn/src/cuda/backend/fa3.rs:187-192 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:316-321 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:608-613 | mistralrs-paged-attn/src/cuda/backend/mla.rs:34-39 | mistralrs-paged-attn/src/cuda/backend/mla.rs:321-326 | mistralrs-paged-attn/src/cuda/backend/mla.rs:684-689 | mistralrs-quant/src/blockwise_fp8/mma.rs:214-219 | mistralrs-quant/src/rotary/mod.rs:697-701 — before extracting anything, compare `mistralrs-paged-attn/src/cuda/backend/flashinfer.rs` and `mistralrs-paged-attn/src/cuda/backend/mla.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
AC3 · Page structure· Page without a main landmark · ×2
Page without a main landmark mistralrs-cli/static/index.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. This document's body is only the mount point <div id="app">, so there is no content here to wrap — render the <main> from the component mounted into it.
Page without a main landmark mistralrs-cli/webui/index.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. This document's body is only the mount point <div id="app">, so there is no content here to wrap — render the <main> from the component mounted into it.
Gemma4ImageProcessor::process_inputs (cyclomatic 81) mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1025— Gemma4ImageProcessor::process_inputs has cyclomatic complexity 81 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Gemma4ImageProcessor::prepare_for_paged_prompt_planning (cyclomatic 29) mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:834— Gemma4ImageProcessor::prepare_for_paged_prompt_planning has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImageEmbedding::forward (cyclomatic 54) mistralrs-core/src/vision_models/phi3/mod.rs:697— ImageEmbedding::forward has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImageEmbedding::forward (cyclomatic 20) mistralrs-core/src/vision_models/phi4/image_embedding.rs:465— ImageEmbedding::forward 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.
Qwen3VLImageProcessor::process_inputs (cyclomatic 54) mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1019— Qwen3VLImageProcessor::process_inputs has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Qwen3VLImageProcessor::prepare_for_paged_prompt_planning (cyclomatic 29) mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:776— Qwen3VLImageProcessor::prepare_for_paged_prompt_planning has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Qwen2_5VLImageProcessor::process_inputs (cyclomatic 52) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:352— Qwen2_5VLImageProcessor::process_inputs has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Qwen2_5VLImageProcessor::prepare_for_paged_prompt_planning (cyclomatic 29) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:118— Qwen2_5VLImageProcessor::prepare_for_paged_prompt_planning has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Qwen2VLImageProcessor::process_inputs (cyclomatic 52) mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:918— Qwen2VLImageProcessor::process_inputs has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Qwen2VLImageProcessor::prepare_for_paged_prompt_planning (cyclomatic 29) mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:684— Qwen2VLImageProcessor::prepare_for_paged_prompt_planning has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PagedAttentionScheduler::schedule (cyclomatic 50) mistralrs-core/src/paged_attention/scheduler.rs:921— PagedAttentionScheduler::schedule has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PagedAttentionScheduler::select_prompt_batch (cyclomatic 23) mistralrs-core/src/paged_attention/scheduler.rs:318— PagedAttentionScheduler::select_prompt_batch has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Qwen3_5Model::dflash_propose (cyclomatic 34) mistralrs-core/src/vision_models/qwen3_5/speculative.rs:304— Qwen3_5Model::dflash_propose has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Qwen3_5Model::forward (cyclomatic 31) mistralrs-core/src/vision_models/qwen3_5/mod.rs:115— Qwen3_5Model::forward has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Sdpa::run_attention_noflash (cyclomatic 32) mistralrs-core/src/attention/mod.rs:476— Sdpa::run_attention_noflash has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Sdpa::run_attention (cyclomatic 26) mistralrs-core/src/attention/mod.rs:320— Sdpa::run_attention 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.
UnquantLinear::apply_isq (cyclomatic 29) mistralrs-quant/src/unquantized/mod.rs:417— UnquantLinear::apply_isq has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UnquantLinear::forward_raw (cyclomatic 17) mistralrs-quant/src/unquantized/mod.rs:143— UnquantLinear::forward_raw 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.
Qwen2VLModel::forward (cyclomatic 26) mistralrs-core/src/vision_models/qwen2vl/mod.rs:326— Qwen2VLModel::forward 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.
Qwen2VLModel::compute_rope_index (cyclomatic 20) mistralrs-core/src/vision_models/qwen2vl/mod.rs:191— Qwen2VLModel::compute_rope_index 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.
GGUFLoader::load_model_from_path (cyclomatic 25) mistralrs-core/src/pipeline/gguf.rs:1309— GGUFLoader::load_model_from_path 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.
GGUFLoader::infer_multimodal_asset_paths (cyclomatic 20) mistralrs-core/src/pipeline/gguf.rs:1055— GGUFLoader::infer_multimodal_asset_paths 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.
ChatCompletionStreamer::poll_next (cyclomatic 24) mistralrs-server-core/src/chat_completion.rs:387— ChatCompletionStreamer::poll_next has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ChatCompletionStreamer::__next__ (cyclomatic 20) mistralrs-pyo3/src/stream.rs:23— ChatCompletionStreamer::__next__ 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.
Idefics2ImageProcessor::process_inputs (cyclomatic 23) mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:409— Idefics2ImageProcessor::process_inputs has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Idefics2ImageProcessor::preprocess (cyclomatic 16) mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:679— Idefics2ImageProcessor::preprocess 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.
BitWise::cuda_fwd (cyclomatic 23) mistralrs-quant/src/utils/ops.rs:365— BitWise::cuda_fwd has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
BitWise::cpu_fwd (cyclomatic 21) mistralrs-quant/src/utils/ops.rs:261— BitWise::cpu_fwd has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Attention::forward (cyclomatic 22) mistralrs-core/src/vision_models/gemma4/text.rs:507— Attention::forward 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.
Attention::forward (cyclomatic 18) mistralrs-core/src/vision_models/gemma3n/text.rs:434— Attention::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.
Sampler::sample_topk_on_device (cyclomatic 16) mistralrs-core/src/sampler.rs:1465— Sampler::sample_topk_on_device 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.
Sampler::sample_topk_on_device_metal (cyclomatic 16) mistralrs-core/src/sampler.rs:1644— Sampler::sample_topk_on_device_metal 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.
XxxComment mistralrs-quant/src/safetensors.rs:36— // 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 mistralrs-quant/src/safetensors.rs:67— // 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.
Gemma4ImageProcessor::process_inputs (cognitive 242) mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1025— Gemma4ImageProcessor::process_inputs has cognitive complexity 242 (threshold 15). Drivers by points: if/else 88 (188 pts), loops 14 (49 pts), boolean chains 5 (nesting depth added 135). 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.
Gemma4ImageProcessor::prepare_for_paged_prompt_planning (cognitive 57) mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:834— Gemma4ImageProcessor::prepare_for_paged_prompt_planning has cognitive complexity 57 (threshold 15). Drivers by points: if/else 22 (47 pts), boolean chains 6, loops 2 (4 pts) (nesting depth added 27). 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.
Gemma4Model::forward_inner (cognitive 139) mistralrs-core/src/vision_models/gemma4/mod.rs:341— Gemma4Model::forward_inner has cognitive complexity 139 (threshold 15). Drivers by points: if/else 50 (105 pts), loops 9 (30 pts), boolean chains 4 (nesting depth added 76). 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.
Gemma4Model::speculative_target_hiddens (cognitive 18) mistralrs-core/src/vision_models/gemma4/mod.rs:1213— Gemma4Model::speculative_target_hiddens has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (4 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.
Qwen3VLImageProcessor::process_inputs (cognitive 120) mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1019— Qwen3VLImageProcessor::process_inputs has cognitive complexity 120 (threshold 15). Drivers by points: if/else 49 (95 pts), loops 8 (17 pts), boolean chains 7, match/switch 1 (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen3VLImageProcessor::prepare_for_paged_prompt_planning (cognitive 57) mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:776— Qwen3VLImageProcessor::prepare_for_paged_prompt_planning has cognitive complexity 57 (threshold 15). Drivers by points: if/else 24 (47 pts), loops 6 (8 pts), boolean chains 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen2_5VLImageProcessor::process_inputs (cognitive 115) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:352— Qwen2_5VLImageProcessor::process_inputs has cognitive complexity 115 (threshold 15). Drivers by points: if/else 48 (93 pts), loops 7 (14 pts), boolean chains 7, match/switch 1 (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen2_5VLImageProcessor::prepare_for_paged_prompt_planning (cognitive 58) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:118— Qwen2_5VLImageProcessor::prepare_for_paged_prompt_planning has cognitive complexity 58 (threshold 15). Drivers by points: if/else 24 (48 pts), loops 6 (8 pts), boolean chains 2 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen2VLImageProcessor::process_inputs (cognitive 115) mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:918— Qwen2VLImageProcessor::process_inputs has cognitive complexity 115 (threshold 15). Drivers by points: if/else 48 (93 pts), loops 7 (14 pts), boolean chains 7, match/switch 1 (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen2VLImageProcessor::prepare_for_paged_prompt_planning (cognitive 58) mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:684— Qwen2VLImageProcessor::prepare_for_paged_prompt_planning has cognitive complexity 58 (threshold 15). Drivers by points: if/else 24 (48 pts), loops 6 (8 pts), boolean chains 2 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Gemma3ImageProcessor::process_inputs (cognitive 83) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:382— Gemma3ImageProcessor::process_inputs has cognitive complexity 83 (threshold 15). Drivers by points: if/else 36 (75 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 43). 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.
Gemma3ImageProcessor::prepare_for_paged_prompt_planning (cognitive 21) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:265— Gemma3ImageProcessor::prepare_for_paged_prompt_planning 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.
Qwen3_5TextModel::forward_embeds (cognitive 81) mistralrs-core/src/vision_models/qwen3_5/text.rs:1434— Qwen3_5TextModel::forward_embeds has cognitive complexity 81 (threshold 15). Drivers by points: if/else 31 (50 pts), boolean chains 15, match/switch 7 (15 pts), loops 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen3_5TextModel::new (cognitive 16) mistralrs-core/src/vision_models/qwen3_5/text.rs:804— Qwen3_5TextModel::new has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), match/switch 3 (4 pts), loops 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Qwen3_5Model::dflash_propose (cognitive 70) mistralrs-core/src/vision_models/qwen3_5/speculative.rs:304— Qwen3_5Model::dflash_propose has cognitive complexity 70 (threshold 15). Drivers by points: if/else 22 (41 pts), loops 7 (20 pts), boolean chains 6, match/switch 1 (3 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen3_5Model::forward (cognitive 58) mistralrs-core/src/vision_models/qwen3_5/mod.rs:115— Qwen3_5Model::forward has cognitive complexity 58 (threshold 15). Drivers by points: if/else 21 (35 pts), loops 7 (17 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen2VLModel::forward (cognitive 69) mistralrs-core/src/vision_models/qwen2vl/mod.rs:326— Qwen2VLModel::forward has cognitive complexity 69 (threshold 15). Drivers by points: if/else 26 (41 pts), loops 5 (20 pts), match/switch 2 (6 pts), boolean chains 2 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen2VLModel::compute_rope_index (cognitive 47) mistralrs-core/src/vision_models/qwen2vl/mod.rs:191— Qwen2VLModel::compute_rope_index has cognitive complexity 47 (threshold 15). Drivers by points: loops 9 (27 pts), if/else 7 (16 pts), boolean chains 3, match/switch 1 (nesting depth added 27). 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.
MistralRs::init_external_tool_callbacks (cognitive 64) mistralrs-core/src/lib.rs:1339— MistralRs::init_external_tool_callbacks has cognitive complexity 64 (threshold 15). Drivers by points: if/else 18 (39 pts), match/switch 6 (15 pts), loops 3 (9 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.
MistralRs::new (cognitive 18) mistralrs-core/src/lib.rs:1518— MistralRs::new has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 2 (4 pts), boolean chains 2, match/switch 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LLaVAInputProcessor::process_inputs (cognitive 53) mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:273— LLaVAInputProcessor::process_inputs has cognitive complexity 53 (threshold 15). Drivers by points: if/else 25 (39 pts), loops 6 (12 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LLaVAInputProcessor::prepare_for_paged_prompt_planning (cognitive 21) mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:171— LLaVAInputProcessor::prepare_for_paged_prompt_planning has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (5 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.
GraniteMoeHybrid::forward (cognitive 51) mistralrs-core/src/models/granite.rs:2180— GraniteMoeHybrid::forward has cognitive complexity 51 (threshold 15). Drivers by points: if/else 21 (48 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 28). 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.
GraniteMoeHybrid::new_inner (cognitive 26) mistralrs-core/src/models/granite.rs:1940— GraniteMoeHybrid::new_inner has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (17 pts), match/switch 3 (6 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.
PrefixCacheManagerV2::search_for_matching_cache (cognitive 51) mistralrs-core/src/prefix_cacher.rs:711— PrefixCacheManagerV2::search_for_matching_cache has cognitive complexity 51 (threshold 15). Drivers by points: if/else 21 (33 pts), match/switch 4 (10 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PrefixCacheManagerV2::evict_caches (cognitive 17) mistralrs-core/src/prefix_cacher.rs:405— PrefixCacheManagerV2::evict_caches has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (3 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Idefics2ImageProcessor::process_inputs (cognitive 48) mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:409— Idefics2ImageProcessor::process_inputs has cognitive complexity 48 (threshold 15). Drivers by points: if/else 24 (41 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Idefics2ImageProcessor::preprocess (cognitive 24) mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:679— Idefics2ImageProcessor::preprocess has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HybridCacheManager::clone_in_cache (cognitive 47) mistralrs-core/src/kv_cache/mod.rs:1196— HybridCacheManager::clone_in_cache has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (38 pts), match/switch 1 (5 pts), loops 2 (4 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HybridCacheManager::clone_out_cache (cognitive 39) mistralrs-core/src/kv_cache/mod.rs:1289— HybridCacheManager::clone_out_cache has cognitive complexity 39 (threshold 15). Drivers by points: if/else 6 (21 pts), loops 3 (11 pts), match/switch 1 (6 pts), boolean chains 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LLaVANextInputProcessor::process_inputs (cognitive 44) mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:309— LLaVANextInputProcessor::process_inputs has cognitive complexity 44 (threshold 15). Drivers by points: if/else 25 (37 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LLaVANextInputProcessor::prepare_for_paged_prompt_planning (cognitive 16) mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:236— LLaVANextInputProcessor::prepare_for_paged_prompt_planning has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sdpa::run_attention_noflash (cognitive 40) mistralrs-core/src/attention/mod.rs:476— Sdpa::run_attention_noflash has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 12, match/switch 3 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sdpa::run_attention (cognitive 35) mistralrs-core/src/attention/mod.rs:320— Sdpa::run_attention has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 12, match/switch 3 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UnquantLinear::apply_isq (cognitive 39) mistralrs-quant/src/unquantized/mod.rs:417— UnquantLinear::apply_isq has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (29 pts), match/switch 4 (8 pts), boolean chains 2 (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.
UnquantLinear::forward_raw (cognitive 29) mistralrs-quant/src/unquantized/mod.rs:143— UnquantLinear::forward_raw has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (21 pts), match/switch 4 (7 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FastExpertsWeights::forward_grouped (cognitive 35) mistralrs-core/src/moe/experts/backends.rs:1626— FastExpertsWeights::forward_grouped has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (21 pts), match/switch 9 (12 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
FastExpertsWeights::forward_impl (cognitive 19) mistralrs-core/src/moe/experts/backends.rs:1085— FastExpertsWeights::forward_impl has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ParsedShard::finish (cognitive 33) mistralrs-quant/src/gguf/archive.rs:730— ParsedShard::finish has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (25 pts), match/switch 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ParsedShard::parse (cognitive 16) mistralrs-quant/src/gguf/archive.rs:652— ParsedShard::parse has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 3 (4 pts), match/switch 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Lfm2VlImageProcessor::patchify (cognitive 30) mistralrs-core/src/vision_models/lfm2_vl/inputs_processor.rs:320— Lfm2VlImageProcessor::patchify has cognitive complexity 30 (threshold 15). Drivers by points: loops 5 (15 pts), if/else 4 (14 pts), boolean chains 1 (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.
Lfm2VlImageProcessor::process_inputs (cognitive 23) mistralrs-core/src/vision_models/lfm2_vl/inputs_processor.rs:646— Lfm2VlImageProcessor::process_inputs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17 (21 pts), loops 1 (2 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.
PerTensorFP8Linear::apply_isq (cognitive 30) mistralrs-quant/src/pertensor_fp8/mod.rs:512— PerTensorFP8Linear::apply_isq has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (25 pts), match/switch 3 (5 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PerTensorFP8Linear::register_cutile (cognitive 17) mistralrs-quant/src/pertensor_fp8/mod.rs:146— PerTensorFP8Linear::register_cutile has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 2 (nesting depth added 9). 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.
GGUFLoader::load_model_from_path (cognitive 29) mistralrs-core/src/pipeline/gguf.rs:1309— GGUFLoader::load_model_from_path has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (20 pts), match/switch 4 (5 pts), boolean chains 3, 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.
GGUFLoader::infer_multimodal_asset_paths (cognitive 22) mistralrs-core/src/pipeline/gguf.rs:1055— GGUFLoader::infer_multimodal_asset_paths has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 6 (7 pts), boolean chains 2 (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.
BuiltinMtpProposer::propose (cognitive 28) mistralrs-core/src/speculative/builtin_mtp.rs:216— BuiltinMtpProposer::propose has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 6 (9 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BuiltinMtpProposer::prefill (cognitive 18) mistralrs-core/src/speculative/builtin_mtp.rs:373— BuiltinMtpProposer::prefill has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MXFP4Layer::gather_forward_dequantize (cognitive 28) mistralrs-quant/src/mxfp4/mod.rs:792— MXFP4Layer::gather_forward_dequantize has cognitive complexity 28 (threshold 15). Drivers by points: loops 6 (19 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.
MXFP4Layer::forward_dequantize (cognitive 19) mistralrs-quant/src/mxfp4/mod.rs:712— MXFP4Layer::forward_dequantize has cognitive complexity 19 (threshold 15). Drivers by points: loops 5 (13 pts), if/else 6 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
Llama::create_anymoe_layers (cognitive 27) mistralrs-core/src/models/llama.rs:604— Llama::create_anymoe_layers has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Llama::create_anymoe_layers (cognitive 27) mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:617— Llama::create_anymoe_layers has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GgufDeviceMapLoaderInner::layer_sizes_in_bytes (cognitive 26) mistralrs-core/src/utils/gguf_metadata.rs:401— GgufDeviceMapLoaderInner::layer_sizes_in_bytes has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 1 (4 pts), match/switch 2 (4 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
GgufDeviceMapLoaderInner::non_mapped_size_in_bytes (cognitive 16) mistralrs-core/src/utils/gguf_metadata.rs:303— GgufDeviceMapLoaderInner::non_mapped_size_in_bytes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 1 (nesting depth added 5). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
DecoderLayer::forward_post_attn (cognitive 26) mistralrs-core/src/vision_models/gemma4/text.rs:1208— DecoderLayer::forward_post_attn has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (26 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.
DecoderLayer::forward_linear (cognitive 16) mistralrs-core/src/models/qwen3_next.rs:626— DecoderLayer::forward_linear has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 1 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GdnTransitionLayers::stage_prefixes (cognitive 24) mistralrs-core/src/speculative/gdn_transitions.rs:285— GdnTransitionLayers::stage_prefixes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GdnTransitionLayers::apply_pending (cognitive 22) mistralrs-core/src/speculative/gdn_transitions.rs:189— GdnTransitionLayers::apply_pending has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 4 (7 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Gemma3nImageProcessor::prepare_prompt_plans (cognitive 24) mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:462— Gemma3nImageProcessor::prepare_prompt_plans has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 6, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Gemma3nImageProcessor::process_audio_batch (cognitive 18) mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:640— Gemma3nImageProcessor::process_audio_batch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QLoraLinear::lora_forward (cognitive 21) mistralrs-core/src/lora/qloralinear.rs:213— QLoraLinear::lora_forward has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 2, loops 1 (2 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.
QLoraLinear::new (cognitive 17) mistralrs-core/src/lora/qloralinear.rs:31— QLoraLinear::new has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), loops 3 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
DiaPipeline::generate (cognitive 21) mistralrs-core/src/speech_models/dia/mod.rs:380— DiaPipeline::generate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (4 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiaPipeline::sample_next_token (cognitive 20) mistralrs-core/src/speech_models/dia/mod.rs:222— DiaPipeline::sample_next_token has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 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.
ToolCallingMatcher::new_with_format (cognitive 20) mistralrs-core/src/tools/mod.rs:115— ToolCallingMatcher::new_with_format has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ToolCallingMatcher::get_call_with_content (cognitive 19) mistralrs-core/src/tools/mod.rs:234— ToolCallingMatcher::get_call_with_content has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 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.
D4 · Code Duplication· Near-duplicate member family (18 members, 22 shared lines) · ×2
Near-duplicate member family (18 members, 22 shared lines) mistralrs-core/src/models/flint.rs:347— mistralrs-core/src/models/flint.rs:347-454 | mistralrs-core/src/models/gemma2.rs:208-297 | mistralrs-core/src/models/gpt_oss.rs:248-326 | mistralrs-core/src/models/hunyuan_v1_dense.rs:191-272 | mistralrs-core/src/models/hunyuan_v1_moe.rs:374-458 | mistralrs-core/src/models/llama.rs:75-157 | mistralrs-core/src/models/mistral.rs:206-297 | mistralrs-core/src/models/mixtral.rs:151-233 | mistralrs-core/src/models/phi3.rs:143-236 | mistralrs-core/src/models/phi3_5_moe.rs:178-263 | mistralrs-core/src/models/qwen2.rs:240-327 | mistralrs-core/src/models/qwen3.rs:192-282 | mistralrs-core/src/models/qwen3_moe.rs:195-285 | mistralrs-core/src/models/qwen3_next.rs:272-378 | mistralrs-core/src/models/smollm3.rs:90-174 | mistralrs-core/src/models/starcoder2.rs:227-309 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:58-132 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:227-306 — These 18 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 18 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 18 times.
Near-duplicate member family (18 members, 22 shared lines) mistralrs-core/src/models/flint.rs:347— mistralrs-core/src/models/flint.rs:347-454 | mistralrs-core/src/models/gemma.rs:167-249 | mistralrs-core/src/models/gemma2.rs:208-297 | mistralrs-core/src/models/gpt_oss.rs:248-326 | mistralrs-core/src/models/hunyuan_v1_dense.rs:191-272 | mistralrs-core/src/models/hunyuan_v1_moe.rs:374-458 | mistralrs-core/src/models/lfm2.rs:481-564 | mistralrs-core/src/models/mistral.rs:206-297 | mistralrs-core/src/models/mixtral.rs:151-233 | mistralrs-core/src/models/phi2.rs:254-347 | mistralrs-core/src/models/phi3_5_moe.rs:178-263 | mistralrs-core/src/models/qwen2.rs:240-327 | mistralrs-core/src/models/qwen3.rs:192-282 | mistralrs-core/src/models/qwen3_moe.rs:195-285 | mistralrs-core/src/models/qwen3_next.rs:272-378 | mistralrs-core/src/models/starcoder2.rs:227-309 | mistralrs-core/src/vision_models/mllama/text.rs:158-247 | mistralrs-core/src/vision_models/voxtral/mod.rs:126-208 — These 18 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 18 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 18 times.
D4 · Code Duplication· Near-duplicate member family (5 members, 24 shared lines) · ×2
Near-duplicate member family (5 members, 24 shared lines) mistralrs-core/src/embedding_models/qwen3_embedding.rs:93— mistralrs-core/src/embedding_models/qwen3_embedding.rs:93-171 | mistralrs-core/src/models/qwen3.rs:104-183 | mistralrs-core/src/models/qwen3_moe.rs:107-186 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:106-183 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:212-289 — These 5 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 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Near-duplicate member family (5 members, 24 shared lines) mistralrs-core/src/embedding_models/qwen3_embedding.rs:93— mistralrs-core/src/embedding_models/qwen3_embedding.rs:93-171 | mistralrs-core/src/models/glm4.rs:126-199 | mistralrs-core/src/models/glm4_moe.rs:177-263 | mistralrs-core/src/models/qwen3.rs:104-183 | mistralrs-core/src/models/qwen3_moe.rs:107-186 — These 5 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 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, 31 shared lines) · ×2
Near-duplicate member family (4 members, 31 shared lines) mistralrs-core/src/embedding_models/qwen3_embedding.rs:328— mistralrs-core/src/embedding_models/qwen3_embedding.rs:328-421 | mistralrs-core/src/models/hunyuan_v1_dense.rs:392-522 | mistralrs-core/src/models/hunyuan_v1_moe.rs:882-1016 | mistralrs-core/src/models/qwen3.rs:402-523 — These 4 members are variants of one another: a block of 31 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, 31 shared lines) mistralrs-core/src/models/mixtral.rs:405— mistralrs-core/src/models/mixtral.rs:405-520 | mistralrs-core/src/models/qwen2.rs:432-549 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:399-515 | mistralrs-core/src/vision_models/qwen2vl/text.rs:400-517 — These 4 members are variants of one another: a block of 31 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, 19 shared lines) · ×2
Near-duplicate member family (4 members, 19 shared lines) mistralrs-core/src/models/deepseek2.rs:517— mistralrs-core/src/models/deepseek2.rs:517-594 | mistralrs-core/src/models/deepseek3.rs:530-646 | mistralrs-core/src/models/glm4_moe.rs:451-499 | mistralrs-core/src/models/glm4_moe_lite.rs:548-603 — These 4 members are variants of one another: a block of 19 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, 19 shared lines) mistralrs-core/src/models/glm4_moe.rs:857— mistralrs-core/src/models/glm4_moe.rs:857-895 | mistralrs-core/src/models/glm4_moe.rs:897-940 | mistralrs-core/src/models/glm4_moe_lite.rs:994-1035 | mistralrs-core/src/models/glm4_moe_lite.rs:1037-1091 — These 4 members are variants of one another: a block of 19 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 (96 shared lines) mistralrs-core/src/ops.rs:548— mistralrs-core/src/ops.rs:548-702 | mistralrs-core/src/ops.rs:710-842 — These two members are variants of one another: 96 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 (96 shared lines) scripts/production_soak.py:3146— scripts/production_soak.py:3146-3543 | scripts/production_soak.py:3867-4286 — These two members are variants of one another: 96 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 (73 shared lines) mistralrs-quant/src/cutile/fused_moe.rs:464— mistralrs-quant/src/cutile/fused_moe.rs:464-593 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:880-1033 — These two members are variants of one another: 73 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 (73 shared lines) mistralrs-core/src/vision_models/gemma3n/audio.rs:292— mistralrs-core/src/vision_models/gemma3n/audio.rs:292-408 | mistralrs-core/src/vision_models/gemma4/audio.rs:113-203 — These two members are variants of one another: 73 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 (63 shared lines) mistralrs-quant/src/blockwise_fp8/ops.rs:509— mistralrs-quant/src/blockwise_fp8/ops.rs:509-612 | mistralrs-quant/src/blockwise_fp8/ops.rs:632-775 — These two members are variants of one another: 63 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 (63 shared lines) mistralrs-core/src/pipeline/multimodal.rs:2453— mistralrs-core/src/pipeline/multimodal.rs:2453-2655 | mistralrs-core/src/pipeline/normal.rs:2160-2290 — These two members are variants of one another: 63 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) mistralrs-core/src/models/phi3.rs:407— mistralrs-core/src/models/phi3.rs:407-532 | mistralrs-core/src/vision_models/phi3/mod.rs:1209-1317 — 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 (54 shared lines) mistralrs-quant/src/cublaslt/api.rs:54— mistralrs-quant/src/cublaslt/api.rs:54-228 | mistralrs-quant/src/cublaslt/api.rs:366-456 — 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 (50 shared lines) mistralrs-core/src/xlora_models/mixtral.rs:354— mistralrs-core/src/xlora_models/mixtral.rs:354-421 | mistralrs-core/src/xlora_models/quantized_llama.rs:94-168 — These two members are variants of one another: 50 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 (50 shared lines) mistralrs/src/model_builder_trait.rs:530— mistralrs/src/model_builder_trait.rs:530-603 | mistralrs/src/model_builder_trait.rs:608-682 — These two members are variants of one another: 50 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 (49 shared lines) mistralrs-core/src/cuda/gdn.rs:4803— mistralrs-core/src/cuda/gdn.rs:4803-5040 | mistralrs-core/src/cuda/gdn.rs:5069-5195 — These two members are variants of one another: 49 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 (49 shared lines) mistralrs-quant/src/blockwise_fp8/ops.rs:632— mistralrs-quant/src/blockwise_fp8/ops.rs:632-775 | mistralrs-quant/src/vector_fp8/ops.rs:323-452 — These two members are variants of one another: 49 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 (47 shared lines) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7688— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7688-7754 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8210-8292 — These two members are variants of one another: 47 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 (47 shared lines) mistralrs-core/src/moe/experts/mod.rs:109— mistralrs-core/src/moe/experts/mod.rs:109-190 | mistralrs-core/src/moe/experts/mod.rs:201-261 — These two members are variants of one another: 47 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) mistralrs-core/src/models/llama.rs:345— mistralrs-core/src/models/llama.rs:345-468 | mistralrs-core/src/models/mistral.rs:414-565 — 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 (37 shared lines) mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:78— mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:78-232 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:558-699 — 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 (34 shared lines) mistralrs-core/src/models/phi3.rs:407— mistralrs-core/src/models/phi3.rs:407-532 | mistralrs-core/src/vision_models/phi4/mod.rs:330-438 — These two members are variants of one another: 34 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 (34 shared lines) mistralrs-quant/src/lib.rs:2573— mistralrs-quant/src/lib.rs:2573-2700 | mistralrs-quant/src/lib.rs:2711-2859 — These two members are variants of one another: 34 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 (19 corresponding lines) · ×2
Edited copy of a member (19 corresponding lines) mistralrs-core/src/vision_models/gemma3/text.rs:182— mistralrs-core/src/vision_models/gemma3/text.rs:182-302 | mistralrs-core/src/xlora_models/starcoder2.rs:209-283 — 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) mistralrs-core/src/vision_models/idefics3/vision.rs:242— mistralrs-core/src/vision_models/idefics3/vision.rs:242-269 | mistralrs-core/src/vision_models/siglip.rs:246-267 — 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· Members sharing a duplicated core (14 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (14 members, 50+ identical tokens) mistralrs-core/src/models/deepseek2.rs:950— mistralrs-core/src/models/deepseek2.rs:950-975 | mistralrs-core/src/models/deepseek3.rs:1013-1038 | mistralrs-core/src/models/flint.rs:919-976 | mistralrs-core/src/models/gemma.rs:462-488 | mistralrs-core/src/models/glm4.rs:579-606 | mistralrs-core/src/models/glm4_moe.rs:829-853 | mistralrs-core/src/models/glm4_moe_lite.rs:966-990 | mistralrs-core/src/models/hunyuan_v1_dense.rs:541-568 | mistralrs-core/src/models/hunyuan_v1_moe.rs:1035-1062 | mistralrs-core/src/models/mistral.rs:588-616 | mistralrs-core/src/models/mixtral.rs:526-554 | mistralrs-core/src/models/phi2.rs:542-567 | mistralrs-core/src/models/qwen3.rs:542-570 | mistralrs-core/src/models/qwen3_moe.rs:722-751 — 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.
Members sharing a duplicated core (14 members, 50+ identical tokens) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:396— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:396-690 | mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:323-458 | mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1039-1699 | mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:423-670 | mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:436-712 | mistralrs-core/src/vision_models/lfm2_vl/inputs_processor.rs:660-789 | mistralrs-core/src/vision_models/llama4/inputs_processor.rs:406-613 | mistralrs-core/src/vision_models/minicpmo/inputs_processor.rs:311-585 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:268-481 | mistralrs-core/src/vision_models/mllama/inputs_processor.rs:334-663 | mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:366-973 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:932-1538 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1033-1667 | mistralrs-core/src/vision_models/voxtral/inputs_processor.rs:209-363 — 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.
Duplicated block (67 lines × 2) mistralrs-core/src/models/deepseek2.rs:414— mistralrs-core/src/models/deepseek2.rs:414-480 | mistralrs-core/src/models/deepseek3.rs:415-481 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (67 lines × 2) mistralrs-core/src/vision_models/qwen3_vl/mod.rs:904— mistralrs-core/src/vision_models/qwen3_vl/mod.rs:904-970 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:349-415 — `mistralrs-core/src/vision_models/qwen3_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/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 29 separate duplicated blocks between them, totalling at least 505 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 (58 lines × 2) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3160— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3160-3217 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3493-3550 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (58 lines × 2) mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:362— mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:362-419 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:478-535 — `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.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 52 separate duplicated blocks between them, totalling at least 1117 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 (50 lines × 3) mistralrs-core/src/models/llama.rs:639— mistralrs-core/src/models/llama.rs:639-688 | mistralrs-core/src/models/smollm3.rs:658-707 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:655-704 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 51 separate duplicated blocks between them, totalling at least 710 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (50 lines × 3) REDACTED:355— REDACTED:355-404 | mistralrs-core/src/vision_models/idefics3/vision.rs:167-216 | mistralrs-core/src/vision_models/siglip.rs:168-217 — before extracting anything, compare `REDACTED` and `mistralrs-core/src/vision_models/idefics3/vision.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 213 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 (42 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:1067— mistralrs-core/src/pipeline/multimodal.rs:1067-1108 | mistralrs-core/src/pipeline/normal.rs:1087-1128 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (42 lines × 2) mistralrs-core/src/vision_models/phi3/mod.rs:270— mistralrs-core/src/vision_models/phi3/mod.rs:270-311 | mistralrs-core/src/vision_models/phi4/mod.rs:139-180 — `mistralrs-core/src/vision_models/phi3/mod.rs` and `mistralrs-core/src/vision_models/phi4/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 46 separate duplicated blocks between them, totalling at least 537 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 (41 lines × 2) mistralrs-core/src/vision_models/qwen3_5/mod.rs:154— mistralrs-core/src/vision_models/qwen3_5/mod.rs:154-194 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:137-177 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (41 lines × 2) mistralrs-core/src/vision_models/qwen3_5/text.rs:883— mistralrs-core/src/vision_models/qwen3_5/text.rs:883-923 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:583-623 — `mistralrs-core/src/vision_models/qwen3_5/text.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 26 separate duplicated blocks between them, totalling at least 428 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 (38 lines × 2) mistralrs-core/src/models/granite.rs:1464— mistralrs-core/src/models/granite.rs:1464-1501 | mistralrs-core/src/models/granite.rs:1750-1787 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (38 lines × 2) mistralrs-vision/src/pad.rs:32— mistralrs-vision/src/pad.rs:32-69 | mistralrs-vision/src/pad.rs:72-109 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (36 lines × 2) mistralrs-core/src/pipeline/mod.rs:2122— mistralrs-core/src/pipeline/mod.rs:2122-2157 | mistralrs-core/src/pipeline/mod.rs:2719-2754 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (36 lines × 2) mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:519— mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:519-554 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:688-723 — `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.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 52 separate duplicated blocks between them, totalling at least 1117 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 (35 lines × 3) mistralrs-core/src/models/deepseek2.rs:394— mistralrs-core/src/models/deepseek2.rs:394-428 | mistralrs-core/src/models/deepseek3.rs:395-429 | mistralrs-core/src/models/glm4_moe_lite.rs:359-393 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (35 lines × 3) mistralrs-core/src/models/flint.rs:243— mistralrs-core/src/models/flint.rs:243-277 | mistralrs-core/src/models/hunyuan_v1_dense.rs:113-147 | mistralrs-core/src/models/hunyuan_v1_moe.rs:290-324 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/hunyuan_v1_dense.rs` as WHOLE FILES: this scan already matched 34 separate duplicated blocks between them, totalling at least 415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (32 lines × 3) mistralrs-quant/src/afq/ops.rs:2058— mistralrs-quant/src/afq/ops.rs:2058-2089 | mistralrs-quant/src/afq/ops.rs:2176-2207 | mistralrs-quant/src/afq/ops.rs:2296-2327 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (32 lines × 3) mistralrs-quant/src/gguf/fast_mmvq.rs:787— mistralrs-quant/src/gguf/fast_mmvq.rs:787-818 | mistralrs-quant/src/gguf/fast_mmvq.rs:842-873 | mistralrs-quant/src/gguf/fast_mmvq.rs:897-928 — 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 (30–31 lines × 2) mistralrs-core/src/models/qwen3_next.rs:438— mistralrs-core/src/models/qwen3_next.rs:438-468 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:343-372 — before extracting anything, compare `mistralrs-core/src/models/qwen3_next.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/text.rs` as WHOLE FILES: this scan already matched 29 separate duplicated blocks between them, totalling at least 433 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 (30–31 lines × 2) mistralrs-core/src/models/qwen3_next.rs:1084— mistralrs-core/src/models/qwen3_next.rs:1084-1114 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:872-901 — before extracting anything, compare `mistralrs-core/src/models/qwen3_next.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/text.rs` as WHOLE FILES: this scan already matched 29 separate duplicated blocks between them, totalling at least 433 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 (27–30 lines × 2) mistralrs-core/src/models/qwen3_next.rs:482— mistralrs-core/src/models/qwen3_next.rs:482-511 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:386-412 — before extracting anything, compare `mistralrs-core/src/models/qwen3_next.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/text.rs` as WHOLE FILES: this scan already matched 29 separate duplicated blocks between them, totalling at least 433 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 (27–30 lines × 2) mistralrs-core/src/moe/experts/backends.rs:911— mistralrs-core/src/moe/experts/backends.rs:911-940 | mistralrs-core/src/moe/experts/backends.rs:992-1018 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1089— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1089-1117 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1654-1682 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1850-1878 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (29 lines × 3) mistralrs-quant/src/gguf/fast_mmvq.rs:568— mistralrs-quant/src/gguf/fast_mmvq.rs:568-596 | mistralrs-quant/src/gguf/fast_mmvq.rs:607-635 | mistralrs-quant/src/gguf/fast_mmvq.rs:646-674 — 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 (26–29 lines × 2) mistralrs-core/src/gguf/llama4_bindings.rs:51— mistralrs-core/src/gguf/llama4_bindings.rs:51-76 | mistralrs-core/src/gguf/multimodal_binding_utils.rs:220-248 — 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 (26–29 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7713— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7713-7738 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8235-8263 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (28 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1044— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1044-1071 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1609-1636 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1796-1823 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (28 lines × 3) mistralrs-paged-attn/src/cuda/backend/mla.rs:456— mistralrs-paged-attn/src/cuda/backend/mla.rs:456-483 | mistralrs-paged-attn/src/cuda/backend/mla.rs:515-542 | mistralrs-paged-attn/src/cuda/backend/mla.rs:574-601 — 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 (25–27 lines × 2) mistralrs-core/src/xlora_models/mixtral.rs:397— mistralrs-core/src/xlora_models/mixtral.rs:397-421 | mistralrs-core/src/xlora_models/quantized_llama.rs:137-163 — before extracting anything, compare `mistralrs-core/src/xlora_models/mixtral.rs` and `mistralrs-core/src/xlora_models/quantized_llama.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (25–27 lines × 2) mistralrs/src/gguf_lora_model.rs:43— mistralrs/src/gguf_lora_model.rs:43-69 | mistralrs/src/gguf_xlora_model.rs:50-74 — 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 (24–26 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:2035— mistralrs-core/src/pipeline/multimodal.rs:2035-2060 | mistralrs-core/src/pipeline/normal.rs:1862-1885 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (24–26 lines × 2) mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:345— mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:345-370 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:316-339 — before extracting anything, compare `mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs` and `mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 316 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 (24–25 lines × 2) mistralrs-code-exec/src/lib.rs:339— mistralrs-code-exec/src/lib.rs:339-363 | mistralrs-code-exec/src/shell.rs:354-377 — before extracting anything, compare `mistralrs-code-exec/src/lib.rs` and `mistralrs-code-exec/src/shell.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (24–25 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:762— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:762-785 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1326-1350 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (24 lines × 3) mistralrs-core/src/models/deepseek2.rs:848— mistralrs-core/src/models/deepseek2.rs:848-871 | mistralrs-core/src/models/deepseek3.rs:911-934 | mistralrs-core/src/models/glm4_moe_lite.rs:858-881 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (24 lines × 3) REDACTED:328— REDACTED:328-351 | mistralrs-core/src/vision_models/idefics3/vision.rs:140-163 | mistralrs-core/src/vision_models/siglip.rs:136-159 — before extracting anything, compare `REDACTED` and `mistralrs-core/src/vision_models/idefics3/vision.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 213 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 × 4) mistralrs-core/src/models/deepseek2.rs:821— mistralrs-core/src/models/deepseek2.rs:821-843 | mistralrs-core/src/models/deepseek3.rs:884-906 | mistralrs-core/src/models/glm4_moe.rs:721-743 | mistralrs-core/src/models/glm4_moe_lite.rs:831-853 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (23 lines × 4) mistralrs-core/src/xlora_models/gemma.rs:322— mistralrs-core/src/xlora_models/gemma.rs:322-344 | mistralrs-core/src/xlora_models/gemma2.rs:331-353 | mistralrs-core/src/xlora_models/mistral.rs:318-340 | mistralrs-core/src/xlora_models/starcoder2.rs:307-329 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 3) mistralrs-core/src/models/deepseek2.rs:256— mistralrs-core/src/models/deepseek2.rs:256-277 | mistralrs-core/src/models/deepseek3.rs:257-278 | mistralrs-core/src/models/glm4_moe_lite.rs:217-238 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 3) mistralrs-core/src/pipeline/inputs_processor.rs:2737— mistralrs-core/src/pipeline/inputs_processor.rs:2737-2758 | mistralrs-core/src/pipeline/inputs_processor.rs:2781-2802 | mistralrs-core/src/pipeline/inputs_processor.rs:2830-2851 — 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 (21–22 lines × 2) mistralrs-core/src/ops.rs:626— mistralrs-core/src/ops.rs:626-647 | mistralrs-core/src/ops.rs:782-802 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21–22 lines × 2) mistralrs-quant/src/metal_kernels/mod.rs:3384— mistralrs-quant/src/metal_kernels/mod.rs:3384-3405 | mistralrs-quant/src/metal_kernels/mod.rs:3514-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.
Duplicated block (21 lines × 3) mistralrs-core/src/pipeline/embedding.rs:420— mistralrs-core/src/pipeline/embedding.rs:420-440 | mistralrs-core/src/pipeline/multimodal.rs:961-981 | mistralrs-core/src/pipeline/normal.rs:958-978 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 3) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:65— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:65-85 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:271-291 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:191-211 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/embedding_loaders.rs` and `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (20–21 lines × 3) mistralrs-core/src/xlora_models/mistral.rs:443— mistralrs-core/src/xlora_models/mistral.rs:443-462 | mistralrs-core/src/xlora_models/mixtral.rs:573-593 | mistralrs-core/src/xlora_models/starcoder2.rs:432-451 — before extracting anything, compare `mistralrs-core/src/xlora_models/mistral.rs` and `mistralrs-core/src/xlora_models/mixtral.rs` as WHOLE FILES: this scan already matched 52 separate duplicated blocks between them, totalling at least 769 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (20–21 lines × 3) mistralrs-pyo3/src/util.rs:221— mistralrs-pyo3/src/util.rs:221-241 | mistralrs-pyo3/src/util.rs:276-295 | mistralrs-pyo3/src/util.rs:336-355 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (18–20 lines × 2) mistralrs-core/src/layers.rs:3966— mistralrs-core/src/layers.rs:3966-3985 | mistralrs-core/src/layers.rs:3994-4011 — both copies are in the same file, so extract the block into 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–20 lines × 2) mistralrs-core/src/utils/progress.rs:88— mistralrs-core/src/utils/progress.rs:88-107 | mistralrs-core/src/utils/progress.rs:185-202 — both copies are in the same file, so extract the block into 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–18 lines × 2) mistralrs-core/src/models/qwen3_moe.rs:767— mistralrs-core/src/models/qwen3_moe.rs:767-782 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:731-748 — before extracting anything, compare `mistralrs-core/src/models/qwen3_moe.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 316 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–18 lines × 2) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:304— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:304-319 | mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:442-459 — both copies are in the same file, so extract the block into 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–16 lines × 7) mistralrs-core/src/models/glm4.rs:276— mistralrs-core/src/models/glm4.rs:276-291 | mistralrs-core/src/models/glm4_moe.rs:341-356 | mistralrs-core/src/models/granite.rs:1602-1617 | mistralrs-core/src/vision_models/phi3/mod.rs:307-322 | mistralrs-core/src/vision_models/phi4/mod.rs:176-191 | mistralrs-core/src/vision_models/qwen3_5/text.rs:396-410 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:261-275 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/glm4_moe.rs` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 341 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15–16 lines × 7) mistralrs-core/src/xlora_models/gemma.rs:459— mistralrs-core/src/xlora_models/gemma.rs:459-474 | mistralrs-core/src/xlora_models/gemma2.rs:490-504 | mistralrs-core/src/xlora_models/mistral.rs:456-470 | mistralrs-core/src/xlora_models/mixtral.rs:586-601 | mistralrs-core/src/xlora_models/phi2.rs:442-456 | mistralrs-core/src/xlora_models/phi3.rs:415-429 | mistralrs-core/src/xlora_models/starcoder2.rs:445-459 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/pipeline/multimodal.rs:1156— mistralrs-core/src/pipeline/multimodal.rs:1156-1171 | mistralrs-core/src/pipeline/multimodal.rs:1265-1280 | mistralrs-core/src/pipeline/normal.rs:1202-1217 | mistralrs-core/src/pipeline/normal.rs:1335-1350 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/xlora_models/gemma2.rs:611— mistralrs-core/src/xlora_models/gemma2.rs:611-626 | mistralrs-core/src/xlora_models/phi2.rs:545-560 | mistralrs-core/src/xlora_models/phi3.rs:523-538 | mistralrs-core/src/xlora_models/starcoder2.rs:556-571 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma2.rs` and `mistralrs-core/src/xlora_models/phi2.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 297 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15 lines × 5) mistralrs-core/src/pipeline/multimodal.rs:1161— mistralrs-core/src/pipeline/multimodal.rs:1161-1175 | mistralrs-core/src/pipeline/multimodal.rs:1211-1225 | mistralrs-core/src/pipeline/normal.rs:1207-1221 | mistralrs-core/src/pipeline/normal.rs:1257-1271 | mistralrs-core/src/pipeline/normal.rs:1340-1354 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15 lines × 5) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:222— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:222-236 | mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:512-526 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:788-802 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1120-1134 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1180-1194 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (13–15 lines × 3) mistralrs-core/src/models/quantized_llama.rs:86— mistralrs-core/src/models/quantized_llama.rs:86-98 | mistralrs-core/src/xlora_models/quantized_llama.rs:214-226 | mistralrs-core/src/xlora_models/quantized_phi3.rs:167-181 — `mistralrs-core/src/models/quantized_llama.rs` and `mistralrs-core/src/xlora_models/quantized_llama.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 5 separate duplicated blocks between them, totalling at least 59 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 (13–15 lines × 3) mistralrs-core/src/sampler.rs:1170— mistralrs-core/src/sampler.rs:1170-1184 | mistralrs-core/src/sampler.rs:1250-1264 | mistralrs-core/src/sampler.rs:1867-1879 — 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 (14–15 lines × 3) mistralrs-core/src/pipeline/gguf.rs:704— mistralrs-core/src/pipeline/gguf.rs:704-718 | mistralrs-core/src/pipeline/gguf.rs:845-858 | mistralrs-core/src/pipeline/gguf.rs:990-1003 — 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 (14–15 lines × 3) mistralrs-core/src/vision_models/gemma3n/audio_processing.rs:127— mistralrs-core/src/vision_models/gemma3n/audio_processing.rs:127-141 | mistralrs-core/src/vision_models/gemma4/audio_processing.rs:337-351 | mistralrs-core/src/vision_models/voxtral/audio_processing.rs:91-104 — `mistralrs-core/src/vision_models/gemma3n/audio_processing.rs` and `mistralrs-core/src/vision_models/gemma4/audio_processing.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 38 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 (14 lines × 8) mistralrs-core/src/models/deepseek2.rs:723— mistralrs-core/src/models/deepseek2.rs:723-736 | mistralrs-core/src/models/deepseek3.rs:786-799 | mistralrs-core/src/models/glm4_moe.rs:623-636 | mistralrs-core/src/models/glm4_moe_lite.rs:732-745 | mistralrs-core/src/xlora_models/llama.rs:355-368 | mistralrs-core/src/xlora_models/mistral.rs:335-348 | mistralrs-core/src/xlora_models/mixtral.rs:462-475 | mistralrs-core/src/xlora_models/phi3.rs:300-313 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 8) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:576— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:576-589 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2469-2482 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3179-3192 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3521-3534 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6429-6442 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1283-1296 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2440-2453 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5820-5833 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/embedding_loaders.rs` and `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 6) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1058— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1058-1071 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5040-5053 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:839-852 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1971-1984 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2915-2928 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3803-3816 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 6) mistralrs-core/src/pipeline/multimodal.rs:1136— mistralrs-core/src/pipeline/multimodal.rs:1136-1149 | mistralrs-core/src/pipeline/multimodal.rs:1193-1206 | mistralrs-core/src/pipeline/multimodal.rs:1245-1258 | mistralrs-core/src/pipeline/normal.rs:1182-1195 | mistralrs-core/src/pipeline/normal.rs:1239-1252 | mistralrs-core/src/pipeline/normal.rs:1315-1328 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 4) mistralrs-core/src/xlora_models/gemma.rs:195— mistralrs-core/src/xlora_models/gemma.rs:195-208 | mistralrs-core/src/xlora_models/mistral.rs:184-197 | mistralrs-core/src/xlora_models/mixtral.rs:97-110 | mistralrs-core/src/xlora_models/phi3.rs:76-89 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/mistral.rs` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 4) mistralrs-quant/src/distributed/layers.rs:888— mistralrs-quant/src/distributed/layers.rs:888-901 | mistralrs-quant/src/distributed/layers.rs:1355-1368 | mistralrs-quant/src/distributed/layers.rs:2015-2028 | mistralrs-quant/src/distributed/layers.rs:2231-2244 — 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 (13–14 lines × 3) mistralrs-quant/src/mxfp4/ops.rs:464— mistralrs-quant/src/mxfp4/ops.rs:464-476 | mistralrs-quant/src/mxfp4/ops.rs:481-494 | mistralrs-quant/src/mxfp4/ops.rs:499-512 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13–14 lines × 3) mistralrs-quant/src/mxfp4/ops.rs:551— mistralrs-quant/src/mxfp4/ops.rs:551-563 | mistralrs-quant/src/mxfp4/ops.rs:568-581 | mistralrs-quant/src/mxfp4/ops.rs:586-599 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12–13 lines × 8) mistralrs-core/src/models/deepseek2.rs:954— mistralrs-core/src/models/deepseek2.rs:954-966 | mistralrs-core/src/models/deepseek3.rs:1017-1029 | mistralrs-core/src/models/gemma.rs:467-479 | mistralrs-core/src/models/glm4_moe.rs:833-844 | mistralrs-core/src/models/glm4_moe_lite.rs:970-981 | mistralrs-core/src/models/llama.rs:495-507 | mistralrs-core/src/models/phi2.rs:546-558 | mistralrs-core/src/models/smollm3.rs:514-526 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 8) mistralrs-core/src/models/mixtral.rs:479— mistralrs-core/src/models/mixtral.rs:479-490 | mistralrs-core/src/models/qwen2.rs:510-521 | mistralrs-core/src/vision_models/gemma3/text.rs:529-541 | mistralrs-core/src/vision_models/gemma3n/text.rs:1469-1481 | mistralrs-core/src/vision_models/phi3/mod.rs:1273-1284 | mistralrs-core/src/vision_models/phi4/mod.rs:388-399 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:474-485 | mistralrs-core/src/vision_models/qwen2vl/text.rs:476-487 — before extracting anything, compare `mistralrs-core/src/models/mixtral.rs` and `mistralrs-core/src/models/qwen2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 528 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–12 lines × 3) mistralrs-quant/src/afq/ops.rs:2382— mistralrs-quant/src/afq/ops.rs:2382-2392 | mistralrs-quant/src/afq/ops.rs:2502-2512 | mistralrs-quant/src/afq/ops.rs:3030-3041 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11–12 lines × 3) mistralrs-quant/src/cutile/fp8_gemm.rs:353— mistralrs-quant/src/cutile/fp8_gemm.rs:353-364 | mistralrs-quant/src/cutile/fp8_w8a8.rs:596-607 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:919-929 — before extracting anything, compare `mistralrs-quant/src/cutile/fp8_gemm.rs` and `mistralrs-quant/src/cutile/fp8_w8a8.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–12 lines × 2) mistralrs-core/src/vision_models/gemma3n/audio.rs:1392— mistralrs-core/src/vision_models/gemma3n/audio.rs:1392-1403 | mistralrs-core/src/vision_models/gemma4/audio.rs:1075-1083 — `mistralrs-core/src/vision_models/gemma3n/audio.rs` and `mistralrs-core/src/vision_models/gemma4/audio.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 16 separate duplicated blocks between them, totalling at least 279 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 (9–12 lines × 2) mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:190— mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:190-198 | mistralrs-core/src/vision_models/phi4/inputs_processor.rs:217-228 — 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 (3–11 lines × 4) mistralrs-quant/src/afq/ops.rs:2408— mistralrs-quant/src/afq/ops.rs:2408-2418 | mistralrs-quant/src/afq/ops.rs:2650-2660 | mistralrs-quant/src/afq/ops.rs:3207-3209 | mistralrs-quant/src/afq/ops.rs:3211-3221 — 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 (3–11 lines × 4) mistralrs-core/src/layers.rs:938— mistralrs-core/src/layers.rs:938-940 | mistralrs-core/src/layers.rs:957-966 | mistralrs-core/src/layers.rs:2261-2263 | mistralrs-core/src/layers.rs:2280-2290 — 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 (9–11 lines × 2) mistralrs-core/src/engine/mod.rs:2255— mistralrs-core/src/engine/mod.rs:2255-2265 | mistralrs-core/src/engine/mod.rs:2366-2374 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–11 lines × 2) mistralrs-core/src/kv_cache/mod.rs:1261— mistralrs-core/src/kv_cache/mod.rs:1261-1269 | mistralrs-core/src/kv_cache/mod.rs:1322-1332 — both copies are in the same file, so extract the block into 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 × 9) mistralrs-core/src/embedding_models/embedding_gemma.rs:431— mistralrs-core/src/embedding_models/embedding_gemma.rs:431-440 | mistralrs-core/src/vision_models/gemma3/text.rs:490-499 | mistralrs-core/src/vision_models/gemma4/text.rs:1716-1725 | mistralrs-core/src/vision_models/phi3/mod.rs:1241-1250 | mistralrs-core/src/vision_models/phi4/mod.rs:356-365 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:437-446 | mistralrs-core/src/vision_models/qwen2vl/text.rs:439-448 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:427-436 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:547-556 — before extracting anything, compare `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/vision_models/gemma3/text.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 268 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 × 9) mistralrs-quant/src/cutile/fp8_gemm.rs:349— mistralrs-quant/src/cutile/fp8_gemm.rs:349-358 | mistralrs-quant/src/cutile/fp8_gemm.rs:359-368 | mistralrs-quant/src/cutile/fp8_w8a16.rs:561-570 | mistralrs-quant/src/cutile/fp8_w8a8.rs:592-601 | mistralrs-quant/src/cutile/fp8_w8a8.rs:602-611 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:924-933 | mistralrs-quant/src/cutile/nvfp4_gemv.rs:324-333 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1196-1205 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1454-1463 — before extracting anything, compare `mistralrs-quant/src/cutile/fp8_gemm.rs` and `mistralrs-quant/src/cutile/fp8_w8a16.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 8) mistralrs-core/src/embedding_models/embedding_gemma.rs:430— mistralrs-core/src/embedding_models/embedding_gemma.rs:430-439 | mistralrs-core/src/models/qwen3_next.rs:821-830 | mistralrs-core/src/vision_models/gemma3/text.rs:489-498 | mistralrs-core/src/vision_models/gemma4/text.rs:1715-1724 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:444-453 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:472-481 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:426-435 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:546-555 — before extracting anything, compare `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/vision_models/gemma3/text.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 268 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 × 8) mistralrs-quant/src/cutile/fused_moe.rs:83— mistralrs-quant/src/cutile/fused_moe.rs:83-92 | mistralrs-quant/src/cutile/fused_moe.rs:124-133 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:96-105 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:135-144 | mistralrs-quant/src/cutile/gdn_prefill.rs:268-277 | mistralrs-quant/src/cutile/qsa.rs:99-108 | mistralrs-quant/src/cutile/qsa.rs:305-314 | mistralrs-quant/src/cutile/qsa.rs:362-371 — before extracting anything, compare `mistralrs-quant/src/cutile/fused_moe.rs` and `mistralrs-quant/src/cutile/fused_moe_fp8.rs` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 308 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 7) mistralrs-core/src/pipeline/multimodal.rs:1136— mistralrs-core/src/pipeline/multimodal.rs:1136-1145 | mistralrs-core/src/pipeline/multimodal.rs:1193-1202 | mistralrs-core/src/pipeline/multimodal.rs:1245-1254 | mistralrs-core/src/pipeline/normal.rs:1129-1138 | mistralrs-core/src/pipeline/normal.rs:1182-1191 | mistralrs-core/src/pipeline/normal.rs:1239-1248 | mistralrs-core/src/pipeline/normal.rs:1315-1324 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 7) mistralrs-core/src/xlora_models/gemma.rs:603— mistralrs-core/src/xlora_models/gemma.rs:603-613 | mistralrs-core/src/xlora_models/mistral.rs:599-609 | mistralrs-core/src/xlora_models/mixtral.rs:729-739 | mistralrs-core/src/xlora_models/phi2.rs:569-578 | mistralrs-core/src/xlora_models/quantized_llama.rs:805-814 | mistralrs-core/src/xlora_models/quantized_phi3.rs:473-482 | mistralrs-core/src/xlora_models/starcoder2.rs:584-594 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/mistral.rs` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–10 lines × 5) mistralrs-core/src/embedding_models/qwen3_embedding.rs:446— mistralrs-core/src/embedding_models/qwen3_embedding.rs:446-455 | mistralrs-core/src/xlora_models/mistral.rs:588-596 | mistralrs-core/src/xlora_models/mixtral.rs:718-726 | mistralrs-core/src/xlora_models/phi3.rs:539-548 | mistralrs-core/src/xlora_models/starcoder2.rs:572-581 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/xlora_models/mistral.rs` as WHOLE FILES: this scan already matched 8 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. 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 (9–10 lines × 5) mistralrs-core/src/models/deepseek2.rs:814— mistralrs-core/src/models/deepseek2.rs:814-823 | mistralrs-core/src/models/deepseek3.rs:877-886 | mistralrs-core/src/models/glm4_moe.rs:714-723 | mistralrs-core/src/models/glm4_moe_lite.rs:824-833 | mistralrs-core/src/models/gpt_oss.rs:720-728 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 7) mistralrs-paged-attn/src/cuda/backend/fa3.rs:460— mistralrs-paged-attn/src/cuda/backend/fa3.rs:460-468 | mistralrs-quant/src/cutile/fp8_gemm.rs:356-364 | mistralrs-quant/src/cutile/fp8_w8a8.rs:599-607 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:921-929 | mistralrs-quant/src/cutile/nvfp4_gemv.rs:321-329 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1193-1201 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1451-1459 — before extracting anything, compare `mistralrs-paged-attn/src/cuda/backend/fa3.rs` and `mistralrs-quant/src/cutile/nvfp4_gemv.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. 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 (9 lines × 7) mistralrs-paged-attn/src/cuda/backend/fa3.rs:495— mistralrs-paged-attn/src/cuda/backend/fa3.rs:495-503 | mistralrs-quant/src/cutile/fp8_gemm.rs:351-359 | mistralrs-quant/src/cutile/fp8_w8a8.rs:594-602 | mistralrs-quant/src/cutile/gdn_prefill.rs:707-715 | mistralrs-quant/src/cutile/nvfp4_gemv.rs:326-334 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1198-1206 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:1456-1464 — before extracting anything, compare `mistralrs-paged-attn/src/cuda/backend/fa3.rs` and `mistralrs-quant/src/cutile/nvfp4_gemv.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. 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–9 lines × 4) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:993— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:993-1000 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1558-1565 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1687-1694 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1729-1737 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (8–9 lines × 4) mistralrs-quant/src/metal_kernels/mod.rs:1285— mistralrs-quant/src/metal_kernels/mod.rs:1285-1293 | mistralrs-quant/src/metal_kernels/mod.rs:1433-1441 | mistralrs-quant/src/metal_kernels/mod.rs:4731-4739 | mistralrs-quant/src/metal_kernels/mod.rs:4795-4802 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7–9 lines × 3) mistralrs-code-exec/src/lib.rs:462— mistralrs-code-exec/src/lib.rs:462-469 | mistralrs-code-exec/src/shell.rs:198-206 | mistralrs-code-exec/src/shell.rs:259-265 — before extracting anything, compare `mistralrs-code-exec/src/lib.rs` and `mistralrs-code-exec/src/shell.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–9 lines × 3) mistralrs-quant/src/uqff/reader.rs:242— mistralrs-quant/src/uqff/reader.rs:242-248 | mistralrs-quant/src/uqff/reader.rs:264-272 | mistralrs-quant/src/uqff/reader.rs:289-295 — 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 × 12) mistralrs-core/src/models/flint.rs:740— mistralrs-core/src/models/flint.rs:740-747 | mistralrs-core/src/models/gemma.rs:312-319 | mistralrs-core/src/models/gpt_oss.rs:682-689 | mistralrs-core/src/models/hunyuan_v1_dense.rs:339-346 | mistralrs-core/src/models/hunyuan_v1_moe.rs:829-836 | mistralrs-core/src/models/mistral.rs:360-367 | mistralrs-core/src/models/mixtral.rs:369-376 | mistralrs-core/src/models/phi3.rs:373-380 | mistralrs-core/src/models/qwen3.rs:348-355 | mistralrs-core/src/models/qwen3_moe.rs:522-529 | mistralrs-core/src/vision_models/phi3/mod.rs:464-471 | mistralrs-core/src/vision_models/phi4/mod.rs:294-301 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 12) mistralrs-core/src/models/gemma.rs:500— mistralrs-core/src/models/gemma.rs:500-508 | mistralrs-core/src/models/mistral.rs:628-636 | mistralrs-core/src/models/mixtral.rs:566-574 | mistralrs-core/src/models/phi3.rs:575-583 | mistralrs-core/src/models/qwen2.rs:630-638 | mistralrs-core/src/models/starcoder2.rs:567-575 | mistralrs-core/src/vision_models/llama4/vision.rs:352-360 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:577-584 | mistralrs-core/src/vision_models/phi3/mod.rs:1381-1389 | mistralrs-core/src/vision_models/phi4/mod.rs:643-651 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:568-576 | mistralrs-core/src/vision_models/qwen2vl/text.rs:570-578 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/mistral.rs` as WHOLE FILES: this scan already matched 34 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 8) mistralrs-core/src/vision_models/phi3/mod.rs:1230— mistralrs-core/src/vision_models/phi3/mod.rs:1230-1237 | mistralrs-core/src/vision_models/phi4/mod.rs:345-352 | mistralrs-core/src/xlora_models/gemma.rs:443-450 | mistralrs-core/src/xlora_models/gemma2.rs:474-481 | mistralrs-core/src/xlora_models/mistral.rs:440-447 | mistralrs-core/src/xlora_models/mixtral.rs:570-577 | mistralrs-core/src/xlora_models/phi2.rs:425-433 | mistralrs-core/src/xlora_models/phi3.rs:406-413 — `mistralrs-core/src/vision_models/phi3/mod.rs` and `mistralrs-core/src/vision_models/phi4/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 46 separate duplicated blocks between them, totalling at least 537 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 (8 lines × 8) mistralrs-core/src/vision_models/qwen3_5/mod.rs:220— mistralrs-core/src/vision_models/qwen3_5/mod.rs:220-227 | mistralrs-core/src/vision_models/qwen3_5/mod.rs:281-288 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:203-210 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:264-271 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:741-748 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:816-823 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:186-193 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:261-268 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (8 lines × 7) mistralrs-core/src/models/mixtral.rs:426— mistralrs-core/src/models/mixtral.rs:426-433 | mistralrs-core/src/models/qwen2.rs:453-461 | mistralrs-core/src/models/starcoder2.rs:423-431 | mistralrs-core/src/vision_models/llama4/text.rs:830-837 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:418-426 | mistralrs-core/src/vision_models/qwen2vl/text.rs:419-427 | mistralrs-core/src/xlora_models/starcoder2.rs:429-436 — before extracting anything, compare `mistralrs-core/src/models/mixtral.rs` and `mistralrs-core/src/models/qwen2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 528 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 7) mistralrs-quant/src/blockwise_fp8/deepgemm.rs:514— mistralrs-quant/src/blockwise_fp8/deepgemm.rs:514-521 | mistralrs-quant/src/blockwise_fp8/deepgemm.rs:523-530 | mistralrs-quant/src/blockwise_fp8/deepgemm.rs:607-615 | mistralrs-quant/src/blockwise_fp8/deepgemm.rs:617-624 | mistralrs-quant/src/blockwise_fp8/deepgemm.rs:626-633 | mistralrs-quant/src/blockwise_fp8/ops.rs:1887-1894 | mistralrs-quant/src/blockwise_fp8/ops.rs:1896-1903 — before extracting anything, compare `mistralrs-quant/src/blockwise_fp8/deepgemm.rs` and `mistralrs-quant/src/blockwise_fp8/ops.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.
Duplicated block (6–8 lines × 4) mistralrs-core/src/engine/mod.rs:2239— mistralrs-core/src/engine/mod.rs:2239-2246 | mistralrs-core/src/engine/mod.rs:2314-2321 | mistralrs-core/src/engine/mod.rs:2333-2340 | mistralrs-core/src/engine/mod.rs:2359-2364 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6–8 lines × 4) mistralrs-quant/src/blockwise_fp8/mod.rs:442— mistralrs-quant/src/blockwise_fp8/mod.rs:442-447 | mistralrs-quant/src/mxfp4/mod.rs:111-116 | mistralrs-quant/src/mxfp4/mod.rs:133-140 | mistralrs-quant/src/mxfp4/mod.rs:716-721 — 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 (7 lines × 6) mistralrs-core/src/xlora_models/gemma.rs:489— mistralrs-core/src/xlora_models/gemma.rs:489-495 | mistralrs-core/src/xlora_models/gemma2.rs:519-525 | mistralrs-core/src/xlora_models/mistral.rs:485-491 | mistralrs-core/src/xlora_models/mixtral.rs:616-622 | mistralrs-core/src/xlora_models/phi2.rs:471-477 | mistralrs-core/src/xlora_models/starcoder2.rs:473-479 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 6) mistralrs-quant/src/bitsandbytes/op.rs:421— mistralrs-quant/src/bitsandbytes/op.rs:421-427 | mistralrs-quant/src/hqq/hqq_op.rs:73-79 | mistralrs-quant/src/hqq/hqq_op.rs:184-190 | mistralrs-quant/src/hqq/hqq_op.rs:297-303 | mistralrs-quant/src/hqq/hqq_op.rs:414-420 | mistralrs-quant/src/hqq/hqq_op.rs:533-539 — 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.
Duplicated block (6–7 lines × 3) mistralrs-core/src/pipeline/diffusion.rs:165— mistralrs-core/src/pipeline/diffusion.rs:165-170 | mistralrs-core/src/pipeline/gguf.rs:1392-1398 | mistralrs-core/src/pipeline/speech.rs:268-273 — 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.
Duplicated block (6–7 lines × 3) mistralrs-quant/src/afq/ops.rs:1983— mistralrs-quant/src/afq/ops.rs:1983-1988 | mistralrs-quant/src/afq/ops.rs:2101-2106 | mistralrs-quant/src/afq/ops.rs:2220-2226 — 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–7 lines × 2) mistralrs-core/src/attention/backends/cpu/full.rs:522— mistralrs-core/src/attention/backends/cpu/full.rs:522-526 | mistralrs-core/src/attention/backends/cpu/full.rs:629-635 — both copies are in the same file, so extract the block into 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–7 lines × 2) mistralrs-quant/src/utils/ops.rs:2021— mistralrs-quant/src/utils/ops.rs:2021-2027 | mistralrs-quant/src/utils/ops.rs:2825-2829 — both copies are in the same file, so extract the block into 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 × 9) mistralrs-core/src/models/gemma.rs:187— mistralrs-core/src/models/gemma.rs:187-192 | mistralrs-core/src/models/gemma2.rs:228-233 | mistralrs-core/src/models/hunyuan_v1_dense.rs:211-216 | mistralrs-core/src/models/hunyuan_v1_moe.rs:394-399 | mistralrs-core/src/models/llama.rs:95-100 | mistralrs-core/src/models/mixtral.rs:171-176 | mistralrs-core/src/models/phi2.rs:283-288 | mistralrs-core/src/models/qwen2.rs:260-265 | mistralrs-core/src/models/starcoder2.rs:247-252 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 9) mistralrs-core/src/vision_models/qwen3_5/mod.rs:223— mistralrs-core/src/vision_models/qwen3_5/mod.rs:223-228 | mistralrs-core/src/vision_models/qwen3_5/mod.rs:284-289 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:206-211 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:267-272 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:744-749 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:819-824 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:189-194 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:264-269 | mistralrs-core/src/vision_models/qwen4_exp/mod.rs:332-337 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (6 lines × 7) mistralrs-paged-attn/src/cuda/backend/fa3.rs:188— mistralrs-paged-attn/src/cuda/backend/fa3.rs:188-193 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:127-132 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:317-322 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:609-614 | mistralrs-paged-attn/src/cuda/backend/mla.rs:35-40 | mistralrs-paged-attn/src/cuda/backend/mla.rs:322-327 | mistralrs-paged-attn/src/cuda/backend/mla.rs:685-690 — before extracting anything, compare `mistralrs-paged-attn/src/cuda/backend/flashinfer.rs` and `mistralrs-paged-attn/src/cuda/backend/mla.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 7) REDACTED:553— REDACTED:553-560 | mistralrs-core/src/vision_models/idefics3/vision.rs:350-357 | mistralrs-core/src/vision_models/lfm2_vl/vision.rs:279-284 | mistralrs-core/src/vision_models/muse_glimmer/vision.rs:424-429 | mistralrs-core/src/vision_models/muse_glimmer/vision.rs:516-521 | mistralrs-core/src/vision_models/qwen2vl/vision.rs:97-102 | mistralrs-core/src/vision_models/siglip.rs:361-368 — before extracting anything, compare `REDACTED` and `mistralrs-core/src/vision_models/idefics3/vision.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 213 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–6 lines × 2) mistralrs-quant/src/rotary/mod.rs:19— mistralrs-quant/src/rotary/mod.rs:19-23 | mistralrs-quant/src/rotary/mod.rs:223-228 — both copies are in the same file, so extract the block into 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–6 lines × 2) mistralrs-quant/src/rotary/mod.rs:26— mistralrs-quant/src/rotary/mod.rs:26-30 | mistralrs-quant/src/rotary/mod.rs:234-239 — both copies are in the same file, so extract the block into 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 × 9) mistralrs-core/src/layers.rs:875— mistralrs-core/src/layers.rs:875-879 | mistralrs-core/src/layers.rs:933-937 | mistralrs-core/src/layers.rs:950-954 | mistralrs-core/src/layers.rs:2037-2041 | mistralrs-core/src/layers.rs:2211-2215 | mistralrs-core/src/layers.rs:2256-2260 | mistralrs-core/src/layers.rs:2273-2277 | mistralrs-core/src/layers.rs:3065-3069 | mistralrs-core/src/layers.rs:3198-3202 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 9) mistralrs-core/src/metal/gdn.rs:195— mistralrs-core/src/metal/gdn.rs:195-200 | mistralrs-core/src/metal/gdn.rs:310-315 | mistralrs-core/src/metal/gdn.rs:404-408 | mistralrs-core/src/metal/gdn.rs:556-560 | mistralrs-core/src/metal/gdn.rs:610-614 | mistralrs-core/src/metal/gdn.rs:673-677 | mistralrs-core/src/metal/gdn.rs:786-791 | mistralrs-core/src/metal/gdn.rs:972-977 | mistralrs-core/src/metal/ssm.rs:173-177 — before extracting anything, compare `mistralrs-core/src/metal/gdn.rs` and `mistralrs-core/src/metal/ssm.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (4–5 lines × 3) mistralrs-core/src/cuda/input_packing.rs:41— mistralrs-core/src/cuda/input_packing.rs:41-45 | mistralrs-core/src/cuda/input_packing.rs:66-69 | mistralrs-core/src/cuda/input_packing.rs:134-138 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (4–5 lines × 3) mistralrs-quant/src/metal_kernels/mod.rs:4341— mistralrs-quant/src/metal_kernels/mod.rs:4341-4345 | mistralrs-quant/src/metal_kernels/mod.rs:4440-4445 | mistralrs-quant/src/metal_kernels/mod.rs:5098-5101 — 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 × 5) mistralrs-quant/src/gguf/fast_mmq.rs:578— mistralrs-quant/src/gguf/fast_mmq.rs:578-585 | mistralrs-quant/src/gguf/fast_mmq.rs:862-869 | mistralrs-quant/src/gguf/fast_mmq.rs:1345-1352 | mistralrs-quant/src/gguf/fast_mmvq.rs:523-532 | mistralrs-quant/src/gguf/fast_mmvq.rs:738-747 — before extracting anything, compare `mistralrs-quant/src/gguf/fast_mmq.rs` and `mistralrs-quant/src/gguf/fast_mmvq.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 5) mistralrs-core/src/ops.rs:80— mistralrs-core/src/ops.rs:80-87 | mistralrs-core/src/ops.rs:429-436 | mistralrs-core/src/ops.rs:585-592 | mistralrs-core/src/ops.rs:747-754 | mistralrs-core/src/ops.rs:4644-4651 — 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 (8 lines × 2 locations) mistralrs-cli/webui/src/lib/components/FileCard.svelte:21— mistralrs-cli/webui/src/lib/components/FileCard.svelte:21 · mistralrs-cli/webui/src/lib/services/streaming.ts:11 — 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 (8 lines × 2 locations) mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:265— mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:265 · mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:275 — 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.
X15 · Unvalidated length from an untrusted reader· Length read from the parsed input is spent without ever being bounded · ×2
Length read from the parsed input is spent without ever being bounded mistralrs-quant/src/imatrix.rs:212— `key_len` is read from the bytes being parsed at line 211 (`read_u64`), then used to size a `vec![…; n]` at line 212 — and nowhere in its scope is `key_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 `key_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 mistralrs-quant/src/imatrix.rs:217— `len_data` is read from the bytes being parsed at line 216 (`read_u64`), then used to size a `Vec::with_capacity` at line 217 — and nowhere in its scope is `len_data` 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_data` against the bytes actually remaining and a maximum the format allows before allocating.
AC7 · A11y enforcement· Accessibility enforcement below the top rung · ×1
Accessibility enforcement below the top rung — No accessibility enforcement found — no a11y linter (eslint-plugin-svelte (a11y rules are built in)) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 22 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
production_soak.validate_args (cyclomatic 181) scripts/production_soak.py:13292— production_soak.validate_args has cyclomatic complexity 181 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Pipeline::submit_step (cyclomatic 104) mistralrs-core/src/pipeline/mod.rs:2019— Pipeline::submit_step has cyclomatic complexity 104 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MultimodalLoader::load_model_from_path (cyclomatic 98) mistralrs-core/src/pipeline/multimodal.rs:534— MultimodalLoader::load_model_from_path has cyclomatic complexity 98 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NormalLoader::load_model_from_path (cyclomatic 68) mistralrs-core/src/pipeline/normal.rs:662— NormalLoader::load_model_from_path has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FlashAttnVarLen::cuda_fwd_t (cyclomatic 57) mistralrs-flash-attn/src/flash.rs:470— FlashAttnVarLen::cuda_fwd_t has cyclomatic complexity 57 (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.
Qwen3_5TextModel::forward_embeds (cyclomatic 49) mistralrs-core/src/vision_models/qwen3_5/text.rs:1434— Qwen3_5TextModel::forward_embeds has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Gemma4Model::forward_inner (cyclomatic 47) mistralrs-core/src/vision_models/gemma4/mod.rs:341— Gemma4Model::forward_inner has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ChatStore.generateAssistant (cyclomatic 46) mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:177— ChatStore.generateAssistant has cyclomatic complexity 46 (threshold 15). Of this number, 19 points are the body's own statements and 27 belong to 12 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SoakClient.stream_request (cyclomatic 44) scripts/production_soak.py:1022— SoakClient.stream_request has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
production_soak.adversarial_mode (cyclomatic 43) scripts/production_soak.py:5184— production_soak.adversarial_mode has cyclomatic complexity 43 (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.
bench_decode_serving.validate_args (cyclomatic 41) releases/v0.9.3/scripts/bench_decode_serving.py:216— bench_decode_serving.validate_args 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.
streaming.streamChatCompletion (cyclomatic 41) mistralrs-cli/webui/src/lib/services/streaming.ts:21— streaming.streamChatCompletion has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Qwen3VLModel::forward (cyclomatic 39) mistralrs-core/src/vision_models/qwen3_vl/mod.rs:651— Qwen3VLModel::forward has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Qwen3VLMoEModel::forward (cyclomatic 39) mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:96— Qwen3VLMoEModel::forward has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Qwen4ExpTextModel::forward_embeds (cyclomatic 39) mistralrs-core/src/vision_models/qwen4_exp/text.rs:767— Qwen4ExpTextModel::forward_embeds has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
production_soak.compare_mode (cyclomatic 38) scripts/production_soak.py:2763— production_soak.compare_mode has cyclomatic complexity 38 (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.
EmbeddingLoader::load_model_from_path (cyclomatic 37) mistralrs-core/src/pipeline/embedding.rs:223— EmbeddingLoader::load_model_from_path has cyclomatic complexity 37 (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.
OpenResponsesStreamer::poll_next (cyclomatic 37) mistralrs-server-core/src/responses.rs:1166— OpenResponsesStreamer::poll_next has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
production_soak.canary_mode (cyclomatic 37) scripts/production_soak.py:3141— production_soak.canary_mode has cyclomatic complexity 37 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
production_soak.run_long_context_correctness (cyclomatic 36) scripts/production_soak.py:3862— production_soak.run_long_context_correctness has cyclomatic complexity 36 (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.
production_soak.load_quality_replay_cases (cyclomatic 34) scripts/production_soak.py:9021— production_soak.load_quality_replay_cases has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LoraConfig::validate_dynamic (cyclomatic 33) mistralrs-quant/src/lora/mod.rs:316— LoraConfig::validate_dynamic has cyclomatic complexity 33 (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.
Qwen3_5MoeModel::forward (cyclomatic 31) mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:98— Qwen3_5MoeModel::forward has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PrefixCacheManagerV2::search_for_matching_cache (cyclomatic 30) mistralrs-core/src/prefix_cacher.rs:711— PrefixCacheManagerV2::search_for_matching_cache has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Gemma3ImageProcessor::process_inputs (cyclomatic 30) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:382— Gemma3ImageProcessor::process_inputs has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MLlamaImageProcessor::process_inputs (cyclomatic 30) mistralrs-core/src/vision_models/mllama/inputs_processor.rs:320— MLlamaImageProcessor::process_inputs has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MiniCpmOImageProcessor::process_inputs (cyclomatic 29) mistralrs-core/src/vision_models/minicpmo/inputs_processor.rs:297— MiniCpmOImageProcessor::process_inputs has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
XLoraClassifier::new (cyclomatic 29) mistralrs-core/src/xlora_models/classifier.rs:32— XLoraClassifier::new has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MistralRs::init_external_tool_callbacks (cyclomatic 27) mistralrs-core/src/lib.rs:1339— MistralRs::init_external_tool_callbacks 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.
Idefics2::forward_inner (cyclomatic 27) REDACTED:1148— Idefics2::forward_inner 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.
LLaVAInputProcessor::process_inputs (cyclomatic 27) mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:273— LLaVAInputProcessor::process_inputs 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.
LLaVANextInputProcessor::process_inputs (cyclomatic 27) mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:309— LLaVANextInputProcessor::process_inputs 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.
production_soak.cuda_graph_evidence (cyclomatic 27) scripts/production_soak.py:7369— production_soak.cuda_graph_evidence 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.
Qwen2_5VLModel::forward (cyclomatic 26) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:169— Qwen2_5VLModel::forward 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.
MistralRsForServerBuilder::build_multi_model (cyclomatic 26) mistralrs-server-core/src/mistralrs_for_server_builder.rs:910— MistralRsForServerBuilder::build_multi_model has cyclomatic complexity 26 (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.
TokenizerAdapter.exact_text (cyclomatic 26) scripts/production_soak.py:595— TokenizerAdapter.exact_text 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.
Idefics3ImageProcessor::process_inputs (cyclomatic 25) mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:422— Idefics3ImageProcessor::process_inputs has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CublasLTBatchMatmulF8Scalar::fwd_f8e4m3_scalar (cyclomatic 25) mistralrs-quant/src/cublaslt/api.rs:46— CublasLTBatchMatmulF8Scalar::fwd_f8e4m3_scalar has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FastExpertsWeights::forward_grouped (cyclomatic 24) mistralrs-core/src/moe/experts/backends.rs:1626— FastExpertsWeights::forward_grouped has cyclomatic complexity 24 (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.
Gemma3nAudioAttention::forward (cyclomatic 24) mistralrs-core/src/vision_models/gemma3n/audio.rs:587— Gemma3nAudioAttention::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.
PerTensorFP8Linear::apply_isq (cyclomatic 24) mistralrs-quant/src/pertensor_fp8/mod.rs:512— PerTensorFP8Linear::apply_isq 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.
VectorFP8Linear::apply_isq (cyclomatic 24) mistralrs-quant/src/vector_fp8/mod.rs:91— VectorFP8Linear::apply_isq 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.
Phi3InputsProcessor::process_inputs (cyclomatic 23) mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:282— Phi3InputsProcessor::process_inputs has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
bench_nvfp4_serving.stream_request (cyclomatic 23) scripts/bench_nvfp4_serving.py:164— bench_nvfp4_serving.stream_request has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentStream::next (cyclomatic 22) mistralrs/src/agent.rs:199— AgentStream::next 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.
NormalPipeline::try_cuda_decode_graph_forward (cyclomatic 22) mistralrs-core/src/pipeline/normal.rs:1854— NormalPipeline::try_cuda_decode_graph_forward 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. This is NOT this file's highest cyclomatic complexity: NormalLoaderBuilder::build_inner (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
FlashAttn::cuda_fwd_t (cyclomatic 22) mistralrs-flash-attn/src/flash.rs:22— 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.
ShardedSafeTensors::get (cyclomatic 22) mistralrs-quant/src/safetensors.rs:597— ShardedSafeTensors::get 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.
Gemma4AudioAttention::forward (cyclomatic 21) mistralrs-core/src/vision_models/gemma4/audio.rs:643— Gemma4AudioAttention::forward 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.
ReplicatedLayer::new_layers_matformer_indices (cyclomatic 21) mistralrs-quant/src/distributed/layers.rs:2138— ReplicatedLayer::new_layers_matformer_indices 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.
production_soak.quality_replay_pressure_plan_evidence (cyclomatic 21) scripts/production_soak.py:9613— production_soak.quality_replay_pressure_plan_evidence has cyclomatic complexity 21 (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.
production_soak.compare_time_windows (cyclomatic 21) scripts/production_soak.py:11058— production_soak.compare_time_windows 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.
TagReasoningContext::process_text (cyclomatic 20) mistralrs-core/src/reasoning_parsers/tag_based.rs:170— TagReasoningContext::process_text 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.
BuiltinMtpProposer::propose (cyclomatic 20) mistralrs-core/src/speculative/builtin_mtp.rs:216— BuiltinMtpProposer::propose 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.
Gemma3nImageProcessor::prepare_prompt_plans (cyclomatic 20) mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:462— Gemma3nImageProcessor::prepare_prompt_plans 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.
Llama4ImageProcessor::process_inputs (cyclomatic 20) mistralrs-core/src/vision_models/llama4/inputs_processor.rs:392— Llama4ImageProcessor::process_inputs 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.
Phi4MMInputsProcessor::process_image_batch (cyclomatic 20) mistralrs-core/src/vision_models/phi4/inputs_processor.rs:754— Phi4MMInputsProcessor::process_image_batch 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.
HqqBits::bitpack_type (cyclomatic 20) mistralrs-quant/src/hqq/mod.rs:152— HqqBits::bitpack_type 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.
CumSum::cpu_fwd (cyclomatic 20) mistralrs-quant/src/utils/ops.rs:1402— CumSum::cpu_fwd 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.
render_pyi._render_class (cyclomatic 20) docs/scripts/render_pyi.py:437— render_pyi._render_class 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.
production_soak.multimodal_mode (cyclomatic 20) scripts/production_soak.py:11748— production_soak.multimodal_mode 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.
production_soak.async_main (cyclomatic 20) scripts/production_soak.py:14070— production_soak.async_main has cyclomatic complexity 20 (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.
GraniteMoeHybrid::forward (cyclomatic 19) mistralrs-core/src/models/granite.rs:2180— GraniteMoeHybrid::forward 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.
CudaGraphCaptureMemory::shape (cyclomatic 19) mistralrs-core/src/pipeline/cuda_graph.rs:89— CudaGraphCaptureMemory::shape 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.
Llama4Model::forward (cyclomatic 19) mistralrs-core/src/vision_models/llama4/mod.rs:105— Llama4Model::forward 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.
Mistral3ImageProcessor::process_inputs (cyclomatic 19) mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:254— Mistral3ImageProcessor::process_inputs 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.
SliceReader::read_value (cyclomatic 19) mistralrs-quant/src/gguf/archive.rs:963— SliceReader::read_value has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: GgufDType::name (cyclomatic 35) 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.
IndexedMoeLoraDecode::new (cyclomatic 19) mistralrs-quant/src/gguf/cuda.rs:1145— IndexedMoeLoraDecode::new has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: mistralrs_quant::gguf::cuda::indexed_moe_fused_decode (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
production_soak.text_prerequisite_evidence (cyclomatic 19) scripts/production_soak.py:11388— production_soak.text_prerequisite_evidence 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.
ChatStore.editMessage (cyclomatic 19) mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:493— ChatStore.editMessage has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal 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.
CacheEngine::allocate_gpu_cache (cyclomatic 18) mistralrs-core/src/paged_attention/cache_engine.rs:194— CacheEngine::allocate_gpu_cache has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GdnTransitionLayers::stage_prefixes (cyclomatic 18) mistralrs-core/src/speculative/gdn_transitions.rs:285— GdnTransitionLayers::stage_prefixes 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.
Gemma3nModel::forward (cyclomatic 18) mistralrs-core/src/vision_models/gemma3n/mod.rs:334— Gemma3nModel::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.
Qwen4ExpModel::forward (cyclomatic 18) mistralrs-core/src/vision_models/qwen4_exp/mod.rs:223— Qwen4ExpModel::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.
VoxtralInputsProcessor::process_inputs (cyclomatic 18) mistralrs-core/src/vision_models/voxtral/inputs_processor.rs:195— VoxtralInputsProcessor::process_inputs 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.
mistralrs_pyo3::parse_which (cyclomatic 18) mistralrs-pyo3/src/lib.rs:449— mistralrs_pyo3::parse_which has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: mistralrs_pyo3::lora_adapter_error_code (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
GptqLayer::gptq_gemm (cyclomatic 18) mistralrs-quant/src/gptq/gptq_cuda.rs:82— GptqLayer::gptq_gemm has cyclomatic complexity 18 (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.
production_soak.exact_output_diagnostics (cyclomatic 18) scripts/production_soak.py:2195— production_soak.exact_output_diagnostics 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.
production_soak.load_canary_artifact (cyclomatic 18) scripts/production_soak.py:2683— production_soak.load_canary_artifact has cyclomatic complexity 18 (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.
production_soak.process_telemetry (cyclomatic 18) scripts/production_soak.py:8792— production_soak.process_telemetry 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.
production_soak.production_mode (cyclomatic 18) scripts/production_soak.py:10233— production_soak.production_mode 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.
verify_release_assets.main (cyclomatic 18) scripts/verify_release_assets.py:249— verify_release_assets.main has cyclomatic complexity 18 (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.
KvCache::append (cyclomatic 17) mistralrs-core/src/kv_cache/mod.rs:152— KvCache::append has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
DFlashDraftModel::precapture_cuda_graphs (cyclomatic 17) mistralrs-core/src/speculative/dflash.rs:2459— DFlashDraftModel::precapture_cuda_graphs 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.
MetalPagedPrefillShape::dispatch (cyclomatic 17) mistralrs-paged-attn/src/metal/backend/paged_prefill.rs:187— MetalPagedPrefillShape::dispatch 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.
ParsedShard::finish (cyclomatic 17) mistralrs-quant/src/gguf/archive.rs:730— ParsedShard::finish has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: GgufDType::name (cyclomatic 35) 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.
SoftmaxWithSinks::cpu_fwd (cyclomatic 17) mistralrs-quant/src/utils/ops.rs:1870— SoftmaxWithSinks::cpu_fwd has cyclomatic complexity 17 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
MultiModelBuilder::build (cyclomatic 16) mistralrs/src/model_builder_trait.rs:241— MultiModelBuilder::build has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
NormalCacheManager::clone_in_cache (cyclomatic 16) mistralrs-core/src/kv_cache/mod.rs:486— NormalCacheManager::clone_in_cache 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.
Config::validate (cyclomatic 16) mistralrs-core/src/models/hunyuan_v1_moe.rs:199— Config::validate 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.
MoEExpertsBackend::resolve (cyclomatic 16) mistralrs-core/src/moe/experts/config.rs:198— MoEExpertsBackend::resolve 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.
AnyMoePipeline::amoe_pre_train (cyclomatic 16) mistralrs-core/src/pipeline/amoe.rs:440— AnyMoePipeline::amoe_pre_train has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
CudaGraphDecodeStep::one_token_continuation (cyclomatic 16) mistralrs-core/src/pipeline/cuda_graph.rs:942— CudaGraphDecodeStep::one_token_continuation 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.
CudaGraphPinnedBuffer::copy_from (cyclomatic 16) mistralrs-core/src/pipeline/cuda_graph.rs:3507— CudaGraphPinnedBuffer::copy_from has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CudaDecodeGraphState::replay (cyclomatic 16) mistralrs-core/src/pipeline/cuda_graph.rs:2332— CudaDecodeGraphState::replay 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.
SequenceGroup::maybe_send_streaming_response (cyclomatic 16) mistralrs-core/src/sequence.rs:2478— SequenceGroup::maybe_send_streaming_response 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.
Topology::from_str (cyclomatic 16) mistralrs-core/src/topology/mod.rs:104— Topology::from_str 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.
GgufDeviceMapLoaderInner::layer_sizes_in_bytes (cyclomatic 16) mistralrs-core/src/utils/gguf_metadata.rs:401— GgufDeviceMapLoaderInner::layer_sizes_in_bytes 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.
Idefics3Model::forward_inner (cyclomatic 16) REDACTED:119— Idefics3Model::forward_inner has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RopeParameters::validate_scaling (cyclomatic 16) mistralrs-core/src/vision_models/qwen3_5/config.rs:82— RopeParameters::validate_scaling has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RowParallelLayer::new_with_lora_spec (cyclomatic 16) mistralrs-quant/src/distributed/layers.rs:810— RowParallelLayer::new_with_lora_spec 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.
PreQuantizedExperts::new (cyclomatic 16) mistralrs-quant/src/distributed/layers.rs:2585— PreQuantizedExperts::new has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
State::forward (cyclomatic 16) mistralrs-quant/src/nvfp4/cutlass.rs:345— State::forward has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AnthropicStreamer::poll_next (cyclomatic 16) mistralrs-server-core/src/anthropic.rs:1524— AnthropicStreamer::poll_next 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.
TokenizerAdapter.retrieval_text (cyclomatic 16) scripts/production_soak.py:707— TokenizerAdapter.retrieval_text 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.
production_soak.server_provenance_evidence (cyclomatic 16) scripts/production_soak.py:1544— production_soak.server_provenance_evidence has cyclomatic complexity 16 (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.
production_soak.validate_args (cognitive 332) scripts/production_soak.py:13292— production_soak.validate_args has cognitive complexity 332 (threshold 15). Drivers by points: if/else 134 (272 pts), boolean chains 34, loops 11 (24 pts), ternaries 1 (2 pts) (nesting depth added 152). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Pipeline::submit_step (cognitive 238) mistralrs-core/src/pipeline/mod.rs:2019— Pipeline::submit_step has cognitive complexity 238 (threshold 15). Drivers by points: if/else 52 (141 pts), loops 16 (53 pts), boolean chains 25, match/switch 7 (19 pts) (nesting depth added 138). 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.
MultimodalLoader::load_model_from_path (cognitive 169) mistralrs-core/src/pipeline/multimodal.rs:534— MultimodalLoader::load_model_from_path has cognitive complexity 169 (threshold 15). Drivers by points: if/else 88 (127 pts), match/switch 17 (25 pts), loops 6 (10 pts), boolean chains 7 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NormalLoader::load_model_from_path (cognitive 118) mistralrs-core/src/pipeline/normal.rs:662— NormalLoader::load_model_from_path has cognitive complexity 118 (threshold 15). Drivers by points: if/else 66 (92 pts), match/switch 12 (18 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentStream::next (cognitive 106) mistralrs/src/agent.rs:199— AgentStream::next has cognitive complexity 106 (threshold 15). Drivers by points: if/else 18 (85 pts), match/switch 4 (16 pts), loops 2 (5 pts) (nesting depth added 82). 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.
OpenResponsesStreamer::poll_next (cognitive 92) mistralrs-server-core/src/responses.rs:1166— OpenResponsesStreamer::poll_next has cognitive complexity 92 (threshold 15). Drivers by points: if/else 23 (75 pts), loops 3 (12 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 62). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
XLoraClassifier::new (cognitive 85) mistralrs-core/src/xlora_models/classifier.rs:32— XLoraClassifier::new has cognitive complexity 85 (threshold 15). Drivers by points: if/else 49 (83 pts), loops 1 (2 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
streaming.streamChatCompletion (cognitive 85) mistralrs-cli/webui/src/lib/services/streaming.ts:21— streaming.streamChatCompletion has cognitive complexity 85 (threshold 15). Drivers by points: if/else 32 (71 pts), error handling 4 (8 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 44). 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.
Qwen3VLModel::forward (cognitive 81) mistralrs-core/src/vision_models/qwen3_vl/mod.rs:651— Qwen3VLModel::forward has cognitive complexity 81 (threshold 15). Drivers by points: if/else 30 (51 pts), loops 8 (23 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen3VLMoEModel::forward (cognitive 81) mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:96— Qwen3VLMoEModel::forward has cognitive complexity 81 (threshold 15). Drivers by points: if/else 30 (51 pts), loops 8 (23 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FlashAttnVarLen::cuda_fwd_t (cognitive 81) mistralrs-flash-attn/src/flash.rs:470— FlashAttnVarLen::cuda_fwd_t has cognitive complexity 81 (threshold 15). Drivers by points: if/else 46 (57 pts), match/switch 9 (14 pts), boolean chains 10 (nesting depth added 16). 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.
Qwen4ExpTextModel::forward_embeds (cognitive 77) mistralrs-core/src/vision_models/qwen4_exp/text.rs:767— Qwen4ExpTextModel::forward_embeds has cognitive complexity 77 (threshold 15). Drivers by points: if/else 23 (46 pts), match/switch 7 (16 pts), boolean chains 9, loops 3 (6 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SoakClient.stream_request (cognitive 77) scripts/production_soak.py:1022— SoakClient.stream_request has cognitive complexity 77 (threshold 15). Drivers by points: if/else 25 (53 pts), boolean chains 8, ternaries 7 (8 pts), loops 2 (6 pts), error handling 2 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChatStore.generateAssistant (cognitive 77) mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:177— ChatStore.generateAssistant has cognitive complexity 77 (threshold 15). Drivers by points: if/else 30 (52 pts), boolean chains 15, loops 3 (9 pts), ternaries 1 (nesting depth added 28). Of this number, 31 points are the body's own statements and 46 belong to 12 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Idefics2::forward_inner (cognitive 76) REDACTED:1148— Idefics2::forward_inner has cognitive complexity 76 (threshold 15). Drivers by points: if/else 26 (58 pts), loops 5 (14 pts), boolean chains 4 (nesting depth added 41). 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.
TagReasoningContext::process_text (cognitive 71) mistralrs-core/src/reasoning_parsers/tag_based.rs:170— TagReasoningContext::process_text has cognitive complexity 71 (threshold 15). Drivers by points: if/else 23 (69 pts), boolean chains 1, loops 1 (nesting depth added 46). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MiniCpmOImageProcessor::process_inputs (cognitive 71) mistralrs-core/src/vision_models/minicpmo/inputs_processor.rs:297— MiniCpmOImageProcessor::process_inputs has cognitive complexity 71 (threshold 15). Drivers by points: if/else 23 (45 pts), loops 7 (23 pts), boolean chains 3 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen2_5VLModel::forward (cognitive 69) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:169— Qwen2_5VLModel::forward has cognitive complexity 69 (threshold 15). Drivers by points: if/else 26 (41 pts), loops 5 (20 pts), match/switch 2 (6 pts), boolean chains 2 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
production_soak.canary_mode (cognitive 65) scripts/production_soak.py:3141— production_soak.canary_mode has cognitive complexity 65 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 7 (20 pts), boolean chains 19 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EmbeddingLoader::load_model_from_path (cognitive 63) mistralrs-core/src/pipeline/embedding.rs:223— EmbeddingLoader::load_model_from_path has cognitive complexity 63 (threshold 15). Drivers by points: if/else 42 (53 pts), loops 4 (5 pts), match/switch 3 (5 pts) (nesting depth added 14). 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.
production_soak.run_long_context_correctness (cognitive 59) scripts/production_soak.py:3862— production_soak.run_long_context_correctness has cognitive complexity 59 (threshold 15). Drivers by points: loops 9 (21 pts), if/else 9 (20 pts), boolean chains 18 (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.
Qwen3_5MoeModel::forward (cognitive 58) mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:98— Qwen3_5MoeModel::forward has cognitive complexity 58 (threshold 15). Drivers by points: if/else 21 (35 pts), loops 7 (17 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ShardedSafeTensors::get (cognitive 53) mistralrs-quant/src/safetensors.rs:597— ShardedSafeTensors::get has cognitive complexity 53 (threshold 15). Drivers by points: if/else 19 (46 pts), match/switch 4 (7 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
production_soak.adversarial_mode (cognitive 53) scripts/production_soak.py:5184— production_soak.adversarial_mode has cognitive complexity 53 (threshold 15). Drivers by points: boolean chains 17, loops 13 (16 pts), if/else 7 (14 pts), ternaries 5 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Llama4Model::forward (cognitive 51) mistralrs-core/src/vision_models/llama4/mod.rs:105— Llama4Model::forward has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (39 pts), loops 3 (9 pts), boolean chains 3 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
bench_decode_serving.validate_args (cognitive 48) releases/v0.9.3/scripts/bench_decode_serving.py:216— bench_decode_serving.validate_args has cognitive complexity 48 (threshold 15). Drivers by points: if/else 27 (35 pts), boolean chains 12, loops 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Idefics3Model::forward_inner (cognitive 47) REDACTED:119— Idefics3Model::forward_inner has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (32 pts), loops 5 (14 pts), boolean chains 1 (nesting depth added 26). 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.
MLlamaImageProcessor::process_inputs (cognitive 46) mistralrs-core/src/vision_models/mllama/inputs_processor.rs:320— MLlamaImageProcessor::process_inputs has cognitive complexity 46 (threshold 15). Drivers by points: if/else 21 (29 pts), boolean chains 9, match/switch 3 (6 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CudaGraphCaptureMemory::shape (cognitive 44) mistralrs-core/src/pipeline/cuda_graph.rs:89— CudaGraphCaptureMemory::shape has cognitive complexity 44 (threshold 15). Drivers by points: if/else 13 (35 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Gemma3nAudioAttention::forward (cognitive 43) mistralrs-core/src/vision_models/gemma3n/audio.rs:587— Gemma3nAudioAttention::forward has cognitive complexity 43 (threshold 15). Drivers by points: if/else 21 (32 pts), boolean chains 5, match/switch 3 (4 pts), loops 1 (2 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.
CublasLTBatchMatmulF8Scalar::fwd_f8e4m3_scalar (cognitive 42) mistralrs-quant/src/cublaslt/api.rs:46— CublasLTBatchMatmulF8Scalar::fwd_f8e4m3_scalar has cognitive complexity 42 (threshold 15). Drivers by points: if/else 18 (31 pts), match/switch 5 (7 pts), boolean chains 3, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TokenizerAdapter.exact_text (cognitive 42) scripts/production_soak.py:595— TokenizerAdapter.exact_text has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (30 pts), loops 6 (9 pts), boolean chains 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Llama4ImageProcessor::process_inputs (cognitive 39) mistralrs-core/src/vision_models/llama4/inputs_processor.rs:392— Llama4ImageProcessor::process_inputs has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (31 pts), loops 3 (7 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.
Mistral3ImageProcessor::process_inputs (cognitive 39) mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:254— Mistral3ImageProcessor::process_inputs has cognitive complexity 39 (threshold 15). Drivers by points: if/else 26 (36 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
production_soak.load_quality_replay_cases (cognitive 39) scripts/production_soak.py:9021— production_soak.load_quality_replay_cases has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 9, loops 3 (4 pts), error handling 1 (2 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.
Gemma4AudioAttention::forward (cognitive 38) mistralrs-core/src/vision_models/gemma4/audio.rs:643— Gemma4AudioAttention::forward has cognitive complexity 38 (threshold 15). Drivers by points: if/else 20 (29 pts), boolean chains 4, match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VoxtralInputsProcessor::process_inputs (cognitive 38) mistralrs-core/src/vision_models/voxtral/inputs_processor.rs:195— VoxtralInputsProcessor::process_inputs has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (32 pts), loops 3 (6 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CumSum::cpu_fwd (cognitive 38) mistralrs-quant/src/utils/ops.rs:1402— CumSum::cpu_fwd has cognitive complexity 38 (threshold 15). Drivers by points: loops 8 (28 pts), if/else 7 (9 pts), match/switch 1 (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.
bench_nvfp4_serving.stream_request (cognitive 38) scripts/bench_nvfp4_serving.py:164— bench_nvfp4_serving.stream_request has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (30 pts), loops 3 (4 pts), boolean chains 3, error handling 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.
production_soak.compare_mode (cognitive 38) scripts/production_soak.py:2763— production_soak.compare_mode has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 31, if/else 4, loops 1 (2 pts), ternaries 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CacheEngine::allocate_gpu_cache (cognitive 37) mistralrs-core/src/paged_attention/cache_engine.rs:194— CacheEngine::allocate_gpu_cache has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (31 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HarmonyContext::extract_delta (cognitive 36) mistralrs-core/src/reasoning_parsers/harmony.rs:181— HarmonyContext::extract_delta has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (33 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 22). 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.
Phi3InputsProcessor::process_inputs (cognitive 36) mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:282— Phi3InputsProcessor::process_inputs has cognitive complexity 36 (threshold 15). Drivers by points: if/else 20 (29 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LoraConfig::validate_dynamic (cognitive 36) mistralrs-quant/src/lora/mod.rs:316— LoraConfig::validate_dynamic has cognitive complexity 36 (threshold 15). Drivers by points: if/else 20 (25 pts), boolean chains 4, loops 3 (4 pts), match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
MistralRsForServerBuilder::build_multi_model (cognitive 36) mistralrs-server-core/src/mistralrs_for_server_builder.rs:910— MistralRsForServerBuilder::build_multi_model has cognitive complexity 36 (threshold 15). Drivers by points: if/else 27 (34 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PackedMultimodalLayout::new (cognitive 35) mistralrs-core/src/vision_models/multimodal_layout.rs:156— PackedMultimodalLayout::new has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (22 pts), loops 4 (10 pts), boolean chains 3 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
production_soak.cuda_graph_evidence (cognitive 35) scripts/production_soak.py:7369— production_soak.cuda_graph_evidence has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 14, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Topology::from_str (cognitive 34) mistralrs-core/src/topology/mod.rs:104— Topology::from_str has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 3 (4 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReplicatedLayer::new_layers_matformer_indices (cognitive 34) mistralrs-quant/src/distributed/layers.rs:2138— ReplicatedLayer::new_layers_matformer_indices has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (25 pts), match/switch 3 (8 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnyMoePipeline::amoe_pre_train (cognitive 33) mistralrs-core/src/pipeline/amoe.rs:440— AnyMoePipeline::amoe_pre_train has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 5 (11 pts), match/switch 2 (9 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
production_soak.process_telemetry (cognitive 33) scripts/production_soak.py:8792— production_soak.process_telemetry has cognitive complexity 33 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 6 (11 pts), loops 3 (5 pts), ternaries 2 (5 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Gemma3nModel::forward (cognitive 32) mistralrs-core/src/vision_models/gemma3n/mod.rs:334— Gemma3nModel::forward has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 2 (6 pts), boolean chains 4, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen4ExpModel::forward (cognitive 32) mistralrs-core/src/vision_models/qwen4_exp/mod.rs:223— Qwen4ExpModel::forward has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 4 (8 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HqqBits::bitpack_type (cognitive 31) mistralrs-quant/src/hqq/mod.rs:152— HqqBits::bitpack_type has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 8 (12 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ChatStore.editMessage (cognitive 31) mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:493— ChatStore.editMessage has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (18 pts), error handling 2 (5 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 12). Of this number, 30 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen3_5MoeTextModel::forward_embeds (cognitive 30) mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:778— Qwen3_5MoeTextModel::forward_embeds has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (25 pts), match/switch 2 (3 pts), boolean chains 1, 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.
SumAllReduce::cuda_fwd (cognitive 30) mistralrs-quant/src/distributed/mod.rs:545— SumAllReduce::cuda_fwd has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 5 (12 pts) (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (AllGather::cuda_fwd) 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.
AllGather::cuda_fwd (cognitive 30) mistralrs-quant/src/distributed/mod.rs:691— AllGather::cuda_fwd has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 5 (12 pts) (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (SumAllReduce::cuda_fwd) 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.
VectorFP8Linear::apply_isq (cognitive 30) mistralrs-quant/src/vector_fp8/mod.rs:91— VectorFP8Linear::apply_isq has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (25 pts), match/switch 3 (5 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SoftmaxWithSinks::cpu_fwd (cognitive 29) mistralrs-quant/src/utils/ops.rs:1870— SoftmaxWithSinks::cpu_fwd has cognitive complexity 29 (threshold 15). Drivers by points: loops 9 (18 pts), if/else 3 (9 pts), match/switch 2 (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
TokenizerAdapter.retrieval_text (cognitive 29) scripts/production_soak.py:707— TokenizerAdapter.retrieval_text has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 6 (9 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Gemma3nLoader::non_mapped_size_in_bytes (cognitive 28) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5886— Gemma3nLoader::non_mapped_size_in_bytes has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DequantizeOp::dequantize_cpu (cognitive 28) mistralrs-quant/src/bitsandbytes/op.rs:130— DequantizeOp::dequantize_cpu has cognitive complexity 28 (threshold 15). Drivers by points: loops 6 (15 pts), if/else 6 (12 pts), match/switch 1 (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
render_pyi._render_class (cognitive 28) docs/scripts/render_pyi.py:437— render_pyi._render_class has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 5 (9 pts), boolean chains 1, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SmolLm3::create_anymoe_layers (cognitive 27) mistralrs-core/src/models/smollm3.rs:623— SmolLm3::create_anymoe_layers has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CudaGraphDecodeStep::one_token_continuation (cognitive 27) mistralrs-core/src/pipeline/cuda_graph.rs:942— CudaGraphDecodeStep::one_token_continuation has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (23 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FlashAttn::cuda_fwd_t (cognitive 27) mistralrs-flash-attn/src/flash.rs:22— 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.
PreQuantizedExperts::new (cognitive 27) mistralrs-quant/src/distributed/layers.rs:2585— PreQuantizedExperts::new has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (19 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (2 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.
bench_decode_serving.plot_summary (cognitive 27) releases/v0.9.3/scripts/bench_decode_serving.py:1558— bench_decode_serving.plot_summary has cognitive complexity 27 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 4 (8 pts), ternaries 2 (7 pts), boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
production_soak.compare_time_windows (cognitive 27) scripts/production_soak.py:11058— production_soak.compare_time_windows has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 6, loops 2 (3 pts), ternaries 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.
AudioEmbedding::forward (cognitive 26) mistralrs-core/src/vision_models/phi4/audio_embedding.rs:208— AudioEmbedding::forward has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CudaPeerAccess::new_cuda (cognitive 25) mistralrs-core/src/device_map/peer.rs:58— CudaPeerAccess::new_cuda has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (4 pts), match/switch 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AutoLoader::detect (cognitive 25) mistralrs-core/src/pipeline/auto.rs:399— AutoLoader::detect has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (24 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.
GgufMatMul::apply_isq (cognitive 25) mistralrs-quant/src/gguf/mod.rs:653— GgufMatMul::apply_isq has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (21 pts), match/switch 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bench_decode_serving.write_summaries (cognitive 25) releases/v0.9.3/scripts/bench_decode_serving.py:1511— bench_decode_serving.write_summaries has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 5 (11 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
production_soak.calibrate_prompt_profiles (cognitive 25) scripts/production_soak.py:3608— production_soak.calibrate_prompt_profiles has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 2 (6 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
verify_release_assets.main (cognitive 25) scripts/verify_release_assets.py:249— verify_release_assets.main has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 5, boolean chains 2, error handling 1 (2 pts), ternaries 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.
MoEExpertsBackend::resolve (cognitive 24) mistralrs-core/src/moe/experts/config.rs:198— MoEExpertsBackend::resolve has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelWeights::from_gguf (cognitive 24) mistralrs-core/src/xlora_models/quantized_llama.rs:464— ModelWeights::from_gguf has cognitive complexity 24 (threshold 15). Drivers by points: loops 5 (11 pts), if/else 7 (8 pts), match/switch 1 (3 pts), boolean chains 2 (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.
RowParallelLayer::new_with_lora_spec (cognitive 24) mistralrs-quant/src/distributed/layers.rs:810— RowParallelLayer::new_with_lora_spec has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 2, match/switch 1 (2 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.
render_pyi._parse_doc_sections (cognitive 24) docs/scripts/render_pyi.py:255— render_pyi._parse_doc_sections has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 2 (3 pts), boolean chains 1, ternaries 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.
bench_nvfp4_serving.prepare (cognitive 24) scripts/bench_nvfp4_serving.py:62— bench_nvfp4_serving.prepare has cognitive complexity 24 (threshold 15). Drivers by points: loops 4 (10 pts), ternaries 2 (8 pts), if/else 2 (6 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
production_soak.gpu_driver_provenance (cognitive 24) scripts/production_soak.py:1454— production_soak.gpu_driver_provenance has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 2 (5 pts), loops 2 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RotatingCache::append (cognitive 23) mistralrs-core/src/kv_cache/rotating_cache.rs:253— RotatingCache::append has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Config::validate (cognitive 23) mistralrs-core/src/models/hunyuan_v1_moe.rs:199— Config::validate has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SequenceGroup::maybe_send_streaming_response (cognitive 23) mistralrs-core/src/sequence.rs:2478— SequenceGroup::maybe_send_streaming_response has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AudioModel::forward (cognitive 23) mistralrs-core/src/vision_models/gemma3n/audio.rs:1311— AudioModel::forward has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (17 pts), loops 3 (4 pts), boolean chains 2 (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.
mistralrs_macros::generate_tool_impl (cognitive 23) mistralrs-macros/src/lib.rs:127— mistralrs_macros::generate_tool_impl has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MetalPagedPrefillShape::dispatch (cognitive 23) mistralrs-paged-attn/src/metal/backend/paged_prefill.rs:187— MetalPagedPrefillShape::dispatch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18 (19 pts), boolean chains 4 (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.
GptqLayer::gptq_gemm (cognitive 23) mistralrs-quant/src/gptq/gptq_cuda.rs:82— GptqLayer::gptq_gemm has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 6, boolean chains 4 (nesting depth added 3). 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.
bench_cpu_sweep.main (cognitive 23) releases/v0.9.0/scripts/bench_cpu_sweep.py:189— bench_cpu_sweep.main has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 5 (11 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
production_soak.multimodal_mode (cognitive 23) scripts/production_soak.py:11748— production_soak.multimodal_mode has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 7, loops 3, error handling 1, ternaries 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.
IntervalLogger::new (cognitive 22) mistralrs-core/src/engine/logger.rs:58— IntervalLogger::new has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Mistral3Model::forward (cognitive 22) mistralrs-core/src/vision_models/mistral3/mod.rs:230— Mistral3Model::forward has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (7 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VisualEncoder::encode (cognitive 22) mistralrs-core/src/vision_models/qwen3_vl/mod.rs:435— VisualEncoder::encode has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (9 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GgufArchive::merge_components (cognitive 22) mistralrs-quant/src/gguf/archive.rs:459— GgufArchive::merge_components has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 5 (8 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MuseGlimmerImageProcessor::process_inputs (cognitive 21) mistralrs-core/src/vision_models/muse_glimmer/inputs_processor.rs:904— MuseGlimmerImageProcessor::process_inputs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (14 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PleTable::quantize_shards (cognitive 21) mistralrs-core/src/vision_models/qwen4_exp/ple.rs:484— PleTable::quantize_shards has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (6 pts), match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Fp8BlockwiseQuantize::dispatch_quant_blockwise (cognitive 21) mistralrs-quant/src/blockwise_fp8/ops.rs:370— Fp8BlockwiseQuantize::dispatch_quant_blockwise has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 4 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GgufWeightSource::materialize_mxfp4_component (cognitive 21) mistralrs-quant/src/gguf/weight_source.rs:465— GgufWeightSource::materialize_mxfp4_component has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
merge_results.build_summary (cognitive 21) releases/v0.9.3/scripts/merge_results.py:74— merge_results.build_summary has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 5 (10 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
production_soak.exact_output_diagnostics (cognitive 21) scripts/production_soak.py:2195— production_soak.exact_output_diagnostics has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, ternaries 3, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs::messages::resolve_pending (cognitive 20) mistralrs/src/messages.rs:1327— mistralrs::messages::resolve_pending has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 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.
KvCache::append (cognitive 20) mistralrs-core/src/kv_cache/mod.rs:152— KvCache::append has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 6 (9 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LoraLinear::lora_forward (cognitive 20) mistralrs-core/src/lora/loralinear.rs:168— LoraLinear::lora_forward has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 1 (2 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.
FixedBucketingManager::bucket_and_waitlist_seqs_waiting (cognitive 20) mistralrs-core/src/scheduler/default_scheduler.rs:124— FixedBucketingManager::bucket_and_waitlist_seqs_waiting has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (6 pts), match/switch 1 (2 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.
GemmaLarkBuilder::emit_constrained_args (cognitive 20) mistralrs-core/src/tools/parsers/gemma4_strict.rs:61— GemmaLarkBuilder::emit_constrained_args has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 4 (5 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CublasLTBatchMatmul::fwd (cognitive 20) mistralrs-quant/src/cublaslt/api.rs:358— CublasLTBatchMatmul::fwd has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IndexedMoeLoraDecode::new (cognitive 20) mistralrs-quant/src/gguf/cuda.rs:1145— IndexedMoeLoraDecode::new has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 4, loops 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.
production_soak.load_canary_artifact (cognitive 20) scripts/production_soak.py:2683— production_soak.load_canary_artifact has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (7 pts), error handling 1 (2 pts), loops 1 (nesting depth added 4). 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.
production_soak.quality_replay_pressure_plan_evidence (cognitive 20) scripts/production_soak.py:9613— production_soak.quality_replay_pressure_plan_evidence has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 13, ternaries 7. 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.
MultiModelBuilder::build (cognitive 19) mistralrs/src/model_builder_trait.rs:241— MultiModelBuilder::build has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (17 pts), loops 2 (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.
HybridPagedPrefixValidator::validate_prefix_cache_hit (cognitive 19) mistralrs-core/src/engine/mod.rs:383— HybridPagedPrefixValidator::validate_prefix_cache_hit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (19 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HybridCache::allocate_slot (cognitive 19) mistralrs-core/src/kv_cache/hybrid_cache.rs:1920— HybridCache::allocate_slot has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SamplingParams::apply_model_defaults (cognitive 19) mistralrs-core/src/sampler.rs:149— SamplingParams::apply_model_defaults has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultScheduler::schedule (cognitive 19) mistralrs-core/src/scheduler/default_scheduler.rs:227— DefaultScheduler::schedule has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (4 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sequence::take_ready_streaming_emissions (cognitive 19) mistralrs-core/src/sequence.rs:1564— Sequence::take_ready_streaming_emissions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ParamArgs::from_attrs (cognitive 19) mistralrs-macros/src/lib.rs:60— ParamArgs::from_attrs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 1 (nesting depth added 12). 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.
plot_results.plot_speedup (cognitive 19) releases/v0.9.0/scripts/plot_results.py:67— plot_results.plot_speedup has cognitive complexity 19 (threshold 15). Drivers by points: if/else 2 (8 pts), loops 4 (8 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bench_decode_serving.main (cognitive 19) releases/v0.9.3/scripts/bench_decode_serving.py:1657— bench_decode_serving.main has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
production_soak.text_prerequisite_evidence (cognitive 19) scripts/production_soak.py:11388— production_soak.text_prerequisite_evidence has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, ternaries 2 (4 pts), if/else 2 (3 pts), loops 1 (nesting depth added 3). 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.
Agent::run (cognitive 18) mistralrs/src/agent.rs:534— Agent::run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (6 pts), match/switch 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FormatOptions::derive_local_model_root (cognitive 18) mistralrs-cli/src/args/model.rs:156— FormatOptions::derive_local_model_root has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
T5Attention::forward (cognitive 18) mistralrs-core/src/diffusion_models/t5/mod.rs:350— T5Attention::forward has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 5 (8 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Content::print_metadata (cognitive 18) mistralrs-core/src/gguf/content.rs:205— Content::print_metadata has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 5 (9 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.
SpeculativeTapRouting::new (cognitive 18) mistralrs-core/src/speculative/proposer.rs:89— SpeculativeTapRouting::new has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen3VLVisionModel::rot_pos_emb (cognitive 18) mistralrs-core/src/vision_models/qwen3_vl/vision.rs:550— 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.
mistralrs_pyo3::util::parse_video_url (cognitive 18) mistralrs-pyo3/src/util.rs:315— mistralrs_pyo3::util::parse_video_url has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BitWise::cpu_fwd (cognitive 18) mistralrs-quant/src/utils/ops.rs:261— BitWise::cpu_fwd has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 11 (13 pts), if/else 4, boolean chains 1 (nesting depth added 2). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
MessageContent::to_text (cognitive 18) mistralrs-server-core/src/openai.rs:205— MessageContent::to_text has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (5 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
executor.execute_code (cognitive 18) REDACTED:325— executor.execute_code has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 3, 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.
production_soak.resident_decode_mode (cognitive 18) scripts/production_soak.py:7647— production_soak.resident_decode_mode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, loops 2 (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.
production_soak.production_mode (cognitive 18) scripts/production_soak.py:10233— production_soak.production_mode has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 5, ternaries 2 (3 pts), loops 2 (nesting depth added 1). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Gemma4Loader::non_mapped_size_in_bytes (cognitive 17) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:9424— Gemma4Loader::non_mapped_size_in_bytes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, loops 1 (2 pts), boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
McpClient::convert_mcp_schema_to_parameters (cognitive 17) mistralrs-mcp/src/client.rs:515— McpClient::convert_mcp_schema_to_parameters has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (7 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.
mistralrs_metal_compile::preprocess_includes (cognitive 17) mistralrs-metal-compile/src/lib.rs:420— mistralrs_metal_compile::preprocess_includes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Fp8W8A8Kernel::warm (cognitive 17) mistralrs-quant/src/cutile/fp8_w8a8.rs:827— Fp8W8A8Kernel::warm has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 2 (5 pts), loops 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Descent::search (cognitive 17) mistralrs-quant/src/cutile/tune.rs:506— Descent::search has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
State::forward (cognitive 17) mistralrs-quant/src/nvfp4/cutlass.rs:345— State::forward has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (13 pts), match/switch 2, boolean chains 1, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AnthropicStreamer::poll_next (cognitive 17) mistralrs-server-core/src/anthropic.rs:1524— AnthropicStreamer::poll_next has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
upload_wheels.main (cognitive 17) scripts/upload_wheels.py:189— upload_wheels.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 4 (6 pts), ternaries 2, boolean chains 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.
SearchPipeline::chunk_document (cognitive 16) mistralrs-core/src/search/rag.rs:166— SearchPipeline::chunk_document has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DFlashCudaGraphState::run (cognitive 16) mistralrs-core/src/speculative/dflash.rs:1865— DFlashCudaGraphState::run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 3 (4 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.
ColumnParallelLayer::new_with_shard_and_key (cognitive 16) mistralrs-quant/src/distributed/layers.rs:1301— ColumnParallelLayer::new_with_shard_and_key has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 2, 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.
render_examples.main (cognitive 16) docs/scripts/render_examples.py:148— render_examples.main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 2 (6 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
build_wheels._detect_nccl (cognitive 16) scripts/build_wheels.py:163— build_wheels._detect_nccl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (4 pts), error handling 1 (2 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.
production_soak.histogram_quantile_delta (cognitive 16) scripts/production_soak.py:8173— production_soak.histogram_quantile_delta has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2, ternaries 1 (2 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.
production_soak.async_main (cognitive 16) scripts/production_soak.py:14070— production_soak.async_main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 3 (4 pts), error handling 2 (3 pts), boolean chains 2 (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.
D4 · Code Duplication· Near-duplicate member family (25 members, 30 shared lines) · ×1
Near-duplicate member family (25 members, 30 shared lines) mistralrs-core/src/models/flint.rs:347— mistralrs-core/src/models/flint.rs:347-454 | mistralrs-core/src/models/gemma2.rs:208-297 | mistralrs-core/src/models/glm4.rs:209-296 | mistralrs-core/src/models/glm4_moe.rs:272-361 | mistralrs-core/src/models/gpt_oss.rs:248-326 | mistralrs-core/src/models/granite.rs:1538-1622 | mistralrs-core/src/models/hunyuan_v1_dense.rs:191-272 | mistralrs-core/src/models/hunyuan_v1_moe.rs:374-458 | mistralrs-core/src/models/llama.rs:75-157 | mistralrs-core/src/models/mistral.rs:206-297 | mistralrs-core/src/models/mixtral.rs:151-233 | mistralrs-core/src/models/phi3_5_moe.rs:178-263 | mistralrs-core/src/models/qwen2.rs:240-327 | mistralrs-core/src/models/qwen3.rs:192-282 | mistralrs-core/src/models/qwen3_moe.rs:195-285 | mistralrs-core/src/models/qwen3_next.rs:272-378 | mistralrs-core/src/models/smollm3.rs:90-174 | mistralrs-core/src/models/starcoder2.rs:227-309 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:226-322 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:194-294 | mistralrs-core/src/vision_models/qwen2vl/text.rs:195-295 | mistralrs-core/src/vision_models/qwen3_5/text.rs:280-427 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:189-285 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:194-287 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:300-390 — These 25 members are variants of one another: a block of 30 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 25 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 25 times.
D4 · Code Duplication· Near-duplicate member family (23 members, 23 shared lines) · ×1
Near-duplicate member family (23 members, 23 shared lines) mistralrs-core/src/models/flint.rs:347— mistralrs-core/src/models/flint.rs:347-454 | mistralrs-core/src/models/gemma2.rs:208-297 | mistralrs-core/src/models/glm4.rs:209-296 | mistralrs-core/src/models/glm4_moe.rs:272-361 | mistralrs-core/src/models/gpt_oss.rs:248-326 | mistralrs-core/src/models/granite.rs:1538-1622 | mistralrs-core/src/models/hunyuan_v1_dense.rs:191-272 | mistralrs-core/src/models/hunyuan_v1_moe.rs:374-458 | mistralrs-core/src/models/llama.rs:75-157 | mistralrs-core/src/models/mistral.rs:206-297 | mistralrs-core/src/models/mixtral.rs:151-233 | mistralrs-core/src/models/phi3_5_moe.rs:178-263 | mistralrs-core/src/models/qwen2.rs:240-327 | mistralrs-core/src/models/qwen3.rs:192-282 | mistralrs-core/src/models/qwen3_moe.rs:195-285 | mistralrs-core/src/models/smollm3.rs:90-174 | mistralrs-core/src/models/starcoder2.rs:227-309 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:58-132 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:227-306 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:194-294 | mistralrs-core/src/vision_models/qwen2vl/text.rs:195-295 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:194-287 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:300-390 — These 23 members are variants of one another: a block of 23 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 23 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 23 times.
D4 · Code Duplication· Near-duplicate member family (22 members, 22 shared lines) · ×1
Near-duplicate member family (22 members, 22 shared lines) mistralrs-core/src/models/flint.rs:347— mistralrs-core/src/models/flint.rs:347-454 | mistralrs-core/src/models/gemma.rs:167-249 | mistralrs-core/src/models/gemma2.rs:208-297 | mistralrs-core/src/models/glm4.rs:209-296 | mistralrs-core/src/models/glm4_moe.rs:272-361 | mistralrs-core/src/models/gpt_oss.rs:248-326 | mistralrs-core/src/models/hunyuan_v1_dense.rs:191-272 | mistralrs-core/src/models/hunyuan_v1_moe.rs:374-458 | mistralrs-core/src/models/mistral.rs:206-297 | mistralrs-core/src/models/mixtral.rs:151-233 | mistralrs-core/src/models/phi2.rs:254-347 | mistralrs-core/src/models/phi3.rs:143-236 | mistralrs-core/src/models/phi3_5_moe.rs:178-263 | mistralrs-core/src/models/qwen2.rs:240-327 | mistralrs-core/src/models/qwen3.rs:192-282 | mistralrs-core/src/models/qwen3_moe.rs:195-285 | mistralrs-core/src/models/starcoder2.rs:227-309 | mistralrs-core/src/vision_models/phi3/mod.rs:235-327 | mistralrs-core/src/vision_models/phi4/mod.rs:104-196 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:194-287 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:300-390 | mistralrs-core/src/vision_models/voxtral/mod.rs:126-208 — These 22 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 22 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 22 times.
D4 · Code Duplication· Near-duplicate member family (20 members, 22 shared lines) · ×1
Near-duplicate member family (20 members, 22 shared lines) mistralrs-core/src/models/flint.rs:347— mistralrs-core/src/models/flint.rs:347-454 | mistralrs-core/src/models/gemma.rs:167-249 | mistralrs-core/src/models/gemma2.rs:208-297 | mistralrs-core/src/models/gpt_oss.rs:248-326 | mistralrs-core/src/models/hunyuan_v1_dense.rs:191-272 | mistralrs-core/src/models/hunyuan_v1_moe.rs:374-458 | mistralrs-core/src/models/llama.rs:75-157 | mistralrs-core/src/models/mistral.rs:206-297 | mistralrs-core/src/models/mixtral.rs:151-233 | mistralrs-core/src/models/phi2.rs:254-347 | mistralrs-core/src/models/phi3_5_moe.rs:178-263 | mistralrs-core/src/models/qwen2.rs:240-327 | mistralrs-core/src/models/qwen3.rs:192-282 | mistralrs-core/src/models/qwen3_moe.rs:195-285 | mistralrs-core/src/models/qwen3_next.rs:272-378 | mistralrs-core/src/models/smollm3.rs:90-174 | mistralrs-core/src/models/starcoder2.rs:227-309 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:58-132 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:227-306 | mistralrs-core/src/vision_models/voxtral/mod.rs:126-208 — These 20 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 20 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 20 times.
D4 · Code Duplication· Near-duplicate member family (18 members, 28 shared lines) · ×1
Near-duplicate member family (18 members, 28 shared lines) mistralrs-core/src/models/flint.rs:347— mistralrs-core/src/models/flint.rs:347-454 | mistralrs-core/src/models/gemma.rs:167-249 | mistralrs-core/src/models/gemma2.rs:208-297 | mistralrs-core/src/models/gpt_oss.rs:248-326 | mistralrs-core/src/models/hunyuan_v1_dense.rs:191-272 | mistralrs-core/src/models/hunyuan_v1_moe.rs:374-458 | mistralrs-core/src/models/lfm2.rs:481-564 | mistralrs-core/src/models/llama.rs:75-157 | mistralrs-core/src/models/mistral.rs:206-297 | mistralrs-core/src/models/mixtral.rs:151-233 | mistralrs-core/src/models/phi2.rs:254-347 | mistralrs-core/src/models/qwen2.rs:240-327 | mistralrs-core/src/models/qwen3.rs:192-282 | mistralrs-core/src/models/qwen3_moe.rs:195-285 | mistralrs-core/src/models/qwen3_next.rs:272-378 | mistralrs-core/src/models/smollm3.rs:90-174 | mistralrs-core/src/models/starcoder2.rs:227-309 | mistralrs-core/src/vision_models/voxtral/mod.rs:126-208 — These 18 members are variants of one another: a block of 28 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 18 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 18 times.
D4 · Code Duplication· Near-duplicate member family (17 members, 31 shared lines) · ×1
Near-duplicate member family (17 members, 31 shared lines) mistralrs-core/src/models/flint.rs:347— mistralrs-core/src/models/flint.rs:347-454 | mistralrs-core/src/models/glm4.rs:209-296 | mistralrs-core/src/models/glm4_moe.rs:272-361 | mistralrs-core/src/models/gpt_oss.rs:248-326 | mistralrs-core/src/models/granite.rs:1538-1622 | mistralrs-core/src/models/hunyuan_v1_dense.rs:191-272 | mistralrs-core/src/models/hunyuan_v1_moe.rs:374-458 | mistralrs-core/src/models/llama.rs:75-157 | mistralrs-core/src/models/mistral.rs:206-297 | mistralrs-core/src/models/mixtral.rs:151-233 | mistralrs-core/src/models/phi3_5_moe.rs:178-263 | mistralrs-core/src/models/qwen3.rs:192-282 | mistralrs-core/src/models/qwen3_moe.rs:195-285 | mistralrs-core/src/models/qwen3_next.rs:272-378 | mistralrs-core/src/models/smollm3.rs:90-174 | mistralrs-core/src/models/starcoder2.rs:227-309 | mistralrs-core/src/vision_models/llama4/text.rs:426-528 — These 17 members are variants of one another: a block of 31 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 17 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 17 times.
D4 · Code Duplication· Near-duplicate member family (16 members, 25 shared lines) · ×1
Near-duplicate member family (16 members, 25 shared lines) mistralrs-core/src/models/gemma.rs:167— mistralrs-core/src/models/gemma.rs:167-249 | mistralrs-core/src/models/gemma2.rs:208-297 | mistralrs-core/src/models/gpt_oss.rs:248-326 | mistralrs-core/src/models/hunyuan_v1_dense.rs:191-272 | mistralrs-core/src/models/hunyuan_v1_moe.rs:374-458 | mistralrs-core/src/models/mistral.rs:206-297 | mistralrs-core/src/models/mixtral.rs:151-233 | mistralrs-core/src/models/phi2.rs:254-347 | mistralrs-core/src/models/phi3.rs:143-236 | mistralrs-core/src/models/phi3_5_moe.rs:178-263 | mistralrs-core/src/models/qwen2.rs:240-327 | mistralrs-core/src/models/qwen3.rs:192-282 | mistralrs-core/src/models/qwen3_moe.rs:195-285 | mistralrs-core/src/models/qwen3_next.rs:272-378 | mistralrs-core/src/models/starcoder2.rs:227-309 | mistralrs-core/src/vision_models/voxtral/mod.rs:126-208 — These 16 members are variants of one another: a block of 25 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 (13 members, 30 shared lines) · ×1
Near-duplicate member family (13 members, 30 shared lines) mistralrs-core/src/models/gemma.rs:583— mistralrs-core/src/models/gemma.rs:583-674 | mistralrs-core/src/models/gemma2.rs:700-791 | mistralrs-core/src/models/glm4.rs:703-794 | mistralrs-core/src/models/hunyuan_v1_dense.rs:671-762 | mistralrs-core/src/models/mistral.rs:711-802 | mistralrs-core/src/models/phi2.rs:659-742 | mistralrs-core/src/models/phi3.rs:654-737 | mistralrs-core/src/models/qwen2.rs:713-804 | mistralrs-core/src/models/qwen3.rs:689-780 | mistralrs-core/src/models/starcoder2.rs:650-733 | mistralrs-core/src/vision_models/gemma3/text.rs:924-1015 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:667-761 | mistralrs-core/src/vision_models/phi3/mod.rs:1491-1573 — These 13 members are variants of one another: a block of 30 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, 24 shared lines) · ×1
Near-duplicate member family (13 members, 24 shared lines) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1399— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1399-1434 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1706-1741 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2006-2041 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2411-2458 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2781-2815 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3134-3169 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3476-3511 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4204-4238 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4992-5028 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:794-829 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1238-1273 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2165-2200 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5775-5810 — These 13 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 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 (10 members, 52 shared lines) · ×1
Near-duplicate member family (10 members, 52 shared lines) mistralrs-core/src/models/gemma.rs:583— mistralrs-core/src/models/gemma.rs:583-674 | mistralrs-core/src/models/gemma2.rs:700-791 | mistralrs-core/src/models/glm4.rs:703-794 | mistralrs-core/src/models/hunyuan_v1_dense.rs:671-762 | mistralrs-core/src/models/mistral.rs:711-802 | mistralrs-core/src/models/qwen2.rs:713-804 | mistralrs-core/src/models/qwen3.rs:689-780 | mistralrs-core/src/vision_models/gemma3/text.rs:924-1015 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:667-761 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:681-767 — These 10 members are variants of one another: a block of 52 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 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· Near-duplicate member family (9 members, 40 shared lines) · ×1
Near-duplicate member family (9 members, 40 shared lines) mistralrs-core/src/xlora_models/gemma.rs:631— mistralrs-core/src/xlora_models/gemma.rs:631-690 | mistralrs-core/src/xlora_models/gemma2.rs:682-741 | mistralrs-core/src/xlora_models/llama.rs:459-518 | mistralrs-core/src/xlora_models/mistral.rs:627-686 | mistralrs-core/src/xlora_models/mixtral.rs:757-816 | mistralrs-core/src/xlora_models/phi2.rs:597-656 | mistralrs-core/src/xlora_models/quantized_llama.rs:849-908 | mistralrs-core/src/xlora_models/quantized_phi3.rs:514-573 | mistralrs-core/src/xlora_models/starcoder2.rs:612-671 — These 9 members are variants of one another: a block of 40 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 9 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 9 times.
D4 · Code Duplication· Near-duplicate member family (9 members, 28 shared lines) · ×1
Near-duplicate member family (9 members, 28 shared lines) mistralrs-core/src/models/glm4.rs:209— mistralrs-core/src/models/glm4.rs:209-296 | mistralrs-core/src/models/glm4_moe.rs:272-361 | mistralrs-core/src/vision_models/phi3/mod.rs:235-327 | mistralrs-core/src/vision_models/phi4/mod.rs:104-196 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:194-294 | mistralrs-core/src/vision_models/qwen2vl/text.rs:195-295 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:189-285 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:194-287 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:300-390 — These 9 members are variants of one another: a block of 28 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 9 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 9 times.
D4 · Code Duplication· Near-duplicate member family (9 members, 22 shared lines) · ×1
Near-duplicate member family (9 members, 22 shared lines) mistralrs-core/src/models/glm4.rs:209— mistralrs-core/src/models/glm4.rs:209-296 | mistralrs-core/src/models/glm4_moe.rs:272-361 | mistralrs-core/src/models/granite.rs:1538-1622 | mistralrs-core/src/vision_models/phi3/mod.rs:235-327 | mistralrs-core/src/vision_models/phi4/mod.rs:104-196 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:194-294 | mistralrs-core/src/vision_models/qwen2vl/text.rs:195-295 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:194-287 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:300-390 — These 9 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 9 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 9 times.
D4 · Code Duplication· Near-duplicate member family (9 members, 15 shared lines) · ×1
Near-duplicate member family (9 members, 15 shared lines) mistralrs-core/src/models/deepseek2.rs:950— mistralrs-core/src/models/deepseek2.rs:950-975 | mistralrs-core/src/models/deepseek3.rs:1013-1038 | mistralrs-core/src/models/glm4_moe.rs:829-853 | mistralrs-core/src/models/glm4_moe_lite.rs:966-990 | mistralrs-core/src/models/mixtral.rs:526-554 | mistralrs-core/src/models/phi2.rs:542-567 | mistralrs-core/src/models/phi3.rs:534-563 | mistralrs-core/src/models/phi3_5_moe.rs:607-636 | mistralrs-core/src/models/starcoder2.rs:527-555 — These 9 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 9 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 9 times.
D4 · Code Duplication· Near-duplicate member family (7 members, 37 shared lines) · ×1
Near-duplicate member family (7 members, 37 shared lines) mistralrs-core/src/models/flint.rs:774— mistralrs-core/src/models/flint.rs:774-900 | mistralrs-core/src/models/glm4.rs:439-564 | mistralrs-core/src/models/hunyuan_v1_dense.rs:392-522 | mistralrs-core/src/models/hunyuan_v1_moe.rs:882-1016 | mistralrs-core/src/models/mistral.rs:414-565 | mistralrs-core/src/models/qwen3.rs:402-523 | mistralrs-core/src/models/qwen3_moe.rs:576-703 — These 7 members are variants of one another: a block of 37 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 (7 members, 27 shared lines) · ×1
Near-duplicate member family (7 members, 27 shared lines) mistralrs-core/src/xlora_models/gemma.rs:232— mistralrs-core/src/xlora_models/gemma.rs:232-298 | mistralrs-core/src/xlora_models/gemma2.rs:237-305 | mistralrs-core/src/xlora_models/llama.rs:55-115 | mistralrs-core/src/xlora_models/mistral.rs:222-294 | mistralrs-core/src/xlora_models/mixtral.rs:135-207 | mistralrs-core/src/xlora_models/phi2.rs:217-288 | mistralrs-core/src/xlora_models/starcoder2.rs:209-283 — These 7 members are variants of one another: a block of 27 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 (7 members, 21 shared lines) · ×1
Near-duplicate member family (7 members, 21 shared lines) mistralrs-core/src/xlora_models/gemma.rs:232— mistralrs-core/src/xlora_models/gemma.rs:232-298 | mistralrs-core/src/xlora_models/gemma2.rs:237-305 | mistralrs-core/src/xlora_models/mistral.rs:222-294 | mistralrs-core/src/xlora_models/mixtral.rs:135-207 | mistralrs-core/src/xlora_models/phi2.rs:217-288 | mistralrs-core/src/xlora_models/phi3.rs:113-182 | mistralrs-core/src/xlora_models/starcoder2.rs:209-283 — 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 (6 members, 46 shared lines) · ×1
Near-duplicate member family (6 members, 46 shared lines) mistralrs-quant/src/cutile/nvfp4_glu.rs:38— mistralrs-quant/src/cutile/nvfp4_glu.rs:38-175 | mistralrs-quant/src/cutile/nvfp4_glu.rs:195-332 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:23-90 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:176-243 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:341-490 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:635-784 — These 6 members are variants of one another: a block of 46 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 (6 members, 39 shared lines) · ×1
Near-duplicate member family (6 members, 39 shared lines) mistralrs-core/src/models/glm4.rs:209— mistralrs-core/src/models/glm4.rs:209-296 | mistralrs-core/src/models/glm4_moe.rs:272-361 | mistralrs-core/src/models/granite.rs:1538-1622 | mistralrs-core/src/vision_models/phi3/mod.rs:235-327 | mistralrs-core/src/vision_models/phi4/mod.rs:104-196 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:189-285 — These 6 members are variants of one another: a block of 39 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 (6 members, 32 shared lines) · ×1
Near-duplicate member family (6 members, 32 shared lines) mistralrs-core/src/models/mixtral.rs:405— mistralrs-core/src/models/mixtral.rs:405-520 | mistralrs-core/src/vision_models/gemma3/text.rs:432-581 | mistralrs-core/src/vision_models/phi3/mod.rs:1209-1317 | mistralrs-core/src/vision_models/phi4/mod.rs:330-438 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:399-515 | mistralrs-core/src/vision_models/qwen2vl/text.rs:400-517 — These 6 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 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 (6 members, 23 shared lines) · ×1
Near-duplicate member family (6 members, 23 shared lines) mistralrs-core/src/embedding_models/qwen3_embedding.rs:235— mistralrs-core/src/embedding_models/qwen3_embedding.rs:235-269 | mistralrs-core/src/models/llama.rs:271-303 | mistralrs-core/src/models/mistral.rs:318-350 | mistralrs-core/src/models/qwen2.rs:349-382 | mistralrs-core/src/models/qwen3.rs:303-338 | mistralrs-core/src/models/smollm3.rs:287-319 — These 6 members are variants of one another: a block of 23 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Near-duplicate member family (5 members, 40 shared lines) · ×1
Near-duplicate member family (5 members, 40 shared lines) mistralrs-core/src/embedding_models/embedding_gemma.rs:111— mistralrs-core/src/embedding_models/embedding_gemma.rs:111-197 | mistralrs-core/src/models/gemma.rs:91-158 | mistralrs-core/src/models/gemma2.rs:124-198 | mistralrs-core/src/vision_models/gemma3/text.rs:86-170 | mistralrs-core/src/vision_models/gemma3n/text.rs:314-414 — These 5 members are variants of one another: a block of 40 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, 36 shared lines) · ×1
Near-duplicate member family (5 members, 36 shared lines) mistralrs-core/src/models/deepseek2.rs:813— mistralrs-core/src/models/deepseek2.rs:813-948 | mistralrs-core/src/models/deepseek3.rs:876-1011 | mistralrs-core/src/models/glm4_moe.rs:713-827 | mistralrs-core/src/models/glm4_moe_lite.rs:823-964 | mistralrs-core/src/models/mixtral.rs:405-520 — These 5 members are variants of one another: a block of 36 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, 23 shared lines) · ×1
Near-duplicate member family (5 members, 23 shared lines) mistralrs-core/src/vision_models/qwen3_5/mod.rs:133— mistralrs-core/src/vision_models/qwen3_5/mod.rs:133-432 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:116-417 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:669-999 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:114-444 | mistralrs-core/src/vision_models/qwen4_exp/mod.rs:241-405 — These 5 members are variants of one another: a block of 23 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) mistralrs-core/src/xlora_models/mistral.rs:570— mistralrs-core/src/xlora_models/mistral.rs:570-613 | mistralrs-core/src/xlora_models/mixtral.rs:700-743 | mistralrs-core/src/xlora_models/phi2.rs:543-583 | mistralrs-core/src/xlora_models/phi3.rs:521-566 | mistralrs-core/src/xlora_models/starcoder2.rs:553-598 — 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 (5 members, 12 shared lines) · ×1
Near-duplicate member family (5 members, 12 shared lines) mistralrs-quant/src/metal_kernels/mod.rs:396— mistralrs-quant/src/metal_kernels/mod.rs:396-420 | mistralrs-quant/src/metal_kernels/mod.rs:434-466 | mistralrs-quant/src/metal_kernels/mod.rs:480-512 | mistralrs-quant/src/metal_kernels/mod.rs:526-558 | mistralrs-quant/src/metal_kernels/mod.rs:571-598 — These 5 members are variants of one another: a block of 12 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, 182 shared lines) · ×1
Near-duplicate member family (4 members, 182 shared lines) mistralrs-core/src/vision_models/qwen3_5/mod.rs:133— mistralrs-core/src/vision_models/qwen3_5/mod.rs:133-432 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:116-417 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:669-999 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:114-444 — These 4 members are variants of one another: a block of 182 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, 64 shared lines) · ×1
Near-duplicate member family (4 members, 64 shared lines) mistralrs-quant/src/blockwise_fp8/mod.rs:947— mistralrs-quant/src/blockwise_fp8/mod.rs:947-1109 | mistralrs-quant/src/pertensor_fp8/mod.rs:519-668 | mistralrs-quant/src/unquantized/mod.rs:424-610 | mistralrs-quant/src/vector_fp8/mod.rs:98-249 — 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, 49 shared lines) · ×1
Near-duplicate member family (4 members, 49 shared lines) mistralrs/src/model_builder_trait.rs:734— mistralrs/src/model_builder_trait.rs:734-880 | mistralrs/src/model_builder_trait.rs:886-1040 | mistralrs/src/model_builder_trait.rs:1046-1243 | mistralrs/src/model_builder_trait.rs:1478-1659 — These 4 members are variants of one another: a block of 49 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, 41 shared lines) · ×1
Near-duplicate member family (4 members, 41 shared lines) mistralrs-core/src/models/deepseek2.rs:718— mistralrs-core/src/models/deepseek2.rs:718-770 | mistralrs-core/src/models/deepseek3.rs:781-833 | mistralrs-core/src/models/glm4_moe.rs:618-670 | mistralrs-core/src/models/glm4_moe_lite.rs:727-780 — These 4 members are variants of one another: a block of 41 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) mistralrs-cli/src/ui/handlers/api.rs:165— mistralrs-cli/src/ui/handlers/api.rs:165-212 | mistralrs-cli/src/ui/handlers/api.rs:217-264 | mistralrs-cli/src/ui/handlers/api.rs:269-316 | mistralrs-cli/src/ui/handlers/api.rs:321-372 — 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, 34 shared lines) · ×1
Near-duplicate member family (4 members, 34 shared lines) mistralrs-core/src/models/flint.rs:230— mistralrs-core/src/models/flint.rs:230-338 | mistralrs-core/src/models/glm4_moe.rs:177-263 | mistralrs-core/src/models/hunyuan_v1_dense.rs:108-182 | mistralrs-core/src/models/hunyuan_v1_moe.rs:285-365 — These 4 members are variants of one another: a block of 34 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, 30 shared lines) · ×1
Near-duplicate member family (4 members, 30 shared lines) mistralrs-core/src/models/mixtral.rs:405— mistralrs-core/src/models/mixtral.rs:405-520 | mistralrs-core/src/models/qwen2.rs:432-549 | mistralrs-core/src/models/qwen3.rs:402-523 | mistralrs-core/src/models/qwen3_moe.rs:576-703 — These 4 members are variants of one another: a block of 30 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, 27 shared lines) · ×1
Near-duplicate member family (4 members, 27 shared lines) mistralrs-core/src/vision_models/qwen3_5/mod.rs:72— mistralrs-core/src/vision_models/qwen3_5/mod.rs:72-112 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:60-95 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:614-648 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:59-93 — These 4 members are variants of one another: a block of 27 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, 26 shared lines) · ×1
Near-duplicate member family (4 members, 26 shared lines) mistralrs-core/src/models/mixtral.rs:405— mistralrs-core/src/models/mixtral.rs:405-520 | mistralrs-core/src/models/qwen2.rs:432-549 | mistralrs-core/src/vision_models/phi3/mod.rs:1209-1317 | mistralrs-core/src/vision_models/phi4/mod.rs:330-438 — These 4 members are variants of one another: a block of 26 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, 22 shared lines) · ×1
Near-duplicate member family (4 members, 22 shared lines) mistralrs-core/src/models/phi3.rs:534— mistralrs-core/src/models/phi3.rs:534-563 | mistralrs-core/src/models/phi3_5_moe.rs:607-636 | mistralrs-core/src/vision_models/phi3/mod.rs:1327-1366 | mistralrs-core/src/vision_models/phi4/mod.rs:456-528 — These 4 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 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, 18 shared lines) · ×1
Near-duplicate member family (4 members, 18 shared lines) mistralrs-core/src/xlora_models/gemma2.rs:608— mistralrs-core/src/xlora_models/gemma2.rs:608-668 | mistralrs-core/src/xlora_models/phi2.rs:543-583 | mistralrs-core/src/xlora_models/quantized_llama.rs:775-835 | mistralrs-core/src/xlora_models/quantized_phi3.rs:437-500 — These 4 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 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, 17 shared lines) · ×1
Near-duplicate member family (4 members, 17 shared lines) mistralrs-core/src/xlora_models/phi2.rs:543— mistralrs-core/src/xlora_models/phi2.rs:543-583 | mistralrs-core/src/xlora_models/quantized_llama.rs:775-835 | mistralrs-core/src/xlora_models/quantized_phi3.rs:437-500 | mistralrs-core/src/xlora_models/starcoder2.rs:553-598 — These 4 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 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, 14 shared lines) · ×1
Near-duplicate member family (4 members, 14 shared lines) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:984— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:984-1013 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1549-1578 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1678-1707 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1717-1756 — These 4 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 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, 12 shared lines) · ×1
Near-duplicate member family (4 members, 12 shared lines) mistralrs-quant/src/metal_kernels/mod.rs:3999— mistralrs-quant/src/metal_kernels/mod.rs:3999-4022 | mistralrs-quant/src/metal_kernels/mod.rs:4034-4057 | mistralrs-quant/src/metal_kernels/mod.rs:4071-4097 | mistralrs-quant/src/metal_kernels/mod.rs:4111-4137 — These 4 members are variants of one another: a block of 12 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, 163 shared lines) · ×1
Near-duplicate member family (3 members, 163 shared lines) mistralrs-core/src/models/deepseek2.rs:294— mistralrs-core/src/models/deepseek2.rs:294-489 | mistralrs-core/src/models/deepseek3.rs:295-490 | mistralrs-core/src/models/glm4_moe_lite.rs:255-454 — These 3 members are variants of one another: a block of 163 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, 80 shared lines) · ×1
Near-duplicate member family (3 members, 80 shared lines) mistralrs-core/src/models/llama.rs:612— mistralrs-core/src/models/llama.rs:612-703 | mistralrs-core/src/models/smollm3.rs:631-722 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:625-719 — These 3 members are variants of one another: a block of 80 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, 79 shared lines) · ×1
Near-duplicate member family (3 members, 79 shared lines) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1022— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1022-1117 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1587-1682 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1766-1878 — These 3 members are variants of one another: a block of 79 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, 68 shared lines) · ×1
Near-duplicate member family (3 members, 68 shared lines) mistralrs-paged-attn/src/cuda/backend/mla.rs:16— mistralrs-paged-attn/src/cuda/backend/mla.rs:16-224 | mistralrs-paged-attn/src/cuda/backend/mla.rs:240-641 | mistralrs-paged-attn/src/cuda/backend/mla.rs:649-897 — These 3 members are variants of one another: a block of 68 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, 42 shared lines) · ×1
Near-duplicate member family (3 members, 42 shared lines) mistralrs-core/src/ops.rs:4393— mistralrs-core/src/ops.rs:4393-4570 | mistralrs-core/src/ops.rs:4578-4721 | mistralrs-core/src/ops.rs:5337-5566 — These 3 members are variants of one another: a block of 42 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, 39 shared lines) · ×1
Near-duplicate member family (3 members, 39 shared lines) mistralrs-core/src/models/deepseek2.rs:1019— mistralrs-core/src/models/deepseek2.rs:1019-1072 | mistralrs-core/src/models/deepseek3.rs:1083-1137 | mistralrs-core/src/models/glm4_moe_lite.rs:1037-1091 — These 3 members are variants of one another: a block of 39 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, 30 shared lines) · ×1
Near-duplicate member family (3 members, 30 shared lines) mistralrs-quant/src/gemv/mod.rs:370— mistralrs-quant/src/gemv/mod.rs:370-428 | mistralrs-quant/src/gemv/mod.rs:441-496 | mistralrs-quant/src/gemv/mod.rs:509-564 — These 3 members are variants of one another: a block of 30 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, 26 shared lines) · ×1
Near-duplicate member family (3 members, 26 shared lines) mistralrs-quant/src/gguf/fast_mmvq.rs:299— mistralrs-quant/src/gguf/fast_mmvq.rs:299-470 | mistralrs-quant/src/gguf/fast_mmvq.rs:477-677 | mistralrs-quant/src/gguf/fast_mmvq.rs:687-940 — These 3 members are variants of one another: a block of 26 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, 25 shared lines) · ×1
Near-duplicate member family (3 members, 25 shared lines) mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:319— mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:319-358 | mistralrs-core/src/vision_models/qwen2vl/text.rs:320-359 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:308-340 — These 3 members are variants of one another: a block of 25 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, 21 shared lines) · ×1
Near-duplicate member family (3 members, 21 shared lines) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1131— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:1131-1197 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1696-1762 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1892-1975 — These 3 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 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, 19 shared lines) · ×1
Near-duplicate member family (3 members, 19 shared lines) mistralrs-core/src/models/phi3.rs:339— mistralrs-core/src/models/phi3.rs:339-363 | mistralrs-core/src/vision_models/phi3/mod.rs:430-454 | mistralrs-core/src/vision_models/phi4/mod.rs:259-284 — These 3 members are variants of one another: a block of 19 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, 17 shared lines) · ×1
Near-duplicate member family (3 members, 17 shared lines) mistralrs-core/src/models/quantized_llama.rs:79— mistralrs-core/src/models/quantized_llama.rs:79-134 | mistralrs-core/src/xlora_models/quantized_llama.rs:199-248 | mistralrs-core/src/xlora_models/quantized_phi3.rs:153-219 — These 3 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 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 (181 shared lines) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:187— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:187-376 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:344-532 — These two members are variants of one another: 181 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 (163 shared lines) mistralrs-core/src/model_loader.rs:292— mistralrs-core/src/model_loader.rs:292-931 | mistralrs-core/src/toml_selector.rs:811-1248 — These two members are variants of one another: 163 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 (145 shared lines) mistralrs-core/src/pipeline/multimodal.rs:2029— mistralrs-core/src/pipeline/multimodal.rs:2029-2255 | mistralrs-core/src/pipeline/normal.rs:1857-2054 — These two members are variants of one another: 145 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 (106 shared lines) mistralrs-core/src/models/llama.rs:345— mistralrs-core/src/models/llama.rs:345-468 | mistralrs-core/src/models/smollm3.rs:361-491 — These two members are variants of one another: 106 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 (101 shared lines) mistralrs-quant/src/mxfp4/ops.rs:21— mistralrs-quant/src/mxfp4/ops.rs:21-214 | mistralrs-quant/src/mxfp4/ops.rs:319-614 — These two members are variants of one another: 101 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 (92 shared lines) mistralrs-cli/src/commands/run/interactive.rs:867— mistralrs-cli/src/commands/run/interactive.rs:867-1049 | mistralrs-cli/src/commands/run/interactive.rs:1525-1844 — These two members are variants of one another: 92 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 (89 shared lines) mistralrs-core/src/xlora_models/quantized_llama.rs:274— mistralrs-core/src/xlora_models/quantized_llama.rs:274-459 | mistralrs-core/src/xlora_models/quantized_llama.rs:474-761 — These two members are variants of one another: 89 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 (87 shared lines) REDACTED:1154— REDACTED:1154-1380 | REDACTED:123-317 — These two members are variants of one another: 87 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 (84 shared lines) mistralrs-quant/src/blockwise_fp8/ops.rs:1015— mistralrs-quant/src/blockwise_fp8/ops.rs:1015-1162 | mistralrs-quant/src/blockwise_fp8/ops.rs:1178-1358 — These two members are variants of one another: 84 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 (82 shared lines) mistralrs-core/src/vision_models/phi3/mod.rs:532— mistralrs-core/src/vision_models/phi3/mod.rs:532-679 | mistralrs-core/src/vision_models/phi4/image_embedding.rs:130-311 — These two members are variants of one another: 82 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 (74 shared lines) mistralrs-paged-attn/src/metal/kernels/mod.rs:521— mistralrs-paged-attn/src/metal/kernels/mod.rs:521-618 | mistralrs-paged-attn/src/metal/kernels/mod.rs:658-784 — These two members are variants of one another: 74 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 (69 shared lines) mistralrs-core/src/models/phi3.rs:407— mistralrs-core/src/models/phi3.rs:407-532 | mistralrs-core/src/models/phi3_5_moe.rs:479-605 — These two members are variants of one another: 69 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 (68 shared lines) mistralrs-quant/src/metal_kernels/mod.rs:4266— mistralrs-quant/src/metal_kernels/mod.rs:4266-4469 | mistralrs-quant/src/metal_kernels/mod.rs:5019-5125 — These two members are variants of one another: 68 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 (64 shared lines) mistralrs-core/src/ops.rs:2000— mistralrs-core/src/ops.rs:2000-2110 | mistralrs-core/src/ops.rs:2117-2267 — These two members are variants of one another: 64 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 (58 shared lines) mistralrs-cli/src/commands/run/interactive.rs:1865— mistralrs-cli/src/commands/run/interactive.rs:1865-1981 | mistralrs-cli/src/commands/run/interactive.rs:1990-2108 — These two members are variants of one another: 58 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 (55 shared lines) mistralrs-quant/src/metal_kernels/mod.rs:3831— mistralrs-quant/src/metal_kernels/mod.rs:3831-3893 | mistralrs-quant/src/metal_kernels/mod.rs:3922-3983 — These two members are variants of one another: 55 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 (53 shared lines) mistralrs-quant/src/cutile/nvfp4_gemv.rs:54— mistralrs-quant/src/cutile/nvfp4_gemv.rs:54-140 | mistralrs-quant/src/cutile/nvfp4_gemv.rs:158-244 — These two members are variants of one another: 53 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 (45 shared lines) mistralrs-paged-attn/src/metal/kernels/mod.rs:425— mistralrs-paged-attn/src/metal/kernels/mod.rs:425-484 | mistralrs-paged-attn/src/metal/kernels/mod.rs:814-879 — These two members are variants of one another: 45 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 (44 shared lines) mistralrs-quant/src/cublaslt/matmul.rs:407— mistralrs-quant/src/cublaslt/matmul.rs:407-515 | mistralrs-quant/src/cublaslt/matmul.rs:531-612 — These two members are variants of one another: 44 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 (40 shared lines) mistralrs-server-core/src/anthropic.rs:1823— mistralrs-server-core/src/anthropic.rs:1823-1912 | mistralrs-server-core/src/chat_completion.rs:1126-1225 — These two members are variants of one another: 40 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 (39 shared lines) mistralrs-quant/src/cutile/fp8_w8a16.rs:808— mistralrs-quant/src/cutile/fp8_w8a16.rs:808-874 | mistralrs-quant/src/cutile/fp8_w8a8.rs:827-908 — These two members are variants of one another: 39 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) mistralrs-quant/src/blockwise_fp8/ops.rs:778— mistralrs-quant/src/blockwise_fp8/ops.rs:778-890 | mistralrs-quant/src/blockwise_fp8/ops.rs:893-1001 — 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 (30 shared lines) mistralrs-quant/src/gguf/cuda.rs:662— mistralrs-quant/src/gguf/cuda.rs:662-709 | mistralrs-quant/src/gguf/cuda.rs:725-769 — These two members are variants of one another: 30 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 (40 corresponding lines) · ×1
Edited copy of a member (40 corresponding lines) mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:393— mistralrs-core/src/vision_models/qwen2_5_vl/vision.rs:393-432 | mistralrs-core/src/vision_models/qwen2vl/vision.rs:357-396 — 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 (32 corresponding lines) · ×1
Edited copy of a member (32 corresponding lines) mistralrs-pyo3/src/lib.rs:1002— mistralrs-pyo3/src/lib.rs:1002-1284 | mistralrs-server-core/src/mistralrs_for_server_builder.rs:1362-1398 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (39 corresponding lines) · ×1
Edited copy of a member (39 corresponding lines) mistralrs-core/src/models/granite.rs:1455— mistralrs-core/src/models/granite.rs:1455-1501 | mistralrs-core/src/models/granite.rs:1745-1787 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (38 corresponding lines) · ×1
Edited copy of a member (38 corresponding lines) mistralrs-quant/src/metal_kernels/mod.rs:3364— mistralrs-quant/src/metal_kernels/mod.rs:3364-3405 | mistralrs-quant/src/metal_kernels/mod.rs:3493-3534 — 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 (35 corresponding lines) · ×1
Edited copy of a member (35 corresponding lines) mistralrs-quant/src/metal_kernels/mod.rs:3300— mistralrs-quant/src/metal_kernels/mod.rs:3300-3338 | mistralrs-quant/src/metal_kernels/mod.rs:3428-3466 — 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 (14 corresponding lines) · ×1
Edited copy of a member (14 corresponding lines) mistralrs-quant/src/safetensors.rs:247— mistralrs-quant/src/safetensors.rs:247-265 | mistralrs-quant/src/safetensors.rs:287-322 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×1
Edited copy of a member (15 corresponding lines) mistralrs-quant/src/metal_kernels/mod.rs:1244— mistralrs-quant/src/metal_kernels/mod.rs:1244-1370 | mistralrs-quant/src/metal_kernels/mod.rs:1415-1462 — 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 (18 corresponding lines) · ×1
Edited copy of a member (18 corresponding lines) mistralrs/src/messages.rs:514— mistralrs/src/messages.rs:514-531 | mistralrs/src/messages.rs:1196-1223 — 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.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×1
Edited copy of a member (23 corresponding lines) mistralrs-core/src/tools/parsers/gemma4.rs:286— mistralrs-core/src/tools/parsers/gemma4.rs:286-326 | mistralrs-core/src/tools/parsers/gemma4.rs:329-360 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (21 corresponding lines) · ×1
Edited copy of a member (21 corresponding lines) mistralrs-core/src/layers.rs:3891— mistralrs-core/src/layers.rs:3891-3917 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:100-124 — 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 (12 corresponding lines) · ×1
Edited copy of a member (12 corresponding lines) mistralrs-quant/src/metal_kernels/mod.rs:1659— mistralrs-quant/src/metal_kernels/mod.rs:1659-1696 | mistralrs-quant/src/metal_kernels/mod.rs:2582-2717 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (25 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (25 members, 50+ identical tokens) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:946— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:946-1011 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3749-3850 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4521-4595 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4923-4984 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5335-5413 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:763-786 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1207-1230 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1451-1474 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1678-1701 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1898-1921 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2134-2157 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2831-2854 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3128-3150 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3461-3483 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3724-3746 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3936-3958 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4185-4207 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4416-4438 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4688-4710 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5000-5022 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5283-5305 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5744-5767 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5990-6013 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6253-6276 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6520-6543 — These 25 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 25 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 25 times.
D4 · Code Duplication· Members sharing a duplicated core (24 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (24 members, 50+ identical tokens) examples/server/chat.py:8— examples/server/chat.py:8-28 | examples/server/completion.py:8-28 | examples/server/embedding.py:8-28 | examples/server/gemma3.py:8-28 | examples/server/gemma3n.py:8-28 | examples/server/gpt_oss.py:18-38 | examples/server/idefics2.py:8-28 | examples/server/idefics3.py:8-28 | examples/server/llama4.py:8-28 | examples/server/llama_vision.py:8-28 | examples/server/llava.py:8-28 | examples/server/llava_next.py:8-28 | examples/server/minicpmo_2_6.py:8-28 | examples/server/mistral3.py:8-28 | examples/server/phi3v.py:8-28 | examples/server/phi3v_base64.py:9-29 | examples/server/phi3v_local_img.py:8-28 | examples/server/phi4mm.py:8-28 | examples/server/qwen3.py:8-28 | examples/server/responses.py:18-38 | examples/server/responses_audio.py:8-28 | examples/server/responses_vision.py:8-28 | examples/server/smollm3.py:8-28 | scripts/bench.py:26-46 — These 24 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 24 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 24 times.
D4 · Code Duplication· Members sharing a duplicated core (22 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (22 members, 50+ identical tokens) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:434— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:434-447 | mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:637-650 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1159-1172 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1540-1553 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1848-1861 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2571-2584 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3999-4012 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4372-4385 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4777-4790 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5590-5624 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:9233-9253 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:10479-10494 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:694-707 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:920-933 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1141-1154 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2042-2059 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2293-2306 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3651-3664 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3872-3883 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4085-4106 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5190-5208 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5678-5691 — These 22 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 22 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 22 times.
D4 · Code Duplication· Members sharing a duplicated core (12 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (12 members, 50+ identical tokens) mistralrs-core/src/models/flint.rs:739— mistralrs-core/src/models/flint.rs:739-750 | mistralrs-core/src/models/gemma.rs:311-322 | mistralrs-core/src/models/gpt_oss.rs:681-693 | mistralrs-core/src/models/hunyuan_v1_dense.rs:338-349 | mistralrs-core/src/models/hunyuan_v1_moe.rs:828-839 | mistralrs-core/src/models/mistral.rs:359-370 | mistralrs-core/src/models/mixtral.rs:368-381 | mistralrs-core/src/models/phi3.rs:372-383 | mistralrs-core/src/models/qwen3.rs:347-358 | mistralrs-core/src/models/qwen3_moe.rs:521-532 | mistralrs-core/src/vision_models/phi3/mod.rs:463-474 | mistralrs-core/src/vision_models/phi4/mod.rs:293-304 — These 12 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 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· Members sharing a duplicated core (9 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (9 members, 50+ identical tokens) mistralrs-core/src/metal/gdn.rs:161— mistralrs-core/src/metal/gdn.rs:161-237 | mistralrs-core/src/metal/gdn.rs:272-342 | mistralrs-core/src/metal/gdn.rs:374-431 | mistralrs-core/src/metal/gdn.rs:491-582 | mistralrs-core/src/metal/gdn.rs:586-633 | mistralrs-core/src/metal/gdn.rs:646-698 | mistralrs-core/src/metal/gdn.rs:753-908 | mistralrs-core/src/metal/gdn.rs:937-1002 | mistralrs-core/src/metal/ssm.rs:132-212 — These 9 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 9 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 9 times.
D4 · Code Duplication· Members sharing a duplicated core (8 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (8 members, 50+ identical tokens) mistralrs-core/src/xlora_models/gemma.rs:425— mistralrs-core/src/xlora_models/gemma.rs:425-564 | mistralrs-core/src/xlora_models/gemma2.rs:456-596 | mistralrs-core/src/xlora_models/llama.rs:530-667 | mistralrs-core/src/xlora_models/mistral.rs:421-558 | mistralrs-core/src/xlora_models/mixtral.rs:551-688 | mistralrs-core/src/xlora_models/phi2.rs:402-531 | mistralrs-core/src/xlora_models/phi3.rs:388-508 | mistralrs-core/src/xlora_models/starcoder2.rs:410-541 — 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.
Duplicated block (110 lines × 2) mistralrs-core/src/pipeline/mod.rs:2193— mistralrs-core/src/pipeline/mod.rs:2193-2302 | mistralrs-core/src/pipeline/mod.rs:2860-2969 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (88 lines × 2) mistralrs-core/src/vision_models/qwen3_5/config.rs:267— mistralrs-core/src/vision_models/qwen3_5/config.rs:267-354 | mistralrs-core/src/vision_models/qwen3_5_moe/config.rs:72-159 — 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 (77 lines × 2) mistralrs-core/src/vision_models/qwen3_vl/text.rs:107— mistralrs-core/src/vision_models/qwen3_vl/text.rs:107-183 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:213-289 — `mistralrs-core/src/vision_models/qwen3_vl/text.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/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 42 separate duplicated blocks between them, totalling at least 613 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 (76 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:444— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:444-519 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1052-1127 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1112-1187 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (4–68 lines × 5) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4179— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4179-4182 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6683-6750 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7125-7192 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7596-7661 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8118-8183 — 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 (67 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:818— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:818-884 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1383-1449 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1502-1568 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (65 lines × 3) mistralrs-core/src/embedding_models/qwen3_embedding.rs:94— mistralrs-core/src/embedding_models/qwen3_embedding.rs:94-158 | mistralrs-core/src/models/qwen3.rs:105-169 | mistralrs-core/src/models/qwen3_moe.rs:108-172 — `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/qwen3.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 27 separate duplicated blocks between them, totalling at least 372 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 (65 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:1144— mistralrs-core/src/pipeline/multimodal.rs:1144-1208 | mistralrs-core/src/pipeline/normal.rs:1190-1254 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (63 lines × 2) mistralrs/src/messages.rs:417— mistralrs/src/messages.rs:417-479 | mistralrs/src/messages.rs:912-974 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (61 lines × 2) mistralrs-quant/src/gguf/fast_mmq.rs:914— mistralrs-quant/src/gguf/fast_mmq.rs:914-974 | mistralrs-quant/src/gguf/fast_mmq.rs:1399-1459 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (60 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:188— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:188-247 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:345-404 — `mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 21 separate duplicated blocks between them, totalling at least 374 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 (58 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:165— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:165-222 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:731-788 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:826-883 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (57–58 lines × 3) mistralrs-quant/src/blockwise_fp8/mod.rs:985— mistralrs-quant/src/blockwise_fp8/mod.rs:985-1042 | mistralrs-quant/src/pertensor_fp8/mod.rs:547-603 | mistralrs-quant/src/vector_fp8/mod.rs:127-183 — `mistralrs-quant/src/blockwise_fp8/mod.rs` and `mistralrs-quant/src/pertensor_fp8/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 9 separate duplicated blocks between them, totalling at least 217 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 (56–58 lines × 3) mistralrs-quant/src/blockwise_fp8/mod.rs:1047— mistralrs-quant/src/blockwise_fp8/mod.rs:1047-1104 | mistralrs-quant/src/pertensor_fp8/mod.rs:608-663 | mistralrs-quant/src/vector_fp8/mod.rs:188-244 — `mistralrs-quant/src/blockwise_fp8/mod.rs` and `mistralrs-quant/src/pertensor_fp8/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 9 separate duplicated blocks between them, totalling at least 217 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 (57 lines × 3) mistralrs-core/src/models/deepseek2.rs:327— mistralrs-core/src/models/deepseek2.rs:327-383 | mistralrs-core/src/models/deepseek3.rs:328-384 | mistralrs-core/src/models/glm4_moe_lite.rs:291-347 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (57 lines × 2) mistralrs-paged-attn/src/metal/kernels/mod.rs:552— mistralrs-paged-attn/src/metal/kernels/mod.rs:552-608 | mistralrs-paged-attn/src/metal/kernels/mod.rs:696-752 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (53 lines × 4) mistralrs-core/src/vision_models/qwen3_5/mod.rs:322— mistralrs-core/src/vision_models/qwen3_5/mod.rs:322-374 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:305-357 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:858-910 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:303-355 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (50 lines × 7) mistralrs-core/src/xlora_models/gemma.rs:641— mistralrs-core/src/xlora_models/gemma.rs:641-690 | mistralrs-core/src/xlora_models/gemma2.rs:692-741 | mistralrs-core/src/xlora_models/llama.rs:469-518 | mistralrs-core/src/xlora_models/mistral.rs:637-686 | mistralrs-core/src/xlora_models/mixtral.rs:767-816 | mistralrs-core/src/xlora_models/phi2.rs:607-656 | mistralrs-core/src/xlora_models/starcoder2.rs:622-671 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (50 lines × 2) mistralrs-core/src/xlora_models/quantized_llama.rs:859— mistralrs-core/src/xlora_models/quantized_llama.rs:859-908 | mistralrs-core/src/xlora_models/quantized_phi3.rs:524-573 — before extracting anything, compare `mistralrs-core/src/xlora_models/quantized_llama.rs` and `mistralrs-core/src/xlora_models/quantized_phi3.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 221 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (48 lines × 3) mistralrs-core/src/models/qwen2.rs:165— mistralrs-core/src/models/qwen2.rs:165-212 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:122-169 | mistralrs-core/src/vision_models/qwen2vl/text.rs:123-170 — before extracting anything, compare `mistralrs-core/src/models/qwen2.rs` and `mistralrs-core/src/vision_models/qwen2_5_vl/text.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 295 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 (48 lines × 2) mistralrs-core/src/models/deepseek2.rs:616— mistralrs-core/src/models/deepseek2.rs:616-663 | mistralrs-core/src/models/deepseek3.rs:679-726 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (46–48 lines × 2) mistralrs-core/src/models/glm4_moe.rs:521— mistralrs-core/src/models/glm4_moe.rs:521-566 | mistralrs-core/src/models/glm4_moe_lite.rs:625-672 — before extracting anything, compare `mistralrs-core/src/models/glm4_moe.rs` and `mistralrs-core/src/models/glm4_moe_lite.rs` as WHOLE FILES: this scan already matched 43 separate duplicated blocks between them, totalling at least 572 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (47 lines × 2) mistralrs-core/src/models/deepseek2.rs:169— mistralrs-core/src/models/deepseek2.rs:169-215 | mistralrs-core/src/models/deepseek3.rs:170-216 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (45–46 lines × 2) mistralrs-mcp/src/client.rs:464— mistralrs-mcp/src/client.rs:464-508 | mistralrs-mcp/src/client.rs:618-663 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (45 lines × 3) mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:532— mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:532-576 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:539-583 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:469-513 — before extracting anything, compare `mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs` and `mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 206 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (45 lines × 2) mistralrs-core/src/models/deepseek2.rs:241— mistralrs-core/src/models/deepseek2.rs:241-285 | mistralrs-core/src/models/deepseek3.rs:242-286 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (44 lines × 3) mistralrs-core/src/models/mistral.rs:135— mistralrs-core/src/models/mistral.rs:135-178 | mistralrs-core/src/models/mixtral.rs:81-124 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:155-198 — before extracting anything, compare `mistralrs-core/src/models/mistral.rs` and `mistralrs-core/src/models/mixtral.rs` as WHOLE FILES: this scan already matched 43 separate duplicated blocks between them, totalling at least 564 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (44 lines × 2) mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:457— mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:457-500 | mistralrs-core/src/vision_models/qwen2vl/text.rs:459-502 — `mistralrs-core/src/vision_models/qwen2_5_vl/text.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 43 separate duplicated blocks between them, totalling at least 650 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 (39–40 lines × 10) mistralrs-core/src/models/gemma.rs:610— mistralrs-core/src/models/gemma.rs:610-649 | mistralrs-core/src/models/gemma2.rs:727-766 | mistralrs-core/src/models/glm4.rs:730-769 | mistralrs-core/src/models/hunyuan_v1_dense.rs:698-737 | mistralrs-core/src/models/mistral.rs:738-777 | mistralrs-core/src/models/qwen2.rs:740-779 | mistralrs-core/src/models/qwen3.rs:716-755 | mistralrs-core/src/vision_models/gemma3/text.rs:951-990 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:697-736 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:705-743 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (40 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:679— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:679-718 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1288-1327 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1353-1392 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (21–40 lines × 2) mistralrs-core/src/cuda/speculative_rejection.rs:521— mistralrs-core/src/cuda/speculative_rejection.rs:521-560 | mistralrs-core/src/cuda/speculative_rejection.rs:588-608 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (39–40 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:2129— mistralrs-core/src/pipeline/multimodal.rs:2129-2168 | mistralrs-core/src/pipeline/normal.rs:1943-1981 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (38–40 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:2466— mistralrs-core/src/pipeline/multimodal.rs:2466-2505 | mistralrs-core/src/pipeline/normal.rs:2169-2206 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (30–40 lines × 2) mistralrs-core/src/vision_models/gemma3/text.rs:791— mistralrs-core/src/vision_models/gemma3/text.rs:791-830 | mistralrs-core/src/vision_models/gemma4/text.rs:2460-2489 — `mistralrs-core/src/vision_models/gemma3/text.rs` and `mistralrs-core/src/vision_models/gemma4/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 9 separate duplicated blocks between them, totalling at least 108 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 (39 lines × 3) mistralrs-core/src/models/deepseek2.rs:209— mistralrs-core/src/models/deepseek2.rs:209-247 | mistralrs-core/src/models/deepseek3.rs:210-248 | mistralrs-core/src/models/glm4_moe_lite.rs:170-208 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (37–39 lines × 2) mistralrs-quant/src/metal_kernels/mod.rs:4402— mistralrs-quant/src/metal_kernels/mod.rs:4402-4440 | mistralrs-quant/src/metal_kernels/mod.rs:5058-5094 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (36–37 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:367— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:367-403 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:933-968 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1034-1069 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (29–37 lines × 2) mistralrs-core/src/vision_models/gemma3n/audio.rs:337— mistralrs-core/src/vision_models/gemma3n/audio.rs:337-373 | mistralrs-core/src/vision_models/gemma4/audio.rs:146-174 — `mistralrs-core/src/vision_models/gemma3n/audio.rs` and `mistralrs-core/src/vision_models/gemma4/audio.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 16 separate duplicated blocks between them, totalling at least 279 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 (36 lines × 3) mistralrs-core/src/gguf/gemma3_bindings.rs:157— mistralrs-core/src/gguf/gemma3_bindings.rs:157-192 | mistralrs-core/src/gguf/idefics3_bindings.rs:49-84 | mistralrs-core/src/gguf/lfm2_vl_bindings.rs:84-119 — 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.
Duplicated block (35–36 lines × 2) mistralrs-core/src/pipeline/normal.rs:1146— mistralrs-core/src/pipeline/normal.rs:1146-1180 | mistralrs-core/src/pipeline/normal.rs:1274-1309 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34–35 lines × 2) mistralrs-core/src/gguf/gemma3_bindings.rs:108— mistralrs-core/src/gguf/gemma3_bindings.rs:108-142 | mistralrs-core/src/gguf/muse_glimmer_bindings.rs:67-100 — before extracting anything, compare `mistralrs-core/src/gguf/gemma3_bindings.rs` and `mistralrs-core/src/gguf/muse_glimmer_bindings.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (34 lines × 6) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:590— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:590-623 | mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:597-630 | mistralrs-core/src/vision_models/mllama/inputs_processor.rs:358-391 | mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:729-762 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1005-1038 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1403-1436 — `mistralrs-core/src/vision_models/gemma3/inputs_processor.rs` and `mistralrs-core/src/vision_models/idefics3/inputs_processor.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 9 separate duplicated blocks between them, totalling at least 138 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 (34 lines × 3) mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:527— mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:527-560 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1135-1168 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1195-1228 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (33 lines × 5) mistralrs-core/src/vision_models/qwen3_5/mod.rs:453— mistralrs-core/src/vision_models/qwen3_5/mod.rs:453-485 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:440-472 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:1038-1070 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:467-499 | mistralrs-core/src/vision_models/qwen4_exp/mod.rs:426-458 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (32–33 lines × 4) mistralrs-core/src/models/granite.rs:1644— mistralrs-core/src/models/granite.rs:1644-1675 | mistralrs-core/src/models/llama.rs:181-213 | mistralrs-core/src/models/smollm3.rs:198-230 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:155-187 — before extracting anything, compare `mistralrs-core/src/models/granite.rs` and `mistralrs-core/src/models/llama.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 244 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (33 lines × 4) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3088— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3088-3120 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3430-3462 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3806-3838 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4555-4587 — 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–33 lines × 4) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3212— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3212-3239 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3545-3572 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4767-4799 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5078-5110 — 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 (32–33 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:1486— mistralrs-core/src/pipeline/multimodal.rs:1486-1518 | mistralrs-core/src/pipeline/normal.rs:208-239 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (29–33 lines × 2) mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:630— mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:630-662 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:403-431 — `mistralrs-core/src/vision_models/idefics3/inputs_processor.rs` and `mistralrs-core/src/vision_models/mistral3/inputs_processor.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 157 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 (31–33 lines × 2) mistralrs-core/src/vision_models/llava/llava15.rs:193— mistralrs-core/src/vision_models/llava/llava15.rs:193-225 | mistralrs-core/src/vision_models/llava/llava_next.rs:158-188 — before extracting anything, compare `mistralrs-core/src/vision_models/llava/llava15.rs` and `mistralrs-core/src/vision_models/llava/llava_next.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (29–32 lines × 10) mistralrs-core/src/models/glm4.rs:244— mistralrs-core/src/models/glm4.rs:244-275 | mistralrs-core/src/models/glm4_moe.rs:312-340 | mistralrs-core/src/models/granite.rs:1573-1601 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:272-300 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:239-267 | mistralrs-core/src/vision_models/qwen2vl/text.rs:240-268 | mistralrs-core/src/vision_models/qwen3_5/text.rs:364-392 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:232-260 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:236-267 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:342-370 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/glm4_moe.rs` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 341 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (26–32 lines × 3) mistralrs-quant/src/blockwise_fp8/mod.rs:953— mistralrs-quant/src/blockwise_fp8/mod.rs:953-984 | mistralrs-quant/src/pertensor_fp8/mod.rs:521-546 | mistralrs-quant/src/vector_fp8/mod.rs:101-126 — `mistralrs-quant/src/blockwise_fp8/mod.rs` and `mistralrs-quant/src/pertensor_fp8/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 9 separate duplicated blocks between them, totalling at least 217 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 (30 lines × 7) mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:365— mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:365-394 | mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:469-498 | mistralrs-core/src/vision_models/lfm2_vl/inputs_processor.rs:721-750 | mistralrs-core/src/vision_models/llama4/inputs_processor.rs:447-476 | mistralrs-core/src/vision_models/minicpmo/inputs_processor.rs:495-524 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:374-403 | mistralrs-core/src/vision_models/voxtral/inputs_processor.rs:280-309 — before extracting anything, compare `mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs` and `mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 98 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 (30 lines × 4) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:530— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:530-559 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4613-4642 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1015-1044 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2395-2424 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/embedding_loaders.rs` and `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (25–30 lines × 2) mistralrs-core/src/models/glm4_moe.rs:455— mistralrs-core/src/models/glm4_moe.rs:455-479 | mistralrs-core/src/models/glm4_moe_lite.rs:553-582 — before extracting anything, compare `mistralrs-core/src/models/glm4_moe.rs` and `mistralrs-core/src/models/glm4_moe_lite.rs` as WHOLE FILES: this scan already matched 43 separate duplicated blocks between them, totalling at least 572 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (26–30 lines × 2) mistralrs-core/src/ops.rs:1557— mistralrs-core/src/ops.rs:1557-1582 | mistralrs-core/src/ops.rs:1795-1824 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (3–30 lines × 3) mistralrs-core/src/vision_models/muse_glimmer/mod.rs:154— mistralrs-core/src/vision_models/muse_glimmer/mod.rs:154-156 | mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:137-166 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:160-189 — `mistralrs-core/src/vision_models/muse_glimmer/mod.rs` and `mistralrs-core/src/vision_models/qwen2_5_vl/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 5 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.
Duplicated block (28–30 lines × 2) mistralrs-quant/src/gguf/fast_mmq.rs:981— mistralrs-quant/src/gguf/fast_mmq.rs:981-1008 | mistralrs-quant/src/gguf/fast_mmq.rs:1151-1180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (28–29 lines × 7) mistralrs-core/src/models/flint.rs:474— mistralrs-core/src/models/flint.rs:474-502 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:222-249 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:45-72 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:49-76 | mistralrs-core/src/vision_models/qwen2vl/text.rs:50-77 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:37-64 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:43-71 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/vision_models/llava/llava_llm/llama.rs` as WHOLE FILES: this scan already matched 12 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. 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 (28–29 lines × 2) mistralrs-core/src/paged_attention/cache_engine.rs:247— mistralrs-core/src/paged_attention/cache_engine.rs:247-275 | mistralrs-core/src/paged_attention/cache_engine.rs:382-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.
Duplicated block (13–29 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1174— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1174-1186 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2941-2969 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25–28 lines × 17) mistralrs-core/src/models/flint.rs:395— mistralrs-core/src/models/flint.rs:395-419 | mistralrs-core/src/models/gemma2.rs:247-274 | mistralrs-core/src/models/gpt_oss.rs:280-304 | mistralrs-core/src/models/hunyuan_v1_dense.rs:226-250 | mistralrs-core/src/models/hunyuan_v1_moe.rs:412-436 | mistralrs-core/src/models/llama.rs:108-135 | mistralrs-core/src/models/mistral.rs:248-275 | mistralrs-core/src/models/mixtral.rs:184-211 | mistralrs-core/src/models/phi3_5_moe.rs:214-241 | mistralrs-core/src/models/qwen2.rs:278-305 | mistralrs-core/src/models/qwen3.rs:233-260 | mistralrs-core/src/models/qwen3_moe.rs:236-263 | mistralrs-core/src/models/qwen3_next.rs:320-344 | mistralrs-core/src/models/smollm3.rs:125-152 | mistralrs-core/src/models/starcoder2.rs:260-287 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:82-109 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:251-278 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 186 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 5) mistralrs-core/src/embedding_models/embedding_gemma.rs:117— mistralrs-core/src/embedding_models/embedding_gemma.rs:117-144 | mistralrs-core/src/models/gemma.rs:97-124 | mistralrs-core/src/models/gemma2.rs:130-157 | mistralrs-core/src/models/starcoder2.rs:157-184 | mistralrs-core/src/vision_models/gemma3n/text.rs:320-347 — `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/models/gemma.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 7 separate duplicated blocks between them, totalling at least 113 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 (28 lines × 4) mistralrs-core/src/models/deepseek2.rs:886— mistralrs-core/src/models/deepseek2.rs:886-913 | mistralrs-core/src/models/deepseek3.rs:949-976 | mistralrs-core/src/models/glm4_moe.rs:785-812 | mistralrs-core/src/models/glm4_moe_lite.rs:896-923 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–28 lines × 2) mistralrs-core/src/gguf/gemma3n_bindings.rs:232— mistralrs-core/src/gguf/gemma3n_bindings.rs:232-250 | mistralrs-core/src/gguf/muse_glimmer_bindings.rs:66-93 — 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 (26–28 lines × 2) mistralrs-core/src/ops.rs:1073— mistralrs-core/src/ops.rs:1073-1100 | mistralrs-core/src/ops.rs:1304-1329 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (27–28 lines × 2) mistralrs/src/model_builder_trait.rs:298— mistralrs/src/model_builder_trait.rs:298-325 | mistralrs/src/model_builder_trait.rs:698-724 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26–27 lines × 6) mistralrs-core/src/embedding_models/embedding_gemma.rs:129— mistralrs-core/src/embedding_models/embedding_gemma.rs:129-155 | mistralrs-core/src/models/gemma.rs:109-135 | mistralrs-core/src/models/gemma2.rs:142-168 | mistralrs-core/src/models/starcoder2.rs:169-195 | mistralrs-core/src/vision_models/gemma3/text.rs:102-127 | mistralrs-core/src/vision_models/gemma3n/text.rs:332-358 — `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/models/gemma.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 7 separate duplicated blocks between them, totalling at least 113 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 (27 lines × 5) mistralrs-core/src/xlora_models/gemma.rs:466— mistralrs-core/src/xlora_models/gemma.rs:466-492 | mistralrs-core/src/xlora_models/gemma2.rs:496-522 | mistralrs-core/src/xlora_models/mistral.rs:462-488 | mistralrs-core/src/xlora_models/mixtral.rs:593-619 | mistralrs-core/src/xlora_models/phi3.rs:421-447 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–27 lines × 2) mistralrs-core/src/vision_models/gemma3n/audio.rs:264— mistralrs-core/src/vision_models/gemma3n/audio.rs:264-290 | mistralrs-core/src/vision_models/gemma4/audio.rs:93-111 — `mistralrs-core/src/vision_models/gemma3n/audio.rs` and `mistralrs-core/src/vision_models/gemma4/audio.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 16 separate duplicated blocks between them, totalling at least 279 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 (22–27 lines × 2) mistralrs-quant/src/mxfp4/ops.rs:22— mistralrs-quant/src/mxfp4/ops.rs:22-43 | mistralrs-quant/src/mxfp4/ops.rs:320-346 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24–26 lines × 17) mistralrs-core/src/models/gemma.rs:216— mistralrs-core/src/models/gemma.rs:216-240 | mistralrs-core/src/models/gemma2.rs:263-288 | mistralrs-core/src/models/gpt_oss.rs:293-317 | mistralrs-core/src/models/hunyuan_v1_dense.rs:239-263 | mistralrs-core/src/models/hunyuan_v1_moe.rs:425-449 | mistralrs-core/src/models/lfm2.rs:533-556 | mistralrs-core/src/models/llama.rs:124-148 | mistralrs-core/src/models/mistral.rs:264-288 | mistralrs-core/src/models/mixtral.rs:200-224 | mistralrs-core/src/models/phi2.rs:312-336 | mistralrs-core/src/models/qwen2.rs:294-318 | mistralrs-core/src/models/qwen3.rs:249-273 | mistralrs-core/src/models/qwen3_moe.rs:252-276 | mistralrs-core/src/models/qwen3_next.rs:333-356 | mistralrs-core/src/models/smollm3.rs:141-165 | mistralrs-core/src/models/starcoder2.rs:276-300 | mistralrs-core/src/vision_models/voxtral/mod.rs:176-199 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (26 lines × 9) mistralrs-core/src/xlora_models/gemma.rs:632— mistralrs-core/src/xlora_models/gemma.rs:632-657 | mistralrs-core/src/xlora_models/gemma2.rs:683-708 | mistralrs-core/src/xlora_models/llama.rs:460-485 | mistralrs-core/src/xlora_models/mistral.rs:628-653 | mistralrs-core/src/xlora_models/mixtral.rs:758-783 | mistralrs-core/src/xlora_models/phi2.rs:598-623 | mistralrs-core/src/xlora_models/quantized_llama.rs:850-875 | mistralrs-core/src/xlora_models/quantized_phi3.rs:515-540 | mistralrs-core/src/xlora_models/starcoder2.rs:613-638 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (23–26 lines × 2) mistralrs-core/src/vision_models/gemma3n/audio.rs:295— mistralrs-core/src/vision_models/gemma3n/audio.rs:295-320 | mistralrs-core/src/vision_models/gemma4/audio.rs:114-136 — `mistralrs-core/src/vision_models/gemma3n/audio.rs` and `mistralrs-core/src/vision_models/gemma4/audio.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 16 separate duplicated blocks between them, totalling at least 279 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 (25–26 lines × 2) mistralrs-quant/src/safetensors.rs:655— mistralrs-quant/src/safetensors.rs:655-680 | mistralrs-quant/src/safetensors.rs:732-756 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 5) mistralrs-core/src/xlora_models/gemma.rs:233— mistralrs-core/src/xlora_models/gemma.rs:233-257 | mistralrs-core/src/xlora_models/gemma2.rs:238-262 | mistralrs-core/src/xlora_models/mistral.rs:223-247 | mistralrs-core/src/xlora_models/mixtral.rs:136-160 | mistralrs-core/src/xlora_models/starcoder2.rs:210-234 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21–25 lines × 2) mistralrs-core/src/vision_models/gemma3n/audio.rs:384— mistralrs-core/src/vision_models/gemma3n/audio.rs:384-408 | mistralrs-core/src/vision_models/gemma4/audio.rs:183-203 — `mistralrs-core/src/vision_models/gemma3n/audio.rs` and `mistralrs-core/src/vision_models/gemma4/audio.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 16 separate duplicated blocks between them, totalling at least 279 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 (23–25 lines × 2) mistralrs-quant/src/metal_kernels/mod.rs:3847— mistralrs-quant/src/metal_kernels/mod.rs:3847-3871 | mistralrs-quant/src/metal_kernels/mod.rs:3938-3960 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 4) mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:537— mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:537-560 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:544-567 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:474-497 | mistralrs-core/src/vision_models/phi4/inputs_processor.rs:452-475 — before extracting anything, compare `mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs` and `mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 206 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (23–24 lines × 2) mistralrs-core/src/lora/loralinear.rs:182— mistralrs-core/src/lora/loralinear.rs:182-205 | mistralrs-core/src/lora/qloralinear.rs:233-255 — before extracting anything, compare `mistralrs-core/src/lora/loralinear.rs` and `mistralrs-core/src/lora/qloralinear.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–24 lines × 2) mistralrs-core/src/pipeline/sampling.rs:1411— mistralrs-core/src/pipeline/sampling.rs:1411-1432 | mistralrs-core/src/pipeline/sampling.rs:1499-1522 — both copies are in the same file, so extract the block into 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–23 lines × 14) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:583— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:583-605 | mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:356-377 | mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1538-1559 | mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:460-481 | mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:590-612 | mistralrs-core/src/vision_models/lfm2_vl/inputs_processor.rs:712-733 | mistralrs-core/src/vision_models/llama4/inputs_processor.rs:438-459 | mistralrs-core/src/vision_models/minicpmo/inputs_processor.rs:486-507 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:365-386 | mistralrs-core/src/vision_models/mllama/inputs_processor.rs:351-373 | mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:722-744 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:998-1020 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1396-1418 | mistralrs-core/src/vision_models/voxtral/inputs_processor.rs:271-292 — `mistralrs-core/src/vision_models/gemma3/inputs_processor.rs` and `mistralrs-core/src/vision_models/gemma3n/inputs_processor.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 75 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 (22–23 lines × 4) mistralrs-core/src/models/flint.rs:252— mistralrs-core/src/models/flint.rs:252-273 | mistralrs-core/src/models/glm4_moe.rs:195-217 | mistralrs-core/src/models/hunyuan_v1_dense.rs:122-143 | mistralrs-core/src/models/hunyuan_v1_moe.rs:299-320 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/glm4_moe.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 184 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21–23 lines × 2) mistralrs-quant/src/cublaslt/api.rs:134— mistralrs-quant/src/cublaslt/api.rs:134-156 | mistralrs-quant/src/cublaslt/api.rs:404-424 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21–22 lines × 6) mistralrs-core/src/models/glm4.rs:266— mistralrs-core/src/models/glm4.rs:266-287 | mistralrs-core/src/models/glm4_moe.rs:331-352 | mistralrs-core/src/models/granite.rs:1592-1613 | mistralrs-core/src/vision_models/phi3/mod.rs:297-318 | mistralrs-core/src/vision_models/phi4/mod.rs:166-187 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:251-271 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/glm4_moe.rs` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 341 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs/src/model_builder_trait.rs:802— mistralrs/src/model_builder_trait.rs:802-823 | mistralrs/src/model_builder_trait.rs:957-978 | mistralrs/src/model_builder_trait.rs:1130-1151 | mistralrs/src/model_builder_trait.rs:1579-1600 — 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 (20–22 lines × 2) mistralrs-quant/src/cublaslt/api.rs:187— mistralrs-quant/src/cublaslt/api.rs:187-208 | mistralrs-quant/src/cublaslt/api.rs:429-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 (21 lines × 8) mistralrs-core/src/vision_models/qwen3_5/mod.rs:230— mistralrs-core/src/vision_models/qwen3_5/mod.rs:230-250 | mistralrs-core/src/vision_models/qwen3_5/mod.rs:291-311 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:213-233 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:274-294 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:751-771 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:826-846 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:196-216 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:271-291 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (21 lines × 7) mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:438— mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs:438-458 | mistralrs-core/src/vision_models/qwen2vl/mod.rs:594-614 | mistralrs-core/src/vision_models/qwen3_5/mod.rs:476-496 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:463-483 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:1061-1081 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:490-510 | mistralrs-core/src/vision_models/qwen4_exp/mod.rs:449-469 — `mistralrs-core/src/vision_models/qwen2_5_vl/mod.rs` and `mistralrs-core/src/vision_models/qwen2vl/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 21 separate duplicated blocks between them, totalling at least 374 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 (21 lines × 6) mistralrs-core/src/models/glm4.rs:502— mistralrs-core/src/models/glm4.rs:502-522 | mistralrs-core/src/models/hunyuan_v1_dense.rs:467-487 | mistralrs-core/src/models/hunyuan_v1_moe.rs:961-981 | mistralrs-core/src/models/mistral.rs:508-528 | mistralrs-core/src/models/mixtral.rs:463-483 | mistralrs-core/src/models/qwen3.rs:461-481 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/hunyuan_v1_dense.rs` as WHOLE FILES: this scan already matched 40 separate duplicated blocks between them, totalling at least 461 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 4) mistralrs-core/src/models/deepseek2.rs:750— mistralrs-core/src/models/deepseek2.rs:750-770 | mistralrs-core/src/models/deepseek3.rs:813-833 | mistralrs-core/src/models/glm4_moe.rs:650-670 | mistralrs-core/src/models/glm4_moe_lite.rs:760-780 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–21 lines × 2) mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1238— mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1238-1258 | mistralrs-core/src/vision_models/phi4/inputs_processor.rs:864-882 — `mistralrs-core/src/vision_models/gemma4/inputs_processor.rs` and `mistralrs-core/src/vision_models/phi4/inputs_processor.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 46 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 (19–20 lines × 4) mistralrs-core/src/pipeline/multimodal.rs:1136— mistralrs-core/src/pipeline/multimodal.rs:1136-1154 | mistralrs-core/src/pipeline/multimodal.rs:1244-1263 | mistralrs-core/src/pipeline/normal.rs:1182-1200 | mistralrs-core/src/pipeline/normal.rs:1314-1333 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–20 lines × 4) mistralrs-core/src/xlora_models/mistral.rs:270— mistralrs-core/src/xlora_models/mistral.rs:270-287 | mistralrs-core/src/xlora_models/mixtral.rs:183-200 | mistralrs-core/src/xlora_models/phi3.rs:158-175 | mistralrs-core/src/xlora_models/starcoder2.rs:257-276 — before extracting anything, compare `mistralrs-core/src/xlora_models/mistral.rs` and `mistralrs-core/src/xlora_models/mixtral.rs` as WHOLE FILES: this scan already matched 52 separate duplicated blocks between them, totalling at least 769 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15–20 lines × 4) mistralrs-quant/src/blockwise_fp8/mod.rs:954— mistralrs-quant/src/blockwise_fp8/mod.rs:954-973 | mistralrs-quant/src/pertensor_fp8/mod.rs:521-535 | mistralrs-quant/src/unquantized/mod.rs:425-444 | mistralrs-quant/src/vector_fp8/mod.rs:101-115 — `mistralrs-quant/src/blockwise_fp8/mod.rs` and `mistralrs-quant/src/pertensor_fp8/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 9 separate duplicated blocks between them, totalling at least 217 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 (18–19 lines × 11) mistralrs-core/src/models/gemma.rs:635— mistralrs-core/src/models/gemma.rs:635-652 | mistralrs-core/src/models/gemma2.rs:752-769 | mistralrs-core/src/models/glm4.rs:755-772 | mistralrs-core/src/models/hunyuan_v1_dense.rs:723-740 | mistralrs-core/src/models/mistral.rs:763-780 | mistralrs-core/src/models/phi3.rs:698-716 | mistralrs-core/src/models/qwen2.rs:765-782 | mistralrs-core/src/models/qwen3.rs:741-758 | mistralrs-core/src/vision_models/gemma3/text.rs:976-993 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:722-739 | mistralrs-core/src/vision_models/phi3/mod.rs:1534-1552 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 5) mistralrs-core/src/models/granite.rs:1960— mistralrs-core/src/models/granite.rs:1960-1977 | mistralrs-core/src/models/llama.rs:358-375 | mistralrs-core/src/models/qwen3_next.rs:754-772 | mistralrs-core/src/models/smollm3.rs:374-391 | mistralrs-core/src/vision_models/llama4/text.rs:807-824 — before extracting anything, compare `mistralrs-core/src/models/granite.rs` and `mistralrs-core/src/models/llama.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 244 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 5) mistralrs-quant/src/hqq/hqq_op.rs:88— mistralrs-quant/src/hqq/hqq_op.rs:88-106 | mistralrs-quant/src/hqq/hqq_op.rs:199-217 | mistralrs-quant/src/hqq/hqq_op.rs:312-330 | mistralrs-quant/src/hqq/hqq_op.rs:429-447 | mistralrs-quant/src/hqq/hqq_op.rs:548-566 — 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 (19 lines × 4) mistralrs-quant/src/metal_kernels/mod.rs:3045— mistralrs-quant/src/metal_kernels/mod.rs:3045-3063 | mistralrs-quant/src/metal_kernels/mod.rs:3078-3096 | mistralrs-quant/src/metal_kernels/mod.rs:3111-3129 | mistralrs-quant/src/metal_kernels/mod.rs:3144-3162 — 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 (18–19 lines × 3) mistralrs-core/src/embedding_models/embedding_gemma.rs:414— mistralrs-core/src/embedding_models/embedding_gemma.rs:414-431 | mistralrs-core/src/vision_models/gemma3/text.rs:473-490 | mistralrs-core/src/vision_models/gemma3n/text.rs:1398-1416 — before extracting anything, compare `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/vision_models/gemma3/text.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 268 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–19 lines × 2) mistralrs-core/src/vision_models/gemma3n/audio.rs:982— mistralrs-core/src/vision_models/gemma3n/audio.rs:982-1000 | mistralrs-core/src/vision_models/gemma4/audio.rs:471-486 — `mistralrs-core/src/vision_models/gemma3n/audio.rs` and `mistralrs-core/src/vision_models/gemma4/audio.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 16 separate duplicated blocks between them, totalling at least 279 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 (18 lines × 15) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:548— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:548-565 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1417-1434 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2798-2815 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3152-3169 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3494-3511 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4221-4238 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4631-4648 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5011-5028 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:812-829 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1033-1050 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1256-1273 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2183-2200 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2413-2430 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4463-4480 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5793-5810 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/embedding_loaders.rs` and `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 lines × 7) mistralrs-core/src/xlora_models/gemma.rs:235— mistralrs-core/src/xlora_models/gemma.rs:235-252 | mistralrs-core/src/xlora_models/gemma2.rs:240-257 | mistralrs-core/src/xlora_models/llama.rs:58-75 | mistralrs-core/src/xlora_models/mistral.rs:225-242 | mistralrs-core/src/xlora_models/mixtral.rs:138-155 | mistralrs-core/src/xlora_models/phi2.rs:219-236 | mistralrs-core/src/xlora_models/starcoder2.rs:212-229 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 lines × 5) mistralrs-quant/src/metal_kernels/mod.rs:211— mistralrs-quant/src/metal_kernels/mod.rs:211-228 | mistralrs-quant/src/metal_kernels/mod.rs:250-267 | mistralrs-quant/src/metal_kernels/mod.rs:289-306 | mistralrs-quant/src/metal_kernels/mod.rs:328-345 | mistralrs-quant/src/metal_kernels/mod.rs:367-384 — 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–18 lines × 3) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7718— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7718-7732 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8240-8257 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6581-6587 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–18 lines × 3) mistralrs-quant/src/afq/ops.rs:2432— mistralrs-quant/src/afq/ops.rs:2432-2444 | mistralrs-quant/src/afq/ops.rs:2796-2808 | mistralrs-quant/src/afq/ops.rs:3387-3404 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15–18 lines × 2) mistralrs-core/src/xlora_models/quantized_llama.rs:776— mistralrs-core/src/xlora_models/quantized_llama.rs:776-790 | mistralrs-core/src/xlora_models/quantized_phi3.rs:438-455 — before extracting anything, compare `mistralrs-core/src/xlora_models/quantized_llama.rs` and `mistralrs-core/src/xlora_models/quantized_phi3.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 221 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 22) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:948— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:948-964 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3751-3767 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:766-782 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1210-1226 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1454-1470 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1681-1697 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1901-1917 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2137-2153 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2834-2850 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3130-3146 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3463-3479 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3726-3742 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3938-3954 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4187-4203 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4418-4434 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4690-4706 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5002-5018 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5285-5301 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5747-5763 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5993-6009 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6256-6272 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6523-6539 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 17) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:546— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:546-562 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1415-1431 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1722-1738 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2022-2038 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2796-2812 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3150-3166 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3492-3508 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4219-4235 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4629-4645 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5009-5025 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:810-826 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1031-1047 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1254-1270 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2181-2197 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2411-2427 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4461-4477 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5791-5807 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/embedding_loaders.rs` and `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 14) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1412— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1412-1428 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1719-1735 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2019-2035 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2435-2451 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2793-2809 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3147-3163 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3489-3505 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4216-4232 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5006-5022 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:807-823 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1251-1267 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2178-2194 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4458-4474 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5788-5804 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 13) mistralrs-core/src/models/gemma.rs:585— mistralrs-core/src/models/gemma.rs:585-601 | mistralrs-core/src/models/gemma2.rs:702-718 | mistralrs-core/src/models/glm4.rs:705-721 | mistralrs-core/src/models/hunyuan_v1_dense.rs:673-689 | mistralrs-core/src/models/mistral.rs:713-729 | mistralrs-core/src/models/phi2.rs:661-677 | mistralrs-core/src/models/phi3.rs:656-672 | mistralrs-core/src/models/qwen2.rs:715-731 | mistralrs-core/src/models/qwen3.rs:691-707 | mistralrs-core/src/models/starcoder2.rs:652-668 | mistralrs-core/src/vision_models/gemma3/text.rs:926-942 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:669-685 | mistralrs-core/src/vision_models/phi3/mod.rs:1493-1509 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15–17 lines × 5) mistralrs-core/src/models/deepseek2.rs:823— mistralrs-core/src/models/deepseek2.rs:823-837 | mistralrs-core/src/models/deepseek3.rs:886-900 | mistralrs-core/src/models/glm4_moe.rs:723-737 | mistralrs-core/src/models/glm4_moe_lite.rs:833-847 | mistralrs-core/src/vision_models/mllama/text.rs:765-781 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–17 lines × 5) mistralrs-core/src/vision_models/qwen3_5/mod.rs:403— mistralrs-core/src/vision_models/qwen3_5/mod.rs:403-419 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:388-404 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:973-988 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:418-433 | mistralrs-core/src/vision_models/qwen4_exp/mod.rs:384-400 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (16–17 lines × 4) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3021— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3021-3036 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3354-3369 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4587-4603 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4904-4920 — 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 (15–17 lines × 2) mistralrs-core/src/xlora_models/quantized_llama.rs:803— mistralrs-core/src/xlora_models/quantized_llama.rs:803-819 | mistralrs-core/src/xlora_models/quantized_phi3.rs:471-485 — before extracting anything, compare `mistralrs-core/src/xlora_models/quantized_llama.rs` and `mistralrs-core/src/xlora_models/quantized_phi3.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 221 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–16 lines × 27) mistralrs-core/src/models/flint.rs:403— mistralrs-core/src/models/flint.rs:403-415 | mistralrs-core/src/models/gemma2.rs:255-270 | mistralrs-core/src/models/glm4.rs:255-270 | mistralrs-core/src/models/glm4_moe.rs:323-335 | mistralrs-core/src/models/gpt_oss.rs:288-300 | mistralrs-core/src/models/granite.rs:1584-1596 | mistralrs-core/src/models/hunyuan_v1_dense.rs:234-246 | mistralrs-core/src/models/hunyuan_v1_moe.rs:420-432 | mistralrs-core/src/models/llama.rs:116-131 | mistralrs-core/src/models/mistral.rs:256-271 | mistralrs-core/src/models/mixtral.rs:192-207 | mistralrs-core/src/models/phi3_5_moe.rs:222-237 | mistralrs-core/src/models/qwen2.rs:286-301 | mistralrs-core/src/models/qwen3.rs:241-256 | mistralrs-core/src/models/qwen3_moe.rs:244-259 | mistralrs-core/src/models/qwen3_next.rs:328-340 | mistralrs-core/src/models/smollm3.rs:133-148 | mistralrs-core/src/models/starcoder2.rs:268-283 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:90-105 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:259-274 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:283-295 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:250-262 | mistralrs-core/src/vision_models/qwen2vl/text.rs:251-263 | mistralrs-core/src/vision_models/qwen3_5/text.rs:375-387 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:243-255 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:247-262 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:353-365 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 186 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15–16 lines × 18) mistralrs-core/src/models/flint.rs:407— mistralrs-core/src/models/flint.rs:407-421 | mistralrs-core/src/models/gemma.rs:215-229 | mistralrs-core/src/models/gemma2.rs:262-277 | mistralrs-core/src/models/gpt_oss.rs:292-306 | mistralrs-core/src/models/hunyuan_v1_dense.rs:238-252 | mistralrs-core/src/models/hunyuan_v1_moe.rs:424-438 | mistralrs-core/src/models/lfm2.rs:532-546 | mistralrs-core/src/models/llama.rs:123-137 | mistralrs-core/src/models/mistral.rs:263-277 | mistralrs-core/src/models/mixtral.rs:199-213 | mistralrs-core/src/models/phi2.rs:311-325 | mistralrs-core/src/models/qwen2.rs:293-307 | mistralrs-core/src/models/qwen3.rs:248-262 | mistralrs-core/src/models/qwen3_moe.rs:251-265 | mistralrs-core/src/models/qwen3_next.rs:332-346 | mistralrs-core/src/models/smollm3.rs:140-154 | mistralrs-core/src/models/starcoder2.rs:275-289 | mistralrs-core/src/vision_models/voxtral/mod.rs:175-189 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 18) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:545— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:545-560 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1414-1429 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1721-1736 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2021-2036 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2437-2452 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2795-2810 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3149-3164 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3491-3506 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4218-4233 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4628-4643 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5008-5023 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:809-824 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1030-1045 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1253-1268 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2180-2195 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2410-2425 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4460-4475 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5790-5805 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/embedding_loaders.rs` and `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15–16 lines × 8) mistralrs-core/src/xlora_models/gemma.rs:649— mistralrs-core/src/xlora_models/gemma.rs:649-664 | mistralrs-core/src/xlora_models/gemma2.rs:700-715 | mistralrs-core/src/xlora_models/llama.rs:477-492 | mistralrs-core/src/xlora_models/mistral.rs:645-660 | mistralrs-core/src/xlora_models/mixtral.rs:775-790 | mistralrs-core/src/xlora_models/phi2.rs:615-630 | mistralrs-core/src/xlora_models/phi3.rs:601-615 | mistralrs-core/src/xlora_models/starcoder2.rs:630-645 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14–16 lines × 5) mistralrs-core/src/models/deepseek2.rs:563— mistralrs-core/src/models/deepseek2.rs:563-578 | mistralrs-core/src/models/deepseek3.rs:583-598 | mistralrs-core/src/models/deepseek3.rs:613-628 | mistralrs-core/src/models/glm4_moe.rs:472-485 | mistralrs-core/src/models/glm4_moe_lite.rs:573-588 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15–16 lines × 5) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2679— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2679-2694 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6657-6672 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7099-7114 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7571-7585 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8093-8107 — 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 (14–16 lines × 4) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6622— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6622-6637 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7064-7079 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7539-7552 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8061-8074 — 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 (15–16 lines × 3) mistralrs-core/src/embedding_models/qwen3_embedding.rs:478— mistralrs-core/src/embedding_models/qwen3_embedding.rs:478-492 | mistralrs-core/src/models/qwen3.rs:584-598 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:608-623 — `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/qwen3.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 27 separate duplicated blocks between them, totalling at least 372 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 (12–16 lines × 2) mistralrs-pyo3/src/util.rs:390— mistralrs-pyo3/src/util.rs:390-401 | mistralrs-server-core/src/video.rs:129-144 — before extracting anything, compare `mistralrs-pyo3/src/util.rs` and `mistralrs-server-core/src/video.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 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–15 lines × 19) mistralrs-core/src/models/gemma.rs:231— mistralrs-core/src/models/gemma.rs:231-243 | mistralrs-core/src/models/gemma2.rs:279-291 | mistralrs-core/src/models/gpt_oss.rs:308-320 | mistralrs-core/src/models/hunyuan_v1_dense.rs:254-266 | mistralrs-core/src/models/hunyuan_v1_moe.rs:440-452 | mistralrs-core/src/models/llama.rs:139-151 | mistralrs-core/src/models/mistral.rs:279-291 | mistralrs-core/src/models/mixtral.rs:215-227 | mistralrs-core/src/models/phi2.rs:327-341 | mistralrs-core/src/models/phi3.rs:218-230 | mistralrs-core/src/models/phi3_5_moe.rs:245-257 | mistralrs-core/src/models/qwen2.rs:309-321 | mistralrs-core/src/models/qwen3.rs:264-276 | mistralrs-core/src/models/qwen3_moe.rs:267-279 | mistralrs-core/src/models/qwen3_next.rs:347-359 | mistralrs-core/src/models/smollm3.rs:156-168 | mistralrs-core/src/models/starcoder2.rs:291-303 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:114-126 | mistralrs-core/src/vision_models/voxtral/mod.rs:190-202 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–15 lines × 18) mistralrs-core/src/models/flint.rs:397— mistralrs-core/src/models/flint.rs:397-408 | mistralrs-core/src/models/gemma2.rs:249-263 | mistralrs-core/src/models/gpt_oss.rs:282-293 | mistralrs-core/src/models/hunyuan_v1_dense.rs:228-239 | mistralrs-core/src/models/hunyuan_v1_moe.rs:414-425 | mistralrs-core/src/models/llama.rs:110-124 | mistralrs-core/src/models/mistral.rs:250-264 | mistralrs-core/src/models/mixtral.rs:186-200 | mistralrs-core/src/models/phi3.rs:189-203 | mistralrs-core/src/models/phi3_5_moe.rs:216-230 | mistralrs-core/src/models/qwen2.rs:280-294 | mistralrs-core/src/models/qwen3.rs:235-249 | mistralrs-core/src/models/qwen3_moe.rs:238-252 | mistralrs-core/src/models/qwen3_next.rs:322-333 | mistralrs-core/src/models/smollm3.rs:127-141 | mistralrs-core/src/models/starcoder2.rs:262-276 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:84-98 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:253-267 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 186 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–15 lines × 12) mistralrs-core/src/models/glm4.rs:249— mistralrs-core/src/models/glm4.rs:249-263 | mistralrs-core/src/models/glm4_moe.rs:317-328 | mistralrs-core/src/models/granite.rs:1578-1589 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:277-288 | mistralrs-core/src/vision_models/phi3/mod.rs:280-294 | mistralrs-core/src/vision_models/phi4/mod.rs:149-163 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:244-255 | mistralrs-core/src/vision_models/qwen2vl/text.rs:245-256 | mistralrs-core/src/vision_models/qwen3_5/text.rs:369-380 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:237-248 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:241-255 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:347-358 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/glm4_moe.rs` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 341 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15 lines × 11) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:676— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:676-690 | mistralrs-core/src/vision_models/gemma3n/inputs_processor.rs:444-458 | mistralrs-core/src/vision_models/idefics2/idefics2_input_processor.rs:656-670 | mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:698-712 | mistralrs-core/src/vision_models/llama4/inputs_processor.rs:599-613 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:467-481 | mistralrs-core/src/vision_models/mllama/inputs_processor.rs:649-663 | mistralrs-core/src/vision_models/muse_glimmer/inputs_processor.rs:1088-1102 | mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:959-973 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1524-1538 | mistralrs-core/src/vision_models/voxtral/inputs_processor.rs:349-363 — `mistralrs-core/src/vision_models/gemma3/inputs_processor.rs` and `mistralrs-core/src/vision_models/gemma3n/inputs_processor.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 75 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 (14–15 lines × 10) mistralrs-core/src/models/glm4.rs:581— mistralrs-core/src/models/glm4.rs:581-594 | mistralrs-core/src/models/mistral.rs:590-604 | mistralrs-core/src/models/mixtral.rs:528-542 | mistralrs-core/src/models/phi3.rs:536-550 | mistralrs-core/src/models/phi3_5_moe.rs:609-623 | mistralrs-core/src/models/qwen3.rs:544-558 | mistralrs-core/src/models/qwen3_moe.rs:724-738 | mistralrs-core/src/models/starcoder2.rs:530-543 | mistralrs-core/src/vision_models/phi3/mod.rs:1340-1353 | mistralrs-core/src/vision_models/phi4/mod.rs:502-515 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/mistral.rs` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 483 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14–15 lines × 9) mistralrs-paged-attn/src/cuda/backend/mla.rs:132— mistralrs-paged-attn/src/cuda/backend/mla.rs:132-145 | mistralrs-paged-attn/src/cuda/backend/mla.rs:157-170 | mistralrs-paged-attn/src/cuda/backend/mla.rs:182-195 | mistralrs-paged-attn/src/cuda/backend/mla.rs:454-467 | mistralrs-paged-attn/src/cuda/backend/mla.rs:513-526 | mistralrs-paged-attn/src/cuda/backend/mla.rs:572-585 | mistralrs-paged-attn/src/cuda/backend/mla.rs:770-784 | mistralrs-paged-attn/src/cuda/backend/mla.rs:808-822 | mistralrs-paged-attn/src/cuda/backend/mla.rs:846-860 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14–15 lines × 8) mistralrs-core/src/xlora_models/gemma.rs:664— mistralrs-core/src/xlora_models/gemma.rs:664-678 | mistralrs-core/src/xlora_models/gemma2.rs:715-729 | mistralrs-core/src/xlora_models/llama.rs:492-506 | mistralrs-core/src/xlora_models/mistral.rs:660-674 | mistralrs-core/src/xlora_models/mixtral.rs:790-804 | mistralrs-core/src/xlora_models/phi2.rs:630-644 | mistralrs-core/src/xlora_models/phi3.rs:617-630 | mistralrs-core/src/xlora_models/starcoder2.rs:645-659 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15 lines × 7) mistralrs-core/src/models/flint.rs:849— mistralrs-core/src/models/flint.rs:849-863 | mistralrs-core/src/models/glm4.rs:516-530 | mistralrs-core/src/models/hunyuan_v1_dense.rs:481-495 | mistralrs-core/src/models/hunyuan_v1_moe.rs:975-989 | mistralrs-core/src/models/mistral.rs:522-536 | mistralrs-core/src/models/qwen3.rs:475-489 | mistralrs-core/src/models/qwen3_moe.rs:655-669 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14–15 lines × 6) mistralrs-paged-attn/src/metal/kernels/mod.rs:441— mistralrs-paged-attn/src/metal/kernels/mod.rs:441-455 | mistralrs-paged-attn/src/metal/kernels/mod.rs:557-571 | mistralrs-paged-attn/src/metal/kernels/mod.rs:582-596 | mistralrs-paged-attn/src/metal/kernels/mod.rs:701-715 | mistralrs-paged-attn/src/metal/kernels/mod.rs:726-740 | mistralrs-paged-attn/src/metal/kernels/mod.rs:831-844 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14–15 lines × 5) mistralrs-core/src/embedding_models/embedding_gemma.rs:112— mistralrs-core/src/embedding_models/embedding_gemma.rs:112-126 | mistralrs-core/src/models/gemma.rs:92-106 | mistralrs-core/src/models/gemma2.rs:125-139 | mistralrs-core/src/vision_models/gemma3/text.rs:87-100 | mistralrs-core/src/vision_models/gemma3n/text.rs:315-329 — `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/models/gemma.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 7 separate duplicated blocks between them, totalling at least 113 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 (12–15 lines × 4) mistralrs-core/src/models/flint.rs:239— mistralrs-core/src/models/flint.rs:239-250 | mistralrs-core/src/models/glm4_moe.rs:178-192 | mistralrs-core/src/models/hunyuan_v1_dense.rs:109-120 | mistralrs-core/src/models/hunyuan_v1_moe.rs:286-297 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/glm4_moe.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 184 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 11) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:777— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:777-790 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1444-1457 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1752-1765 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2052-2065 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2825-2838 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4248-4261 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1531-1544 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2211-2224 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2659-2672 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4490-4503 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5379-5392 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/embedding_loaders.rs` and `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 10) mistralrs-core/src/models/glm4.rs:583— mistralrs-core/src/models/glm4.rs:583-596 | mistralrs-core/src/models/mistral.rs:592-606 | mistralrs-core/src/models/mixtral.rs:530-544 | mistralrs-core/src/models/phi3.rs:538-552 | mistralrs-core/src/models/phi3_5_moe.rs:611-625 | mistralrs-core/src/models/qwen2.rs:583-596 | mistralrs-core/src/models/qwen3.rs:546-560 | mistralrs-core/src/models/qwen3_moe.rs:726-740 | mistralrs-core/src/models/starcoder2.rs:532-545 | mistralrs-core/src/vision_models/phi3/mod.rs:1342-1355 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/mistral.rs` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 483 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 9) mistralrs-core/src/xlora_models/gemma.rs:659— mistralrs-core/src/xlora_models/gemma.rs:659-672 | mistralrs-core/src/xlora_models/gemma2.rs:710-723 | mistralrs-core/src/xlora_models/llama.rs:487-500 | mistralrs-core/src/xlora_models/mistral.rs:655-668 | mistralrs-core/src/xlora_models/mixtral.rs:785-798 | mistralrs-core/src/xlora_models/phi2.rs:625-638 | mistralrs-core/src/xlora_models/quantized_llama.rs:877-890 | mistralrs-core/src/xlora_models/quantized_phi3.rs:542-555 | mistralrs-core/src/xlora_models/starcoder2.rs:640-653 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 6) mistralrs-core/src/embedding_models/qwen3_embedding.rs:476— mistralrs-core/src/embedding_models/qwen3_embedding.rs:476-488 | mistralrs-core/src/models/flint.rs:988-1000 | mistralrs-core/src/models/qwen3.rs:582-594 | mistralrs-core/src/models/qwen3_moe.rs:763-775 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:606-619 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:727-740 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/flint.rs` as WHOLE FILES: this scan already matched 6 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 (13–14 lines × 4) mistralrs-core/src/models/mixtral.rs:420— mistralrs-core/src/models/mixtral.rs:420-432 | mistralrs-core/src/models/qwen2.rs:447-460 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:412-425 | mistralrs-core/src/vision_models/qwen2vl/text.rs:413-426 — before extracting anything, compare `mistralrs-core/src/models/mixtral.rs` and `mistralrs-core/src/models/qwen2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 528 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (4–14 lines × 6) mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:156— mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:156-166 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:168-180 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:186-199 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:373-376 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:655-658 | mistralrs-paged-attn/src/cuda/backend/gather_kv.rs:202-205 — before extracting anything, compare `mistralrs-paged-attn/src/cuda/backend/flashinfer.rs` and `mistralrs-paged-attn/src/cuda/backend/gather_kv.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (2–14 lines × 4) mistralrs-quant/src/cutile/nvfp4_matmul.rs:360— mistralrs-quant/src/cutile/nvfp4_matmul.rs:360-361 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:444-457 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:654-655 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:738-751 — 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 (13 lines × 23) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4537— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4537-4549 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4934-4946 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5345-5357 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:772-784 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1216-1228 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1460-1472 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1687-1699 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1907-1919 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2143-2155 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2840-2852 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3136-3148 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3469-3481 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3732-3744 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3944-3956 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4193-4205 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4424-4436 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4696-4708 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5008-5020 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5291-5303 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5753-5765 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5999-6011 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6262-6274 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6529-6541 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 14) mistralrs-core/src/models/gemma.rs:662— mistralrs-core/src/models/gemma.rs:662-674 | mistralrs-core/src/models/gemma2.rs:779-791 | mistralrs-core/src/models/glm4.rs:782-794 | mistralrs-core/src/models/hunyuan_v1_dense.rs:750-762 | mistralrs-core/src/models/mistral.rs:790-802 | mistralrs-core/src/models/phi2.rs:730-742 | mistralrs-core/src/models/phi3.rs:725-737 | mistralrs-core/src/models/qwen2.rs:792-804 | mistralrs-core/src/models/qwen3.rs:768-780 | mistralrs-core/src/models/starcoder2.rs:721-733 | mistralrs-core/src/vision_models/gemma3/text.rs:1003-1015 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:749-761 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:755-767 | mistralrs-core/src/vision_models/phi3/mod.rs:1561-1573 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 12) mistralrs-core/src/models/flint.rs:779— mistralrs-core/src/models/flint.rs:779-791 | mistralrs-core/src/models/glm4.rs:441-453 | mistralrs-core/src/models/granite.rs:1949-1961 | mistralrs-core/src/models/hunyuan_v1_dense.rs:410-422 | mistralrs-core/src/models/hunyuan_v1_moe.rs:904-916 | mistralrs-core/src/models/lfm2.rs:1018-1030 | mistralrs-core/src/models/llama.rs:347-359 | mistralrs-core/src/models/mistral.rs:416-428 | mistralrs-core/src/models/qwen3.rs:404-416 | mistralrs-core/src/models/qwen3_moe.rs:578-590 | mistralrs-core/src/models/smollm3.rs:363-375 | mistralrs-core/src/vision_models/llama4/text.rs:796-808 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–13 lines × 11) mistralrs-core/src/models/deepseek2.rs:863— mistralrs-core/src/models/deepseek2.rs:863-875 | mistralrs-core/src/models/deepseek3.rs:926-938 | mistralrs-core/src/models/gemma.rs:379-390 | mistralrs-core/src/models/gemma2.rs:452-463 | mistralrs-core/src/models/glm4_moe.rs:762-774 | mistralrs-core/src/models/glm4_moe_lite.rs:873-885 | mistralrs-core/src/models/mistral.rs:489-498 | mistralrs-core/src/models/mixtral.rs:442-453 | mistralrs-core/src/models/phi2.rs:469-480 | mistralrs-core/src/models/phi3.rs:457-468 | mistralrs-core/src/models/phi3_5_moe.rs:526-537 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 11) mistralrs-core/src/models/glm4.rs:586— mistralrs-core/src/models/glm4.rs:586-597 | mistralrs-core/src/models/mistral.rs:595-607 | mistralrs-core/src/models/mixtral.rs:533-545 | mistralrs-core/src/models/phi3.rs:541-553 | mistralrs-core/src/models/phi3_5_moe.rs:614-626 | mistralrs-core/src/models/qwen2.rs:586-597 | mistralrs-core/src/models/qwen3.rs:549-561 | mistralrs-core/src/models/qwen3_moe.rs:729-741 | mistralrs-core/src/models/starcoder2.rs:535-546 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:546-558 | mistralrs-core/src/vision_models/phi3/mod.rs:1345-1356 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/mistral.rs` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 483 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 9) mistralrs-core/src/models/gemma.rs:400— mistralrs-core/src/models/gemma.rs:400-412 | mistralrs-core/src/models/gemma2.rs:473-485 | mistralrs-core/src/models/glm4.rs:502-514 | mistralrs-core/src/models/hunyuan_v1_dense.rs:467-479 | mistralrs-core/src/models/hunyuan_v1_moe.rs:961-973 | mistralrs-core/src/models/mistral.rs:508-520 | mistralrs-core/src/models/mixtral.rs:463-475 | mistralrs-core/src/models/qwen3.rs:461-473 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:445-457 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 8) mistralrs-core/src/models/gemma.rs:136— mistralrs-core/src/models/gemma.rs:136-148 | mistralrs-core/src/models/glm4.rs:177-189 | mistralrs-core/src/models/gpt_oss.rs:216-228 | mistralrs-core/src/models/mixtral.rs:120-132 | mistralrs-core/src/models/qwen2.rs:208-220 | mistralrs-core/src/models/starcoder2.rs:196-208 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:165-177 | mistralrs-core/src/vision_models/qwen2vl/text.rs:166-178 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 253 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 6) mistralrs-core/src/pipeline/multimodal.rs:1160— mistralrs-core/src/pipeline/multimodal.rs:1160-1172 | mistralrs-core/src/pipeline/multimodal.rs:1210-1222 | mistralrs-core/src/pipeline/multimodal.rs:1269-1281 | mistralrs-core/src/pipeline/normal.rs:1206-1218 | mistralrs-core/src/pipeline/normal.rs:1256-1268 | mistralrs-core/src/pipeline/normal.rs:1339-1351 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 73 separate duplicated blocks between them, totalling at least 1468 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 6) mistralrs-quant/src/cutile/nvfp4_glu.rs:162— mistralrs-quant/src/cutile/nvfp4_glu.rs:162-174 | mistralrs-quant/src/cutile/nvfp4_glu.rs:319-331 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:77-89 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:230-242 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:442-453 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:736-747 — before extracting anything, compare `mistralrs-quant/src/cutile/nvfp4_glu.rs` and `mistralrs-quant/src/cutile/nvfp4_matmul.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 103 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) mistralrs-core/src/xlora_models/gemma.rs:286— mistralrs-core/src/xlora_models/gemma.rs:286-298 | mistralrs-core/src/xlora_models/mistral.rs:283-294 | mistralrs-core/src/xlora_models/mixtral.rs:196-207 | mistralrs-core/src/xlora_models/phi3.rs:171-182 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/mistral.rs` as WHOLE FILES: this scan already matched 36 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–13 lines × 4) mistralrs/src/model_builder_trait.rs:789— mistralrs/src/model_builder_trait.rs:789-800 | mistralrs/src/model_builder_trait.rs:942-954 | mistralrs/src/model_builder_trait.rs:1401-1411 | mistralrs/src/model_builder_trait.rs:1566-1577 — 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 (9–13 lines × 3) mistralrs-cli/src/commands/bench.rs:119— mistralrs-cli/src/commands/bench.rs:119-127 | mistralrs-cli/src/commands/run/mod.rs:55-63 | mistralrs-cli/src/commands/serve.rs:61-73 — before extracting anything, compare `mistralrs-cli/src/commands/run/mod.rs` and `mistralrs-cli/src/commands/serve.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (4–13 lines × 3) mistralrs-core/src/attention/backends/cpu/full.rs:212— mistralrs-core/src/attention/backends/cpu/full.rs:212-224 | mistralrs-core/src/attention/backends/cpu/full.rs:469-481 | mistralrs-core/src/attention/backends/cpu/full.rs:587-590 — 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–13 lines × 2) mistralrs-core/src/utils/tiktoken.rs:123— mistralrs-core/src/utils/tiktoken.rs:123-135 | mistralrs-core/src/utils/tokenizer.rs:121-128 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10–13 lines × 2) mistralrs-core/src/vision_models/llama4/vision.rs:567— mistralrs-core/src/vision_models/llama4/vision.rs:567-576 | mistralrs-core/src/vision_models/mllama/vision.rs:507-519 — `mistralrs-core/src/vision_models/llama4/vision.rs` and `mistralrs-core/src/vision_models/mllama/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 6 separate duplicated blocks between them, totalling at least 67 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 (9–13 lines × 2) mistralrs-quant/src/unquantized/mod.rs:179— mistralrs-quant/src/unquantized/mod.rs:179-191 | mistralrs-quant/src/unquantized/mod.rs:228-236 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 28) mistralrs-core/src/models/flint.rs:403— mistralrs-core/src/models/flint.rs:403-414 | mistralrs-core/src/models/gemma2.rs:255-269 | mistralrs-core/src/models/glm4.rs:255-269 | mistralrs-core/src/models/glm4_moe.rs:323-334 | mistralrs-core/src/models/gpt_oss.rs:288-299 | mistralrs-core/src/models/granite.rs:1584-1595 | mistralrs-core/src/models/hunyuan_v1_dense.rs:234-245 | mistralrs-core/src/models/hunyuan_v1_moe.rs:420-431 | mistralrs-core/src/models/llama.rs:116-130 | mistralrs-core/src/models/mistral.rs:256-270 | mistralrs-core/src/models/mixtral.rs:192-206 | mistralrs-core/src/models/phi3_5_moe.rs:222-236 | mistralrs-core/src/models/qwen2.rs:286-300 | mistralrs-core/src/models/qwen3.rs:241-255 | mistralrs-core/src/models/qwen3_moe.rs:244-258 | mistralrs-core/src/models/qwen3_next.rs:328-339 | mistralrs-core/src/models/smollm3.rs:133-147 | mistralrs-core/src/models/starcoder2.rs:268-282 | mistralrs-core/src/vision_models/llama4/text.rs:488-502 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:90-104 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:259-273 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:283-294 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:250-261 | mistralrs-core/src/vision_models/qwen2vl/text.rs:251-262 | mistralrs-core/src/vision_models/qwen3_5/text.rs:375-386 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:243-254 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:247-261 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:353-364 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 186 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 22) mistralrs-core/src/models/flint.rs:393— mistralrs-core/src/models/flint.rs:393-404 | mistralrs-core/src/models/gemma.rs:198-209 | mistralrs-core/src/models/gemma2.rs:245-256 | mistralrs-core/src/models/gpt_oss.rs:278-289 | mistralrs-core/src/models/hunyuan_v1_dense.rs:224-235 | mistralrs-core/src/models/hunyuan_v1_moe.rs:410-421 | mistralrs-core/src/models/lfm2.rs:519-530 | mistralrs-core/src/models/llama.rs:106-117 | mistralrs-core/src/models/mistral.rs:246-257 | mistralrs-core/src/models/mixtral.rs:182-193 | mistralrs-core/src/models/phi2.rs:294-305 | mistralrs-core/src/models/phi3_5_moe.rs:212-223 | mistralrs-core/src/models/qwen2.rs:276-287 | mistralrs-core/src/models/qwen3.rs:231-242 | mistralrs-core/src/models/qwen3_moe.rs:234-245 | mistralrs-core/src/models/qwen3_next.rs:318-329 | mistralrs-core/src/models/smollm3.rs:123-134 | mistralrs-core/src/models/starcoder2.rs:258-269 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:80-91 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:249-260 | mistralrs-core/src/vision_models/mllama/text.rs:194-205 | mistralrs-core/src/vision_models/voxtral/mod.rs:159-170 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–12 lines × 18) mistralrs-core/src/models/flint.rs:389— mistralrs-core/src/models/flint.rs:389-399 | mistralrs-core/src/models/gemma.rs:194-204 | mistralrs-core/src/models/gpt_oss.rs:275-284 | mistralrs-core/src/models/hunyuan_v1_dense.rs:220-230 | mistralrs-core/src/models/hunyuan_v1_moe.rs:406-416 | mistralrs-core/src/models/llama.rs:102-112 | mistralrs-core/src/models/mistral.rs:242-252 | mistralrs-core/src/models/mixtral.rs:178-188 | mistralrs-core/src/models/phi2.rs:290-300 | mistralrs-core/src/models/phi3_5_moe.rs:208-218 | mistralrs-core/src/models/qwen3.rs:227-237 | mistralrs-core/src/models/qwen3_moe.rs:230-240 | mistralrs-core/src/models/qwen3_next.rs:313-324 | mistralrs-core/src/models/smollm3.rs:119-129 | mistralrs-core/src/models/starcoder2.rs:254-264 | mistralrs-core/src/vision_models/gemma3/text.rs:245-254 | mistralrs-core/src/vision_models/mllama/text.rs:191-200 | mistralrs-core/src/vision_models/voxtral/mod.rs:156-165 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 13) mistralrs-core/src/models/deepseek2.rs:827— mistralrs-core/src/models/deepseek2.rs:827-838 | mistralrs-core/src/models/deepseek3.rs:890-901 | mistralrs-core/src/models/glm4_moe.rs:727-738 | mistralrs-core/src/models/glm4_moe_lite.rs:837-848 | mistralrs-core/src/models/mixtral.rs:480-491 | mistralrs-core/src/models/qwen2.rs:511-522 | mistralrs-core/src/vision_models/gemma3/text.rs:530-542 | mistralrs-core/src/vision_models/gemma3n/text.rs:1470-1482 | mistralrs-core/src/vision_models/mllama/text.rs:770-782 | mistralrs-core/src/vision_models/phi3/mod.rs:1274-1285 | mistralrs-core/src/vision_models/phi4/mod.rs:389-400 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:475-486 | mistralrs-core/src/vision_models/qwen2vl/text.rs:477-488 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–12 lines × 12) mistralrs-core/src/models/glm4.rs:589— mistralrs-core/src/models/glm4.rs:589-598 | mistralrs-core/src/models/hunyuan_v1_dense.rs:551-560 | mistralrs-core/src/models/hunyuan_v1_moe.rs:1045-1054 | mistralrs-core/src/models/mistral.rs:598-608 | mistralrs-core/src/models/mixtral.rs:536-546 | mistralrs-core/src/models/phi3.rs:544-555 | mistralrs-core/src/models/phi3_5_moe.rs:617-628 | mistralrs-core/src/models/qwen3.rs:552-562 | mistralrs-core/src/models/qwen3_moe.rs:732-742 | mistralrs-core/src/models/starcoder2.rs:538-548 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:550-559 | mistralrs-core/src/vision_models/phi3/mod.rs:1348-1358 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/hunyuan_v1_dense.rs` as WHOLE FILES: this scan already matched 40 separate duplicated blocks between them, totalling at least 461 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–12 lines × 8) mistralrs-quant/src/metal_kernels/mod.rs:446— mistralrs-quant/src/metal_kernels/mod.rs:446-457 | mistralrs-quant/src/metal_kernels/mod.rs:492-503 | mistralrs-quant/src/metal_kernels/mod.rs:538-549 | mistralrs-quant/src/metal_kernels/mod.rs:3188-3199 | mistralrs-quant/src/metal_kernels/mod.rs:3311-3321 | mistralrs-quant/src/metal_kernels/mod.rs:3375-3385 | mistralrs-quant/src/metal_kernels/mod.rs:3439-3449 | mistralrs-quant/src/metal_kernels/mod.rs:3504-3514 — 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 (12 lines × 7) mistralrs-core/src/embedding_models/qwen3_embedding.rs:249— mistralrs-core/src/embedding_models/qwen3_embedding.rs:249-260 | mistralrs-core/src/models/glm4.rs:335-346 | mistralrs-core/src/models/llama.rs:283-294 | mistralrs-core/src/models/mistral.rs:330-341 | mistralrs-core/src/models/qwen2.rs:362-373 | mistralrs-core/src/models/qwen3.rs:318-329 | mistralrs-core/src/models/smollm3.rs:299-310 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 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 (9–12 lines × 5) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4184— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4184-4192 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6754-6765 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7196-7207 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7664-7675 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8186-8197 — 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 (11–12 lines × 4) mistralrs-core/src/embedding_models/embedding_gemma.rs:389— mistralrs-core/src/embedding_models/embedding_gemma.rs:389-400 | mistralrs-core/src/models/gemma.rs:358-368 | mistralrs-core/src/models/gemma2.rs:431-441 | mistralrs-core/src/models/phi3_5_moe.rs:491-501 — `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/models/gemma.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 7 separate duplicated blocks between them, totalling at least 113 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 (9–12 lines × 3) mistralrs-quant/src/distributed/layers.rs:873— mistralrs-quant/src/distributed/layers.rs:873-884 | mistralrs-quant/src/distributed/layers.rs:1340-1351 | mistralrs-quant/src/distributed/layers.rs:2219-2227 — 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–12 lines × 2) mistralrs-core/src/pipeline/mod.rs:2095— mistralrs-core/src/pipeline/mod.rs:2095-2104 | mistralrs-core/src/pipeline/mod.rs:2676-2687 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–11 lines × 31) mistralrs-core/src/models/flint.rs:442— mistralrs-core/src/models/flint.rs:442-450 | mistralrs-core/src/models/gemma.rs:237-245 | mistralrs-core/src/models/gemma2.rs:285-293 | mistralrs-core/src/models/glm4.rs:284-292 | mistralrs-core/src/models/glm4_moe.rs:349-357 | mistralrs-core/src/models/gpt_oss.rs:314-322 | mistralrs-core/src/models/granite.rs:1610-1618 | mistralrs-core/src/models/hunyuan_v1_dense.rs:260-268 | mistralrs-core/src/models/hunyuan_v1_moe.rs:446-454 | mistralrs-core/src/models/llama.rs:145-153 | mistralrs-core/src/models/mistral.rs:285-293 | mistralrs-core/src/models/mixtral.rs:221-229 | mistralrs-core/src/models/phi2.rs:333-343 | mistralrs-core/src/models/phi3.rs:224-232 | mistralrs-core/src/models/phi3_5_moe.rs:251-259 | mistralrs-core/src/models/qwen2.rs:315-323 | mistralrs-core/src/models/qwen3.rs:270-278 | mistralrs-core/src/models/qwen3_moe.rs:273-281 | mistralrs-core/src/models/qwen3_next.rs:353-361 | mistralrs-core/src/models/smollm3.rs:162-170 | mistralrs-core/src/models/starcoder2.rs:297-305 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:120-128 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:294-302 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:308-318 | mistralrs-core/src/vision_models/phi3/mod.rs:315-323 | mistralrs-core/src/vision_models/phi4/mod.rs:184-192 | mistralrs-core/src/vision_models/qwen3_5/text.rs:403-411 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:268-276 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:275-283 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:378-386 | mistralrs-core/src/vision_models/voxtral/mod.rs:196-204 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 25) mistralrs-core/src/embedding_models/qwen3_embedding.rs:255— mistralrs-core/src/embedding_models/qwen3_embedding.rs:255-264 | mistralrs-core/src/models/flint.rs:716-725 | mistralrs-core/src/models/gpt_oss.rs:657-667 | mistralrs-core/src/models/granite.rs:1485-1494 | mistralrs-core/src/models/granite.rs:1771-1780 | mistralrs-core/src/models/hunyuan_v1_dense.rs:315-324 | mistralrs-core/src/models/hunyuan_v1_moe.rs:805-814 | mistralrs-core/src/models/llama.rs:289-298 | mistralrs-core/src/models/mistral.rs:336-345 | mistralrs-core/src/models/mixtral.rs:345-354 | mistralrs-core/src/models/phi3.rs:349-358 | mistralrs-core/src/models/qwen2.rs:368-377 | mistralrs-core/src/models/qwen3.rs:324-333 | mistralrs-core/src/models/qwen3_moe.rs:498-507 | mistralrs-core/src/models/smollm3.rs:305-314 | mistralrs-core/src/vision_models/llama4/text.rs:694-703 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:360-369 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:342-351 | mistralrs-core/src/vision_models/phi3/mod.rs:440-449 | mistralrs-core/src/vision_models/phi4/mod.rs:269-279 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:447-456 | mistralrs-core/src/xlora_models/llama.rs:363-372 | mistralrs-core/src/xlora_models/mistral.rs:343-352 | mistralrs-core/src/xlora_models/mixtral.rs:470-479 | mistralrs-core/src/xlora_models/phi3.rs:308-317 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/flint.rs` as WHOLE FILES: this scan already matched 6 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 (10–11 lines × 23) mistralrs-quant/src/metal_kernels/mod.rs:208— mistralrs-quant/src/metal_kernels/mod.rs:208-218 | mistralrs-quant/src/metal_kernels/mod.rs:247-257 | mistralrs-quant/src/metal_kernels/mod.rs:286-296 | mistralrs-quant/src/metal_kernels/mod.rs:325-335 | mistralrs-quant/src/metal_kernels/mod.rs:364-374 | mistralrs-quant/src/metal_kernels/mod.rs:617-627 | mistralrs-quant/src/metal_kernels/mod.rs:664-674 | mistralrs-quant/src/metal_kernels/mod.rs:711-721 | mistralrs-quant/src/metal_kernels/mod.rs:1949-1959 | mistralrs-quant/src/metal_kernels/mod.rs:3182-3192 | mistralrs-quant/src/metal_kernels/mod.rs:3305-3314 | mistralrs-quant/src/metal_kernels/mod.rs:3369-3378 | mistralrs-quant/src/metal_kernels/mod.rs:3433-3442 | mistralrs-quant/src/metal_kernels/mod.rs:3498-3507 | mistralrs-quant/src/metal_kernels/mod.rs:3560-3570 | mistralrs-quant/src/metal_kernels/mod.rs:4004-4014 | mistralrs-quant/src/metal_kernels/mod.rs:4039-4049 | mistralrs-quant/src/metal_kernels/mod.rs:4076-4086 | mistralrs-quant/src/metal_kernels/mod.rs:4116-4126 | mistralrs-quant/src/metal_kernels/mod.rs:4490-4499 | mistralrs-quant/src/metal_kernels/mod.rs:4552-4561 | mistralrs-quant/src/metal_kernels/mod.rs:4931-4940 | mistralrs-quant/src/metal_kernels/mod.rs:4973-4982 — all 23 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 × 13) mistralrs-core/src/models/flint.rs:778— mistralrs-core/src/models/flint.rs:778-788 | mistralrs-core/src/models/glm4.rs:440-450 | mistralrs-core/src/models/granite.rs:1948-1958 | mistralrs-core/src/models/hunyuan_v1_dense.rs:409-419 | mistralrs-core/src/models/hunyuan_v1_moe.rs:903-913 | mistralrs-core/src/models/lfm2.rs:1017-1027 | mistralrs-core/src/models/llama.rs:346-356 | mistralrs-core/src/models/mistral.rs:415-425 | mistralrs-core/src/models/qwen3.rs:403-413 | mistralrs-core/src/models/qwen3_moe.rs:577-587 | mistralrs-core/src/models/smollm3.rs:362-372 | mistralrs-core/src/vision_models/llama4/text.rs:795-805 | mistralrs-core/src/vision_models/mllama/text.rs:749-759 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 12) mistralrs-core/src/models/flint.rs:846— mistralrs-core/src/models/flint.rs:846-856 | mistralrs-core/src/models/glm4.rs:513-523 | mistralrs-core/src/models/hunyuan_v1_dense.rs:478-488 | mistralrs-core/src/models/hunyuan_v1_moe.rs:972-982 | mistralrs-core/src/models/mistral.rs:519-529 | mistralrs-core/src/models/mixtral.rs:474-484 | mistralrs-core/src/models/phi3.rs:487-497 | mistralrs-core/src/models/qwen2.rs:505-515 | mistralrs-core/src/models/qwen3.rs:472-482 | mistralrs-core/src/models/qwen3_moe.rs:652-662 | mistralrs-core/src/vision_models/phi3/mod.rs:1268-1278 | mistralrs-core/src/vision_models/phi4/mod.rs:383-393 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 10) mistralrs-core/src/models/deepseek2.rs:726— mistralrs-core/src/models/deepseek2.rs:726-736 | mistralrs-core/src/models/deepseek3.rs:789-799 | mistralrs-core/src/models/glm4_moe.rs:626-636 | mistralrs-core/src/models/glm4_moe_lite.rs:735-745 | mistralrs-core/src/models/mixtral.rs:340-350 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:355-365 | mistralrs-core/src/xlora_models/llama.rs:358-368 | mistralrs-core/src/xlora_models/mistral.rs:338-348 | mistralrs-core/src/xlora_models/mixtral.rs:465-475 | mistralrs-core/src/xlora_models/phi3.rs:303-313 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 9) mistralrs-core/src/models/gemma.rs:347— mistralrs-core/src/models/gemma.rs:347-357 | mistralrs-core/src/models/gemma2.rs:420-430 | mistralrs-core/src/models/mixtral.rs:406-415 | mistralrs-core/src/models/phi2.rs:431-440 | mistralrs-core/src/models/phi3.rs:408-417 | mistralrs-core/src/models/phi3_5_moe.rs:480-489 | mistralrs-core/src/models/qwen2.rs:433-442 | mistralrs-core/src/models/starcoder2.rs:405-414 | mistralrs-core/src/vision_models/gemma3/text.rs:433-443 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 7) mistralrs-core/src/embedding_models/qwen3_embedding.rs:348— mistralrs-core/src/embedding_models/qwen3_embedding.rs:348-358 | mistralrs-core/src/models/glm4.rs:458-468 | mistralrs-core/src/models/glm4_moe.rs:743-753 | mistralrs-core/src/models/hunyuan_v1_dense.rs:427-437 | mistralrs-core/src/models/hunyuan_v1_moe.rs:921-931 | mistralrs-core/src/models/qwen3.rs:421-431 | mistralrs-core/src/models/qwen3_moe.rs:595-605 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 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 (9–11 lines × 5) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2642— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2642-2652 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6619-6629 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7061-7071 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7537-7545 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8059-8067 — 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 (11 lines × 5) mistralrs-core/src/xlora_models/gemma.rs:485— mistralrs-core/src/xlora_models/gemma.rs:485-495 | mistralrs-core/src/xlora_models/gemma2.rs:515-525 | mistralrs-core/src/xlora_models/mistral.rs:481-491 | mistralrs-core/src/xlora_models/mixtral.rs:612-622 | mistralrs-core/src/xlora_models/phi2.rs:467-477 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–11 lines × 3) mistralrs-quant/src/afq/ops.rs:2357— mistralrs-quant/src/afq/ops.rs:2357-2365 | mistralrs-quant/src/afq/ops.rs:2481-2491 | mistralrs-quant/src/afq/ops.rs:3003-3013 — 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–11 lines × 2) mistralrs-core/src/attention/backends/cpu/full.rs:436— mistralrs-core/src/attention/backends/cpu/full.rs:436-443 | mistralrs-core/src/attention/backends/cpu/single_q.rs:201-211 — 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–11 lines × 2) mistralrs-core/src/models/qwen3_next.rs:611— mistralrs-core/src/models/qwen3_next.rs:611-616 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:440-450 — before extracting anything, compare `mistralrs-core/src/models/qwen3_next.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/text.rs` as WHOLE FILES: this scan already matched 29 separate duplicated blocks between them, totalling at least 433 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 (2–11 lines × 3) mistralrs-core/src/vision_models/clip.rs:137— mistralrs-core/src/vision_models/clip.rs:137-138 | mistralrs-core/src/vision_models/idefics3/vision.rs:250-260 | mistralrs-core/src/vision_models/siglip.rs:254-264 — before extracting anything, compare `mistralrs-core/src/vision_models/idefics3/vision.rs` and `mistralrs-core/src/vision_models/siglip.rs` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 263 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 (2–11 lines × 4) mistralrs-quant/src/cutile/fused_moe.rs:99— mistralrs-quant/src/cutile/fused_moe.rs:99-100 | mistralrs-quant/src/cutile/fused_moe.rs:106-116 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:111-112 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:118-128 — before extracting anything, compare `mistralrs-quant/src/cutile/fused_moe.rs` and `mistralrs-quant/src/cutile/fused_moe_fp8.rs` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 308 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 33) mistralrs-core/src/embedding_models/qwen3_embedding.rs:253— mistralrs-core/src/embedding_models/qwen3_embedding.rs:253-262 | mistralrs-core/src/models/deepseek2.rs:729-738 | mistralrs-core/src/models/deepseek3.rs:792-801 | mistralrs-core/src/models/flint.rs:714-723 | mistralrs-core/src/models/glm4.rs:339-348 | mistralrs-core/src/models/glm4_moe.rs:629-638 | mistralrs-core/src/models/glm4_moe_lite.rs:738-747 | mistralrs-core/src/models/gpt_oss.rs:655-664 | mistralrs-core/src/models/granite.rs:1483-1492 | mistralrs-core/src/models/granite.rs:1769-1778 | mistralrs-core/src/models/hunyuan_v1_dense.rs:313-322 | mistralrs-core/src/models/hunyuan_v1_moe.rs:803-812 | mistralrs-core/src/models/llama.rs:287-296 | mistralrs-core/src/models/mistral.rs:334-343 | mistralrs-core/src/models/mixtral.rs:343-352 | mistralrs-core/src/models/phi3.rs:347-356 | mistralrs-core/src/models/qwen2.rs:366-375 | mistralrs-core/src/models/qwen3.rs:322-331 | mistralrs-core/src/models/qwen3_moe.rs:496-505 | mistralrs-core/src/models/smollm3.rs:303-312 | mistralrs-core/src/vision_models/gemma4/text.rs:990-999 | mistralrs-core/src/vision_models/llama4/text.rs:692-701 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:358-367 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:340-349 | mistralrs-core/src/vision_models/mllama/text.rs:284-293 | mistralrs-core/src/vision_models/mllama/text.rs:643-652 | mistralrs-core/src/vision_models/phi3/mod.rs:438-447 | mistralrs-core/src/vision_models/phi4/mod.rs:267-276 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:445-454 | mistralrs-core/src/xlora_models/llama.rs:361-370 | mistralrs-core/src/xlora_models/mistral.rs:341-350 | mistralrs-core/src/xlora_models/mixtral.rs:468-477 | mistralrs-core/src/xlora_models/phi3.rs:306-315 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/deepseek2.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 × 31) mistralrs-core/src/models/flint.rs:392— mistralrs-core/src/models/flint.rs:392-401 | mistralrs-core/src/models/gemma.rs:197-206 | mistralrs-core/src/models/gemma2.rs:244-253 | mistralrs-core/src/models/glm4.rs:244-253 | mistralrs-core/src/models/glm4_moe.rs:312-321 | mistralrs-core/src/models/gpt_oss.rs:277-286 | mistralrs-core/src/models/granite.rs:1573-1582 | mistralrs-core/src/models/hunyuan_v1_dense.rs:223-232 | mistralrs-core/src/models/hunyuan_v1_moe.rs:409-418 | mistralrs-core/src/models/lfm2.rs:518-527 | mistralrs-core/src/models/llama.rs:105-114 | mistralrs-core/src/models/mistral.rs:245-254 | mistralrs-core/src/models/mixtral.rs:181-190 | mistralrs-core/src/models/phi2.rs:293-302 | mistralrs-core/src/models/phi3_5_moe.rs:211-220 | mistralrs-core/src/models/qwen2.rs:275-284 | mistralrs-core/src/models/qwen3.rs:230-239 | mistralrs-core/src/models/qwen3_moe.rs:233-242 | mistralrs-core/src/models/qwen3_next.rs:317-326 | mistralrs-core/src/models/smollm3.rs:122-131 | mistralrs-core/src/models/starcoder2.rs:257-266 | mistralrs-core/src/vision_models/gemma3/text.rs:247-256 | mistralrs-core/src/vision_models/mllama/text.rs:193-202 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:272-281 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:239-248 | mistralrs-core/src/vision_models/qwen2vl/text.rs:240-249 | mistralrs-core/src/vision_models/qwen3_5/text.rs:364-373 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:232-241 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:236-245 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:342-351 | mistralrs-core/src/vision_models/voxtral/mod.rs:158-167 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 22) mistralrs-core/src/models/flint.rs:391— mistralrs-core/src/models/flint.rs:391-400 | mistralrs-core/src/models/gemma.rs:196-205 | mistralrs-core/src/models/glm4.rs:243-252 | mistralrs-core/src/models/glm4_moe.rs:311-320 | mistralrs-core/src/models/gpt_oss.rs:276-285 | mistralrs-core/src/models/granite.rs:1572-1581 | mistralrs-core/src/models/hunyuan_v1_dense.rs:222-231 | mistralrs-core/src/models/hunyuan_v1_moe.rs:408-417 | mistralrs-core/src/models/llama.rs:104-113 | mistralrs-core/src/models/mistral.rs:244-253 | mistralrs-core/src/models/mixtral.rs:180-189 | mistralrs-core/src/models/phi2.rs:292-301 | mistralrs-core/src/models/phi3_5_moe.rs:210-219 | mistralrs-core/src/models/qwen3.rs:229-238 | mistralrs-core/src/models/qwen3_moe.rs:232-241 | mistralrs-core/src/models/qwen3_next.rs:316-325 | mistralrs-core/src/models/smollm3.rs:121-130 | mistralrs-core/src/models/starcoder2.rs:256-265 | mistralrs-core/src/vision_models/gemma3/text.rs:246-255 | mistralrs-core/src/vision_models/llama4/text.rs:476-485 | mistralrs-core/src/vision_models/mllama/text.rs:192-201 | mistralrs-core/src/vision_models/voxtral/mod.rs:157-166 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 16) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:436— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:436-447 | mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:639-650 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1161-1172 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1542-1553 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1850-1861 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2573-2584 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4001-4012 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4374-4385 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4779-4790 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:696-707 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:922-933 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1143-1154 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2295-2306 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3653-3664 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3874-3883 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5680-5691 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/embedding_loaders.rs` and `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 14) mistralrs-core/src/models/flint.rs:849— mistralrs-core/src/models/flint.rs:849-858 | mistralrs-core/src/models/glm4.rs:516-525 | mistralrs-core/src/models/hunyuan_v1_dense.rs:481-490 | mistralrs-core/src/models/hunyuan_v1_moe.rs:975-984 | mistralrs-core/src/models/mistral.rs:522-531 | mistralrs-core/src/models/mixtral.rs:477-486 | mistralrs-core/src/models/qwen2.rs:508-517 | mistralrs-core/src/models/qwen3.rs:475-484 | mistralrs-core/src/models/qwen3_moe.rs:655-664 | mistralrs-core/src/vision_models/gemma3/text.rs:527-537 | mistralrs-core/src/vision_models/phi3/mod.rs:1271-1280 | mistralrs-core/src/vision_models/phi4/mod.rs:386-395 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:472-481 | mistralrs-core/src/vision_models/qwen2vl/text.rs:474-483 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 12) mistralrs-core/src/models/deepseek2.rs:867— mistralrs-core/src/models/deepseek2.rs:867-876 | mistralrs-core/src/models/deepseek3.rs:930-939 | mistralrs-core/src/models/gemma.rs:382-391 | mistralrs-core/src/models/gemma2.rs:455-464 | mistralrs-core/src/models/glm4_moe.rs:766-775 | mistralrs-core/src/models/glm4_moe_lite.rs:877-886 | mistralrs-core/src/models/mistral.rs:490-499 | mistralrs-core/src/models/mixtral.rs:445-454 | mistralrs-core/src/models/phi2.rs:472-481 | mistralrs-core/src/models/phi3.rs:460-469 | mistralrs-core/src/models/phi3_5_moe.rs:529-538 | mistralrs-core/src/models/starcoder2.rs:443-452 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 11) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1409— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1409-1418 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1716-1725 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2016-2025 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2432-2441 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3144-3153 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3486-3495 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5003-5012 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:804-813 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1248-1257 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3976-3985 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5785-5794 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–10 lines × 7) mistralrs-core/src/models/deepseek2.rs:958— mistralrs-core/src/models/deepseek2.rs:958-967 | mistralrs-core/src/models/deepseek3.rs:1021-1030 | mistralrs-core/src/models/gemma.rs:471-480 | mistralrs-core/src/models/glm4_moe.rs:837-845 | mistralrs-core/src/models/glm4_moe_lite.rs:974-982 | mistralrs-core/src/models/granite.rs:2254-2263 | mistralrs-core/src/models/phi2.rs:550-559 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 6) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:737— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:737-746 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2790-2799 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4213-4222 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2175-2184 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3763-3772 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4455-4464 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/embedding_loaders.rs` and `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) mistralrs-core/src/embedding_models/embedding_gemma.rs:535— mistralrs-core/src/embedding_models/embedding_gemma.rs:535-544 | mistralrs-core/src/models/gemma2.rs:607-616 | mistralrs-core/src/vision_models/gemma3/text.rs:854-863 | mistralrs-core/src/vision_models/gemma3n/text.rs:1952-1961 | mistralrs-core/src/vision_models/gemma4/text.rs:2610-2619 — before extracting anything, compare `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 156 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 (9–10 lines × 4) mistralrs-core/src/models/deepseek2.rs:480— mistralrs-core/src/models/deepseek2.rs:480-489 | mistralrs-core/src/models/deepseek3.rs:481-490 | mistralrs-core/src/models/glm4_moe_lite.rs:445-454 | mistralrs-core/src/vision_models/llama4/text.rs:520-528 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8–10 lines × 4) mistralrs-core/src/models/phi3.rs:170— mistralrs-core/src/models/phi3.rs:170-179 | mistralrs-core/src/models/phi3_5_moe.rs:197-206 | mistralrs-core/src/vision_models/phi3/mod.rs:262-269 | mistralrs-core/src/vision_models/phi4/mod.rs:131-138 — before extracting anything, compare `mistralrs-core/src/models/phi3.rs` and `mistralrs-core/src/models/phi3_5_moe.rs` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 312 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–10 lines × 3) mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:827— mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:827-835 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:570-579 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:691-700 — `mistralrs-core/src/vision_models/qwen3_5_moe/text.rs` and `mistralrs-core/src/vision_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 18 separate duplicated blocks between them, totalling at least 203 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 (7–10 lines × 2) mistralrs-core/src/models/phi3_5_moe.rs:317— mistralrs-core/src/models/phi3_5_moe.rs:317-323 | mistralrs-core/src/models/phi3_5_moe.rs:342-351 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–10 lines × 2) mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:398— mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:398-405 | mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1740-1749 — both copies are in the same file, so extract the block into 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 × 22) mistralrs-core/src/embedding_models/embedding_gemma.rs:432— mistralrs-core/src/embedding_models/embedding_gemma.rs:432-440 | mistralrs-core/src/models/deepseek2.rs:868-876 | mistralrs-core/src/models/deepseek3.rs:931-939 | mistralrs-core/src/models/gemma.rs:383-391 | mistralrs-core/src/models/gemma2.rs:456-464 | mistralrs-core/src/models/glm4_moe.rs:767-775 | mistralrs-core/src/models/glm4_moe_lite.rs:878-886 | mistralrs-core/src/models/llama.rs:412-420 | mistralrs-core/src/models/mistral.rs:491-499 | mistralrs-core/src/models/mixtral.rs:446-454 | mistralrs-core/src/models/phi2.rs:473-481 | mistralrs-core/src/models/phi3.rs:461-469 | mistralrs-core/src/models/phi3_5_moe.rs:530-538 | mistralrs-core/src/models/starcoder2.rs:444-452 | mistralrs-core/src/vision_models/gemma3/text.rs:491-499 | mistralrs-core/src/vision_models/gemma4/text.rs:1717-1725 | mistralrs-core/src/vision_models/phi3/mod.rs:1242-1250 | mistralrs-core/src/vision_models/phi4/mod.rs:357-365 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:438-446 | mistralrs-core/src/vision_models/qwen2vl/text.rs:440-448 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:428-436 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:548-556 — `mistralrs-core/src/embedding_models/embedding_gemma.rs` and `mistralrs-core/src/models/gemma.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 7 separate duplicated blocks between them, totalling at least 113 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 (3–9 lines × 21) mistralrs-core/src/models/deepseek2.rs:961— mistralrs-core/src/models/deepseek2.rs:961-968 | mistralrs-core/src/models/deepseek3.rs:1024-1031 | mistralrs-core/src/models/gemma.rs:474-481 | mistralrs-core/src/models/glm4.rs:592-599 | mistralrs-core/src/models/glm4_moe.rs:839-846 | mistralrs-core/src/models/glm4_moe_lite.rs:976-983 | mistralrs-core/src/models/granite.rs:2256-2264 | mistralrs-core/src/models/hunyuan_v1_dense.rs:554-561 | mistralrs-core/src/models/hunyuan_v1_moe.rs:1048-1055 | mistralrs-core/src/models/mistral.rs:602-609 | mistralrs-core/src/models/mixtral.rs:540-547 | mistralrs-core/src/models/phi2.rs:553-560 | mistralrs-core/src/models/phi3.rs:548-556 | mistralrs-core/src/models/phi3_5_moe.rs:621-629 | mistralrs-core/src/models/qwen3.rs:556-563 | mistralrs-core/src/models/qwen3_moe.rs:736-743 | mistralrs-core/src/models/qwen3_next.rs:1049-1057 | mistralrs-core/src/models/starcoder2.rs:541-549 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:553-560 | mistralrs-core/src/vision_models/phi3/mod.rs:1351-1359 | mistralrs-core/src/vision_models/phi4/mod.rs:521-523 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 16) mistralrs-core/src/models/gemma.rs:588— mistralrs-core/src/models/gemma.rs:588-596 | mistralrs-core/src/models/gemma2.rs:705-713 | mistralrs-core/src/models/glm4.rs:708-716 | mistralrs-core/src/models/hunyuan_v1_dense.rs:676-684 | mistralrs-core/src/models/llama.rs:617-625 | mistralrs-core/src/models/mistral.rs:716-724 | mistralrs-core/src/models/phi2.rs:664-672 | mistralrs-core/src/models/phi3.rs:659-667 | mistralrs-core/src/models/qwen2.rs:718-726 | mistralrs-core/src/models/qwen3.rs:694-702 | mistralrs-core/src/models/smollm3.rs:636-644 | mistralrs-core/src/models/starcoder2.rs:655-663 | mistralrs-core/src/vision_models/gemma3/text.rs:929-937 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:630-638 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:672-680 | mistralrs-core/src/vision_models/phi3/mod.rs:1496-1504 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 15) mistralrs-core/src/embedding_models/qwen3_embedding.rs:351— mistralrs-core/src/embedding_models/qwen3_embedding.rs:351-359 | mistralrs-core/src/models/gemma.rs:364-372 | mistralrs-core/src/models/gemma2.rs:437-445 | mistralrs-core/src/models/glm4.rs:461-469 | mistralrs-core/src/models/glm4_moe.rs:746-754 | mistralrs-core/src/models/mixtral.rs:427-435 | mistralrs-core/src/models/qwen2.rs:455-463 | mistralrs-core/src/models/qwen3.rs:424-432 | mistralrs-core/src/models/qwen3_moe.rs:598-606 | mistralrs-core/src/models/starcoder2.rs:425-433 | mistralrs-core/src/xlora_models/gemma.rs:444-452 | mistralrs-core/src/xlora_models/gemma2.rs:475-483 | mistralrs-core/src/xlora_models/mistral.rs:441-449 | mistralrs-core/src/xlora_models/mixtral.rs:571-579 | mistralrs-core/src/xlora_models/starcoder2.rs:430-438 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 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 (9 lines × 11) mistralrs-quant/src/cutile/fused_moe.rs:123— mistralrs-quant/src/cutile/fused_moe.rs:123-131 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:134-142 | mistralrs-quant/src/cutile/gdn_prefill.rs:267-275 | mistralrs-quant/src/cutile/qsa.rs:65-73 | mistralrs-quant/src/cutile/qsa.rs:76-84 | mistralrs-quant/src/cutile/qsa.rs:87-95 | mistralrs-quant/src/cutile/qsa.rs:98-106 | mistralrs-quant/src/cutile/qsa.rs:293-301 | mistralrs-quant/src/cutile/qsa.rs:304-312 | mistralrs-quant/src/cutile/qsa.rs:361-369 | mistralrs-quant/src/cutile/routed_lora.rs:172-180 — before extracting anything, compare `mistralrs-quant/src/cutile/fused_moe.rs` and `mistralrs-quant/src/cutile/fused_moe_fp8.rs` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 308 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–9 lines × 9) mistralrs-core/src/models/deepseek2.rs:817— mistralrs-core/src/models/deepseek2.rs:817-825 | mistralrs-core/src/models/deepseek3.rs:880-888 | mistralrs-core/src/models/glm4_moe.rs:717-725 | mistralrs-core/src/models/glm4_moe_lite.rs:827-835 | mistralrs-core/src/models/gpt_oss.rs:722-730 | mistralrs-core/src/models/mixtral.rs:415-423 | mistralrs-core/src/models/phi3.rs:417-425 | mistralrs-core/src/models/qwen2.rs:442-450 | mistralrs-core/src/vision_models/gemma3n/text.rs:1335-1342 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 9) mistralrs-core/src/xlora_models/gemma.rs:268— mistralrs-core/src/xlora_models/gemma.rs:268-276 | mistralrs-core/src/xlora_models/gemma2.rs:273-281 | mistralrs-core/src/xlora_models/llama.rs:91-99 | mistralrs-core/src/xlora_models/mistral.rs:258-266 | mistralrs-core/src/xlora_models/mixtral.rs:171-179 | mistralrs-core/src/xlora_models/phi2.rs:261-269 | mistralrs-core/src/xlora_models/phi3.rs:146-154 | mistralrs-core/src/xlora_models/quantized_phi3.rs:184-192 | mistralrs-core/src/xlora_models/starcoder2.rs:245-253 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–9 lines × 6) mistralrs-core/src/xlora_models/gemma.rs:442— mistralrs-core/src/xlora_models/gemma.rs:442-449 | mistralrs-core/src/xlora_models/gemma2.rs:473-480 | mistralrs-core/src/xlora_models/mistral.rs:439-446 | mistralrs-core/src/xlora_models/mixtral.rs:569-576 | mistralrs-core/src/xlora_models/phi2.rs:424-432 | mistralrs-core/src/xlora_models/phi3.rs:405-412 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–9 lines × 6) mistralrs-core/src/xlora_models/gemma2.rs:618— mistralrs-core/src/xlora_models/gemma2.rs:618-626 | mistralrs-core/src/xlora_models/phi2.rs:552-560 | mistralrs-core/src/xlora_models/phi3.rs:530-538 | mistralrs-core/src/xlora_models/quantized_llama.rs:784-790 | mistralrs-core/src/xlora_models/quantized_phi3.rs:446-454 | mistralrs-core/src/xlora_models/starcoder2.rs:563-571 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma2.rs` and `mistralrs-core/src/xlora_models/phi2.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 297 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–9 lines × 6) mistralrs-core/src/vision_models/conformer/encoder.rs:82— mistralrs-core/src/vision_models/conformer/encoder.rs:82-90 | mistralrs-core/src/vision_models/idefics3/vision.rs:277-285 | mistralrs-core/src/vision_models/lfm2_vl/vision.rs:209-217 | mistralrs-core/src/vision_models/llama4/text.rs:427-432 | mistralrs-core/src/vision_models/mllama/vision.rs:202-210 | mistralrs-core/src/vision_models/siglip.rs:275-283 — `mistralrs-core/src/vision_models/idefics3/vision.rs` and `mistralrs-core/src/vision_models/lfm2_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 7 separate duplicated blocks between them, totalling at least 52 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 (8–9 lines × 5) mistralrs-quant/src/blockwise_fp8/deepgemm.rs:518— mistralrs-quant/src/blockwise_fp8/deepgemm.rs:518-525 | mistralrs-quant/src/blockwise_fp8/deepgemm.rs:602-610 | mistralrs-quant/src/blockwise_fp8/deepgemm.rs:621-628 | mistralrs-quant/src/blockwise_fp8/ops.rs:2064-2071 | mistralrs-quant/src/blockwise_fp8/ops.rs:2073-2081 — before extracting anything, compare `mistralrs-quant/src/blockwise_fp8/deepgemm.rs` and `mistralrs-quant/src/blockwise_fp8/ops.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.
Duplicated block (8 lines × 37) mistralrs-core/src/models/flint.rs:357— mistralrs-core/src/models/flint.rs:357-364 | mistralrs-core/src/models/gemma.rs:177-184 | mistralrs-core/src/models/gemma2.rs:218-225 | mistralrs-core/src/models/glm4.rs:220-227 | mistralrs-core/src/models/glm4_moe.rs:282-289 | mistralrs-core/src/models/gpt_oss.rs:258-265 | mistralrs-core/src/models/hunyuan_v1_dense.rs:201-208 | mistralrs-core/src/models/hunyuan_v1_moe.rs:384-391 | mistralrs-core/src/models/lfm2.rs:490-497 | mistralrs-core/src/models/mistral.rs:216-223 | mistralrs-core/src/models/mixtral.rs:161-168 | mistralrs-core/src/models/phi2.rs:273-280 | mistralrs-core/src/models/phi3.rs:161-168 | mistralrs-core/src/models/phi3_5_moe.rs:188-195 | mistralrs-core/src/models/qwen2.rs:250-257 | mistralrs-core/src/models/qwen3.rs:202-209 | mistralrs-core/src/models/qwen3_moe.rs:205-212 | mistralrs-core/src/models/qwen3_next.rs:288-295 | mistralrs-core/src/models/starcoder2.rs:237-244 | mistralrs-core/src/vision_models/gemma3/text.rs:192-199 | mistralrs-core/src/vision_models/mllama/text.rs:172-179 | mistralrs-core/src/vision_models/phi3/mod.rs:253-260 | mistralrs-core/src/vision_models/phi4/mod.rs:122-129 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:211-218 | mistralrs-core/src/vision_models/qwen2vl/text.rs:212-219 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:203-210 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:204-211 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:310-317 | mistralrs-core/src/vision_models/voxtral/encoder.rs:91-98 | mistralrs-core/src/vision_models/voxtral/mod.rs:137-144 | mistralrs-core/src/xlora_models/gemma.rs:258-265 | mistralrs-core/src/xlora_models/gemma2.rs:263-270 | mistralrs-core/src/xlora_models/mistral.rs:248-255 | mistralrs-core/src/xlora_models/mixtral.rs:161-168 | mistralrs-core/src/xlora_models/phi2.rs:251-258 | mistralrs-core/src/xlora_models/phi3.rs:136-143 | mistralrs-core/src/xlora_models/starcoder2.rs:235-242 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 32) mistralrs-core/src/models/flint.rs:443— mistralrs-core/src/models/flint.rs:443-450 | mistralrs-core/src/models/gemma.rs:238-245 | mistralrs-core/src/models/gemma2.rs:286-293 | mistralrs-core/src/models/glm4.rs:285-292 | mistralrs-core/src/models/glm4_moe.rs:350-357 | mistralrs-core/src/models/gpt_oss.rs:315-322 | mistralrs-core/src/models/granite.rs:1611-1618 | mistralrs-core/src/models/hunyuan_v1_dense.rs:261-268 | mistralrs-core/src/models/hunyuan_v1_moe.rs:447-454 | mistralrs-core/src/models/llama.rs:146-153 | mistralrs-core/src/models/mistral.rs:286-293 | mistralrs-core/src/models/mixtral.rs:222-229 | mistralrs-core/src/models/phi2.rs:334-343 | mistralrs-core/src/models/phi3.rs:225-232 | mistralrs-core/src/models/phi3_5_moe.rs:252-259 | mistralrs-core/src/models/qwen2.rs:316-323 | mistralrs-core/src/models/qwen3.rs:271-278 | mistralrs-core/src/models/qwen3_moe.rs:274-281 | mistralrs-core/src/models/qwen3_next.rs:354-361 | mistralrs-core/src/models/smollm3.rs:163-170 | mistralrs-core/src/models/starcoder2.rs:298-305 | mistralrs-core/src/vision_models/llama4/text.rs:518-525 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:121-128 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:295-302 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:309-318 | mistralrs-core/src/vision_models/phi3/mod.rs:316-323 | mistralrs-core/src/vision_models/phi4/mod.rs:185-192 | mistralrs-core/src/vision_models/qwen3_5/text.rs:404-411 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:269-276 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:276-283 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:379-386 | mistralrs-core/src/vision_models/voxtral/mod.rs:197-204 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 26) mistralrs-quant/src/metal_kernels/mod.rs:211— mistralrs-quant/src/metal_kernels/mod.rs:211-219 | mistralrs-quant/src/metal_kernels/mod.rs:250-258 | mistralrs-quant/src/metal_kernels/mod.rs:289-297 | mistralrs-quant/src/metal_kernels/mod.rs:328-336 | mistralrs-quant/src/metal_kernels/mod.rs:367-375 | mistralrs-quant/src/metal_kernels/mod.rs:620-628 | mistralrs-quant/src/metal_kernels/mod.rs:667-675 | mistralrs-quant/src/metal_kernels/mod.rs:714-722 | mistralrs-quant/src/metal_kernels/mod.rs:1720-1729 | mistralrs-quant/src/metal_kernels/mod.rs:1785-1794 | mistralrs-quant/src/metal_kernels/mod.rs:1855-1864 | mistralrs-quant/src/metal_kernels/mod.rs:1952-1960 | mistralrs-quant/src/metal_kernels/mod.rs:3185-3193 | mistralrs-quant/src/metal_kernels/mod.rs:3308-3315 | mistralrs-quant/src/metal_kernels/mod.rs:3372-3379 | mistralrs-quant/src/metal_kernels/mod.rs:3436-3443 | mistralrs-quant/src/metal_kernels/mod.rs:3501-3508 | mistralrs-quant/src/metal_kernels/mod.rs:3563-3571 | mistralrs-quant/src/metal_kernels/mod.rs:4007-4015 | mistralrs-quant/src/metal_kernels/mod.rs:4042-4050 | mistralrs-quant/src/metal_kernels/mod.rs:4079-4087 | mistralrs-quant/src/metal_kernels/mod.rs:4119-4127 | mistralrs-quant/src/metal_kernels/mod.rs:4493-4500 | mistralrs-quant/src/metal_kernels/mod.rs:4555-4562 | mistralrs-quant/src/metal_kernels/mod.rs:4934-4941 | mistralrs-quant/src/metal_kernels/mod.rs:4976-4983 — all 26 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 × 22) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:435— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:435-444 | mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:638-647 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1160-1169 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1541-1550 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1849-1858 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2572-2581 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4000-4009 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4373-4382 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4778-4787 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5591-5600 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:9235-9242 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:10480-10487 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:695-704 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:921-930 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1142-1151 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2043-2052 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2294-2303 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3652-3661 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3873-3880 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4086-4095 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5191-5200 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5679-5688 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/embedding_loaders.rs` and `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 170 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 16) mistralrs-core/src/models/deepseek2.rs:816— mistralrs-core/src/models/deepseek2.rs:816-823 | mistralrs-core/src/models/deepseek3.rs:879-886 | mistralrs-core/src/models/flint.rs:785-792 | mistralrs-core/src/models/glm4.rs:447-454 | mistralrs-core/src/models/glm4_moe.rs:716-723 | mistralrs-core/src/models/glm4_moe_lite.rs:826-833 | mistralrs-core/src/models/gpt_oss.rs:721-728 | mistralrs-core/src/models/granite.rs:1955-1962 | mistralrs-core/src/models/hunyuan_v1_dense.rs:416-423 | mistralrs-core/src/models/hunyuan_v1_moe.rs:910-917 | mistralrs-core/src/models/llama.rs:353-360 | mistralrs-core/src/models/mistral.rs:422-429 | mistralrs-core/src/models/qwen3.rs:410-417 | mistralrs-core/src/models/qwen3_moe.rs:584-591 | mistralrs-core/src/models/smollm3.rs:369-376 | mistralrs-core/src/vision_models/llama4/text.rs:802-809 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 14) mistralrs-core/src/models/deepseek2.rs:820— mistralrs-core/src/models/deepseek2.rs:820-827 | mistralrs-core/src/models/deepseek3.rs:883-890 | mistralrs-core/src/models/glm4_moe.rs:720-727 | mistralrs-core/src/models/glm4_moe_lite.rs:830-837 | mistralrs-core/src/models/mixtral.rs:418-425 | mistralrs-core/src/models/phi3.rs:420-427 | mistralrs-core/src/models/qwen2.rs:445-452 | mistralrs-core/src/vision_models/gemma3/text.rs:446-453 | mistralrs-core/src/vision_models/gemma3n/text.rs:1337-1344 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:441-448 | mistralrs-core/src/vision_models/phi3/mod.rs:1215-1222 | mistralrs-core/src/vision_models/phi4/mod.rs:336-343 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:410-417 | mistralrs-core/src/vision_models/qwen2vl/text.rs:411-418 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 11) mistralrs-core/src/embedding_models/qwen3_embedding.rs:351— mistralrs-core/src/embedding_models/qwen3_embedding.rs:351-358 | mistralrs-core/src/models/glm4.rs:461-468 | mistralrs-core/src/models/glm4_moe.rs:746-753 | mistralrs-core/src/models/hunyuan_v1_dense.rs:430-437 | mistralrs-core/src/models/hunyuan_v1_moe.rs:924-931 | mistralrs-core/src/models/qwen3.rs:424-431 | mistralrs-core/src/models/qwen3_moe.rs:598-605 | mistralrs-core/src/xlora_models/gemma.rs:444-451 | mistralrs-core/src/xlora_models/gemma2.rs:475-482 | mistralrs-core/src/xlora_models/mistral.rs:441-448 | mistralrs-core/src/xlora_models/mixtral.rs:571-578 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 134 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 (7–8 lines × 9) mistralrs-core/src/models/deepseek2.rs:951— mistralrs-core/src/models/deepseek2.rs:951-957 | mistralrs-core/src/models/deepseek3.rs:1014-1020 | mistralrs-core/src/models/glm4_moe.rs:830-836 | mistralrs-core/src/models/glm4_moe_lite.rs:967-973 | mistralrs-core/src/models/mixtral.rs:527-533 | mistralrs-core/src/models/phi2.rs:543-549 | mistralrs-core/src/models/phi3.rs:535-541 | mistralrs-core/src/models/phi3_5_moe.rs:608-614 | mistralrs-core/src/models/starcoder2.rs:528-535 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–8 lines × 5) mistralrs-core/src/models/flint.rs:957— mistralrs-core/src/models/flint.rs:957-963 | mistralrs-core/src/models/gemma2.rs:566-572 | mistralrs-core/src/models/gpt_oss.rs:916-923 | mistralrs-core/src/models/qwen2.rs:593-599 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:593-600 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 186 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–8 lines × 4) mistralrs-core/src/vision_models/muse_glimmer/inputs_processor.rs:844— mistralrs-core/src/vision_models/muse_glimmer/inputs_processor.rs:844-850 | mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs:543-550 | mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:1151-1158 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:1211-1218 — `mistralrs-core/src/vision_models/qwen2_5_vl/inputs_processor.rs` and `mistralrs-core/src/vision_models/qwen2vl/inputs_processor.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 47 separate duplicated blocks between them, totalling at least 994 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 (7–8 lines × 3) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:730— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:730-736 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2865-2872 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3756-3762 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/embedding_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 206 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (4–8 lines × 4) REDACTED:687— REDACTED:687-694 | mistralrs-core/src/vision_models/idefics3/vision.rs:506-513 | mistralrs-core/src/vision_models/lfm2_vl/vision.rs:386-389 | mistralrs-core/src/vision_models/siglip.rs:529-536 — before extracting anything, compare `REDACTED` and `mistralrs-core/src/vision_models/idefics3/vision.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 213 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 (2–8 lines × 3) mistralrs-core/src/models/quantized_llama.rs:99— mistralrs-core/src/models/quantized_llama.rs:99-106 | mistralrs-core/src/xlora_models/quantized_llama.rs:227-234 | mistralrs-core/src/xlora_models/quantized_phi3.rs:182-183 — `mistralrs-core/src/models/quantized_llama.rs` and `mistralrs-core/src/xlora_models/quantized_llama.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 5 separate duplicated blocks between them, totalling at least 59 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 (4–8 lines × 5) mistralrs-core/src/ops.rs:2203— mistralrs-core/src/ops.rs:2203-2206 | mistralrs-core/src/ops.rs:3939-3946 | mistralrs-core/src/ops.rs:4066-4073 | mistralrs-flash-attn/src/flash.rs:168-171 | mistralrs-flash-attn/src/flash.rs:738-741 — 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.
Duplicated block (1–8 lines × 7) mistralrs-core/src/xlora_models/gemma.rs:278— mistralrs-core/src/xlora_models/gemma.rs:278-285 | mistralrs-core/src/xlora_models/llama.rs:100-101 | mistralrs-core/src/xlora_models/mistral.rs:267-268 | mistralrs-core/src/xlora_models/mixtral.rs:180-181 | mistralrs-core/src/xlora_models/phi2.rs:271-275 | mistralrs-core/src/xlora_models/quantized_llama.rs:236-236 | mistralrs-core/src/xlora_models/starcoder2.rs:254-255 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/llama.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 162 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (4–8 lines × 6) mistralrs-quant/src/cutile/nvfp4_gemv.rs:119— mistralrs-quant/src/cutile/nvfp4_gemv.rs:119-126 | mistralrs-quant/src/cutile/nvfp4_gemv.rs:223-230 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:140-143 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:293-296 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:555-558 | mistralrs-quant/src/cutile/nvfp4_matmul.rs:849-852 — before extracting anything, compare `mistralrs-quant/src/cutile/nvfp4_gemv.rs` and `mistralrs-quant/src/cutile/nvfp4_matmul.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 37) mistralrs-core/src/models/flint.rs:353— mistralrs-core/src/models/flint.rs:353-359 | mistralrs-core/src/models/gemma.rs:173-179 | mistralrs-core/src/models/gemma2.rs:214-220 | mistralrs-core/src/models/glm4.rs:216-222 | mistralrs-core/src/models/glm4_moe.rs:278-284 | mistralrs-core/src/models/gpt_oss.rs:254-260 | mistralrs-core/src/models/hunyuan_v1_dense.rs:197-203 | mistralrs-core/src/models/hunyuan_v1_moe.rs:380-386 | mistralrs-core/src/models/lfm2.rs:486-492 | mistralrs-core/src/models/mistral.rs:212-218 | mistralrs-core/src/models/mixtral.rs:157-163 | mistralrs-core/src/models/phi2.rs:269-275 | mistralrs-core/src/models/phi3.rs:157-163 | mistralrs-core/src/models/phi3_5_moe.rs:184-190 | mistralrs-core/src/models/qwen2.rs:246-252 | mistralrs-core/src/models/qwen3.rs:198-204 | mistralrs-core/src/models/qwen3_moe.rs:201-207 | mistralrs-core/src/models/starcoder2.rs:233-239 | mistralrs-core/src/vision_models/gemma3/text.rs:188-194 | mistralrs-core/src/vision_models/gemma4/text.rs:806-812 | REDACTED:827-833 | mistralrs-core/src/vision_models/mllama/text.rs:168-174 | mistralrs-core/src/vision_models/phi3/mod.rs:249-255 | mistralrs-core/src/vision_models/phi4/mod.rs:118-124 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:207-213 | mistralrs-core/src/vision_models/qwen2vl/text.rs:208-214 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:200-206 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:306-312 | mistralrs-core/src/vision_models/voxtral/encoder.rs:87-93 | mistralrs-core/src/vision_models/voxtral/mod.rs:133-139 | mistralrs-core/src/xlora_models/gemma.rs:254-260 | mistralrs-core/src/xlora_models/gemma2.rs:259-265 | mistralrs-core/src/xlora_models/mistral.rs:244-250 | mistralrs-core/src/xlora_models/mixtral.rs:157-163 | mistralrs-core/src/xlora_models/phi2.rs:247-253 | mistralrs-core/src/xlora_models/phi3.rs:132-138 | mistralrs-core/src/xlora_models/starcoder2.rs:231-237 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 34) mistralrs-core/src/models/flint.rs:443— mistralrs-core/src/models/flint.rs:443-451 | mistralrs-core/src/models/gemma.rs:238-246 | mistralrs-core/src/models/gemma2.rs:286-294 | mistralrs-core/src/models/glm4.rs:285-293 | mistralrs-core/src/models/glm4_moe.rs:350-358 | mistralrs-core/src/models/gpt_oss.rs:315-323 | mistralrs-core/src/models/granite.rs:1611-1619 | mistralrs-core/src/models/hunyuan_v1_dense.rs:261-269 | mistralrs-core/src/models/hunyuan_v1_moe.rs:447-455 | mistralrs-core/src/models/llama.rs:146-154 | mistralrs-core/src/models/mistral.rs:286-294 | mistralrs-core/src/models/mixtral.rs:222-230 | mistralrs-core/src/models/phi2.rs:334-344 | mistralrs-core/src/models/phi3.rs:225-233 | mistralrs-core/src/models/phi3_5_moe.rs:252-260 | mistralrs-core/src/models/qwen2.rs:316-324 | mistralrs-core/src/models/qwen3.rs:271-279 | mistralrs-core/src/models/qwen3_moe.rs:274-282 | mistralrs-core/src/models/qwen3_next.rs:354-362 | mistralrs-core/src/models/smollm3.rs:163-171 | mistralrs-core/src/models/starcoder2.rs:298-306 | mistralrs-core/src/vision_models/llama4/text.rs:518-526 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:121-129 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:295-303 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:309-319 | mistralrs-core/src/vision_models/phi3/mod.rs:316-324 | mistralrs-core/src/vision_models/phi4/mod.rs:185-193 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:285-291 | mistralrs-core/src/vision_models/qwen2vl/text.rs:286-292 | mistralrs-core/src/vision_models/qwen3_5/text.rs:404-412 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:269-277 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:276-284 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:379-387 | mistralrs-core/src/vision_models/voxtral/mod.rs:197-205 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 29) mistralrs-core/src/models/flint.rs:448— mistralrs-core/src/models/flint.rs:448-454 | mistralrs-core/src/models/gemma.rs:243-249 | mistralrs-core/src/models/gemma2.rs:291-297 | mistralrs-core/src/models/glm4.rs:290-296 | mistralrs-core/src/models/glm4_moe.rs:355-361 | mistralrs-core/src/models/gpt_oss.rs:320-326 | mistralrs-core/src/models/granite.rs:1616-1622 | mistralrs-core/src/models/hunyuan_v1_dense.rs:266-272 | mistralrs-core/src/models/hunyuan_v1_moe.rs:452-458 | mistralrs-core/src/models/llama.rs:151-157 | mistralrs-core/src/models/mistral.rs:291-297 | mistralrs-core/src/models/mixtral.rs:227-233 | mistralrs-core/src/models/phi3.rs:230-236 | mistralrs-core/src/models/phi3_5_moe.rs:257-263 | mistralrs-core/src/models/qwen2.rs:321-327 | mistralrs-core/src/models/qwen3.rs:276-282 | mistralrs-core/src/models/qwen3_moe.rs:279-285 | mistralrs-core/src/models/smollm3.rs:168-174 | mistralrs-core/src/models/starcoder2.rs:303-309 | mistralrs-core/src/vision_models/gemma3/text.rs:296-302 | mistralrs-core/src/vision_models/gemma4/text.rs:764-770 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:126-132 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:300-306 | mistralrs-core/src/vision_models/phi3/mod.rs:321-327 | mistralrs-core/src/vision_models/phi4/mod.rs:190-196 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:288-294 | mistralrs-core/src/vision_models/qwen2vl/text.rs:289-295 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:281-287 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:384-390 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–7 lines × 16) mistralrs-core/src/models/gemma.rs:186— mistralrs-core/src/models/gemma.rs:186-191 | mistralrs-core/src/models/gemma2.rs:227-232 | mistralrs-core/src/models/gpt_oss.rs:267-272 | mistralrs-core/src/models/hunyuan_v1_dense.rs:210-215 | mistralrs-core/src/models/hunyuan_v1_moe.rs:393-398 | mistralrs-core/src/models/lfm2.rs:499-504 | mistralrs-core/src/models/mistral.rs:225-230 | mistralrs-core/src/models/mixtral.rs:170-175 | mistralrs-core/src/models/phi2.rs:282-287 | mistralrs-core/src/models/qwen2.rs:259-264 | mistralrs-core/src/models/qwen3.rs:211-216 | mistralrs-core/src/models/qwen3_moe.rs:214-219 | mistralrs-core/src/models/qwen3_next.rs:297-302 | mistralrs-core/src/models/starcoder2.rs:246-251 | mistralrs-core/src/vision_models/mllama/text.rs:181-187 | mistralrs-core/src/vision_models/voxtral/mod.rs:146-152 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 15) mistralrs-core/src/models/deepseek2.rs:820— mistralrs-core/src/models/deepseek2.rs:820-826 | mistralrs-core/src/models/deepseek3.rs:883-889 | mistralrs-core/src/models/glm4_moe.rs:720-726 | mistralrs-core/src/models/glm4_moe_lite.rs:830-836 | mistralrs-core/src/models/mixtral.rs:418-424 | mistralrs-core/src/models/phi3.rs:420-426 | mistralrs-core/src/models/qwen2.rs:445-451 | mistralrs-core/src/vision_models/gemma3/text.rs:446-452 | mistralrs-core/src/vision_models/gemma3n/text.rs:1337-1343 | mistralrs-core/src/vision_models/gemma4/text.rs:1651-1659 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:441-447 | mistralrs-core/src/vision_models/phi3/mod.rs:1215-1221 | mistralrs-core/src/vision_models/phi4/mod.rs:336-342 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:410-416 | mistralrs-core/src/vision_models/qwen2vl/text.rs:411-417 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 12) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1402— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1402-1408 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2425-2431 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2783-2789 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3137-3143 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3479-3485 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4206-4212 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4996-5002 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:797-803 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1241-1247 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1485-1491 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2168-2174 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5778-5784 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 10) mistralrs-core/src/models/deepseek2.rs:819— mistralrs-core/src/models/deepseek2.rs:819-825 | mistralrs-core/src/models/deepseek3.rs:882-888 | mistralrs-core/src/models/glm4_moe.rs:719-725 | mistralrs-core/src/models/glm4_moe_lite.rs:829-835 | mistralrs-core/src/models/gpt_oss.rs:724-730 | mistralrs-core/src/models/mixtral.rs:417-423 | mistralrs-core/src/models/phi3.rs:419-425 | mistralrs-core/src/models/qwen2.rs:444-450 | mistralrs-core/src/vision_models/gemma3/text.rs:445-451 | mistralrs-core/src/vision_models/gemma3n/text.rs:1336-1342 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 8) mistralrs-core/src/vision_models/qwen3_5/mod.rs:192— mistralrs-core/src/vision_models/qwen3_5/mod.rs:192-198 | mistralrs-core/src/vision_models/qwen3_5/mod.rs:255-261 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:175-181 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:238-244 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:700-706 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:777-783 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:145-151 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:222-228 — `mistralrs-core/src/vision_models/qwen3_5/mod.rs` and `mistralrs-core/src/vision_models/qwen3_5_moe/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 23 separate duplicated blocks between them, totalling at least 390 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 (6 lines × 39) mistralrs-core/src/models/flint.rs:356— mistralrs-core/src/models/flint.rs:356-361 | mistralrs-core/src/models/gemma.rs:176-181 | mistralrs-core/src/models/gemma2.rs:217-222 | mistralrs-core/src/models/glm4.rs:219-224 | mistralrs-core/src/models/glm4_moe.rs:281-286 | mistralrs-core/src/models/gpt_oss.rs:257-262 | mistralrs-core/src/models/hunyuan_v1_dense.rs:200-205 | mistralrs-core/src/models/hunyuan_v1_moe.rs:383-388 | mistralrs-core/src/models/lfm2.rs:489-494 | mistralrs-core/src/models/mistral.rs:215-220 | mistralrs-core/src/models/mixtral.rs:160-165 | mistralrs-core/src/models/phi2.rs:272-277 | mistralrs-core/src/models/phi3.rs:160-165 | mistralrs-core/src/models/phi3_5_moe.rs:187-192 | mistralrs-core/src/models/qwen2.rs:249-254 | mistralrs-core/src/models/qwen3.rs:201-206 | mistralrs-core/src/models/qwen3_moe.rs:204-209 | mistralrs-core/src/models/qwen3_next.rs:287-292 | mistralrs-core/src/models/starcoder2.rs:236-241 | mistralrs-core/src/vision_models/gemma3/text.rs:191-196 | mistralrs-core/src/vision_models/gemma4/text.rs:809-814 | REDACTED:830-835 | mistralrs-core/src/vision_models/mllama/text.rs:171-176 | mistralrs-core/src/vision_models/phi3/mod.rs:252-257 | mistralrs-core/src/vision_models/phi4/mod.rs:121-126 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:210-215 | mistralrs-core/src/vision_models/qwen2vl/text.rs:211-216 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:202-207 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:203-208 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:309-314 | mistralrs-core/src/vision_models/voxtral/encoder.rs:90-95 | mistralrs-core/src/vision_models/voxtral/mod.rs:136-141 | mistralrs-core/src/xlora_models/gemma.rs:257-262 | mistralrs-core/src/xlora_models/gemma2.rs:262-267 | mistralrs-core/src/xlora_models/mistral.rs:247-252 | mistralrs-core/src/xlora_models/mixtral.rs:160-165 | mistralrs-core/src/xlora_models/phi2.rs:250-255 | mistralrs-core/src/xlora_models/phi3.rs:135-140 | mistralrs-core/src/xlora_models/starcoder2.rs:234-239 — before extracting anything, compare `mistralrs-core/src/models/flint.rs` and `mistralrs-core/src/models/gemma.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 37) mistralrs-core/src/embedding_models/qwen3_embedding.rs:475— mistralrs-core/src/embedding_models/qwen3_embedding.rs:475-480 | mistralrs-core/src/models/deepseek2.rs:986-991 | mistralrs-core/src/models/deepseek2.rs:1026-1031 | mistralrs-core/src/models/deepseek3.rs:1049-1054 | mistralrs-core/src/models/deepseek3.rs:1090-1095 | mistralrs-core/src/models/flint.rs:987-992 | mistralrs-core/src/models/gemma.rs:499-504 | mistralrs-core/src/models/gemma2.rs:605-610 | mistralrs-core/src/models/glm4.rs:617-622 | mistralrs-core/src/models/glm4_moe.rs:864-869 | mistralrs-core/src/models/glm4_moe.rs:904-909 | mistralrs-core/src/models/glm4_moe_lite.rs:1001-1006 | mistralrs-core/src/models/glm4_moe_lite.rs:1044-1049 | mistralrs-core/src/models/gpt_oss.rs:952-957 | mistralrs-core/src/models/hunyuan_v1_dense.rs:579-584 | mistralrs-core/src/models/hunyuan_v1_moe.rs:1071-1076 | mistralrs-core/src/models/mistral.rs:627-632 | mistralrs-core/src/models/mixtral.rs:565-570 | mistralrs-core/src/models/phi3.rs:574-579 | mistralrs-core/src/models/phi3_5_moe.rs:647-652 | mistralrs-core/src/models/phi3_5_moe.rs:666-671 | mistralrs-core/src/models/qwen2.rs:629-634 | mistralrs-core/src/models/qwen3.rs:581-586 | mistralrs-core/src/models/qwen3_moe.rs:762-767 | mistralrs-core/src/models/qwen3_next.rs:1143-1148 | mistralrs-core/src/models/starcoder2.rs:566-571 | mistralrs-core/src/vision_models/llama4/vision.rs:351-356 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:576-581 | mistralrs-core/src/vision_models/mllama/vision.rs:400-405 | mistralrs-core/src/vision_models/phi3/mod.rs:1380-1385 | mistralrs-core/src/vision_models/phi4/mod.rs:642-647 | mistralrs-core/src/vision_models/qwen2_5_vl/text.rs:567-572 | mistralrs-core/src/vision_models/qwen2vl/text.rs:569-574 | mistralrs-core/src/vision_models/qwen3_5/text.rs:1843-1848 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:959-964 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:605-610 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:726-731 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/deepseek2.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 × 15) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1403— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1403-1408 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1710-1715 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2010-2015 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2426-2431 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2784-2789 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3138-3143 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3480-3485 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4207-4212 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4997-5002 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5428-5433 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:798-803 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1242-1247 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1486-1491 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2169-2174 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5779-5784 — before extracting anything, compare `mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs` and `mistralrs-core/src/pipeline/loaders/normal_loaders.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 426 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 14) mistralrs-core/src/models/gemma.rs:585— mistralrs-core/src/models/gemma.rs:585-590 | mistralrs-core/src/models/gemma2.rs:702-707 | mistralrs-core/src/models/glm4.rs:705-710 | mistralrs-core/src/models/granite.rs:2470-2475 | mistralrs-core/src/models/hunyuan_v1_dense.rs:673-678 | mistralrs-core/src/models/mistral.rs:713-718 | mistralrs-core/src/models/phi2.rs:661-666 | mistralrs-core/src/models/phi3.rs:656-661 | mistralrs-core/src/models/qwen2.rs:715-720 | mistralrs-core/src/models/qwen3.rs:691-696 | mistralrs-core/src/models/starcoder2.rs:652-657 | mistralrs-core/src/vision_models/gemma3/text.rs:926-931 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:669-674 | mistralrs-core/src/vision_models/phi3/mod.rs:1493-1498 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 45 separate duplicated blocks between them, totalling at least 611 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 10) mistralrs-core/src/vision_models/gemma4/mtp.rs:726— mistralrs-core/src/vision_models/gemma4/mtp.rs:726-731 | mistralrs-core/src/xlora_models/gemma.rs:271-276 | mistralrs-core/src/xlora_models/gemma2.rs:276-281 | mistralrs-core/src/xlora_models/llama.rs:94-99 | mistralrs-core/src/xlora_models/mistral.rs:261-266 | mistralrs-core/src/xlora_models/mixtral.rs:174-179 | mistralrs-core/src/xlora_models/phi2.rs:264-269 | mistralrs-core/src/xlora_models/phi3.rs:149-154 | mistralrs-core/src/xlora_models/quantized_phi3.rs:187-192 | mistralrs-core/src/xlora_models/starcoder2.rs:248-253 — before extracting anything, compare `mistralrs-core/src/xlora_models/gemma.rs` and `mistralrs-core/src/xlora_models/gemma2.rs` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 491 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 6) mistralrs-core/src/ops.rs:4461— mistralrs-core/src/ops.rs:4461-4466 | mistralrs-core/src/ops.rs:4626-4631 | mistralrs-core/src/ops.rs:5420-5425 | mistralrs-core/src/ops.rs:5693-5698 | mistralrs-core/src/ops.rs:6115-6120 | mistralrs-core/src/ops.rs:6444-6449 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (4–6 lines × 4) mistralrs-core/src/models/granite.rs:1556— mistralrs-core/src/models/granite.rs:1556-1559 | mistralrs-core/src/models/llama.rs:93-98 | mistralrs-core/src/models/smollm3.rs:108-111 | mistralrs-core/src/xlora_models/llama.rs:89-94 — before extracting anything, compare `mistralrs-core/src/models/granite.rs` and `mistralrs-core/src/models/llama.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 244 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (4–6 lines × 3) mistralrs-quant/src/mxfp4/mod.rs:626— mistralrs-quant/src/mxfp4/mod.rs:626-629 | mistralrs-quant/src/mxfp4/mod.rs:732-737 | mistralrs-quant/src/mxfp4/mod.rs:805-810 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (3–5 lines × 14) mistralrs-core/src/models/deepseek2.rs:971— mistralrs-core/src/models/deepseek2.rs:971-975 | mistralrs-core/src/models/deepseek3.rs:1034-1038 | mistralrs-core/src/models/flint.rs:972-976 | mistralrs-core/src/models/gemma.rs:484-488 | mistralrs-core/src/models/glm4.rs:602-606 | mistralrs-core/src/models/glm4_moe.rs:849-853 | mistralrs-core/src/models/glm4_moe_lite.rs:986-990 | mistralrs-core/src/models/hunyuan_v1_dense.rs:564-568 | mistralrs-core/src/models/hunyuan_v1_moe.rs:1058-1062 | mistralrs-core/src/models/mistral.rs:612-616 | mistralrs-core/src/models/mixtral.rs:550-554 | mistralrs-core/src/models/phi2.rs:561-563 | mistralrs-core/src/models/qwen3.rs:566-570 | mistralrs-core/src/models/qwen3_moe.rs:747-751 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 9) mistralrs-paged-attn/src/cuda/backend/mla.rs:129— mistralrs-paged-attn/src/cuda/backend/mla.rs:129-131 | mistralrs-paged-attn/src/cuda/backend/mla.rs:154-156 | mistralrs-paged-attn/src/cuda/backend/mla.rs:179-181 | mistralrs-paged-attn/src/cuda/backend/mla.rs:440-444 | mistralrs-paged-attn/src/cuda/backend/mla.rs:499-503 | mistralrs-paged-attn/src/cuda/backend/mla.rs:558-562 | mistralrs-paged-attn/src/cuda/backend/mla.rs:764-769 | mistralrs-paged-attn/src/cuda/backend/mla.rs:802-807 | mistralrs-paged-attn/src/cuda/backend/mla.rs:840-845 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (3–5 lines × 5) mistralrs-core/src/gguf/base_model.rs:139— mistralrs-core/src/gguf/base_model.rs:139-143 | mistralrs-core/src/gguf/multimodal_binding_utils.rs:112-116 | mistralrs-core/src/gguf/normal_bindings.rs:899-903 | mistralrs-core/src/gguf/qwen_multimodal_bindings.rs:298-302 | mistralrs-quant/src/gguf/archive.rs:1273-1275 — before extracting anything, compare `mistralrs-core/src/gguf/multimodal_binding_utils.rs` and `mistralrs-core/src/gguf/qwen_multimodal_bindings.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 7) mistralrs-core/src/layers.rs:1176— mistralrs-core/src/layers.rs:1176-1180 | mistralrs-core/src/layers.rs:1203-1205 | mistralrs-core/src/layers.rs:1266-1270 | mistralrs-core/src/layers.rs:1293-1295 | mistralrs-core/src/layers.rs:1365-1370 | mistralrs-core/src/layers.rs:1535-1539 | mistralrs-core/src/layers.rs:1562-1564 — 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.
Duplicated block (2–5 lines × 11) mistralrs-core/src/cuda/dflash_context.rs:302— mistralrs-core/src/cuda/dflash_context.rs:302-303 | mistralrs-core/src/cuda/speculative_rejection.rs:614-615 | mistralrs-core/src/ops.rs:1108-1112 | mistralrs-core/src/ops.rs:1337-1341 | mistralrs-core/src/ops.rs:1585-1586 | mistralrs-core/src/ops.rs:1827-1828 | mistralrs-core/src/ops.rs:4143-4144 | mistralrs-core/src/ops.rs:4324-4325 | mistralrs-core/src/ops.rs:5689-5690 | mistralrs-core/src/ops.rs:6112-6113 | mistralrs-core/src/ops.rs:6441-6442 — there are 11 copies across 3 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 11 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (3–5 lines × 3) mistralrs-core/src/speculative/config.rs:116— mistralrs-core/src/speculative/config.rs:116-118 | mistralrs-core/src/speculative/dflash.rs:2239-2243 | mistralrs-core/src/vision_models/gemma4/mtp.rs:127-131 — 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 (2–5 lines × 13) mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:153— mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:153-154 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:371-372 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:377-378 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:384-385 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:391-392 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:639-640 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:646-647 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:653-654 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:659-660 | mistralrs-paged-attn/src/cuda/backend/gather_kv.rs:172-176 | mistralrs-paged-attn/src/cuda/backend/gather_kv.rs:182-186 | mistralrs-paged-attn/src/cuda/backend/gather_kv.rs:200-201 | mistralrs-paged-attn/src/cuda/backend/gather_kv.rs:206-207 — before extracting anything, compare `mistralrs-paged-attn/src/cuda/backend/flashinfer.rs` and `mistralrs-paged-attn/src/cuda/backend/gather_kv.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 8) mistralrs-core/src/models/deepseek2.rs:691— mistralrs-core/src/models/deepseek2.rs:691-696 | mistralrs-core/src/models/deepseek3.rs:754-759 | mistralrs-core/src/models/flint.rs:671-676 | mistralrs-core/src/models/glm4_moe.rs:591-596 | mistralrs-core/src/models/glm4_moe_lite.rs:700-705 | mistralrs-core/src/models/qwen3_moe.rs:439-444 | mistralrs-core/src/vision_models/llama4/text.rs:626-631 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:178-183 — before extracting anything, compare `mistralrs-core/src/models/deepseek2.rs` and `mistralrs-core/src/models/deepseek3.rs` as WHOLE FILES: this scan already matched 61 separate duplicated blocks between them, totalling at least 1039 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 11) mistralrs-core/src/models/glm4.rs:419— mistralrs-core/src/models/glm4.rs:419-430 | mistralrs-core/src/models/granite.rs:1927-1938 | mistralrs-core/src/models/hunyuan_v1_dense.rs:372-383 | mistralrs-core/src/models/hunyuan_v1_moe.rs:862-873 | mistralrs-core/src/models/llama.rs:325-336 | mistralrs-core/src/models/mistral.rs:394-405 | mistralrs-core/src/models/qwen3.rs:382-393 | mistralrs-core/src/models/qwen3_moe.rs:556-567 | mistralrs-core/src/models/smollm3.rs:341-352 | mistralrs-core/src/vision_models/llama4/text.rs:774-785 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:407-418 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/granite.rs` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 253 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 5) mistralrs-core/src/gguf/gemma3_bindings.rs:171— mistralrs-core/src/gguf/gemma3_bindings.rs:171-192 | mistralrs-core/src/gguf/idefics3_bindings.rs:63-84 | mistralrs-core/src/gguf/lfm2_vl_bindings.rs:98-119 | mistralrs-core/src/gguf/llama4_bindings.rs:221-242 | mistralrs-core/src/gguf/muse_glimmer_bindings.rs:133-154 — before extracting anything, compare `mistralrs-core/src/gguf/gemma3_bindings.rs` and `mistralrs-core/src/gguf/muse_glimmer_bindings.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (2–13 lines × 4) mistralrs-core/src/cuda/speculative_rejection.rs:613— mistralrs-core/src/cuda/speculative_rejection.rs:613-614 | mistralrs-core/src/ops.rs:5675-5688 | mistralrs-core/src/ops.rs:6099-6111 | mistralrs-core/src/ops.rs:6428-6440 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (11 lines × 9) mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:399— mistralrs-core/src/vision_models/gemma3/inputs_processor.rs:399-409 | mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1042-1052 | mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:439-449 | mistralrs-core/src/vision_models/llama4/inputs_processor.rs:409-419 | mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:290-302 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:326-338 | mistralrs-core/src/vision_models/minicpmo/inputs_processor.rs:314-324 | mistralrs-core/src/vision_models/mistral3/inputs_processor.rs:271-281 | mistralrs-core/src/vision_models/phi3/phi3_inputs_processor.rs:299-311 — `mistralrs-core/src/vision_models/gemma3/inputs_processor.rs` and `mistralrs-core/src/vision_models/gemma4/inputs_processor.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 5 separate duplicated blocks between them, totalling at least 76 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 × 24) mistralrs-core/src/embedding_models/qwen3_embedding.rs:251— mistralrs-core/src/embedding_models/qwen3_embedding.rs:251-260 | mistralrs-core/src/models/deepseek2.rs:727-736 | mistralrs-core/src/models/deepseek3.rs:790-799 | mistralrs-core/src/models/glm4.rs:337-346 | mistralrs-core/src/models/glm4_moe.rs:627-636 | mistralrs-core/src/models/glm4_moe_lite.rs:736-745 | mistralrs-core/src/models/gpt_oss.rs:652-662 | mistralrs-core/src/models/hunyuan_v1_dense.rs:311-320 | mistralrs-core/src/models/llama.rs:285-294 | mistralrs-core/src/models/mistral.rs:332-341 | mistralrs-core/src/models/mixtral.rs:341-350 | mistralrs-core/src/models/qwen2.rs:364-373 | mistralrs-core/src/models/qwen3.rs:320-329 | mistralrs-core/src/models/smollm3.rs:301-310 | mistralrs-core/src/vision_models/gemma4/text.rs:987-997 | mistralrs-core/src/vision_models/gemma4/text.rs:1058-1067 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:356-365 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:338-347 | mistralrs-core/src/vision_models/mllama/text.rs:282-291 | mistralrs-core/src/vision_models/mllama/text.rs:641-650 | mistralrs-core/src/xlora_models/llama.rs:359-368 | mistralrs-core/src/xlora_models/mistral.rs:339-348 | mistralrs-core/src/xlora_models/mixtral.rs:466-475 | mistralrs-core/src/xlora_models/phi3.rs:304-313 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/deepseek2.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (3–7 lines × 11) mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:146— mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:146-152 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:364-370 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:375-377 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:382-384 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:389-391 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:632-638 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:644-646 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:651-653 | mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:657-659 | mistralrs-paged-attn/src/cuda/backend/gather_kv.rs:198-200 | mistralrs-paged-attn/src/cuda/backend/gather_kv.rs:204-206 — before extracting anything, compare `mistralrs-paged-attn/src/cuda/backend/flashinfer.rs` and `mistralrs-paged-attn/src/cuda/backend/gather_kv.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (39–41 lines × 2) scripts/production_soak.py:3280— scripts/production_soak.py:3280-3318 | scripts/production_soak.py:4180-4220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/production_soak.py:3280` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22–25 lines × 2) scripts/production_soak.py:2788— scripts/production_soak.py:2788-2812 | scripts/production_soak.py:3407-3428 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/production_soak.py:2788` 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 × 24) examples/server/chat.py:8— examples/server/chat.py:8-28 | examples/server/completion.py:8-28 | examples/server/embedding.py:8-28 | examples/server/gemma3.py:8-28 | examples/server/gemma3n.py:8-28 | examples/server/gpt_oss.py:18-38 | examples/server/idefics2.py:8-28 | examples/server/idefics3.py:8-28 | examples/server/llama4.py:8-28 | examples/server/llama_vision.py:8-28 | examples/server/llava.py:8-28 | examples/server/llava_next.py:8-28 | examples/server/minicpmo_2_6.py:8-28 | examples/server/mistral3.py:8-28 | examples/server/phi3v.py:8-28 | examples/server/phi3v_base64.py:9-29 | examples/server/phi3v_local_img.py:8-28 | examples/server/phi4mm.py:8-28 | examples/server/qwen3.py:8-28 | examples/server/responses.py:18-38 | examples/server/responses_audio.py:8-28 | examples/server/responses_vision.py:8-28 | examples/server/smollm3.py:8-28 | scripts/bench.py:26-46 — before extracting anything, compare `examples/server/chat.py` and `examples/server/completion.py` as WHOLE FILES: 83% 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 1 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. If that is what happened, the fix is to keep one copy and have the 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, `examples/server/completion.py:39` calls `input` and `examples/server/embedding.py:38` 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 (18–21 lines × 3) scripts/production_soak.py:4710— scripts/production_soak.py:4710-4727 | scripts/production_soak.py:4729-4746 | scripts/production_soak.py:4837-4857 — 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 `scripts/production_soak.py:4837` it does not close everything it opens, so those 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 × 3) scripts/production_soak.py:2686— scripts/production_soak.py:2686-2691 | scripts/production_soak.py:9033-9040 | scripts/production_soak.py:11311-11316 — 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.
Duplicated block (14 lines × 2 locations) mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:536— mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:536 · mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:586 — both copies are in the same file, so extract the block into 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 locations) mistralrs-cli/webui/src/lib/components/AssistantMessage.svelte:22— mistralrs-cli/webui/src/lib/components/AssistantMessage.svelte:22 · mistralrs-cli/webui/src/lib/components/UserMessage.svelte:56 — 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 (7 lines × 2 locations) mistralrs-cli/webui/src/lib/services/api.ts:22— mistralrs-cli/webui/src/lib/services/api.ts:22 · mistralrs-cli/webui/src/lib/services/api.ts:32 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Complex function streamChatCompletion (cyclomatic 42, cognitive 86) mistralrs-cli/webui/src/lib/services/streaming.ts:21— streamChatCompletion has cyclomatic complexity 42 and cognitive complexity 86; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function generateAssistant (cyclomatic 20, cognitive 32) mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:177— generateAssistant has cyclomatic complexity 20 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function editMessage (cyclomatic 18, cognitive 30) mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:493— editMessage has cyclomatic complexity 18 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function handleSend (cyclomatic 16, cognitive 22) mistralrs-cli/webui/src/lib/components/ChatInput.svelte:27— handleSend has cyclomatic complexity 16 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function onToolCallProgress (cyclomatic 15, cognitive 31) mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:285— onToolCallProgress has cyclomatic complexity 15 and cognitive complexity 31; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function finalizeStreaming (cyclomatic 13, cognitive 15) mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:419— finalizeStreaming has cyclomatic complexity 13 and cognitive complexity 15; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function regenerateAssistant (cyclomatic 12, cognitive 13) mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:563— regenerateAssistant has cyclomatic complexity 12 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files· mistralrs-cli/webui/src/lib/stores/chat.svelte.ts · ×1
mistralrs-cli/webui/src/lib/stores/chat.svelte.ts: 622 lines of code mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:1— mistralrs-cli/webui/src/lib/stores/chat.svelte.ts has 622 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×1
Recursive walk over a caller-supplied document has no depth cap scripts/production_soak.py:14057— `json_compatible` is public and takes `value: Any` from its caller, and it calls itself at line 14057 (`json_compatible`) with a piece of `value` (and at line 14059) — and nowhere in `json_compatible` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `json_compatible` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
X24 · Document value interpolated into markup unescaped· Untrusted text written into markup unescaped · ×1
Untrusted text written into markup unescaped mistralrs-cli/webui/src/lib/utils/markdown.ts:31— `safe` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
Interpolated log message defeats structured logging mistralrs-server-core/src/chat_completion.rs:119— `warn!` at line 119 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/chat_completion.rs:598— `warn!` at line 598 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/metrics.rs:441— `debug!` at line 441 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/metrics.rs:483— `debug!` at line 483 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/metrics.rs:875— `info!` at line 875 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/metrics.rs:879— `info!` at line 879 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/metrics.rs:884— `info!` at line 884 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/metrics.rs:942— `info!` at line 942 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/metrics.rs:966— `info!` at line 966 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/mistralrs_for_server_builder.rs:1055— `info!` at line 1055 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/mistralrs_for_server_builder.rs:1060— `info!` at line 1060 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/mistralrs_for_server_builder.rs:1137— `info!` at line 1137 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/mistralrs_for_server_builder.rs:1291— `info!` at line 1291 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/mistralrs_for_server_builder.rs:1296— `info!` at line 1296 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/mistralrs_for_server_builder.rs:1312— `info!` at line 1312 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/mistralrs_for_server_builder.rs:1316— `info!` at line 1316 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/mistralrs_for_server_builder.rs:1318— `info!` at line 1318 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/mistralrs_for_server_builder.rs:1402— `debug!` at line 1402 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/mistralrs_for_server_builder.rs:1411— `debug!` at line 1411 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/openai.rs:1101— `warn!` at line 1101 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-server-core/src/streaming.rs:188— `warn!` at line 188 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-sandbox/src/linux/cgroups.rs:28— `debug!` at line 28 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-sandbox/src/linux/cgroups.rs:34— `debug!` at line 34 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-sandbox/src/linux/cgroups.rs:37— `debug!` at line 37 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging mistralrs-sandbox/src/linux/mod.rs:81— `debug!` at line 81 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Duplicated predicate mistralrs-core/src/flashinfer/mod.rs:536— `!cfg!(feature = "cuda") || !crate::perf_flags::flashinfer_decode_enabled()` appears character-identically in 2 files — mistralrs-core/src/flashinfer/mod.rs, mistralrs-core/src/vision_models/gemma4/text.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 mistralrs-code-exec/src/lib.rs:345— `!effective.rlimits_applied && sandbox.name() != "macos"` appears character-identically in 2 files — mistralrs-code-exec/src/lib.rs, mistralrs-code-exec/src/shell.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 mistralrs-pyo3/src/lib.rs:1511— `!image_urls.is_empty() || !audio_urls.is_empty() || !video_urls.is_empty()` appears character-identically in 2 files — mistralrs-pyo3/src/lib.rs, mistralrs-server-core/src/chat_completion.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 mistralrs-core/src/sampler.rs:778— `!inverse_temperature.is_finite() || inverse_temperature <= 0.0` appears character-identically in 2 files — mistralrs-core/src/sampler.rs, mistralrs-core/src/vision_models/qwen3_5/speculative.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 mistralrs-core/src/paged_attention/windowed_pool.rs:620— `!key_cache.is_contiguous() || !value_cache.is_contiguous()` appears character-identically in 2 files — mistralrs-core/src/paged_attention/windowed_pool.rs, mistralrs-paged-attn/src/cuda/backend/cache.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 mistralrs-core/src/vision_models/qwen3_5/text.rs:1534— `!meta.is_first_prompt_chunk && meta.num_cached_tokens.is_none()` appears character-identically in 2 files — mistralrs-core/src/vision_models/qwen3_5/text.rs, mistralrs-core/src/vision_models/qwen4_exp/text.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 mistralrs-core/src/engine/add_request.rs:902— `!pipeline.get_metadata().no_kv_cache && pipeline.cache().is_hybrid()` appears character-identically in 2 files — mistralrs-core/src/engine/add_request.rs, mistralrs-core/src/engine/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 mistralrs-core/src/pipeline/multimodal.rs:2750— `!self.model.has_speculative_proposer() || self.model.supports_speculative_packed_prefill()` appears character-identically in 2 files — mistralrs-core/src/pipeline/multimodal.rs, mistralrs-core/src/pipeline/normal.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 mistralrs-core/src/vision_models/qwen3_5/config.rs:273— `!self.partial_rotary_factor().is_finite() || self.partial_rotary_factor() <= 0.0 || self.partial_rotary_factor() > 1.0` appears character-identically in 2 files — mistralrs-core/src/vision_models/qwen3_5/config.rs, mistralrs-core/src/vision_models/qwen3_5_moe/config.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 mistralrs-core/src/vision_models/qwen3_5/config.rs:270— `!self.rope_theta().is_finite() || self.rope_theta() <= 0.0` appears character-identically in 2 files — mistralrs-core/src/vision_models/qwen3_5/config.rs, mistralrs-core/src/vision_models/qwen3_5_moe/config.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 mistralrs-core/src/vision_models/idefics3/inputs_processor.rs:373— `!seq.has_images() || seq.multimodal.has_changed_prompt` appears character-identically in 3 files — mistralrs-core/src/vision_models/idefics3/inputs_processor.rs, mistralrs-core/src/vision_models/lfm2_vl/inputs_processor.rs, mistralrs-core/src/vision_models/mistral3/inputs_processor.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 mistralrs-core/src/models/qwen3_next.rs:660— `!x.device().same_device(cache.conv_state.device()) || !x.device().same_device(cache.recurrent_state.device())` appears character-identically in 2 files — mistralrs-core/src/models/qwen3_next.rs, mistralrs-core/src/vision_models/qwen3_5/packed_gdn.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 mistralrs-core/src/embedding_models/qwen3_embedding.rs:28— `$cfg.sliding_window.is_some() && $cfg.use_sliding_window && $layer_idx >= $cfg.max_window_layers` appears character-identically in 3 files — mistralrs-core/src/embedding_models/qwen3_embedding.rs, mistralrs-core/src/models/qwen3.rs, mistralrs-core/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 mistralrs-quant/src/blockwise_fp8/mma.rs:197— `activation.dtype() != DType::F8E4M3 || activation_scales.dtype() != DType::F32` appears character-identically in 2 files — mistralrs-quant/src/blockwise_fp8/mma.rs, mistralrs-quant/src/blockwise_fp8/ops.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 mistralrs-core/src/model_loader.rs:318— `args.hf_config_overrides.is_some() && !supports_hf_config_overrides` appears character-identically in 2 files — mistralrs-core/src/model_loader.rs, mistralrs-core/src/toml_selector.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 mistralrs-core/src/model_loader.rs:328— `args.max_model_len.is_some() && !supports_max_model_len` appears character-identically in 2 files — mistralrs-core/src/model_loader.rs, mistralrs-core/src/toml_selector.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 REDACTED:1155— `args.packed_prefill && args.packed_layout.is_none()` appears character-identically in 2 files — REDACTED, mistralrs-core/src/vision_models/llama4/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 mistralrs-core/src/vision_models/gemma3n/audio.rs:689— `b == batch_size && n == num_query_blocks` appears character-identically in 2 files — mistralrs-core/src/vision_models/gemma3n/audio.rs, mistralrs-core/src/vision_models/gemma4/audio.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 mistralrs-code-exec/src/shell.rs:468— `c.is_ascii_alphanumeric() || c == '-' || c == '_'` appears character-identically in 2 files — mistralrs-code-exec/src/shell.rs, mistralrs-core/src/engine/agentic_loop.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 mistralrs-core/src/models/qwen3_moe.rs:479— `cfg.num_experts > 0 && (layer_idx + 1).is_multiple_of(cfg.decoder_sparse_step)` appears character-identically in 2 files — mistralrs-core/src/models/qwen3_moe.rs, mistralrs-core/src/vision_models/qwen3_vl_moe/text.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 mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:664— `cfg.use_sliding_window && cfg.sliding_window.is_some()` appears character-identically in 2 files — mistralrs-core/src/pipeline/loaders/embedding_loaders.rs, mistralrs-core/src/pipeline/loaders/normal_loaders.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 mistralrs-core/src/vision_models/gemma3n/text.rs:1262— `context_lens.is_empty() || context_lens.len() != seqlen_offsets.len()` appears character-identically in 2 files — mistralrs-core/src/vision_models/gemma3n/text.rs, mistralrs-core/src/vision_models/gemma4/text.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 mistralrs-core/src/vision_models/gemma3/text.rs:609— `ctx.prompt_chunk_attention_policy() == MultimodalAttentionPolicy::NonCausal && q_len > 1` appears character-identically in 2 files — mistralrs-core/src/vision_models/gemma3/text.rs, mistralrs-core/src/vision_models/gemma4/text.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 mistralrs-core/src/engine/agentic_loop.rs:692— `decision.approve && decision.remember_for_session` appears character-identically in 2 files — mistralrs-core/src/engine/agentic_loop.rs, mistralrs-server-core/src/approvals.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 mistralrs-pyo3/src/lib.rs:1103— `device_layers.len() == 1 && device_layers[0].parse::<usize>().is_ok()` appears character-identically in 2 files — mistralrs-pyo3/src/lib.rs, mistralrs-server-core/src/mistralrs_for_server_builder.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.
Orphaned file mistralrs-core/src/vision_models/llava/utils.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 scripts/convert_awq_marlin.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 mistralrs-paged-attn/src/cuda/backend/scale_update.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 mistralrs-core/src/models/hunyuan_rope.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 mistralrs-core/src/tools/parsers/hunyuan.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.
Hand-rolled JSON/XML parsing via regex mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:57— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Rust code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:59— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Rust code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex mistralrs-core/src/tools/parsers/qwen.rs:54— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Rust code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex mistralrs-core/src/tools/parsers/qwen.rs:121— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Rust code already uses a real parser in the same package; use it here too.
Silent fallback default in catch docs/scripts/render_pyi.py:158— `_unparse` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch mistralrs-cli/webui/src/lib/services/streaming.ts:16— `getApiBase` swallows every exception into `return "/"` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
C2 · Access Controls· No named authorization policies · ×1
No named authorization policies — Authorization IS enforced here (by route guards, auth middleware or checks that refuse a caller) — this is NOT a claim that endpoints are unprotected. What's missing is a NAMED rule set: who may do what is encoded inline where it is checked, so the rules can't be listed, reviewed or tested apart from the code that applies them. Recommendation, not a defect.
No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 3 of 18 project(s) overshoot their size bounds, lowering Project Cohesion to 6.7/10. The most over is `mistralrs-core` (326972 LoC, 1383 module-visible types across 68 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.
D28 · Secrets (history)· Rotate the exposed credentials · ×1
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 5 of 646 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (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; 646 of the 753 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: mistralrs-core/src/vision_models/llava/utils.rs, scripts/convert_awq_marlin.py, mistralrs-paged-attn/src/cuda/backend/scale_update.rs, mistralrs-core/src/models/hunyuan_rope.rs, mistralrs-core/src/tools/parsers/hunyuan.rs. Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
README/code drift mistralrs-mcp/README.md:54— mistralrs-mcp/README.md links to `../docs/MCP/README.md`, but `docs/MCP/README.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
Unused export 'uploadVideo' mistralrs-cli/webui/src/lib/services/api.ts:183— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'generateSpeech' · ×1
Unused export 'generateSpeech' mistralrs-cli/webui/src/lib/services/api.ts:189— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused private method 'removeSubtree' · ×1
Unused private method 'removeSubtree' mistralrs-cli/webui/src/lib/stores/chat.svelte.ts:83— Nothing in its class calls or references this private method — no member access, no string key, no decorator, and no test reaches it by name. A private member cannot be called from outside its class, so this is the whole search: remove it, or call it where it was meant to be used.
No app-layer HTTPS enforcement detected — This repository starts an HTTP server and nothing in its Rust source or committed `Rocket.toml` secures the transport: no TLS served (actix-web `bind_rustls`/`bind_openssl`, axum-server `bind_rustls` with a `RustlsConfig`, tonic `ServerTlsConfig`, a `TlsAcceptor`, Rocket's `[default.tls]`), no `Strict-Transport-Security` header, no `X-Forwarded-Proto` read from a TLS-terminating proxy — so its traffic may cross the network in clear text. (−2.0 on this card.) The server: `axum::serve(` (mistralrs-cli/src/commands/config.rs:198).
X2 · Cancellation propagation· Not all async functions that make a request accept an AbortSignal · ×1
Not all async functions that make a request accept an AbortSignal — Only 1/6 async functions that make a cancellable request (fetch, axios, ky, ofetch) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
X5 · Nullable reference types· Strict null checking is not enabled everywhere the repository type-checks · ×1
Strict null checking is not enabled everywhere the repository type-checks — 1/2 of this repository's type-checking configuration(s) turn on strict null checking (`"strict": true`, or `"strictNullChecks": true`). A configuration that states neither is counted as OFF, because off is tsc's own default; a solution-style one whose `"files"` is empty and whose `"references"` point at other projects is in neither number, because it checks no source itself. Where it is off, `string` admits `null` and `undefined`: passing a value that is null compiles silently and throws on the first property access.
Null assertions (`!`) reduce the strict null checking score — ~0.6 `!` null assertions per 1k TypeScript source lines — 1 assertion(s) across the 1637 source line(s) of the 8 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: mistralrs-cli/webui/src/main.ts (1). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
Silent fallback default on Err mistralrs-code-exec/src/lib.rs:148— `resolve_python_prefixes` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Outdated: anyhow — `anyhow` is locked at 1.0.100 but 1.0.104 is the current stable release on crates.io, and it already satisfies the `"1.0.100"` requirement declared in mistralrs-audio/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p anyhow` and commit the updated REDACTED.
Outdated: axum — `axum` is locked at 0.8.8 but 0.8.9 is the current stable release on crates.io, and it already satisfies the `"0.8.8"` requirement declared in mistralrs-cli/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p axum` and commit the updated REDACTED.
Outdated: bytemuck — `bytemuck` is locked at 1.24.0 but 1.25.2 is the current stable release on crates.io, and it already satisfies the `"1.24.0"` requirement declared in mistralrs-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bytemuck` and commit the updated REDACTED.
Outdated: bytemuck_derive — `bytemuck_derive` is locked at 1.10.2 but 1.12.1 is the current stable release on crates.io, and it already satisfies the `"1.10.2"` requirement declared in mistralrs-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bytemuck_derive` and commit the updated REDACTED.
Outdated: chrono — `chrono` is locked at 0.4.43 but 0.4.45 is the current stable release on crates.io, and it already satisfies the `"0.4.43"` requirement declared in mistralrs-cli/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p chrono` and commit the updated REDACTED.
Outdated: clap — `clap` is locked at 4.5.54 but 4.6.7 is the current stable release on crates.io, and it already satisfies the `"4.5.54"` requirement declared in mistralrs-cli/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap` and commit the updated REDACTED.
Outdated: clap_complete — `clap_complete` is locked at 4.5.65 but 4.6.11 is the current stable release on crates.io, and it already satisfies the `"4.5"` requirement declared in mistralrs-cli/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap_complete` and commit the updated REDACTED.
Outdated: ctrlc — `ctrlc` is locked at 3.5.1 but 3.5.2 is the current stable release on crates.io, and it already satisfies the `"3.5.1"` requirement declared in mistralrs-cli/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p ctrlc` and commit the updated REDACTED.
Outdated: dispatch2 — `dispatch2` is locked at 0.3.0 but 0.3.1 is the current stable release on crates.io, and it already satisfies the `"0.3.0"` requirement declared in mistralrs-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p dispatch2` and commit the updated REDACTED.
Outdated: either — `either` is locked at 1.15.0 but 1.19.0 is the current stable release on crates.io, and it already satisfies the `"1.15.0"` requirement declared in mistralrs-cli/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p either` and commit the updated REDACTED.
Outdated: futures — `futures` is locked at 0.3.31 but 0.3.34 is the current stable release on crates.io, and it already satisfies the `"0.3"` requirement declared in mistralrs-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p futures` and commit the updated REDACTED.
Outdated: futures-util — `futures-util` is locked at 0.3.31 but 0.3.34 is the current stable release on crates.io, and it already satisfies the `"0.3.31"` requirement declared in mistralrs-cli/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p futures-util` and commit the updated REDACTED.
Outdated: http — `http` is locked at 1.4.0 but 1.5.0 is the current stable release on crates.io, and it already satisfies the `"1.4.0"` requirement declared in mistralrs-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p http` and commit the updated REDACTED.
Outdated: http-body — `http-body` is locked at 1.0.1 but 1.1.0 is the current stable release on crates.io, and it already satisfies the `"1.0.1"` requirement declared in mistralrs-server-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p http-body` and commit the updated REDACTED.
Outdated: http-body-util — `http-body-util` is locked at 0.1.3 but 0.1.5 is the current stable release on crates.io, and it already satisfies the `"0.1.3"` requirement declared in mistralrs-server-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p http-body-util` and commit the updated REDACTED.
Outdated: image — `image` is locked at 0.25.9 but 0.25.10 is the current stable release on crates.io, and it already satisfies the `"0.25.9"` requirement declared in mistralrs-cli/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p image` and commit the updated REDACTED.
Outdated: indexmap — `indexmap` is locked at 2.13.0 but 2.14.2 is the current stable release on crates.io, and it already satisfies the `"2.13.0"` requirement declared in mistralrs-cli/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p indexmap` and commit the updated REDACTED.
Outdated: indicatif — `indicatif` is locked at 0.18.3 but 0.18.6 is the current stable release on crates.io, and it already satisfies the `"0.18.3"` requirement declared in mistralrs-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p indicatif` and commit the updated REDACTED.
Outdated: interprocess — `interprocess` is locked at 2.2.3 but 2.4.7 is the current stable release on crates.io, and it already satisfies the `"2.2.3"` requirement declared in mistralrs-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p interprocess` and commit the updated REDACTED.
Outdated: landlock — `landlock` is locked at 0.4.4 but 0.4.7 is the current stable release on crates.io, and it already satisfies the `"0.4.4"` requirement declared in mistralrs-sandbox/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p landlock` and commit the updated REDACTED.
Outdated: lazy_static — `lazy_static` is locked at 1.5.0 but 1.5.1 is the current stable release on crates.io, and it already satisfies the `"1.5"` requirement declared in mistralrs-quant/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p lazy_static` and commit the updated REDACTED.
Outdated: libc — `libc` is locked at 0.2.186 but 0.2.191 is the current stable release on crates.io, and it already satisfies the `"0.2.180"` requirement declared in mistralrs-code-exec/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p libc` and commit the updated REDACTED.
Outdated: llguidance — `llguidance` is locked at 1.4.0 but 1.9.1 is the current stable release on crates.io, and it already satisfies the `"1.2.0"` requirement declared in mistralrs-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p llguidance` and commit the updated REDACTED.
Outdated: memmap2 — `memmap2` is locked at 0.9.9 but 0.9.12 is the current stable release on crates.io, and it already satisfies the `"0.9.9"` requirement declared in mistralrs-quant/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p memmap2` and commit the updated REDACTED.
Outdated: ordered-float — `ordered-float` is locked at 5.1.0 but 5.5.1 is the current stable release on crates.io, and it already satisfies the `"5.1.0"` requirement declared in mistralrs-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p ordered-float` and commit the updated REDACTED.
+ 19 more in this group — see findings.md.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a17d47-577f-7085-884a-9ed04d695b74 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 131 · Warnings: 4255 · Recommendations: 108 · Info: 44 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 27-10-2026 @ 12:13 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.