Public report — mistral.rs, published 29 Sep 2026.
Concrete security findings (which rule fired, in which file, on which line; CVE IDs, secret matches,
dependency versions) are REDACTED in this version; ask the repo owner for the full report.
Public
Codebase surveyMeasured under the Code Assurance Index · rubric rubric-2026.09.17 (frozen) · verify this surveyFiledcd_4dd92977d1a2452d9e7823a62cea535a
Filed 29 September 2026, 11:43 UTC
Public
Large · 487,563 LoC · 16 projects · rebuild ~4.2 person-years · weakest lens: Accessibility (63%)
Findings by grade
131 critical4052 serious25 minor47 could not be resolved — could be critical — see Limitations
This survey was produced by
Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
29 September 2026, 11:30 UTC
A measurement, not a certificate. The Code Assurance Index does not certify,
approve or guarantee this codebase; it records a reproducible number and the evidence it was computed from. The
standard is authored by Canine Development, who also build Watchdog — its only implementation today. That is said
here so the number is checked rather than believed.
Grounded in facts. Every number here is computed, not narrated — reproducible, tool-backed, and traceable to a line of code. How to trust this ▸
4183findings with an exact file:lineof 4208 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
60/133dimensions across the health lenses487563 LoC · 16 projects — wide & deep
Preview (pre-1.0). This repo hasn't declared a stable release, so it's judged against a relaxed, pre-production bar.
The system holds a strong overall standing with a score of 66%, indicating a robust foundation that is largely healthy but carries specific, manageable risks. This is a large asset, comprising nearly half a million lines of production code, with a rebuild cost estimated at approximately €610,000. The architecture is exceptionally sound, and event handling is mature, suggesting that the core logic is stable and well-structured. However, the value tied up in this system is partially eroded by operational friction and compliance gaps that threaten delivery speed and legal exposure.
The most significant risk is a velocity tax on every change. Code quality signals suggest that modifications in weaker areas cost 4–9% more effort than in clean code. This acts as a recurring drag on the team’s capacity, costing hundreds of engineer-days annually. While the architecture prevents structural ripples, the lack of cohesion in specific modules means that routine updates become slower and more expensive, directly impacting time-to-market for new features.
A secondary, high-impact risk lies in accessibility. With a score of 63%, this is the weakest lens for such a large asset. The operational and business risk concentrates here, exposing the company to compliance issues and excluding users. Remediation in this area buys the most protection relative to effort. The top-ranked fix involves ensuring every control and button has a programmatic label, a change that is straightforward but critical for usability and legal standing.
What is genuinely good is the architectural integrity and event sourcing maturity. The system is designed to handle change without breaking, and the core data flows are reliable. This stability provides a solid platform for future growth, provided the surface-level defects are addressed. The high confidence in this assessment means the diagnosis is reliable and actionable.
Focus first on enforcing accessibility in the toolchain. Adding linting rules and automated tests for accessibility will pay for itself within two months by reducing the annual drag on engineering capacity. This single action addresses the highest-leverage risk, improves compliance, and reduces the velocity tax, offering the best return on investment for the team’s immediate efforts.
How the score is built — each lens's share of the headlineWidth is the lens's weight in the worst-heaviest fold (the weakest area pulls hardest); colour is that lens's own band. A lens fixes the score in proportion to its width.
No single dominant problem — the weakest areas are close, so progress on any of them moves the score.
Code composition — where the lines go
Tests 100%
New since the last scan (100+)
189 finding(s) are new versus the previous scan (2026-09-13) — surfaced by this scheduled scan itself, no pull request required. Showing the first 100; the full set is in the report.
D22 · Inconsistent tool registration API across Agent and AgentBuilder. Agent uses a single with_tool method with a generic callback type, while AgentBuilder splits this into with_sync_tool, with_async_tool, and register_tool with different signatures and naming conventions.
D22 · Redundant high-level chat methods. Both Model and BlockingModel expose chat() and send_chat_request() which appear to do similar things. The distinction between 'chat' and 'send_chat_request' is unclear, and having both on both types creates confusion about which to use.
D22 · Inconsistent naming for embedding generation. The singular 'generate_embedding' and plural 'generate_embeddings' methods exist alongside their _with_model variants, but the distinction between singular and plural is unclear (single prompt vs batch?). This creates confusion about when to use which method.
D22 · Redundant tool callback registration methods. with_tool_callback and with_tool_callback_and_tool differ only by whether a Tool object is passed, but the distinction is unclear. If the callback implies the tool, the second method is redundant; if not, the naming is confusing.
D22 · Excessive method proliferation for LoRA adapter loading. Four variants exist with different combinations of model_id and policy parameters, creating a combinatorial explosion that is hard to remember and use correctly.
A full-fidelity diff against the previous run's complete recorded findings — line-move tolerant: a finding that only shifted line counts as unchanged, only genuinely new titles/files surface here.
Rebuild cost & value ~ Modeled — €200,000–€1,000,000
0.9× (at 66% quality) — the last 20% of quality is most of the work
Size & shape
Large · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)
This codebase represents roughly ~4.2 person-years of build effort (about ~€610,000 to rebuild). Its weakest lens is Accessibility at 63% — the part of that asset most exposed by the findings below.
How we model this: boilerplate at a scaffolding rate + logic × domain Standard (×1.0) — standard service × a 0.9× quality factor, at €60–95/h; indicative, ±~30% · size measured directly from source · effort from total production LoC as straight-line logic (the tier split is a C#-only syntax walk), a conservative lower bound. Indicative only — most sensitive to the hourly rate and the domain tier (both tunable in config).
Top priorities
The highest-leverage moves; the full ranked list is in the Roadmap below.
1
Resolve the 1 No ADRs found finding(s) in ADR Quality.
The top-ranked fix costs roughly 1–3 engineer-days once. Not doing it costs about 140.3–842.1 engineer-days every year, paid as drag on the ~1,461,058 lines this team changes annually — a bill that arrives whether or not anyone books it. On those figures the fix breaks even in roughly 1–2 months and is free after that. Method, stated so this is not read as a quotation: debt from the ranked task's effort band; interest = annual changed lines (measured, annualised from the 90-day window) ÷ an ASSUMED 150–400 lines per engineer-day × the 4–9% drag implied by the code-quality signals; breaking point = debt ÷ annual interest. A modelled planning range built from measured inputs and one named assumption — not a quotation, a valuation, or a certified figure.
Evidence: D15 churn: 360,261 line(s) changed over a 90-day window ⇒ ~1,461,058/year · D1/D2/D4/D6 code quality: averaging 6.5/10 ⇒ a 4–9% drag on each change · top-ranked remediation: Low effort ⇒ about 1–3 engineer-day(s)
→ Do the top-ranked fix now if this code will still be yours in 2 months.
Value concentrated against a weak lens · Medium · Value at risk
This is a Large asset (~4.2 person-years to rebuild), and its weakest lens is Accessibility at 63%. The operational and business risk on an asset this size concentrates there — that's where remediation buys the most protection.
→ Direct remediation budget at Accessibility first — highest risk-reduction per euro on an asset this size.
Highest-leverage move · Medium · Leverage
Of everything flagged, the best return on effort is: Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label. The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
A velocity tax on every change · Medium · Economics
The code-quality signals (complexity, duplication, cohesion) average 6.5/10, which acts as a tax on every change in the weaker areas: modifications there plausibly cost on the order of 4–9% more than in clean code, and the tax compounds as the codebase grows. (A modelled estimate, not a measured fact.)
Evidence: D1/D2/D4/D6 code quality: averaging 6.5/10 across the code-quality signals actually measured
→ Pay it down where churn is highest — the hotspots — not everywhere; that's where the tax is actually paid.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways — a layering smell or cycle. A clean layered graph has none.
Architecture — module dependency matrix
Rows and columns are the same modules, ordered so that a module only depends on ones above it. A cell means the row depends on the column, and its number is how many type pairs create that dependency. Read one thing: is anything above the diagonal? A mark there is a dependency cycle. (A cycle is all this shows — an unusual but cycle-free dependency sits below the diagonal like any other.)
687 modules, 3514 dependencies. 6 dependency cycles across 153 modules, marked above the diagonal.
Showing the 40 most-connected modules; 647 more are not drawn.
Module dependency matrix. The row depends on the column; the number is how many type pairs create the dependency. A cell above the diagonal is part of a dependency cycle.
mistralrs_quant.safetensors uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_quant.safetensors, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
7→6 mistralrs_quant depends on mistralrs_quant.safetensors✕
Type pairs
2 distinct (type in mistralrs_quant → type in mistralrs_quant.safetensors) references.
mistralrs_quant.uqff uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_quant.uqff, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
9→8 mistralrs_core.diffusion_models.flux.autoencoder depends on mistralrs_quant.uqff✕
Type pairs
7 distinct (type in mistralrs_core.diffusion_models.flux.autoencoder → type in mistralrs_quant.uqff) references.
mistralrs_core.diffusion_models.flux.autoencoder uses mistralrs_quant.uqff. Changing mistralrs_quant.uqff can break mistralrs_core.diffusion_models.flux.autoencoder, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
10→8 mistralrs_core.lora depends on mistralrs_quant.uqff✕
Type pairs
1 distinct (type in mistralrs_core.lora → type in mistralrs_quant.uqff) reference.
mistralrs_core.utils.model_config uses mistralrs_quant.uqff. Changing mistralrs_quant.uqff can break mistralrs_core.utils.model_config, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
11→10 mistralrs_core.utils.model_config depends on mistralrs_core.lora✕
Type pairs
4 distinct (type in mistralrs_core.utils.model_config → type in mistralrs_core.lora) references.
mistralrs_core.paged_attention uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.paged_attention, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
13→11 mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor depends on mistralrs_core.utils.model_config✕
Type pairs
5 distinct (type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor → type in mistralrs_core.utils.model_config) references.
mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
13→24 mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor depends on mistralrs_core.pipelinecycle✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor → type in mistralrs_core.pipeline) reference.
mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor uses mistralrs_core.pipeline. Changing mistralrs_core.pipeline can break mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
14→7 mistralrs_core.pipeline.isq depends on mistralrs_quant✕
Type pairs
3 distinct (type in mistralrs_core.pipeline.isq → type in mistralrs_quant) references.
mistralrs_core.pipeline.isq uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.pipeline.isq, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
15→11 mistralrs_quant.distributed depends on mistralrs_core.utils.model_config✕
Type pairs
1 distinct (type in mistralrs_quant.distributed → type in mistralrs_core.utils.model_config) reference.
mistralrs_quant.distributed uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_quant.distributed, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
16→11 mistralrs_core.attention depends on mistralrs_core.utils.model_config✕
Type pairs
1 distinct (type in mistralrs_core.attention → type in mistralrs_core.utils.model_config) reference.
mistralrs_core.attention uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.attention, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
16→13 mistralrs_core.attention depends on mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor✕
Type pairs
1 distinct (type in mistralrs_core.attention → type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor) reference.
mistralrs_core.attention uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor. Changing mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.attention, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
17→7 mistralrs_core.pipeline.loaders depends on mistralrs_quant✕
Type pairs
3 distinct (type in mistralrs_core.pipeline.loaders → type in mistralrs_quant) references.
mistralrs_core.pipeline.loaders uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.pipeline.loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
17→12 mistralrs_core.pipeline.loaders depends on mistralrs_core.paged_attention✕
Type pairs
2 distinct (type in mistralrs_core.pipeline.loaders → type in mistralrs_core.paged_attention) references.
mistralrs_core.pipeline.loaders uses mistralrs_core.paged_attention. Changing mistralrs_core.paged_attention can break mistralrs_core.pipeline.loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
18→8 mistralrs_core.diffusion_models.clip.text depends on mistralrs_quant.uqff✕
Type pairs
6 distinct (type in mistralrs_core.diffusion_models.clip.text → type in mistralrs_quant.uqff) references.
mistralrs_core.diffusion_models.clip.text uses mistralrs_quant.uqff. Changing mistralrs_quant.uqff can break mistralrs_core.diffusion_models.clip.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
18→11 mistralrs_core.diffusion_models.clip.text depends on mistralrs_core.utils.model_config✕
Type pairs
2 distinct (type in mistralrs_core.diffusion_models.clip.text → type in mistralrs_core.utils.model_config) references.
mistralrs_core.diffusion_models.clip.text uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.diffusion_models.clip.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
18→16 mistralrs_core.diffusion_models.clip.text depends on mistralrs_core.attention✕
Type pairs
3 distinct (type in mistralrs_core.diffusion_models.clip.text → type in mistralrs_core.attention) references.
mistralrs_core.diffusion_models.clip.text uses mistralrs_core.attention. Changing mistralrs_core.attention can break mistralrs_core.diffusion_models.clip.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
19→16 mistralrs_core.kv_cache depends on mistralrs_core.attention✕
Type pairs
1 distinct (type in mistralrs_core.kv_cache → type in mistralrs_core.attention) reference.
mistralrs_core.paged_attention.layers.paged_attention uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.paged_attention.layers.paged_attention, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
20→13 mistralrs_core.paged_attention.layers.paged_attention depends on mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor✕
Type pairs
6 distinct (type in mistralrs_core.paged_attention.layers.paged_attention → type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor) references.
mistralrs_core.paged_attention.layers.paged_attention uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor. Changing mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.paged_attention.layers.paged_attention, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
20→16 mistralrs_core.paged_attention.layers.paged_attention depends on mistralrs_core.attention✕
Type pairs
9 distinct (type in mistralrs_core.paged_attention.layers.paged_attention → type in mistralrs_core.attention) references.
mistralrs_core.paged_attention.layers.paged_attention uses mistralrs_core.attention. Changing mistralrs_core.attention can break mistralrs_core.paged_attention.layers.paged_attention, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
21→8 mistralrs_core.amoe depends on mistralrs_quant.uqff✕
Type pairs
2 distinct (type in mistralrs_core.amoe → type in mistralrs_quant.uqff) references.
mistralrs_core.amoe uses mistralrs_core.diffusion_models.clip.text. Changing mistralrs_core.diffusion_models.clip.text can break mistralrs_core.amoe, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
22→19 mistralrs_core.kv_cache.full_cache depends on mistralrs_core.kv_cache✕
Type pairs
1 distinct (type in mistralrs_core.kv_cache.full_cache → type in mistralrs_core.kv_cache) reference.
mistralrs_core.kv_cache.full_cache uses mistralrs_core.kv_cache. Changing mistralrs_core.kv_cache can break mistralrs_core.kv_cache.full_cache, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
23→2 mistralrs_core.sequence depends on mistralrs_core.response✕
Type pairs
17 distinct (type in mistralrs_core.sequence → type in mistralrs_core.response) references.
mistralrs_core.sequence uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor. Changing mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.sequence, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
23→19 mistralrs_core.sequence depends on mistralrs_core.kv_cache✕
Type pairs
1 distinct (type in mistralrs_core.sequence → type in mistralrs_core.kv_cache) reference.
mistralrs_core.pipeline uses mistralrs_core.speculative.target. Changing mistralrs_core.speculative.target can break mistralrs_core.pipeline, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
24→7 mistralrs_core.pipeline depends on mistralrs_quant✕
Type pairs
1 distinct (type in mistralrs_core.pipeline → type in mistralrs_quant) reference.
mistralrs_core.pipeline uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.pipeline, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
24→12 mistralrs_core.pipeline depends on mistralrs_core.paged_attention✕
Type pairs
3 distinct (type in mistralrs_core.pipeline → type in mistralrs_core.paged_attention) references.
mistralrs_core.pipeline uses mistralrs_core.paged_attention. Changing mistralrs_core.paged_attention can break mistralrs_core.pipeline, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
24→13 mistralrs_core.pipeline depends on mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor✕
Type pairs
5 distinct (type in mistralrs_core.pipeline → type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor) references.
mistralrs_core.pipeline uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor. Changing mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.pipeline, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
24→17 mistralrs_core.pipeline depends on mistralrs_core.pipeline.loaders✕
Type pairs
1 distinct (type in mistralrs_core.pipeline → type in mistralrs_core.pipeline.loaders) reference.
mistralrs_core.pipeline uses mistralrs_core.pipeline.loaders. Changing mistralrs_core.pipeline.loaders can break mistralrs_core.pipeline, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
24→21 mistralrs_core.pipeline depends on mistralrs_core.amoe✕
Type pairs
2 distinct (type in mistralrs_core.pipeline → type in mistralrs_core.amoe) references.
mistralrs_core.pipeline uses mistralrs_core.kv_cache.full_cache. Changing mistralrs_core.kv_cache.full_cache can break mistralrs_core.pipeline, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
24→23 mistralrs_core.pipeline depends on mistralrs_core.sequence✕
Type pairs
1 distinct (type in mistralrs_core.pipeline → type in mistralrs_core.sequence) reference.
mistralrs_core.xlora_models uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor. Changing mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.xlora_models, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
25→22 mistralrs_core.xlora_models depends on mistralrs_core.kv_cache.full_cache✕
Type pairs
1 distinct (type in mistralrs_core.xlora_models → type in mistralrs_core.kv_cache.full_cache) reference.
mistralrs_core.xlora_models uses mistralrs_core.kv_cache.full_cache. Changing mistralrs_core.kv_cache.full_cache can break mistralrs_core.xlora_models, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
26→2 mistralrs_core.engine depends on mistralrs_core.response✕
Type pairs
1 distinct (type in mistralrs_core.engine → type in mistralrs_core.response) reference.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.paged_attention.config. Changing mistralrs_core.paged_attention.config can break mistralrs_core.pipeline.loaders.normal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
27→3 mistralrs_core.pipeline.loaders.normal_loaders depends on mistralrs_core.speculative.target✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.loaders.normal_loaders → type in mistralrs_core.speculative.target) reference.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.speculative.target. Changing mistralrs_core.speculative.target can break mistralrs_core.pipeline.loaders.normal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
27→8 mistralrs_core.pipeline.loaders.normal_loaders depends on mistralrs_quant.uqff✕
Type pairs
27 distinct (type in mistralrs_core.pipeline.loaders.normal_loaders → type in mistralrs_quant.uqff) references. 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. Changing mistralrs_quant.uqff can break mistralrs_core.pipeline.loaders.normal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
27→10 mistralrs_core.pipeline.loaders.normal_loaders depends on mistralrs_core.lora✕
Type pairs
27 distinct (type in mistralrs_core.pipeline.loaders.normal_loaders → type in mistralrs_core.lora) references. 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. Changing mistralrs_core.lora can break mistralrs_core.pipeline.loaders.normal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
27→11 mistralrs_core.pipeline.loaders.normal_loaders depends on mistralrs_core.utils.model_config✕
Type pairs
2 distinct (type in mistralrs_core.pipeline.loaders.normal_loaders → type in mistralrs_core.utils.model_config) references.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.pipeline.loaders.normal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
27→12 mistralrs_core.pipeline.loaders.normal_loaders depends on mistralrs_core.paged_attention✕
Type pairs
27 distinct (type in mistralrs_core.pipeline.loaders.normal_loaders → type in mistralrs_core.paged_attention) references. 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. Changing mistralrs_core.paged_attention can break mistralrs_core.pipeline.loaders.normal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
27→13 mistralrs_core.pipeline.loaders.normal_loaders depends on mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.loaders.normal_loaders → type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor) reference.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor. Changing mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.pipeline.loaders.normal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
27→14 mistralrs_core.pipeline.loaders.normal_loaders depends on mistralrs_core.pipeline.isq✕
Type pairs
28 distinct (type in mistralrs_core.pipeline.loaders.normal_loaders → type in mistralrs_core.pipeline.isq) references. 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. Changing mistralrs_core.pipeline.isq can break mistralrs_core.pipeline.loaders.normal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
27→17 mistralrs_core.pipeline.loaders.normal_loaders depends on mistralrs_core.pipeline.loaders✕
Type pairs
53 distinct (type in mistralrs_core.pipeline.loaders.normal_loaders → type in mistralrs_core.pipeline.loaders) references. 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. Changing mistralrs_core.pipeline.loaders can break mistralrs_core.pipeline.loaders.normal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
27→21 mistralrs_core.pipeline.loaders.normal_loaders depends on mistralrs_core.amoe✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.loaders.normal_loaders → type in mistralrs_core.amoe) reference.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.amoe. Changing mistralrs_core.amoe can break mistralrs_core.pipeline.loaders.normal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
27→22 mistralrs_core.pipeline.loaders.normal_loaders depends on mistralrs_core.kv_cache.full_cache✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.loaders.normal_loaders → type in mistralrs_core.kv_cache.full_cache) reference.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.kv_cache.full_cache. Changing mistralrs_core.kv_cache.full_cache can break mistralrs_core.pipeline.loaders.normal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
27→24 mistralrs_core.pipeline.loaders.normal_loaders depends on mistralrs_core.pipeline✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.loaders.normal_loaders → type in mistralrs_core.pipeline) reference.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.pipeline. Changing mistralrs_core.pipeline can break mistralrs_core.pipeline.loaders.normal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
27→25 mistralrs_core.pipeline.loaders.normal_loaders depends on mistralrs_core.xlora_models✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.loaders.normal_loaders → type in mistralrs_core.xlora_models) reference.
mistralrs_core.pipeline.loaders.normal_loaders uses mistralrs_core.xlora_models. Changing mistralrs_core.xlora_models can break mistralrs_core.pipeline.loaders.normal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
28→4 mistralrs_core depends on mistralrs_mcp.tools✕
Type pairs
2 distinct (type in mistralrs_core → type in mistralrs_mcp.tools) references.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.paged_attention.config. Changing mistralrs_core.paged_attention.config can break mistralrs_core.pipeline.loaders.multimodal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
29→3 mistralrs_core.pipeline.loaders.multimodal_loaders depends on mistralrs_core.speculative.target✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.loaders.multimodal_loaders → type in mistralrs_core.speculative.target) reference.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.speculative.target. Changing mistralrs_core.speculative.target can break mistralrs_core.pipeline.loaders.multimodal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
29→8 mistralrs_core.pipeline.loaders.multimodal_loaders depends on mistralrs_quant.uqff✕
Type pairs
25 distinct (type in mistralrs_core.pipeline.loaders.multimodal_loaders → type in mistralrs_quant.uqff) references.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_quant.uqff. Changing mistralrs_quant.uqff can break mistralrs_core.pipeline.loaders.multimodal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
29→11 mistralrs_core.pipeline.loaders.multimodal_loaders depends on mistralrs_core.utils.model_config✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.loaders.multimodal_loaders → type in mistralrs_core.utils.model_config) reference.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.pipeline.loaders.multimodal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
29→12 mistralrs_core.pipeline.loaders.multimodal_loaders depends on mistralrs_core.paged_attention✕
Type pairs
25 distinct (type in mistralrs_core.pipeline.loaders.multimodal_loaders → type in mistralrs_core.paged_attention) references.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.paged_attention. Changing mistralrs_core.paged_attention can break mistralrs_core.pipeline.loaders.multimodal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
29→14 mistralrs_core.pipeline.loaders.multimodal_loaders depends on mistralrs_core.pipeline.isq✕
Type pairs
26 distinct (type in mistralrs_core.pipeline.loaders.multimodal_loaders → type in mistralrs_core.pipeline.isq) references. 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. Changing mistralrs_core.pipeline.isq can break mistralrs_core.pipeline.loaders.multimodal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
29→17 mistralrs_core.pipeline.loaders.multimodal_loaders depends on mistralrs_core.pipeline.loaders✕
Type pairs
49 distinct (type in mistralrs_core.pipeline.loaders.multimodal_loaders → type in mistralrs_core.pipeline.loaders) references. 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. Changing mistralrs_core.pipeline.loaders can break mistralrs_core.pipeline.loaders.multimodal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
29→18 mistralrs_core.pipeline.loaders.multimodal_loaders depends on mistralrs_core.diffusion_models.clip.text✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.loaders.multimodal_loaders → type in mistralrs_core.diffusion_models.clip.text) reference.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.diffusion_models.clip.text. Changing mistralrs_core.diffusion_models.clip.text can break mistralrs_core.pipeline.loaders.multimodal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
29→21 mistralrs_core.pipeline.loaders.multimodal_loaders depends on mistralrs_core.amoe✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.loaders.multimodal_loaders → type in mistralrs_core.amoe) reference.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.amoe. Changing mistralrs_core.amoe can break mistralrs_core.pipeline.loaders.multimodal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
29→22 mistralrs_core.pipeline.loaders.multimodal_loaders depends on mistralrs_core.kv_cache.full_cache✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.loaders.multimodal_loaders → type in mistralrs_core.kv_cache.full_cache) reference.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.kv_cache.full_cache. Changing mistralrs_core.kv_cache.full_cache can break mistralrs_core.pipeline.loaders.multimodal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
29→24 mistralrs_core.pipeline.loaders.multimodal_loaders depends on mistralrs_core.pipeline✕
Type pairs
23 distinct (type in mistralrs_core.pipeline.loaders.multimodal_loaders → type in mistralrs_core.pipeline) references.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.pipeline. Changing mistralrs_core.pipeline can break mistralrs_core.pipeline.loaders.multimodal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
29→27 mistralrs_core.pipeline.loaders.multimodal_loaders depends on mistralrs_core.pipeline.loaders.normal_loaders✕
Type pairs
25 distinct (type in mistralrs_core.pipeline.loaders.multimodal_loaders → type in mistralrs_core.pipeline.loaders.normal_loaders) references.
mistralrs_core.pipeline.loaders.multimodal_loaders uses mistralrs_core.pipeline.loaders.normal_loaders. Changing mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.pipeline.loaders.multimodal_loaders, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
30→3 mistralrs_core.pipeline.multimodal depends on mistralrs_core.speculative.target✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.multimodal → type in mistralrs_core.speculative.target) reference.
mistralrs_core.pipeline.multimodal uses mistralrs_core.speculative.target. Changing mistralrs_core.speculative.target can break mistralrs_core.pipeline.multimodal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
30→7 mistralrs_core.pipeline.multimodal depends on mistralrs_quant✕
Type pairs
2 distinct (type in mistralrs_core.pipeline.multimodal → type in mistralrs_quant) references.
mistralrs_core.pipeline.multimodal uses mistralrs_quant.uqff. Changing mistralrs_quant.uqff can break mistralrs_core.pipeline.multimodal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
30→11 mistralrs_core.pipeline.multimodal depends on mistralrs_core.utils.model_config✕
Type pairs
2 distinct (type in mistralrs_core.pipeline.multimodal → type in mistralrs_core.utils.model_config) references.
mistralrs_core.pipeline.multimodal uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.pipeline.multimodal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
30→12 mistralrs_core.pipeline.multimodal depends on mistralrs_core.paged_attention✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.multimodal → type in mistralrs_core.paged_attention) reference.
mistralrs_core.pipeline.multimodal uses mistralrs_core.paged_attention. Changing mistralrs_core.paged_attention can break mistralrs_core.pipeline.multimodal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
30→13 mistralrs_core.pipeline.multimodal depends on mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor✕
Type pairs
4 distinct (type in mistralrs_core.pipeline.multimodal → type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor) references.
mistralrs_core.pipeline.multimodal uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor. Changing mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.pipeline.multimodal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
30→14 mistralrs_core.pipeline.multimodal depends on mistralrs_core.pipeline.isq✕
Type pairs
2 distinct (type in mistralrs_core.pipeline.multimodal → type in mistralrs_core.pipeline.isq) references.
mistralrs_core.pipeline.multimodal uses mistralrs_core.pipeline.isq. Changing mistralrs_core.pipeline.isq can break mistralrs_core.pipeline.multimodal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
30→17 mistralrs_core.pipeline.multimodal depends on mistralrs_core.pipeline.loaders✕
Type pairs
3 distinct (type in mistralrs_core.pipeline.multimodal → type in mistralrs_core.pipeline.loaders) references.
mistralrs_core.pipeline.multimodal uses mistralrs_core.pipeline.loaders. Changing mistralrs_core.pipeline.loaders can break mistralrs_core.pipeline.multimodal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
30→21 mistralrs_core.pipeline.multimodal depends on mistralrs_core.amoe✕
Type pairs
2 distinct (type in mistralrs_core.pipeline.multimodal → type in mistralrs_core.amoe) references.
mistralrs_core.pipeline.multimodal uses mistralrs_core.amoe. Changing mistralrs_core.amoe can break mistralrs_core.pipeline.multimodal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
30→22 mistralrs_core.pipeline.multimodal depends on mistralrs_core.kv_cache.full_cache✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.multimodal → type in mistralrs_core.kv_cache.full_cache) reference.
mistralrs_core.pipeline.multimodal uses mistralrs_core.kv_cache.full_cache. Changing mistralrs_core.kv_cache.full_cache can break mistralrs_core.pipeline.multimodal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
30→24 mistralrs_core.pipeline.multimodal depends on mistralrs_core.pipeline✕
Type pairs
14 distinct (type in mistralrs_core.pipeline.multimodal → type in mistralrs_core.pipeline) references.
mistralrs_core.pipeline.multimodal uses mistralrs_core.pipeline. Changing mistralrs_core.pipeline can break mistralrs_core.pipeline.multimodal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
30→29 mistralrs_core.pipeline.multimodal depends on mistralrs_core.pipeline.loaders.multimodal_loaders✕
Type pairs
3 distinct (type in mistralrs_core.pipeline.multimodal → type in mistralrs_core.pipeline.loaders.multimodal_loaders) references.
mistralrs_core.pipeline.multimodal uses mistralrs_core.pipeline.loaders.multimodal_loaders. Changing mistralrs_core.pipeline.loaders.multimodal_loaders can break mistralrs_core.pipeline.multimodal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→1 mistralrs_core.vision_models.idefics2 depends on mistralrs_core.paged_attention.config✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.idefics2 → type in mistralrs_core.paged_attention.config) reference.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.paged_attention.config. Changing mistralrs_core.paged_attention.config can break mistralrs_core.vision_models.idefics2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→3 mistralrs_core.vision_models.idefics2 depends on mistralrs_core.speculative.target✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.idefics2 → type in mistralrs_core.speculative.target) reference.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.speculative.target. Changing mistralrs_core.speculative.target can break mistralrs_core.vision_models.idefics2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→7 mistralrs_core.vision_models.idefics2 depends on mistralrs_quant✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.idefics2 → type in mistralrs_quant) reference.
mistralrs_core.vision_models.idefics2 uses mistralrs_quant.uqff. Changing mistralrs_quant.uqff can break mistralrs_core.vision_models.idefics2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→9 mistralrs_core.vision_models.idefics2 depends on mistralrs_core.diffusion_models.flux.autoencoder✕
Type pairs
6 distinct (type in mistralrs_core.vision_models.idefics2 → type in mistralrs_core.diffusion_models.flux.autoencoder) references.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.diffusion_models.flux.autoencoder. Changing mistralrs_core.diffusion_models.flux.autoencoder can break mistralrs_core.vision_models.idefics2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→11 mistralrs_core.vision_models.idefics2 depends on mistralrs_core.utils.model_config✕
Type pairs
2 distinct (type in mistralrs_core.vision_models.idefics2 → type in mistralrs_core.utils.model_config) references.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.vision_models.idefics2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→12 mistralrs_core.vision_models.idefics2 depends on mistralrs_core.paged_attention✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.idefics2 → type in mistralrs_core.paged_attention) reference.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.paged_attention. Changing mistralrs_core.paged_attention can break mistralrs_core.vision_models.idefics2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→14 mistralrs_core.vision_models.idefics2 depends on mistralrs_core.pipeline.isq✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.idefics2 → type in mistralrs_core.pipeline.isq) reference.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.pipeline.isq. Changing mistralrs_core.pipeline.isq can break mistralrs_core.vision_models.idefics2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→16 mistralrs_core.vision_models.idefics2 depends on mistralrs_core.attention✕
Type pairs
4 distinct (type in mistralrs_core.vision_models.idefics2 → type in mistralrs_core.attention) references.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.attention. Changing mistralrs_core.attention can break mistralrs_core.vision_models.idefics2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→18 mistralrs_core.vision_models.idefics2 depends on mistralrs_core.diffusion_models.clip.text✕
Type pairs
6 distinct (type in mistralrs_core.vision_models.idefics2 → type in mistralrs_core.diffusion_models.clip.text) references.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.diffusion_models.clip.text. Changing mistralrs_core.diffusion_models.clip.text can break mistralrs_core.vision_models.idefics2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→21 mistralrs_core.vision_models.idefics2 depends on mistralrs_core.amoe✕
Type pairs
3 distinct (type in mistralrs_core.vision_models.idefics2 → type in mistralrs_core.amoe) references.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.amoe. Changing mistralrs_core.amoe can break mistralrs_core.vision_models.idefics2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→22 mistralrs_core.vision_models.idefics2 depends on mistralrs_core.kv_cache.full_cache✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.idefics2 → type in mistralrs_core.kv_cache.full_cache) reference.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.kv_cache.full_cache. Changing mistralrs_core.kv_cache.full_cache can break mistralrs_core.vision_models.idefics2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→24 mistralrs_core.vision_models.idefics2 depends on mistralrs_core.pipeline✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.idefics2 → type in mistralrs_core.pipeline) reference.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.pipeline. Changing mistralrs_core.pipeline can break mistralrs_core.vision_models.idefics2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→27 mistralrs_core.vision_models.idefics2 depends on mistralrs_core.pipeline.loaders.normal_loaders✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.idefics2 → type in mistralrs_core.pipeline.loaders.normal_loaders) reference.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.pipeline.loaders.normal_loaders. Changing mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.vision_models.idefics2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→29 mistralrs_core.vision_models.idefics2 depends on mistralrs_core.pipeline.loaders.multimodal_loaders✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.idefics2 → type in mistralrs_core.pipeline.loaders.multimodal_loaders) reference.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.pipeline.loaders.multimodal_loaders. Changing mistralrs_core.pipeline.loaders.multimodal_loaders can break mistralrs_core.vision_models.idefics2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→32 mistralrs_core.vision_models.idefics2 depends on mistralrs_core.layerscycle✕
Type pairs
6 distinct (type in mistralrs_core.vision_models.idefics2 → type in mistralrs_core.layers) references.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.layers. Changing mistralrs_core.layers can break mistralrs_core.vision_models.idefics2, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
31→34 mistralrs_core.vision_models.idefics2 depends on mistralrs_core.embedding_models.embedding_gemmacycle✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.idefics2 → type in mistralrs_core.embedding_models.embedding_gemma) reference.
mistralrs_core.vision_models.idefics2 uses mistralrs_core.embedding_models.embedding_gemma. Changing mistralrs_core.embedding_models.embedding_gemma can break mistralrs_core.vision_models.idefics2, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
32→7 mistralrs_core.layers depends on mistralrs_quant✕
Type pairs
5 distinct (type in mistralrs_core.layers → type in mistralrs_quant) references.
mistralrs_core.layers uses mistralrs_core.diffusion_models.flux.autoencoder. Changing mistralrs_core.diffusion_models.flux.autoencoder can break mistralrs_core.layers, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
32→11 mistralrs_core.layers depends on mistralrs_core.utils.model_config✕
Type pairs
15 distinct (type in mistralrs_core.layers → type in mistralrs_core.utils.model_config) references.
mistralrs_core.layers uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.layers, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
32→15 mistralrs_core.layers depends on mistralrs_quant.distributed✕
Type pairs
1 distinct (type in mistralrs_core.layers → type in mistralrs_quant.distributed) reference.
mistralrs_core.layers uses mistralrs_core.diffusion_models.clip.text. Changing mistralrs_core.diffusion_models.clip.text can break mistralrs_core.layers, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
32→21 mistralrs_core.layers depends on mistralrs_core.amoe✕
Type pairs
2 distinct (type in mistralrs_core.layers → type in mistralrs_core.amoe) references.
mistralrs_core.layers uses mistralrs_core.vision_models.idefics2. Changing mistralrs_core.vision_models.idefics2 can break mistralrs_core.layers, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
32→34 mistralrs_core.layers depends on mistralrs_core.embedding_models.embedding_gemmacycle✕
Type pairs
1 distinct (type in mistralrs_core.layers → type in mistralrs_core.embedding_models.embedding_gemma) reference.
mistralrs_core.layers uses mistralrs_core.embedding_models.embedding_gemma. Changing mistralrs_core.embedding_models.embedding_gemma can break mistralrs_core.layers, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
33→3 mistralrs_core.pipeline.normal depends on mistralrs_core.speculative.target✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.normal → type in mistralrs_core.speculative.target) reference.
mistralrs_core.pipeline.normal uses mistralrs_core.speculative.target. Changing mistralrs_core.speculative.target can break mistralrs_core.pipeline.normal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
33→7 mistralrs_core.pipeline.normal depends on mistralrs_quant✕
Type pairs
2 distinct (type in mistralrs_core.pipeline.normal → type in mistralrs_quant) references.
mistralrs_core.pipeline.normal uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.pipeline.normal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
33→12 mistralrs_core.pipeline.normal depends on mistralrs_core.paged_attention✕
Type pairs
2 distinct (type in mistralrs_core.pipeline.normal → type in mistralrs_core.paged_attention) references.
mistralrs_core.pipeline.normal uses mistralrs_core.paged_attention. Changing mistralrs_core.paged_attention can break mistralrs_core.pipeline.normal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
33→13 mistralrs_core.pipeline.normal depends on mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor✕
Type pairs
3 distinct (type in mistralrs_core.pipeline.normal → type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor) references.
mistralrs_core.pipeline.normal uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor. Changing mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.pipeline.normal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
33→14 mistralrs_core.pipeline.normal depends on mistralrs_core.pipeline.isq✕
Type pairs
2 distinct (type in mistralrs_core.pipeline.normal → type in mistralrs_core.pipeline.isq) references.
mistralrs_core.pipeline.normal uses mistralrs_core.pipeline.isq. Changing mistralrs_core.pipeline.isq can break mistralrs_core.pipeline.normal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
33→17 mistralrs_core.pipeline.normal depends on mistralrs_core.pipeline.loaders✕
Type pairs
3 distinct (type in mistralrs_core.pipeline.normal → type in mistralrs_core.pipeline.loaders) references.
mistralrs_core.pipeline.normal uses mistralrs_core.pipeline.loaders. Changing mistralrs_core.pipeline.loaders can break mistralrs_core.pipeline.normal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
33→21 mistralrs_core.pipeline.normal depends on mistralrs_core.amoe✕
Type pairs
2 distinct (type in mistralrs_core.pipeline.normal → type in mistralrs_core.amoe) references.
mistralrs_core.pipeline.normal uses mistralrs_core.kv_cache.full_cache. Changing mistralrs_core.kv_cache.full_cache can break mistralrs_core.pipeline.normal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
33→24 mistralrs_core.pipeline.normal depends on mistralrs_core.pipeline✕
Type pairs
13 distinct (type in mistralrs_core.pipeline.normal → type in mistralrs_core.pipeline) references.
mistralrs_core.pipeline.normal uses mistralrs_core.pipeline. Changing mistralrs_core.pipeline can break mistralrs_core.pipeline.normal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
33→25 mistralrs_core.pipeline.normal depends on mistralrs_core.xlora_models✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.normal → type in mistralrs_core.xlora_models) reference.
mistralrs_core.pipeline.normal uses mistralrs_core.xlora_models. Changing mistralrs_core.xlora_models can break mistralrs_core.pipeline.normal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
33→27 mistralrs_core.pipeline.normal depends on mistralrs_core.pipeline.loaders.normal_loaders✕
Type pairs
1 distinct (type in mistralrs_core.pipeline.normal → type in mistralrs_core.pipeline.loaders.normal_loaders) reference.
mistralrs_core.pipeline.normal uses mistralrs_core.pipeline.loaders.normal_loaders. Changing mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.pipeline.normal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
33→30 mistralrs_core.pipeline.normal depends on mistralrs_core.pipeline.multimodal✕
Type pairs
2 distinct (type in mistralrs_core.pipeline.normal → type in mistralrs_core.pipeline.multimodal) references.
mistralrs_core.pipeline.normal uses mistralrs_core.pipeline.multimodal. Changing mistralrs_core.pipeline.multimodal can break mistralrs_core.pipeline.normal, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→7 mistralrs_core.embedding_models.embedding_gemma depends on mistralrs_quant✕
Type pairs
1 distinct (type in mistralrs_core.embedding_models.embedding_gemma → type in mistralrs_quant) reference.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_quant. Changing mistralrs_quant can break mistralrs_core.embedding_models.embedding_gemma, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→8 mistralrs_core.embedding_models.embedding_gemma depends on mistralrs_quant.uqff✕
Type pairs
3 distinct (type in mistralrs_core.embedding_models.embedding_gemma → type in mistralrs_quant.uqff) references.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_quant.uqff. Changing mistralrs_quant.uqff can break mistralrs_core.embedding_models.embedding_gemma, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→11 mistralrs_core.embedding_models.embedding_gemma depends on mistralrs_core.utils.model_config✕
Type pairs
1 distinct (type in mistralrs_core.embedding_models.embedding_gemma → type in mistralrs_core.utils.model_config) reference.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.embedding_models.embedding_gemma, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→12 mistralrs_core.embedding_models.embedding_gemma depends on mistralrs_core.paged_attention✕
Type pairs
1 distinct (type in mistralrs_core.embedding_models.embedding_gemma → type in mistralrs_core.paged_attention) reference.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.paged_attention. Changing mistralrs_core.paged_attention can break mistralrs_core.embedding_models.embedding_gemma, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→13 mistralrs_core.embedding_models.embedding_gemma depends on mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor✕
Type pairs
3 distinct (type in mistralrs_core.embedding_models.embedding_gemma → type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor) references.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor. Changing mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.embedding_models.embedding_gemma, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→14 mistralrs_core.embedding_models.embedding_gemma depends on mistralrs_core.pipeline.isq✕
Type pairs
1 distinct (type in mistralrs_core.embedding_models.embedding_gemma → type in mistralrs_core.pipeline.isq) reference.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.pipeline.isq. Changing mistralrs_core.pipeline.isq can break mistralrs_core.embedding_models.embedding_gemma, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→15 mistralrs_core.embedding_models.embedding_gemma depends on mistralrs_quant.distributed✕
Type pairs
2 distinct (type in mistralrs_core.embedding_models.embedding_gemma → type in mistralrs_quant.distributed) references.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_quant.distributed. Changing mistralrs_quant.distributed can break mistralrs_core.embedding_models.embedding_gemma, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→16 mistralrs_core.embedding_models.embedding_gemma depends on mistralrs_core.attention✕
Type pairs
1 distinct (type in mistralrs_core.embedding_models.embedding_gemma → type in mistralrs_core.attention) reference.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.attention. Changing mistralrs_core.attention can break mistralrs_core.embedding_models.embedding_gemma, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→18 mistralrs_core.embedding_models.embedding_gemma depends on mistralrs_core.diffusion_models.clip.text✕
Type pairs
2 distinct (type in mistralrs_core.embedding_models.embedding_gemma → type in mistralrs_core.diffusion_models.clip.text) references.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.diffusion_models.clip.text. Changing mistralrs_core.diffusion_models.clip.text can break mistralrs_core.embedding_models.embedding_gemma, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→21 mistralrs_core.embedding_models.embedding_gemma depends on mistralrs_core.amoe✕
Type pairs
1 distinct (type in mistralrs_core.embedding_models.embedding_gemma → type in mistralrs_core.amoe) reference.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.amoe. Changing mistralrs_core.amoe can break mistralrs_core.embedding_models.embedding_gemma, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→27 mistralrs_core.embedding_models.embedding_gemma depends on mistralrs_core.pipeline.loaders.normal_loaders✕
Type pairs
1 distinct (type in mistralrs_core.embedding_models.embedding_gemma → type in mistralrs_core.pipeline.loaders.normal_loaders) reference.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.pipeline.loaders.normal_loaders. Changing mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.embedding_models.embedding_gemma, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→32 mistralrs_core.embedding_models.embedding_gemma depends on mistralrs_core.layers✕
Type pairs
8 distinct (type in mistralrs_core.embedding_models.embedding_gemma → type in mistralrs_core.layers) references.
mistralrs_core.embedding_models.embedding_gemma uses mistralrs_core.layers. Changing mistralrs_core.layers can break mistralrs_core.embedding_models.embedding_gemma, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→1 mistralrs_core.models.deepseek2 depends on mistralrs_core.paged_attention.config✕
Type pairs
1 distinct (type in mistralrs_core.models.deepseek2 → type in mistralrs_core.paged_attention.config) reference.
mistralrs_core.models.deepseek2 uses mistralrs_core.paged_attention.config. Changing mistralrs_core.paged_attention.config can break mistralrs_core.models.deepseek2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→3 mistralrs_core.models.deepseek2 depends on mistralrs_core.speculative.target✕
Type pairs
1 distinct (type in mistralrs_core.models.deepseek2 → type in mistralrs_core.speculative.target) reference.
mistralrs_core.models.deepseek2 uses mistralrs_core.speculative.target. Changing mistralrs_core.speculative.target can break mistralrs_core.models.deepseek2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→7 mistralrs_core.models.deepseek2 depends on mistralrs_quant✕
Type pairs
1 distinct (type in mistralrs_core.models.deepseek2 → type in mistralrs_quant) reference.
mistralrs_core.models.deepseek2 uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.models.deepseek2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→12 mistralrs_core.models.deepseek2 depends on mistralrs_core.paged_attention✕
Type pairs
1 distinct (type in mistralrs_core.models.deepseek2 → type in mistralrs_core.paged_attention) reference.
mistralrs_core.models.deepseek2 uses mistralrs_core.paged_attention. Changing mistralrs_core.paged_attention can break mistralrs_core.models.deepseek2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→13 mistralrs_core.models.deepseek2 depends on mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor✕
Type pairs
1 distinct (type in mistralrs_core.models.deepseek2 → type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor) reference.
mistralrs_core.models.deepseek2 uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor. Changing mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.models.deepseek2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→14 mistralrs_core.models.deepseek2 depends on mistralrs_core.pipeline.isq✕
Type pairs
1 distinct (type in mistralrs_core.models.deepseek2 → type in mistralrs_core.pipeline.isq) reference.
mistralrs_core.models.deepseek2 uses mistralrs_core.pipeline.isq. Changing mistralrs_core.pipeline.isq can break mistralrs_core.models.deepseek2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→15 mistralrs_core.models.deepseek2 depends on mistralrs_quant.distributed✕
Type pairs
3 distinct (type in mistralrs_core.models.deepseek2 → type in mistralrs_quant.distributed) references.
mistralrs_core.models.deepseek2 uses mistralrs_quant.distributed. Changing mistralrs_quant.distributed can break mistralrs_core.models.deepseek2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→16 mistralrs_core.models.deepseek2 depends on mistralrs_core.attention✕
Type pairs
3 distinct (type in mistralrs_core.models.deepseek2 → type in mistralrs_core.attention) references.
mistralrs_core.models.deepseek2 uses mistralrs_core.attention. Changing mistralrs_core.attention can break mistralrs_core.models.deepseek2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→18 mistralrs_core.models.deepseek2 depends on mistralrs_core.diffusion_models.clip.text✕
Type pairs
2 distinct (type in mistralrs_core.models.deepseek2 → type in mistralrs_core.diffusion_models.clip.text) references.
mistralrs_core.models.deepseek2 uses mistralrs_core.diffusion_models.clip.text. Changing mistralrs_core.diffusion_models.clip.text can break mistralrs_core.models.deepseek2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→19 mistralrs_core.models.deepseek2 depends on mistralrs_core.kv_cache✕
Type pairs
2 distinct (type in mistralrs_core.models.deepseek2 → type in mistralrs_core.kv_cache) references.
mistralrs_core.models.deepseek2 uses mistralrs_core.kv_cache. Changing mistralrs_core.kv_cache can break mistralrs_core.models.deepseek2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→20 mistralrs_core.models.deepseek2 depends on mistralrs_core.paged_attention.layers.paged_attention✕
Type pairs
2 distinct (type in mistralrs_core.models.deepseek2 → type in mistralrs_core.paged_attention.layers.paged_attention) references.
mistralrs_core.models.deepseek2 uses mistralrs_core.paged_attention.layers.paged_attention. Changing mistralrs_core.paged_attention.layers.paged_attention can break mistralrs_core.models.deepseek2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→21 mistralrs_core.models.deepseek2 depends on mistralrs_core.amoe✕
Type pairs
2 distinct (type in mistralrs_core.models.deepseek2 → type in mistralrs_core.amoe) references.
mistralrs_core.models.deepseek2 uses mistralrs_core.kv_cache.full_cache. Changing mistralrs_core.kv_cache.full_cache can break mistralrs_core.models.deepseek2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→24 mistralrs_core.models.deepseek2 depends on mistralrs_core.pipeline✕
Type pairs
3 distinct (type in mistralrs_core.models.deepseek2 → type in mistralrs_core.pipeline) references.
mistralrs_core.models.deepseek2 uses mistralrs_core.pipeline. Changing mistralrs_core.pipeline can break mistralrs_core.models.deepseek2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→25 mistralrs_core.models.deepseek2 depends on mistralrs_core.xlora_models✕
Type pairs
1 distinct (type in mistralrs_core.models.deepseek2 → type in mistralrs_core.xlora_models) reference.
mistralrs_core.models.deepseek2 uses mistralrs_core.xlora_models. Changing mistralrs_core.xlora_models can break mistralrs_core.models.deepseek2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→27 mistralrs_core.models.deepseek2 depends on mistralrs_core.pipeline.loaders.normal_loaders✕
Type pairs
2 distinct (type in mistralrs_core.models.deepseek2 → type in mistralrs_core.pipeline.loaders.normal_loaders) references.
mistralrs_core.models.deepseek2 uses mistralrs_core.pipeline.loaders.normal_loaders. Changing mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.models.deepseek2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→32 mistralrs_core.models.deepseek2 depends on mistralrs_core.layers✕
Type pairs
6 distinct (type in mistralrs_core.models.deepseek2 → type in mistralrs_core.layers) references.
mistralrs_core.models.deepseek2 uses mistralrs_core.embedding_models.embedding_gemma. Changing mistralrs_core.embedding_models.embedding_gemma can break mistralrs_core.models.deepseek2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
36→1 mistralrs_core.models.gpt_oss depends on mistralrs_core.paged_attention.config✕
Type pairs
1 distinct (type in mistralrs_core.models.gpt_oss → type in mistralrs_core.paged_attention.config) reference.
mistralrs_core.models.gpt_oss uses mistralrs_core.paged_attention.config. Changing mistralrs_core.paged_attention.config can break mistralrs_core.models.gpt_oss, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
36→3 mistralrs_core.models.gpt_oss depends on mistralrs_core.speculative.target✕
Type pairs
1 distinct (type in mistralrs_core.models.gpt_oss → type in mistralrs_core.speculative.target) reference.
mistralrs_core.models.gpt_oss uses mistralrs_core.speculative.target. Changing mistralrs_core.speculative.target can break mistralrs_core.models.gpt_oss, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
36→7 mistralrs_core.models.gpt_oss depends on mistralrs_quant✕
Type pairs
1 distinct (type in mistralrs_core.models.gpt_oss → type in mistralrs_quant) reference.
mistralrs_core.models.gpt_oss uses mistralrs_core.diffusion_models.flux.autoencoder. Changing mistralrs_core.diffusion_models.flux.autoencoder can break mistralrs_core.models.gpt_oss, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
36→11 mistralrs_core.models.gpt_oss depends on mistralrs_core.utils.model_config✕
Type pairs
3 distinct (type in mistralrs_core.models.gpt_oss → type in mistralrs_core.utils.model_config) references.
mistralrs_core.models.gpt_oss uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.models.gpt_oss, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
36→12 mistralrs_core.models.gpt_oss depends on mistralrs_core.paged_attention✕
Type pairs
1 distinct (type in mistralrs_core.models.gpt_oss → type in mistralrs_core.paged_attention) reference.
mistralrs_core.models.gpt_oss uses mistralrs_core.paged_attention. Changing mistralrs_core.paged_attention can break mistralrs_core.models.gpt_oss, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
36→13 mistralrs_core.models.gpt_oss depends on mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor✕
Type pairs
1 distinct (type in mistralrs_core.models.gpt_oss → type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor) reference.
mistralrs_core.models.gpt_oss uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor. Changing mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.models.gpt_oss, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
36→14 mistralrs_core.models.gpt_oss depends on mistralrs_core.pipeline.isq✕
Type pairs
1 distinct (type in mistralrs_core.models.gpt_oss → type in mistralrs_core.pipeline.isq) reference.
mistralrs_core.models.gpt_oss uses mistralrs_core.pipeline.isq. Changing mistralrs_core.pipeline.isq can break mistralrs_core.models.gpt_oss, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
36→15 mistralrs_core.models.gpt_oss depends on mistralrs_quant.distributed✕
Type pairs
2 distinct (type in mistralrs_core.models.gpt_oss → type in mistralrs_quant.distributed) references.
mistralrs_core.models.gpt_oss uses mistralrs_quant.distributed. Changing mistralrs_quant.distributed can break mistralrs_core.models.gpt_oss, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
36→16 mistralrs_core.models.gpt_oss depends on mistralrs_core.attention✕
Type pairs
3 distinct (type in mistralrs_core.models.gpt_oss → type in mistralrs_core.attention) references.
mistralrs_core.models.gpt_oss uses mistralrs_core.attention. Changing mistralrs_core.attention can break mistralrs_core.models.gpt_oss, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
36→19 mistralrs_core.models.gpt_oss depends on mistralrs_core.kv_cache✕
Type pairs
2 distinct (type in mistralrs_core.models.gpt_oss → type in mistralrs_core.kv_cache) references.
mistralrs_core.models.gpt_oss uses mistralrs_core.paged_attention.layers.paged_attention. Changing mistralrs_core.paged_attention.layers.paged_attention can break mistralrs_core.models.gpt_oss, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
36→21 mistralrs_core.models.gpt_oss depends on mistralrs_core.amoe✕
Type pairs
1 distinct (type in mistralrs_core.models.gpt_oss → type in mistralrs_core.amoe) reference.
mistralrs_core.models.gpt_oss uses mistralrs_core.kv_cache.full_cache. Changing mistralrs_core.kv_cache.full_cache can break mistralrs_core.models.gpt_oss, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
36→24 mistralrs_core.models.gpt_oss depends on mistralrs_core.pipeline✕
Type pairs
3 distinct (type in mistralrs_core.models.gpt_oss → type in mistralrs_core.pipeline) references.
mistralrs_core.models.gpt_oss uses mistralrs_core.xlora_models. Changing mistralrs_core.xlora_models can break mistralrs_core.models.gpt_oss, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
36→27 mistralrs_core.models.gpt_oss depends on mistralrs_core.pipeline.loaders.normal_loaders✕
Type pairs
2 distinct (type in mistralrs_core.models.gpt_oss → type in mistralrs_core.pipeline.loaders.normal_loaders) references.
mistralrs_core.models.gpt_oss uses mistralrs_core.pipeline.loaders.normal_loaders. Changing mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.models.gpt_oss, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
36→32 mistralrs_core.models.gpt_oss depends on mistralrs_core.layers✕
Type pairs
2 distinct (type in mistralrs_core.models.gpt_oss → type in mistralrs_core.layers) references.
mistralrs_core.models.gpt_oss uses mistralrs_core.embedding_models.embedding_gemma. Changing mistralrs_core.embedding_models.embedding_gemma can break mistralrs_core.models.gpt_oss, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→1 mistralrs_core.models.granite depends on mistralrs_core.paged_attention.config✕
Type pairs
1 distinct (type in mistralrs_core.models.granite → type in mistralrs_core.paged_attention.config) reference.
mistralrs_core.models.granite uses mistralrs_core.paged_attention.config. Changing mistralrs_core.paged_attention.config can break mistralrs_core.models.granite, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→3 mistralrs_core.models.granite depends on mistralrs_core.speculative.target✕
Type pairs
1 distinct (type in mistralrs_core.models.granite → type in mistralrs_core.speculative.target) reference.
mistralrs_core.models.granite uses mistralrs_core.speculative.target. Changing mistralrs_core.speculative.target can break mistralrs_core.models.granite, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→7 mistralrs_core.models.granite depends on mistralrs_quant✕
Type pairs
2 distinct (type in mistralrs_core.models.granite → type in mistralrs_quant) references.
mistralrs_core.models.granite uses mistralrs_core.diffusion_models.flux.autoencoder. Changing mistralrs_core.diffusion_models.flux.autoencoder can break mistralrs_core.models.granite, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→11 mistralrs_core.models.granite depends on mistralrs_core.utils.model_config✕
Type pairs
6 distinct (type in mistralrs_core.models.granite → type in mistralrs_core.utils.model_config) references.
mistralrs_core.models.granite uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.models.granite, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→12 mistralrs_core.models.granite depends on mistralrs_core.paged_attention✕
Type pairs
1 distinct (type in mistralrs_core.models.granite → type in mistralrs_core.paged_attention) reference.
mistralrs_core.models.granite uses mistralrs_core.paged_attention. Changing mistralrs_core.paged_attention can break mistralrs_core.models.granite, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→13 mistralrs_core.models.granite depends on mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor✕
Type pairs
1 distinct (type in mistralrs_core.models.granite → type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor) reference.
mistralrs_core.models.granite uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor. Changing mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.models.granite, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→14 mistralrs_core.models.granite depends on mistralrs_core.pipeline.isq✕
Type pairs
1 distinct (type in mistralrs_core.models.granite → type in mistralrs_core.pipeline.isq) reference.
mistralrs_core.models.granite uses mistralrs_core.pipeline.isq. Changing mistralrs_core.pipeline.isq can break mistralrs_core.models.granite, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→15 mistralrs_core.models.granite depends on mistralrs_quant.distributed✕
Type pairs
4 distinct (type in mistralrs_core.models.granite → type in mistralrs_quant.distributed) references.
mistralrs_core.models.granite uses mistralrs_quant.distributed. Changing mistralrs_quant.distributed can break mistralrs_core.models.granite, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→16 mistralrs_core.models.granite depends on mistralrs_core.attention✕
Type pairs
3 distinct (type in mistralrs_core.models.granite → type in mistralrs_core.attention) references.
mistralrs_core.models.granite uses mistralrs_core.attention. Changing mistralrs_core.attention can break mistralrs_core.models.granite, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→18 mistralrs_core.models.granite depends on mistralrs_core.diffusion_models.clip.text✕
Type pairs
1 distinct (type in mistralrs_core.models.granite → type in mistralrs_core.diffusion_models.clip.text) reference.
mistralrs_core.models.granite uses mistralrs_core.diffusion_models.clip.text. Changing mistralrs_core.diffusion_models.clip.text can break mistralrs_core.models.granite, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→19 mistralrs_core.models.granite depends on mistralrs_core.kv_cache✕
Type pairs
2 distinct (type in mistralrs_core.models.granite → type in mistralrs_core.kv_cache) references.
mistralrs_core.models.granite uses mistralrs_core.paged_attention.layers.paged_attention. Changing mistralrs_core.paged_attention.layers.paged_attention can break mistralrs_core.models.granite, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→21 mistralrs_core.models.granite depends on mistralrs_core.amoe✕
Type pairs
5 distinct (type in mistralrs_core.models.granite → type in mistralrs_core.amoe) references.
mistralrs_core.models.granite uses mistralrs_core.kv_cache.full_cache. Changing mistralrs_core.kv_cache.full_cache can break mistralrs_core.models.granite, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→24 mistralrs_core.models.granite depends on mistralrs_core.pipeline✕
Type pairs
5 distinct (type in mistralrs_core.models.granite → type in mistralrs_core.pipeline) references.
mistralrs_core.models.granite uses mistralrs_core.xlora_models. Changing mistralrs_core.xlora_models can break mistralrs_core.models.granite, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→27 mistralrs_core.models.granite depends on mistralrs_core.pipeline.loaders.normal_loaders✕
Type pairs
2 distinct (type in mistralrs_core.models.granite → type in mistralrs_core.pipeline.loaders.normal_loaders) references.
mistralrs_core.models.granite uses mistralrs_core.pipeline.loaders.normal_loaders. Changing mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.models.granite, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→32 mistralrs_core.models.granite depends on mistralrs_core.layers✕
Type pairs
5 distinct (type in mistralrs_core.models.granite → type in mistralrs_core.layers) references.
mistralrs_core.models.granite uses mistralrs_core.embedding_models.embedding_gemma. Changing mistralrs_core.embedding_models.embedding_gemma can break mistralrs_core.models.granite, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
38→1 mistralrs_core.models.lfm2 depends on mistralrs_core.paged_attention.config✕
Type pairs
1 distinct (type in mistralrs_core.models.lfm2 → type in mistralrs_core.paged_attention.config) reference.
mistralrs_core.models.lfm2 uses mistralrs_core.paged_attention.config. Changing mistralrs_core.paged_attention.config can break mistralrs_core.models.lfm2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
38→3 mistralrs_core.models.lfm2 depends on mistralrs_core.speculative.target✕
Type pairs
1 distinct (type in mistralrs_core.models.lfm2 → type in mistralrs_core.speculative.target) reference.
mistralrs_core.models.lfm2 uses mistralrs_core.speculative.target. Changing mistralrs_core.speculative.target can break mistralrs_core.models.lfm2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
38→7 mistralrs_core.models.lfm2 depends on mistralrs_quant✕
Type pairs
1 distinct (type in mistralrs_core.models.lfm2 → type in mistralrs_quant) reference.
mistralrs_core.models.lfm2 uses mistralrs_core.diffusion_models.flux.autoencoder. Changing mistralrs_core.diffusion_models.flux.autoencoder can break mistralrs_core.models.lfm2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
38→11 mistralrs_core.models.lfm2 depends on mistralrs_core.utils.model_config✕
Type pairs
1 distinct (type in mistralrs_core.models.lfm2 → type in mistralrs_core.utils.model_config) reference.
mistralrs_core.models.lfm2 uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.models.lfm2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
38→12 mistralrs_core.models.lfm2 depends on mistralrs_core.paged_attention✕
Type pairs
1 distinct (type in mistralrs_core.models.lfm2 → type in mistralrs_core.paged_attention) reference.
mistralrs_core.models.lfm2 uses mistralrs_core.paged_attention. Changing mistralrs_core.paged_attention can break mistralrs_core.models.lfm2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
38→13 mistralrs_core.models.lfm2 depends on mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor✕
Type pairs
1 distinct (type in mistralrs_core.models.lfm2 → type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor) reference.
mistralrs_core.models.lfm2 uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor. Changing mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.models.lfm2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
38→14 mistralrs_core.models.lfm2 depends on mistralrs_core.pipeline.isq✕
Type pairs
1 distinct (type in mistralrs_core.models.lfm2 → type in mistralrs_core.pipeline.isq) reference.
mistralrs_core.models.lfm2 uses mistralrs_core.pipeline.isq. Changing mistralrs_core.pipeline.isq can break mistralrs_core.models.lfm2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
38→15 mistralrs_core.models.lfm2 depends on mistralrs_quant.distributed✕
Type pairs
3 distinct (type in mistralrs_core.models.lfm2 → type in mistralrs_quant.distributed) references.
mistralrs_core.models.lfm2 uses mistralrs_quant.distributed. Changing mistralrs_quant.distributed can break mistralrs_core.models.lfm2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
38→16 mistralrs_core.models.lfm2 depends on mistralrs_core.attention✕
Type pairs
3 distinct (type in mistralrs_core.models.lfm2 → type in mistralrs_core.attention) references.
mistralrs_core.models.lfm2 uses mistralrs_core.paged_attention.layers.paged_attention. Changing mistralrs_core.paged_attention.layers.paged_attention can break mistralrs_core.models.lfm2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
38→21 mistralrs_core.models.lfm2 depends on mistralrs_core.amoe✕
Type pairs
1 distinct (type in mistralrs_core.models.lfm2 → type in mistralrs_core.amoe) reference.
mistralrs_core.models.lfm2 uses mistralrs_core.kv_cache.full_cache. Changing mistralrs_core.kv_cache.full_cache can break mistralrs_core.models.lfm2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
38→24 mistralrs_core.models.lfm2 depends on mistralrs_core.pipeline✕
Type pairs
5 distinct (type in mistralrs_core.models.lfm2 → type in mistralrs_core.pipeline) references.
mistralrs_core.models.lfm2 uses mistralrs_core.xlora_models. Changing mistralrs_core.xlora_models can break mistralrs_core.models.lfm2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
38→27 mistralrs_core.models.lfm2 depends on mistralrs_core.pipeline.loaders.normal_loaders✕
Type pairs
2 distinct (type in mistralrs_core.models.lfm2 → type in mistralrs_core.pipeline.loaders.normal_loaders) references.
mistralrs_core.models.lfm2 uses mistralrs_core.pipeline.loaders.normal_loaders. Changing mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.models.lfm2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
38→32 mistralrs_core.models.lfm2 depends on mistralrs_core.layers✕
Type pairs
5 distinct (type in mistralrs_core.models.lfm2 → type in mistralrs_core.layers) references.
mistralrs_core.models.lfm2 uses mistralrs_core.embedding_models.embedding_gemma. Changing mistralrs_core.embedding_models.embedding_gemma can break mistralrs_core.models.lfm2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
38→36 mistralrs_core.models.lfm2 depends on mistralrs_core.models.gpt_oss✕
Type pairs
3 distinct (type in mistralrs_core.models.lfm2 → type in mistralrs_core.models.gpt_oss) references.
mistralrs_core.models.lfm2 uses mistralrs_core.models.gpt_oss. Changing mistralrs_core.models.gpt_oss can break mistralrs_core.models.lfm2, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→1 mistralrs_core.models.qwen3_next depends on mistralrs_core.paged_attention.config✕
Type pairs
1 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.paged_attention.config) reference.
mistralrs_core.models.qwen3_next uses mistralrs_core.paged_attention.config. Changing mistralrs_core.paged_attention.config can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→3 mistralrs_core.models.qwen3_next depends on mistralrs_core.speculative.target✕
Type pairs
1 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.speculative.target) reference.
mistralrs_core.models.qwen3_next uses mistralrs_core.speculative.target. Changing mistralrs_core.speculative.target can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→7 mistralrs_core.models.qwen3_next depends on mistralrs_quant✕
Type pairs
1 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_quant) reference.
mistralrs_core.models.qwen3_next uses mistralrs_core.diffusion_models.flux.autoencoder. Changing mistralrs_core.diffusion_models.flux.autoencoder can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→11 mistralrs_core.models.qwen3_next depends on mistralrs_core.utils.model_config✕
Type pairs
2 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.utils.model_config) references.
mistralrs_core.models.qwen3_next uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→12 mistralrs_core.models.qwen3_next depends on mistralrs_core.paged_attention✕
Type pairs
1 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.paged_attention) reference.
mistralrs_core.models.qwen3_next uses mistralrs_core.paged_attention. Changing mistralrs_core.paged_attention can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→13 mistralrs_core.models.qwen3_next depends on mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor✕
Type pairs
1 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor) reference.
mistralrs_core.models.qwen3_next uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor. Changing mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→14 mistralrs_core.models.qwen3_next depends on mistralrs_core.pipeline.isq✕
Type pairs
1 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.pipeline.isq) reference.
mistralrs_core.models.qwen3_next uses mistralrs_core.pipeline.isq. Changing mistralrs_core.pipeline.isq can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→15 mistralrs_core.models.qwen3_next depends on mistralrs_quant.distributed✕
Type pairs
2 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_quant.distributed) references.
mistralrs_core.models.qwen3_next uses mistralrs_quant.distributed. Changing mistralrs_quant.distributed can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→16 mistralrs_core.models.qwen3_next depends on mistralrs_core.attention✕
Type pairs
3 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.attention) references.
mistralrs_core.models.qwen3_next uses mistralrs_core.attention. Changing mistralrs_core.attention can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→18 mistralrs_core.models.qwen3_next depends on mistralrs_core.diffusion_models.clip.text✕
Type pairs
1 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.diffusion_models.clip.text) reference.
mistralrs_core.models.qwen3_next uses mistralrs_core.diffusion_models.clip.text. Changing mistralrs_core.diffusion_models.clip.text can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→19 mistralrs_core.models.qwen3_next depends on mistralrs_core.kv_cache✕
Type pairs
2 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.kv_cache) references.
mistralrs_core.models.qwen3_next uses mistralrs_core.kv_cache. Changing mistralrs_core.kv_cache can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→20 mistralrs_core.models.qwen3_next depends on mistralrs_core.paged_attention.layers.paged_attention✕
Type pairs
1 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.paged_attention.layers.paged_attention) reference.
mistralrs_core.models.qwen3_next uses mistralrs_core.paged_attention.layers.paged_attention. Changing mistralrs_core.paged_attention.layers.paged_attention can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→21 mistralrs_core.models.qwen3_next depends on mistralrs_core.amoe✕
Type pairs
1 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.amoe) reference.
mistralrs_core.models.qwen3_next uses mistralrs_core.kv_cache.full_cache. Changing mistralrs_core.kv_cache.full_cache can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→24 mistralrs_core.models.qwen3_next depends on mistralrs_core.pipeline✕
Type pairs
4 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.pipeline) references.
mistralrs_core.models.qwen3_next uses mistralrs_core.pipeline. Changing mistralrs_core.pipeline can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→25 mistralrs_core.models.qwen3_next depends on mistralrs_core.xlora_models✕
Type pairs
1 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.xlora_models) reference.
mistralrs_core.models.qwen3_next uses mistralrs_core.xlora_models. Changing mistralrs_core.xlora_models can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→27 mistralrs_core.models.qwen3_next depends on mistralrs_core.pipeline.loaders.normal_loaders✕
Type pairs
2 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.pipeline.loaders.normal_loaders) references.
mistralrs_core.models.qwen3_next uses mistralrs_core.pipeline.loaders.normal_loaders. Changing mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→32 mistralrs_core.models.qwen3_next depends on mistralrs_core.layers✕
Type pairs
4 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.layers) references.
mistralrs_core.models.qwen3_next uses mistralrs_core.layers. Changing mistralrs_core.layers can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→34 mistralrs_core.models.qwen3_next depends on mistralrs_core.embedding_models.embedding_gemma✕
Type pairs
1 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.embedding_models.embedding_gemma) reference.
mistralrs_core.models.qwen3_next uses mistralrs_core.embedding_models.embedding_gemma. Changing mistralrs_core.embedding_models.embedding_gemma can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→36 mistralrs_core.models.qwen3_next depends on mistralrs_core.models.gpt_oss✕
Type pairs
2 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.models.gpt_oss) references.
mistralrs_core.models.qwen3_next uses mistralrs_core.models.gpt_oss. Changing mistralrs_core.models.gpt_oss can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→38 mistralrs_core.models.qwen3_next depends on mistralrs_core.models.lfm2✕
Type pairs
1 distinct (type in mistralrs_core.models.qwen3_next → type in mistralrs_core.models.lfm2) reference.
mistralrs_core.models.qwen3_next uses mistralrs_core.models.lfm2. Changing mistralrs_core.models.lfm2 can break mistralrs_core.models.qwen3_next, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→1 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.paged_attention.config✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.paged_attention.config) reference.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.paged_attention.config. Changing mistralrs_core.paged_attention.config can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→3 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.speculative.target✕
Type pairs
2 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.speculative.target) references.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.speculative.target. Changing mistralrs_core.speculative.target can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→7 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_quant✕
Type pairs
4 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_quant) references.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_quant. Changing mistralrs_quant can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→8 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_quant.uqff✕
Type pairs
3 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_quant.uqff) references.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_quant.uqff. Changing mistralrs_quant.uqff can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→11 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.utils.model_config✕
Type pairs
3 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.utils.model_config) references.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.utils.model_config. Changing mistralrs_core.utils.model_config can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→12 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.paged_attention✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.paged_attention) reference.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.paged_attention. Changing mistralrs_core.paged_attention can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→13 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor✕
Type pairs
3 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor) references.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor. Changing mistralrs_core.pipeline.inputs_processor.text_models_inputs_processor can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→14 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.pipeline.isq✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.pipeline.isq) reference.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.pipeline.isq. Changing mistralrs_core.pipeline.isq can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→15 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_quant.distributed✕
Type pairs
2 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_quant.distributed) references.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_quant.distributed. Changing mistralrs_quant.distributed can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→16 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.attention✕
Type pairs
4 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.attention) references.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.attention. Changing mistralrs_core.attention can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→19 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.kv_cache✕
Type pairs
2 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.kv_cache) references.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.kv_cache. Changing mistralrs_core.kv_cache can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→20 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.paged_attention.layers.paged_attention✕
Type pairs
2 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.paged_attention.layers.paged_attention) references.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.paged_attention.layers.paged_attention. Changing mistralrs_core.paged_attention.layers.paged_attention can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→21 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.amoe✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.amoe) reference.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.amoe. Changing mistralrs_core.amoe can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→22 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.kv_cache.full_cache✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.kv_cache.full_cache) reference.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.kv_cache.full_cache. Changing mistralrs_core.kv_cache.full_cache can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→24 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.pipeline✕
Type pairs
3 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.pipeline) references.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.pipeline. Changing mistralrs_core.pipeline can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→25 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.xlora_models✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.xlora_models) reference.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.xlora_models. Changing mistralrs_core.xlora_models can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→27 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.pipeline.loaders.normal_loaders✕
Type pairs
2 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.pipeline.loaders.normal_loaders) references.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.pipeline.loaders.normal_loaders. Changing mistralrs_core.pipeline.loaders.normal_loaders can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→31 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.vision_models.idefics2✕
Type pairs
3 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.vision_models.idefics2) references.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.vision_models.idefics2. Changing mistralrs_core.vision_models.idefics2 can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→32 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.layers✕
Type pairs
7 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.layers) references.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.layers. Changing mistralrs_core.layers can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→34 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.embedding_models.embedding_gemma✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.embedding_models.embedding_gemma) reference.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.embedding_models.embedding_gemma. Changing mistralrs_core.embedding_models.embedding_gemma can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→36 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.models.gpt_oss✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.models.gpt_oss) reference.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.models.gpt_oss. Changing mistralrs_core.models.gpt_oss can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→38 mistralrs_core.vision_models.qwen3_5.text depends on mistralrs_core.models.lfm2✕
Type pairs
1 distinct (type in mistralrs_core.vision_models.qwen3_5.text → type in mistralrs_core.models.lfm2) reference.
mistralrs_core.vision_models.qwen3_5.text uses mistralrs_core.models.lfm2. Changing mistralrs_core.models.lfm2 can break mistralrs_core.vision_models.qwen3_5.text, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
At a glance — Code Health · 77% · Adequate · gated by D2 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A03:2021 — Injection
130
High / Critical
A05:2021 — Security Misconfiguration
21
High / Critical
A06:2021 — Vulnerable & Outdated Components
14
High / Critical
A02:2021 — Cryptographic Failures
5
High / Critical
Roadmap
First, ensure every form control and button has a proper programmatic label to fix accessibility issues. Next, establish correct page structure by defining language, title, and main landmarks, while enforcing accessibility standards through linting and CI gates. Finally, secure the system by enabling dependency scanning and adding timeouts with retries to all outbound HTTP requests.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 1 No ADRs found finding(s) in ADR Quality.
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.
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.
Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree, with each file named `NNNN-title` in whatever markup those docs already use, is the most discoverable form).
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 — 4052
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 — 25
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 47
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 55 of 60 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 5 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 60 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, 4183 of 4208 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: test source is present (.rs, .mjs) but the built-in coverage collector has no runner for this repository's ecosystem — so this suite was never executed by it. Not scored — this is a gap in the analyzer's language coverage, not a defect in the repo. To have real coverage read, produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`, or lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`, or lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
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 83 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 source is present (.rs, .mjs) and this repository declares a Cargo test suite (repository root, 347 test files), but it was not re-run: no test result was produced. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
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 (94 contributor(s) across 3480 commit(s) sampled, automation and bot accounts excluded). One of them holds 89% of the history; the other 93 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.
AX1 Captive dependencies — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
AX2 Stateful singletons — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
AX6 Interface segregation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
C2 Access Controls — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
C3 Audit Trail — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
C4 Data Retention — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
C5 Data-Subject Rights — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
ED5 Idempotency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check finds retry-prone mutations by walking the repository's declared types, and NONE was loaded on this run, so it had nothing to look at. That is a limit of the analyzer's reach — it reads .NET projects — not a finding that this repository has no command handlers or message consumers.
GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
P10 Library API & versioning — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads NuGet packaging and C# public API only, and no .NET project was loaded for this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
PF1 Benchmark discipline — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
PF2 Allocation hygiene — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
S1 Web-Security Posture — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
X1 Async correctness — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X10 Duplicated predicate — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X12 Unreachable branch — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X13 Undrained process stream — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X14 Bypassable address classification — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X15 Unvalidated length from an untrusted reader — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X16 Unfloored truncation loop — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X17 Uncapped recursion over a caller-supplied document — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X18 Disposal-pattern correctness — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X19 Unrestored process-global state — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X2 Cancellation propagation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X20 Mistyped argument guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X21 Side-effecting pattern guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X22 Contradicted release guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X23 Unguarded diagnostic materialisation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X24 Document value interpolated into markup unescaped — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X25 Inert configuration knob — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X26 Unsynchronised callback handoff — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X27 Collection changed while being enumerated — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X28 Index access outside its own emptiness guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X29 Per-element action decided by a fixed element — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X3 Exception handling — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X30 Support guard that admits what it rejects — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X32 Type resolved by simple name across every loaded assembly — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X4 Structured logging — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X5 Nullable reference types — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X6 Hand-rolled structured-format parsing — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X7 Silent fallback defaults — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
Repo exclusion declarations (.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").
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 is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement. Its critique rows are drawn from a closed category vocabulary and each row means the same thing in every run, so two scans can be compared row by row; the SET that fires is still a sample, and does not repeat exactly. Measured on one frozen input, six scans at one engine SHA: 2-5 critique rows per scan, 8 distinct rows across the six, 3 of those 8 seen in only one scan. So a D19 row is evidence about the documentation, but a COUNT of D19 rows is not a quantity — never read a change in it as an improvement or a regression.
D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
D22 Internal API Consistency: API-surface coherence is an LLM judgement over a sample of the public surface — consistency of intent across the whole API is approximated, not exhaustively verified.
D23 Boundary Type-Coupling: Boundary leakage is detected from type references across detected contexts — leaks that flow through primitives, serialization or shared infrastructure may not surface as a typed reference.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
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.
AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
The LLM boundary
LLM-set scores this run (5): D19, D21, D22, D26, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
303 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was production_soak.validate_args at 181. A further 45 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 27), mistralrs-core/src/pipeline/loaders/normal_loaders.rs (NormalLoaderType::from_causal_lm_name at 27), mistralrs-core/src/model_metadata.rs (NormalLoaderType::arch_metadata at 26), mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs (AutoMultimodalLoader::get_loader at 26), 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.
+ 124 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 73 mistralrs_core finding(s) in Cyclomatic Complexity — start with ops.rs (17), gdn.rs (8), REDACTED (4). — One of this dimension's main actionable groups (73 warning-level).
Resolve the 36 mistralrs_quant finding(s) in Cyclomatic Complexity — start with ops.rs (8), lib.rs (5), fast_mmq.rs (3). — One of this dimension's main actionable groups (36 warning-level).
Resolve the 14 mistralrs_cli finding(s) in Cyclomatic Complexity — start with interactive.rs (6), serve.rs (2), quantize.rs (2). — One of this dimension's main actionable groups (14 warning-level).
Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 193 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 107 mistralrs_core finding(s) in Cognitive Complexity — start with ops.rs (15), gdn.rs (9), inputs_processor.rs (7). — One of this dimension's main actionable groups (107 warning-level).
Resolve the 54 mistralrs_quant finding(s) in Cognitive Complexity — start with ops.rs (10), lib.rs (5), report.rs (4). — One of this dimension's main actionable groups (54 warning-level).
Resolve the 22 mistralrs_cli finding(s) in Cognitive Complexity — start with interactive.rs (7), quantize.rs (3), gguf_discovery.rs (3). — One of this dimension's main actionable groups (22 warning-level).
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God 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 210 MethodTooLong finding(s) in God Classes — start with REDACTED (33), inputs_processor.rs (27), text.rs (27). — One of this dimension's main actionable groups (210 warning-level).
Resolve the 208 FileTooLong finding(s) in God Classes — start with REDACTED (23), inputs_processor.rs (15), text.rs (10). — One of this dimension's main actionable groups (208 warning-level).
Resolve the 161 FunctionTooLong finding(s) in God Classes — start with gdn.rs (16), ops.rs (10), REDACTED (7). — One of this dimension's main actionable groups (161 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.
2138 duplicated block group(s) detected. A further 184 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 4 of the 2322 are in trees this repository does not ship — vendored, example/demo, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
+ 533 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 98 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with ops.rs (15), gdn.rs (10), REDACTED (7). — One of this dimension's main actionable groups (98 warning-level).
Resolve the 97 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with REDACTED (12), ops.rs (11), gdn.rs (4). — One of this dimension's main actionable groups (97 warning-level).
Resolve the 93 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with ops.rs (14), REDACTED (10), lib.rs (6). — One of this dimension's main actionable groups (93 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, 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 13 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 (13 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.
2787 test methods: 2699 unit, 88 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 2572 `#[test]` function(s) across 347 file(s) declaring at least one; its unit/integration split is Cargo's own — 15 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 209 test function(s) across 4 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 83 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.
3 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: clap_complete · ×3
✓ On the Gold path — maintain.
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Resolve the 98 Hotspot finding(s) in Churn × Complexity Hotspots — start with REDACTED (14), inputs_processor.rs (13), text.rs (4). — One of this dimension's main actionable groups (98 warning-level).
Resolve the 1 Repeated repair finding(s) in Churn × Complexity Hotspots — start with media_source.rs. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
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 487563 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), request.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, speech.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: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.
A strong developer guide for mistral.rs: the README is a source-build and contributor guide with install/prerequisites, clone/build steps, and a detailed multimodal pipeline; architecture/design docs are separate (256 markdown files). The examples directory points to runnable Rust/Python code repositories. All visible content is present in the outline and clearly explains what the project does. (20 of 25 sampled documents could not be assessed: 1 of 2 evaluation groups failed.)
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.
0 naming inconsistencies across 0 sampled symbols.
✓ On the Gold path — maintain.
Detailed fixes: d21_recommendation.md.
Do you agree with this assessment?
D22 · Internal API ConsistencyWeak◐ Sampled · advisory
What it measures: Whether the internal API surface is consistent and coherent.
Method: Judged by language model at low temperature over a sample of the public API surface (IsPackable or .Contracts types). Sampled, advisory; confidence discounted by model uncertainty.
5 API inconsistencies across a 400-member sample of 818 exposed types.
Inconsistent tool registration API across Agent and AgentBuilder. Agent uses a single with_tool method with a generic callback type, while AgentBuilder splits this into with_sync_tool, with_async_tool, and register_tool with different signatures and naming conventions.
Redundant high-level chat methods. Both Model and BlockingModel expose chat() and send_chat_request() which appear to do similar things. The distinction between 'chat' and 'send_chat_request' is unclear, and having both on both types creates confusion about which to use.
Inconsistent naming for embedding generation. The singular 'generate_embedding' and plural 'generate_embeddings' methods exist alongside their _with_model variants, but the distinction between singular and plural is unclear (single prompt vs batch?). This creates confusion about when to use which method.
Redundant tool callback registration methods. with_tool_callback and with_tool_callback_and_tool differ only by whether a Tool object is passed, but the distinction is unclear. If the callback implies the tool, the second method is redundant; if not, the naming is confusing.
Excessive method proliferation for LoRA adapter loading. Four variants exist with different combinations of model_id and policy parameters, creating a combinatorial explosion that is hard to remember and use correctly.
What to do
Resolve the 1 Inconsistent tool registration API across Agent and AgentBuilder. Agent… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Redundant high-level chat methods. Both Model and BlockingModel expose… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Inconsistent naming for embedding generation. The singular… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d22_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether domain types (IDs, enums, value objects) leak across bounded-context boundaries.
Method: Cross-context domain-type leakage via Roslyn structural classification (strongly-typed IDs / value objects) over every public surface. Exhaustive, deterministic, type-level aggregate-boundary check.
Coverage: Bounded contexts derived from NAMESPACE prefix (or graph-inferred where available); cross-boundary domain-type leakage then checked exhaustively over every public member of every type.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: 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).
130 finding(s): 0 critical, 104 high, 16 medium, 10 low. 85 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`, `REDACTED` (lines 857–979), `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
+ 7 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 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4). — One of this dimension's main actionable groups (4 issue-level).
No action in Static Analysis (SAST) — all 85 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 (85 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.
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 5 Medium advisory (unmaintained) finding(s) in Dependency Vulnerabilities — start with REDACTED (5). — One of this dimension's main actionable groups (5 warning-level).
Resolve the 4 Medium vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (4). — One of this dimension's main actionable groups (4 warning-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.
4 of 611 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 611 of the 719 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Orphaned files with no living knowledge
✓ On the Gold path — maintain.
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 1 Boundary-crossing change coupling finding(s) in Change Coupling — start with toml_selector.rs. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 7 Change coupling finding(s) in Change Coupling — start with REDACTED (3), embedding.rs (2), model_selected.rs. — One of this dimension's main actionable groups (7 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
What it measures: Whether 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.
Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.
Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.
Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
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 21 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 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 · 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 significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree, with each file named `NNNN-title` in whatever markup those docs already use, is the most discoverable form).
Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
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. 3 of the 10 files that make outbound calls are unbounded; the first 3 are listed. — 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. (×2) — mistralrs-core/src/pipeline/amoe.rs:587, mistralrs-pyo3/src/util.rs:219
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) or inside a Java method returning a Reactor Mono/Flux — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
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.
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.
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
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.
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 13 of 55 WCAG 2.2 Level A/AA success criteria (24%; ≈26% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 42 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Not evidenced — 4 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 69 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.
AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX2 Stateful singletons — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
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) — DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
Install the buildx component to build images with BuildKit:
https://docs.docker.com/go/bui…; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
D11 Test Reliability — Test reliability not included — the .rs suite was found but not re-run
D14 License Compliance — Not scored — this repository's 762 shipped crate(s) were read from its REDACTED, but crates.io could not be asked for the licence of 50 of them (HTTP 429 Unknown Error), and a licence verdict over part of a dependency graph is not a licence verdict. Nothing is asserted about this repository's licensing in either direction.
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.
D24 Comment Value — No inline comments to assess — comment value is not applicable here.
D25 ADR Conformance — no ADRs to check
D27 Navigability — symbol resolution incomplete — navigability not assessed
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 included — suite not readable by the collector
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); 152 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 — This check finds retry-prone mutations (command handlers and message/event consumers) by walking the repository's declared types, and none was loaded here, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
GD1 Unfinished & placeholder code — no source files were read — this check reads C# syntax, and none was loaded for this repository. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P10 Library API & versioning — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
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 — no coverage report found on disk — produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
PF1 Benchmark discipline — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
PF2 Allocation hygiene — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
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 1.06% of this repository's production source and the other 98.94% carries 17,613 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
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X1 Async correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X10 Duplicated predicate — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X12 Unreachable branch — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X13 Undrained process stream — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X14 Bypassable address classification — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X15 Unvalidated length from an untrusted reader — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X16 Unfloored truncation loop — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X17 Uncapped recursion over a caller-supplied document — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X18 Disposal-pattern correctness — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X19 Unrestored process-global state — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X2 Cancellation propagation — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X20 Mistyped argument guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X21 Side-effecting pattern guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X22 Contradicted release guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X23 Unguarded diagnostic materialisation — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X24 Document value interpolated into markup unescaped — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X25 Inert configuration knob — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X26 Unsynchronised callback handoff — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X27 Collection changed while being enumerated — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X28 Index access outside its own emptiness guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X29 Per-element action decided by a fixed element — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X3 Exception handling — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X30 Support guard that admits what it rejects — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X32 Type resolved by simple name across every loaded assembly — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X6 Hand-rolled structured-format parsing — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X7 Silent fallback defaults — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
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— `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.
MethodTooLong: Engine.run mistralrs-core/src/engine/mod.rs:1107— MethodTooLong — run runs 876 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 776 over it, 8.76× 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:531— MethodTooLong — load_model_from_path runs 816 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 716 over it, 8.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: Pipeline.submit_step mistralrs-core/src/pipeline/mod.rs:2002— MethodTooLong — submit_step runs 761 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 661 over it, 7.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: NormalLoader.load_model_from_path mistralrs-core/src/pipeline/normal.rs:634— MethodTooLong — load_model_from_path runs 697 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 597 over it, 6.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: Engine.add_request mistralrs-core/src/engine/add_request.rs:136— 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 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.
MethodTooLong: ImageEmbedding.forward mistralrs-core/src/vision_models/phi3/mod.rs:698— 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: Runner.new mistralrs-pyo3/src/lib.rs:972— MethodTooLong — new runs 341 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 241 over it, 3.41× 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:967— MethodTooLong — build_multi_model runs 322 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 222 over it, 3.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: 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:1403— 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:2364— 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:885— MethodTooLong — schedule 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: Qwen3_5TextModel.forward_embeds mistralrs-core/src/vision_models/qwen3_5/text.rs:2268— MethodTooLong — forward_embeds runs 290 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 190 over it, 2.90× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: 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: 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.
FileTooLong: scripts/production_soak.py scripts/production_soak.py— FileTooLong — 11920 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 11420 over it, 23.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/multimodal_loaders.rs mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs— FileTooLong — 7040 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 6540 over it, 14.08× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/ops.rs mistralrs-core/src/ops.rs— FileTooLong — 5001 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 4501 over it, 10.00× 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 — 4879 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 4379 over it, 9.76× 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 — 4617 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 4117 over it, 9.23× 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 — 3076 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 36 free functions. The bar is 500 significant lines; this is 2576 over it, 6.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: speculative/dflash.rs mistralrs-core/src/speculative/dflash.rs— FileTooLong — 3050 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 2550 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/cuda_graph.rs mistralrs-core/src/pipeline/cuda_graph.rs— FileTooLong — 2755 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 68 free functions. The bar is 500 significant lines; this is 2255 over it, 5.51× 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 — 2616 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 62% of them inside a single declaration: Runner (3 blocks, 302-3023). The bar is 500 significant lines; this is 2116 over it, 5.23× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: 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: pipeline/multimodal.rs mistralrs-core/src/pipeline/multimodal.rs— FileTooLong — 2434 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 1934 over it, 4.87× 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 — 2398 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 1898 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: pipeline/mod.rs mistralrs-core/src/pipeline/mod.rs— FileTooLong — 2258 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 1758 over it, 4.52× 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 — 2244 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 1744 over it, 4.49× 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 — 2236 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 1736 over it, 4.47× 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: qwen3_5/text.rs mistralrs-core/src/vision_models/qwen3_5/text.rs— FileTooLong — 2189 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 1689 over it, 4.38× 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 — 2188 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 1688 over it, 4.38× 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 — 2102 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, 440-2967). The bar is 500 significant lines; this is 1602 over it, 4.20× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: src/lib.rs mistralrs-quant/src/lib.rs— FileTooLong — 2094 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 36 free functions. The bar is 500 significant lines; this is 1594 over it, 4.19× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: gemma4/text.rs mistralrs-core/src/vision_models/gemma4/text.rs— FileTooLong — 2042 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 1542 over it, 4.08× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: 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 — 1941 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-4139). The bar is 500 significant lines; this is 1441 over it, 3.88× 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 — 1855 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 69 free functions. The bar is 500 significant lines; this is 1355 over it, 3.71× 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 — 1799 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 32 free functions. The bar is 500 significant lines; this is 1299 over it, 3.60× 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/sequence.rs mistralrs-core/src/sequence.rs— FileTooLong — 1744 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 1244 over it, 3.49× 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.
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 562 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 462 over it, 5.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.
FunctionTooLong: mistralrs_core::pipeline::inputs_processor::text_models_inputs_processor::make_prompt_chunk mistralrs-core/src/pipeline/inputs_processor.rs:828— FunctionTooLong — mistralrs_core::pipeline::inputs_processor::text_models_inputs_processor::make_prompt_chunk runs 553 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 453 over it, 5.53× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mistralrs_quant::afq::ops::cuda_backend::afq_mm_op mistralrs-quant/src/afq/ops.rs:2942— 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:432— FunctionTooLong — mistralrs_pyo3::parse_which runs 425 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 325 over it, 4.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mistralrs_core::cuda::gdn::speculative_recurrence_checkpoints_cuda mistralrs-core/src/cuda/gdn.rs:3388— FunctionTooLong — mistralrs_core::cuda::gdn::speculative_recurrence_checkpoints_cuda runs 408 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 308 over it, 4.08× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: 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:2455— 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_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 359 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 259 over it, 3.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_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_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:3940— 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:1929— 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_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_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::speculative::driver::verify_staged_batch mistralrs-core/src/speculative/driver.rs:316— FunctionTooLong — mistralrs_core::speculative::driver::verify_staged_batch runs 254 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 154 over it, 2.54× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
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:544— 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:434— 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.
FunctionTooLong: mistralrs_paged_attn::cuda::backend::flashinfer::flashinfer_decode mistralrs-paged-attn/src/cuda/backend/flashinfer.rs:241— FunctionTooLong — mistralrs_paged_attn::cuda::backend::flashinfer::flashinfer_decode runs 250 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 150 over it, 2.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_core::mla::forward::mla_cache_forward mistralrs-core/src/mla/forward.rs:356— FunctionTooLong — mistralrs_core::mla::forward::mla_cache_forward runs 241 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 141 over it, 2.41× 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::run::interactive::multimodal_interactive_mode mistralrs-cli/src/commands/run/interactive.rs:1521— FunctionTooLong — mistralrs_cli::commands::run::interactive::multimodal_interactive_mode runs 240 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 140 over it, 2.40× 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 133) mistralrs-core/src/pipeline/inputs_processor.rs:828— mistralrs_core::pipeline::inputs_processor::text_models_inputs_processor::make_prompt_chunk has cognitive complexity 133 (threshold 15). Drivers by points: if/else 63 (110 pts), loops 7 (18 pts), boolean chains 5 (nesting depth added 58). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:3396— 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::ops::try_cuda_qk_rms_norm_rope_positions (cognitive 56) mistralrs-core/src/ops.rs:5587— 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::ops::try_cuda_qk_rms_norm_rope (cognitive 55) mistralrs-core/src/ops.rs:5158— 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::sampling::sample_sequence (cognitive 55) mistralrs-core/src/pipeline/sampling.rs:1392— mistralrs_core::pipeline::sampling::sample_sequence has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (39 pts), boolean chains 8, loops 1 (5 pts), match/switch 3 (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.
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::pipeline::loaders::auto_device_map::get_device_layers (cognitive 53) mistralrs-core/src/pipeline/loaders/auto_device_map.rs:200— mistralrs_core::pipeline::loaders::auto_device_map::get_device_layers has cognitive complexity 53 (threshold 15). Drivers by points: if/else 22 (40 pts), loops 3 (5 pts), match/switch 4 (5 pts), boolean chains 3 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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::paged_attention::calculate_cache_config (cognitive 50) mistralrs-core/src/paged_attention/mod.rs:380— mistralrs_core::paged_attention::calculate_cache_config has cognitive complexity 50 (threshold 15). Drivers by points: if/else 23 (39 pts), match/switch 2 (5 pts), boolean chains 4, loops 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistralrs_core::pipeline::inputs_processor::text_models_inputs_processor::make_completion_chunk (cognitive 48) mistralrs-core/src/pipeline/inputs_processor.rs:1525— 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 43) mistralrs-core/src/speculative/driver.rs:316— mistralrs_core::speculative::driver::verify_staged_batch has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (30 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::vision_models::diffusion_gemma::generation::generate_canvas (cognitive 41) mistralrs-core/src/vision_models/diffusion_gemma/generation.rs:98— mistralrs_core::vision_models::diffusion_gemma::generation::generate_canvas has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 4 (10 pts), boolean chains 5 (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.
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.
mistralrs_core::ops::cuda_dflash_sample_select (cognitive 40) mistralrs-core/src/ops.rs:1702— mistralrs_core::ops::cuda_dflash_sample_select has cognitive complexity 40 (threshold 15). Drivers by points: if/else 23 (26 pts), match/switch 8, boolean chains 4, loops 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.
Hotspot: mistralrs-core/src/pipeline/multimodal.rs mistralrs-core/src/pipeline/multimodal.rs:531— mistralrs-core/src/pipeline/multimodal.rs changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 87 in MultimodalLoader::load_model_from_path at line 531. 3 of those changes were fix/bug commits, and the other 22 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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/engine/mod.rs mistralrs-core/src/engine/mod.rs:1107— mistralrs-core/src/engine/mod.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 119 in Engine::run at line 1107. 3 of those changes were fix/bug commits, and the other 14 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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/mod.rs mistralrs-core/src/pipeline/mod.rs:2002— mistralrs-core/src/pipeline/mod.rs changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 100 in Pipeline::submit_step at line 2002. 3 of those changes were fix/bug commits, and the other 17 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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:634— mistralrs-core/src/pipeline/normal.rs changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 63 in NormalLoader::load_model_from_path at line 634. 2 of those changes were fix/bug commits, and the other 18 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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/engine/add_request.rs mistralrs-core/src/engine/add_request.rs:136— mistralrs-core/src/engine/add_request.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 103 in Engine::add_request at line 136. 1 of those changes was a fix/bug commit, 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-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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/pipeline/sampling.rs mistralrs-core/src/pipeline/sampling.rs:189— mistralrs-core/src/pipeline/sampling.rs changed 12 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 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-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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/vision_models/qwen3_5/text.rs mistralrs-core/src/vision_models/qwen3_5/text.rs:2268— mistralrs-core/src/vision_models/qwen3_5/text.rs changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 49 in Qwen3_5TextModel::forward_embeds at line 2268. 2 of those changes were fix/bug commits, and the other 14 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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/paged_attention/scheduler.rs mistralrs-core/src/paged_attention/scheduler.rs:885— 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 885. 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-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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/lib.rs mistralrs-core/src/lib.rs:1336— mistralrs-core/src/lib.rs changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in MistralRs::init_external_tool_callbacks at line 1336. 4 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-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -04:00' --full-history --no-merges -- mistralrs-core/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/cuda/gdn.rs mistralrs-core/src/cuda/gdn.rs:3388— mistralrs-core/src/cuda/gdn.rs changed 9 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 3388. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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-server-core/src/chat_completion.rs mistralrs-server-core/src/chat_completion.rs:566— mistralrs-server-core/src/chat_completion.rs changed 10 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-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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/pipeline/inputs_processor.rs mistralrs-core/src/pipeline/inputs_processor.rs:828— mistralrs-core/src/pipeline/inputs_processor.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 52 in mistralrs_core::pipeline::inputs_processor::text_models_inputs_processor::make_prompt_chunk at line 828. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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-core/src/vision_models/gemma4/inputs_processor.rs mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:1025— mistralrs-core/src/vision_models/gemma4/inputs_processor.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 81 in Gemma4ImageProcessor::process_inputs at line 1025. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -04:00' --full-history --no-merges -- mistralrs-core/src/vision_models/gemma4/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-pyo3/src/lib.rs mistralrs-pyo3/src/lib.rs:972— mistralrs-pyo3/src/lib.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in Runner::new at line 972. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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/ops.rs mistralrs-core/src/ops.rs:5158— mistralrs-core/src/ops.rs changed 9 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 5158. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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-server-core/src/responses.rs mistralrs-server-core/src/responses.rs:1166— mistralrs-server-core/src/responses.rs changed 10 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-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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/pipeline/loaders/multimodal_loaders.rs mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:430— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in AutoMultimodalLoader::get_loader at line 430. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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/vision_models/qwen3_5/mod.rs mistralrs-core/src/vision_models/qwen3_5/mod.rs:113— mistralrs-core/src/vision_models/qwen3_5/mod.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in Qwen3_5Model::forward at line 113. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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/vision_models/qwen3_5/speculative.rs mistralrs-core/src/vision_models/qwen3_5/speculative.rs:431— mistralrs-core/src/vision_models/qwen3_5/speculative.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 34 in Qwen3_5Model::dflash_propose at line 431. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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/pipeline/embedding.rs mistralrs-core/src/pipeline/embedding.rs:223— mistralrs-core/src/pipeline/embedding.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in EmbeddingLoader::load_model_from_path at line 223. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -04:00' --full-history --no-merges -- mistralrs-core/src/pipeline/embedding.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/prefix_cacher.rs mistralrs-core/src/prefix_cacher.rs:711— mistralrs-core/src/prefix_cacher.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in PrefixCacheManagerV2::search_for_matching_cache at line 711. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -04:00' --full-history --no-merges -- mistralrs-core/src/prefix_cacher.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-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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/distributed/layers.rs mistralrs-quant/src/distributed/layers.rs:434— mistralrs-quant/src/distributed/layers.rs changed 9 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 434. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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-quant/src/lib.rs mistralrs-quant/src/lib.rs:2142— 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 2142. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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/vision_models/gemma4/text.rs mistralrs-core/src/vision_models/gemma4/text.rs:2096— mistralrs-core/src/vision_models/gemma4/text.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in TextModel::forward_embeds_scaled at line 2096. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -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.
Duplicated block (5 lines × 2) mistralrs-cli/src/commands/bench.rs:327— mistralrs-cli/src/commands/bench.rs:327-331 | mistralrs-cli/src/commands/bench.rs:344-348 — both copies are in the same file, so extract the block into 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:612— mistralrs-cli/src/commands/serve.rs:612-616 | mistralrs-cli/src/commands/serve.rs:672-676 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (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:1908— mistralrs-core/src/cuda/gdn.rs:1908-1912 | mistralrs-core/src/cuda/gdn.rs:3193-3199 — both copies are in the same file, so extract the block into 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:3690— mistralrs-core/src/cuda/gdn.rs:3690-3694 | mistralrs-core/src/cuda/gdn.rs:4185-4189 — both copies are in the same file, so extract the block into 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:5528— mistralrs-core/src/cuda/gdn.rs:5528-5532 | mistralrs-core/src/cuda/gdn.rs:5767-5771 — both copies are in the same file, so extract the block into 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:903— mistralrs-core/src/gdn/backend.rs:903-907 | mistralrs-core/src/gdn/backend.rs:1042-1046 — both copies are in the same file, so extract the block into 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:303-307 — 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:1640— mistralrs-core/src/kv_cache/hybrid_cache.rs:1640-1644 | mistralrs-core/src/kv_cache/hybrid_cache.rs:1698-1702 — both copies are in the same file, so extract the block into 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/models/gpt_oss.rs:949— mistralrs-core/src/models/gpt_oss.rs:949-953 | mistralrs-core/src/vision_models/mllama/text.rs:981-986 — 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:514— mistralrs-core/src/models/llama.rs:514-518 | mistralrs-core/src/models/smollm3.rs:533-537 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:5078-5082 — both copies are in the same file, so extract the block into 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:5087-5091 — both copies are in the same file, so extract the block into 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:1317— mistralrs-core/src/pipeline/inputs_processor.rs:1317-1321 | mistralrs-core/src/pipeline/inputs_processor.rs:1328-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 (5 lines × 2) mistralrs-core/src/pipeline/mod.rs:1151— mistralrs-core/src/pipeline/mod.rs:1151-1155 | mistralrs-core/src/pipeline/mod.rs:1209-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 (5 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:1504— mistralrs-core/src/pipeline/multimodal.rs:1504-1508 | mistralrs-core/src/pipeline/normal.rs:1454-1458 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/pipeline/multimodal.rs:1629— mistralrs-core/src/pipeline/multimodal.rs:1629-1633 | mistralrs-core/src/pipeline/normal.rs:1560-1564 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/pipeline/multimodal.rs:1636— mistralrs-core/src/pipeline/multimodal.rs:1636-1640 | mistralrs-core/src/pipeline/normal.rs:1567-1571 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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-cli/src/commands/bench.rs:69— mistralrs-cli/src/commands/bench.rs:69-74 | mistralrs-cli/src/commands/serve.rs:921-926 — 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:932— mistralrs-cli/src/commands/serve.rs:932-939 | mistralrs-cli/src/commands/serve.rs:968-973 — both copies are in the same file, so extract the block into 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:178— mistralrs-core/src/attention/mod.rs:178-183 | 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:1666— mistralrs-core/src/cuda/gdn.rs:1666-1671 | mistralrs-core/src/cuda/gdn.rs:5530-5535 — both copies are in the same file, so extract the block into 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:1691— mistralrs-core/src/cuda/gdn.rs:1691-1696 | mistralrs-core/src/cuda/gdn.rs:1735-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 (6 lines × 2) mistralrs-core/src/cuda/gdn.rs:1910— mistralrs-core/src/cuda/gdn.rs:1910-1915 | mistralrs-core/src/cuda/gdn.rs:2735-2740 — both copies are in the same file, so extract the block into 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:4193— mistralrs-core/src/cuda/gdn.rs:4193-4198 | mistralrs-core/src/cuda/gdn.rs:4200-4205 — both copies are in the same file, so extract the block into 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/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:1019— mistralrs-core/src/gdn/backend.rs:1019-1024 | mistralrs-core/src/models/granite.rs:1186-1191 — 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:508— mistralrs-core/src/gguf/gguf_tokenizer.rs:508-513 | mistralrs-core/src/gguf/gguf_tokenizer.rs:616-621 — both copies are in the same file, so extract the block into 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:1102— mistralrs-core/src/gguf/normal_config.rs:1102-1107 | mistralrs-core/src/gguf/normal_config.rs:1223-1228 — both copies are in the same file, so extract the block into 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:1233— mistralrs-core/src/kv_cache/hybrid_cache.rs:1233-1238 | mistralrs-core/src/kv_cache/hybrid_cache.rs:1834-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 (6 lines × 2) mistralrs-core/src/models/gemma.rs:465— mistralrs-core/src/models/gemma.rs:465-470 | 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 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1051-1057 — 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 14 separate duplicated blocks between them, totalling at least 141 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) mistralrs-core/src/moe/experts/backends.rs:1598— mistralrs-core/src/moe/experts/backends.rs:1598-1603 | mistralrs-core/src/ops.rs:6455-6460 — 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:5193— mistralrs-core/src/ops.rs:5193-5198 | mistralrs-core/src/ops.rs:5624-5629 — both copies are in the same file, so extract the block into 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/pipeline/loaders/multimodal_loaders.rs:184— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:184-189 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:132-137 — 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 × 2) mistralrs-core/src/sequence.rs:2049— mistralrs-core/src/sequence.rs:2049-2054 | mistralrs-core/src/sequence.rs:2081-2086 — both copies are in the same file, so extract the block into 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/utils/varbuilder_utils.rs:99— mistralrs-core/src/utils/varbuilder_utils.rs:99-104 | mistralrs-core/src/utils/varbuilder_utils.rs:135-140 — both copies are in the same file, so extract the block into 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-cli/src/commands/serve.rs:738— mistralrs-cli/src/commands/serve.rs:738-746 | mistralrs-cli/src/commands/serve.rs:770-778 — both copies are in the same file, so extract the block into 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:1069— mistralrs-core/src/cuda/gdn.rs:1069-1077 | mistralrs-core/src/cuda/gdn.rs:1182-1191 — both copies are in the same file, so extract the block into 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:848— mistralrs-core/src/lib.rs:848-856 | mistralrs-core/src/lib.rs:896-904 — both copies are in the same file, so extract the block into 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:350— mistralrs-core/src/model_loader.rs:350-358 | 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:515— mistralrs-core/src/models/hunyuan_v1_dense.rs:515-523 | mistralrs-core/src/models/hunyuan_v1_moe.rs:1009-1017 — 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 686 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:461— mistralrs-core/src/models/llama.rs:461-469 | mistralrs-core/src/models/smollm3.rs:484-492 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 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 (9 lines × 2) mistralrs-core/src/models/qwen3_next.rs:695— mistralrs-core/src/models/qwen3_next.rs:695-703 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:474-482 — 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 27 separate duplicated blocks between them, totalling at least 411 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 × 2) mistralrs-core/src/moe/experts/mod.rs:180— mistralrs-core/src/moe/experts/mod.rs:180-188 | mistralrs-core/src/moe/experts/mod.rs:251-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 (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:5031-5039 — both copies are in the same file, so extract the block into 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/paged_attention/scheduler.rs:1027— mistralrs-core/src/paged_attention/scheduler.rs:1027-1035 | mistralrs-core/src/paged_attention/scheduler.rs:1063-1071 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) mistralrs-core/src/pipeline/embedding.rs:249— mistralrs-core/src/pipeline/embedding.rs:249-257 | mistralrs-core/src/pipeline/normal.rs:679-687 — 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 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 (9 lines × 2) mistralrs-core/src/pipeline/gguf.rs:1342— mistralrs-core/src/pipeline/gguf.rs:1342-1350 | mistralrs-core/src/pipeline/normal.rs:1323-1331 — 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/multimodal.rs:1859— mistralrs-core/src/pipeline/multimodal.rs:1859-1867 | mistralrs-core/src/pipeline/normal.rs:2271-2279 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/multimodal.rs:1915— mistralrs-core/src/pipeline/multimodal.rs:1915-1923 | mistralrs-core/src/pipeline/normal.rs:2237-2245 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/multimodal.rs:2346— mistralrs-core/src/pipeline/multimodal.rs:2346-2354 | mistralrs-core/src/pipeline/normal.rs:2082-2090 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/sampler.rs:415— mistralrs-core/src/sampler.rs:415-423 | mistralrs-core/src/sampler.rs:501-509 — both copies are in the same file, so extract the block into 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/sampler.rs:1752— mistralrs-core/src/sampler.rs:1752-1760 | mistralrs-core/src/sampler.rs:1923-1931 — both copies are in the same file, so extract the block into 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/search/mod.rs:117— mistralrs-core/src/search/mod.rs:117-125 | mistralrs-core/src/search/mod.rs:136-144 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) mistralrs-core/src/vision_models/gemma3n/audio.rs:862— mistralrs-core/src/vision_models/gemma3n/audio.rs:862-870 | mistralrs-core/src/vision_models/gemma4/audio.rs:353-361 — `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 lines × 2) mistralrs-core/src/vision_models/gemma3n/audio.rs:1414— mistralrs-core/src/vision_models/gemma3n/audio.rs:1414-1422 | mistralrs-core/src/vision_models/gemma4/audio.rs:1105-1113 — `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 (7 lines × 2) mistralrs/src/model_builder_trait.rs:729— mistralrs/src/model_builder_trait.rs:729-735 | mistralrs/src/model_builder_trait.rs:1483-1489 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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/mod.rs:409— mistralrs-core/src/attention/mod.rs:409-415 | mistralrs-core/src/attention/mod.rs:432-438 — both copies are in the same file, so extract the block into 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:1468— mistralrs-core/src/kv_cache/mod.rs:1468-1474 | mistralrs-core/src/kv_cache/mod.rs:1568-1574 — both copies are in the same file, so extract the block into 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:793— mistralrs-core/src/layers.rs:793-799 | mistralrs-core/src/layers.rs:800-806 — both copies are in the same file, so extract the block into 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:2444— mistralrs-core/src/lib.rs:2444-2450 | mistralrs-core/src/lib.rs:2471-2477 — both copies are in the same file, so extract the block into 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/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 573 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:632— mistralrs-core/src/models/qwen3_next.rs:632-638 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:466-472 — 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 27 separate duplicated blocks between them, totalling at least 411 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:857— mistralrs-core/src/moe/experts/backends.rs:857-863 | mistralrs-core/src/moe/experts/backends.rs:1013-1019 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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:6031-6037 — both copies are in the same file, so extract the block into 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:5356— mistralrs-core/src/ops.rs:5356-5362 | mistralrs-core/src/ops.rs:5792-5798 — both copies are in the same file, so extract the block into 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:2239— mistralrs-core/src/pipeline/cuda_graph.rs:2239-2245 | mistralrs-core/src/speculative/dflash.rs:1640-1646 — 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:1281-1287 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) mistralrs-core/src/pipeline/inputs_processor.rs:883— mistralrs-core/src/pipeline/inputs_processor.rs:883-889 | mistralrs-quant/src/distributed/layers.rs:2807-2814 — 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/speculative/cache.rs:310— mistralrs-core/src/speculative/cache.rs:310-316 | mistralrs-core/src/speculative/paged_rows.rs:257-263 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) mistralrs-core/src/cuda/dflash_context.rs:97— mistralrs-core/src/cuda/dflash_context.rs:97-103 | mistralrs-core/src/speculative/dflash.rs:866-872 — 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:893-899 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) mistralrs-cli/src/commands/run/mod.rs:144— mistralrs-cli/src/commands/run/mod.rs:144-151 | mistralrs-cli/src/commands/run/mod.rs:173-180 — both copies are in the same file, so extract the block into 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:879— mistralrs-cli/src/commands/serve.rs:879-886 | mistralrs-cli/src/commands/serve.rs:891-898 — both copies are in the same file, so extract the block into 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:2748— mistralrs-core/src/cuda/gdn.rs:2748-2755 | mistralrs-core/src/cuda/gdn.rs:2758-2765 — both copies are in the same file, so extract the block into 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:334-341 — both copies are in the same file, so extract the block into 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:1470— mistralrs-core/src/gguf/normal_config.rs:1470-1477 | mistralrs-core/src/gguf/normal_config.rs:2090-2097 — both copies are in the same file, so extract the block into 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:1161— mistralrs-core/src/kv_cache/hybrid_cache.rs:1161-1168 | mistralrs-core/src/kv_cache/hybrid_cache.rs:1994-2001 — both copies are in the same file, so extract the block into 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:1228— mistralrs-core/src/kv_cache/hybrid_cache.rs:1228-1235 | mistralrs-core/src/kv_cache/hybrid_cache.rs:2058-2065 — both copies are in the same file, so extract the block into 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:839— mistralrs-core/src/layers.rs:839-846 | mistralrs-core/src/layers.rs:2175-2182 — both copies are in the same file, so extract the block into 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:1591— mistralrs-core/src/layers.rs:1591-1598 | mistralrs-core/src/layers.rs:1902-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 (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/moe/experts/backends.rs:1399— mistralrs-core/src/moe/experts/backends.rs:1399-1406 | mistralrs-core/src/moe/experts/backends.rs:1465-1472 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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:6601— mistralrs-core/src/ops.rs:6601-6608 | mistralrs-core/src/ops.rs:6673-6680 — both copies are in the same file, so extract the block into 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:389— mistralrs-core/src/paged_attention/cache_engine.rs:389-396 | mistralrs-core/src/paged_attention/cache_engine.rs:427-434 — both copies are in the same file, so extract the block into 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:509— mistralrs-core/src/pipeline/chat_template.rs:509-516 | mistralrs-core/src/pipeline/chat_template.rs:580-587 — both copies are in the same file, so extract the block into 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:687— mistralrs-core/src/pipeline/cuda_graph.rs:687-694 | mistralrs-core/src/pipeline/cuda_graph.rs:697-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 (8 lines × 2) mistralrs-core/src/pipeline/loaders/auto_device_map.rs:244— mistralrs-core/src/pipeline/loaders/auto_device_map.rs:244-251 | mistralrs-core/src/pipeline/loaders/auto_device_map.rs:255-262 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:2472— mistralrs-core/src/pipeline/multimodal.rs:2472-2479 | mistralrs-core/src/pipeline/normal.rs:2147-2154 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/reasoning_parsers/harmony.rs:349— mistralrs-core/src/reasoning_parsers/harmony.rs:349-356 | mistralrs-core/src/reasoning_parsers/harmony.rs:388-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 (8 lines × 2) mistralrs-core/src/utils/memory_usage.rs:147— mistralrs-core/src/utils/memory_usage.rs:147-154 | mistralrs-core/src/utils/memory_usage.rs:181-188 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) mistralrs-core/src/vision_models/diffusion_gemma/mod.rs:282— mistralrs-core/src/vision_models/diffusion_gemma/mod.rs:282-289 | mistralrs-core/src/vision_models/gemma4/mod.rs:371-378 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:249— mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:249-256 | mistralrs-core/src/vision_models/gemma4/inputs_processor.rs:514-521 — both copies are in the same file, so extract the block into 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/vision_models/gemma4/mod.rs:365— mistralrs-core/src/vision_models/gemma4/mod.rs:365-372 | mistralrs-core/src/vision_models/gemma4/mod.rs:677-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.
mistralrs_core::gguf::normal_bindings::bind_block_tensor (cyclomatic 68) mistralrs-core/src/gguf/normal_bindings.rs:109— mistralrs_core::gguf::normal_bindings::bind_block_tensor has cyclomatic complexity 68 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
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:3396— 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 52) mistralrs-core/src/pipeline/inputs_processor.rs:828— mistralrs_core::pipeline::inputs_processor::text_models_inputs_processor::make_prompt_chunk 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.
mistralrs_core::ops::try_cuda_qk_rms_norm_rope (cyclomatic 43) mistralrs-core/src/ops.rs:5158— 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:5587— 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:5920— 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:3093— 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::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::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::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::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::model_loader::loader_from_model_selected (cyclomatic 30) mistralrs-core/src/model_loader.rs:292— mistralrs_core::model_loader::loader_from_model_selected 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::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:4910— 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::paged_attention::calculate_cache_config (cyclomatic 30) mistralrs-core/src/paged_attention/mod.rs:380— mistralrs_core::paged_attention::calculate_cache_config 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:4550— 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.
Duplicated block (10 lines × 2) mistralrs/src/model_builder_trait.rs:1252— mistralrs/src/model_builder_trait.rs:1252-1261 | mistralrs/src/model_builder_trait.rs:1388-1397 — both copies are in the same file, so extract the block into 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-cli/src/commands/quantize.rs:558— mistralrs-cli/src/commands/quantize.rs:558-567 | mistralrs-cli/src/commands/quantize.rs:605-614 — both copies are in the same file, so extract the block into 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:4006— mistralrs-core/src/cuda/gdn.rs:4006-4015 | mistralrs-core/src/cuda/gdn.rs:4388-4397 — both copies are in the same file, so extract the block into 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:1329— mistralrs-core/src/gguf/normal_config.rs:1329-1338 | mistralrs-core/src/gguf/normal_config.rs:1375-1384 — both copies are in the same file, so extract the block into 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:2024— mistralrs-core/src/kv_cache/hybrid_cache.rs:2024-2033 | mistralrs-core/src/kv_cache/hybrid_cache.rs:3979-3988 — both copies are in the same file, so extract the block into 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:838— mistralrs-core/src/models/gpt_oss.rs:838-847 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5674-5683 — 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/llama.rs:251— mistralrs-core/src/models/llama.rs:251-260 | mistralrs-core/src/models/smollm3.rs:267-276 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/moe/experts/backends.rs:790— mistralrs-core/src/moe/experts/backends.rs:790-799 | mistralrs-core/src/moe/experts/backends.rs:837-846 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) mistralrs-core/src/moe/experts/mod.rs:109— mistralrs-core/src/moe/experts/mod.rs:109-118 | mistralrs-core/src/moe/experts/mod.rs:200-209 — both copies are in the same file, so extract the block into 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:5069-5078 — both copies are in the same file, so extract the block into 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:5612— mistralrs-core/src/ops.rs:5612-5621 | mistralrs-core/src/ops.rs:5951-5960 — both copies are in the same file, so extract the block into 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:271— mistralrs-core/src/paged_attention/cache_engine.rs:271-280 | mistralrs-core/src/paged_attention/cache_engine.rs:325-334 — both copies are in the same file, so extract the block into 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:571— mistralrs-core/src/paged_attention/layers/paged_attention.rs:571-580 | mistralrs-core/src/paged_attention/layers/paged_attention.rs:610-619 — both copies are in the same file, so extract the block into 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:7208— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7208-7217 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7667-7676 — both copies are in the same file, so extract the block into 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:2652— mistralrs-core/src/speculative/dflash.rs:2652-2661 | mistralrs-core/src/speculative/dflash.rs:3531-3540 — both copies are in the same file, so extract the block into 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:2336-2345 — `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 8 separate duplicated blocks between them, totalling at least 83 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:2347-2356 — `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 8 separate duplicated blocks between them, totalling at least 83 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:543-552 — 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: Runner mistralrs-pyo3/src/lib.rs:302— ClassTooLong — 1631 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 302-3023. The bar is 400 significant lines; this is 1231 over it, 4.08× 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: MistralRs mistralrs-core/src/lib.rs:440— 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 440-2967. 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: DFlashDraftModel mistralrs-core/src/speculative/dflash.rs:1283— 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 1283-3858. 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: Engine mistralrs-core/src/engine/mod.rs:200— ClassTooLong — 1377 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 200-2284. The bar is 400 significant lines; this is 977 over it, 3.44× 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:1170— ClassTooLong — 1273 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 1170-2832. The bar is 400 significant lines; this is 873 over it, 3.18× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: MultimodalPipeline mistralrs-core/src/pipeline/multimodal.rs:216— ClassTooLong — 1228 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 216-3145. The bar is 400 significant lines; this is 828 over it, 3.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: HybridCache mistralrs-core/src/kv_cache/hybrid_cache.rs:1053— ClassTooLong — 1169 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 67 methods, 5 blocks, lines 1053-4139. The bar is 400 significant lines; this is 769 over it, 2.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.
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 — 1084 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 34 methods, 4 blocks, lines 100-1551. The bar is 400 significant lines; this is 684 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: 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: 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: NormalPipeline mistralrs-core/src/pipeline/normal.rs:112— ClassTooLong — 1002 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 112-2792. The bar is 400 significant lines; this is 602 over it, 2.51× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Sequence mistralrs-core/src/sequence.rs:752— ClassTooLong — 994 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 147 methods, 2 blocks, lines 752-2250. The bar is 400 significant lines; this is 594 over it, 2.49× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: 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: Pipeline mistralrs-core/src/pipeline/mod.rs:1749— ClassTooLong — 967 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 567 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: MultimodalLoader mistralrs-core/src/pipeline/multimodal.rs:242— ClassTooLong — 902 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 242-1557. The bar is 400 significant lines; this is 502 over it, 2.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: 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: TextModel mistralrs-core/src/vision_models/gemma4/text.rs:1484— ClassTooLong — 854 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 1484-2675. The bar is 400 significant lines; this is 454 over it, 2.14× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: GGUFLoader mistralrs-core/src/pipeline/gguf.rs:147— ClassTooLong — 813 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, 3 blocks, lines 147-1431. The bar is 400 significant lines; this is 413 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: NormalLoader mistralrs-core/src/pipeline/normal.rs:315— ClassTooLong — 771 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 315-1491. The bar is 400 significant lines; this is 371 over it, 1.93× 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 — 767 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-1241. The bar is 400 significant lines; this is 367 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.
ClassTooLong: GatedDeltaNet mistralrs-core/src/gdn/layer.rs:185— ClassTooLong — 757 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-1084. The bar is 400 significant lines; this is 357 over it, 1.89× 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: MistralRsForServerBuilder mistralrs-server-core/src/mistralrs_for_server_builder.rs:183— ClassTooLong — 749 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 62 methods, 3 blocks, lines 183-1383. The bar is 400 significant lines; this is 349 over it, 1.87× 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 (12 lines × 2) mistralrs/src/blocking.rs:50— mistralrs/src/blocking.rs:50-61 | mistralrs/src/blocking.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 (12 lines × 2) mistralrs-cli/src/commands/quantize.rs:223— mistralrs-cli/src/commands/quantize.rs:223-234 | mistralrs-cli/src/commands/serve.rs:1134-1145 — 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:655— mistralrs-cli/src/commands/quantize.rs:655-666 | mistralrs-cli/src/commands/quantize.rs:690-701 — both copies are in the same file, so extract the block into 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:339-350 — 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/gdn.rs:4672— mistralrs-core/src/cuda/gdn.rs:4672-4683 | mistralrs-core/src/cuda/gdn.rs:4708-4719 — both copies are in the same file, so extract the block into 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/hybrid_cache.rs:1624— mistralrs-core/src/kv_cache/hybrid_cache.rs:1624-1635 | mistralrs-core/src/kv_cache/hybrid_cache.rs:1685-1696 — both copies are in the same file, so extract the block into 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:847— mistralrs-core/src/layers.rs:847-858 | mistralrs-core/src/layers.rs:2183-2194 — both copies are in the same file, so extract the block into 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:891— mistralrs-core/src/model_loader.rs:891-902 | 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:459— mistralrs-core/src/models/glm4.rs:459-470 | mistralrs-core/src/models/glm4_moe.rs:748-759 — 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/qwen3_next.rs:356— mistralrs-core/src/models/qwen3_next.rs:356-367 | mistralrs-core/src/vision_models/qwen3_5/text.rs:400-411 — 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:266— mistralrs-core/src/paged_attention/cache_engine.rs:266-277 | mistralrs-core/src/paged_attention/cache_engine.rs:422-433 — both copies are in the same file, so extract the block into 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/paged_attention/layers/paged_attention.rs:1038— mistralrs-core/src/paged_attention/layers/paged_attention.rs:1038-1049 | mistralrs-core/src/paged_attention/layers/paged_attention.rs:1633-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 (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:694— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:694-705 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5077-5095 — both copies are in the same file, so extract the block into 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:4973— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4973-4984 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4997-5008 — both copies are in the same file, so extract the block into 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:7879— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7879-7890 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7894-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 (12 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8925— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8925-8936 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6139-6150 — 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:3688— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3688-3699 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3914-3925 — both copies are in the same file, so extract the block into 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:669— mistralrs-core/src/pipeline/multimodal.rs:669-680 | mistralrs-core/src/pipeline/normal.rs:682-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 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:2564— mistralrs-core/src/pipeline/multimodal.rs:2564-2575 | mistralrs-core/src/pipeline/normal.rs:2336-2347 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/response.rs:461— mistralrs-core/src/response.rs:461-472 | mistralrs-core/src/response.rs:479-490 — both copies are in the same file, so extract the block into 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/src/auto_model.rs:111— mistralrs/src/auto_model.rs:111-123 | mistralrs/src/text_model.rs:143-155 — 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 (13 lines × 2) mistralrs/src/messages.rs:519— mistralrs/src/messages.rs:519-531 | mistralrs/src/messages.rs:1210-1222 — both copies are in the same file, so extract the block into 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/src/model.rs:647— mistralrs/src/model.rs:647-659 | mistralrs/src/model.rs:724-736 — both copies are in the same file, so extract the block into 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/src/model_builder_trait.rs:1100— mistralrs/src/model_builder_trait.rs:1100-1112 | mistralrs/src/model_builder_trait.rs:1511-1523 — both copies are in the same file, so extract the block into 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/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/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-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/quantize.rs:200— mistralrs-cli/src/commands/quantize.rs:200-212 | mistralrs-cli/src/commands/serve.rs:1111-1123 — 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-core/src/cuda/gdn.rs:2289— mistralrs-core/src/cuda/gdn.rs:2289-2301 | mistralrs-core/src/cuda/gdn.rs:2548-2560 — both copies are in the same file, so extract the block into 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:159-171 — 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/gguf/normal_config.rs:1357— mistralrs-core/src/gguf/normal_config.rs:1357-1369 | mistralrs-core/src/gguf/normal_config.rs:2173-2185 — both copies are in the same file, so extract the block into 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:1200— mistralrs-core/src/kv_cache/mod.rs:1200-1212 | mistralrs-core/src/kv_cache/mod.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 (13 lines × 2) mistralrs-core/src/layers.rs:995— mistralrs-core/src/layers.rs:995-1007 | mistralrs-core/src/layers.rs:2273-2285 — both copies are in the same file, so extract the block into 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:1151— mistralrs-core/src/layers.rs:1151-1163 | mistralrs-core/src/layers.rs:1241-1253 — both copies are in the same file, so extract the block into 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:752— mistralrs-core/src/model_loader.rs:752-764 | 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/gemma2.rs:579— mistralrs-core/src/models/gemma2.rs:579-591 | mistralrs-core/src/vision_models/gemma3/text.rs:751-763 — 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:866— mistralrs-core/src/models/glm4_moe.rs:866-878 | mistralrs-core/src/models/glm4_moe.rs:906-918 — both copies are in the same file, so extract the block into 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:142— mistralrs-core/src/models/quantized_llama.rs:142-154 | 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:5337— mistralrs-core/src/ops.rs:5337-5349 | mistralrs-core/src/ops.rs:5770-5782 — both copies are in the same file, so extract the block into 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/loaders/embedding_loaders.rs:481— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:481-493 | mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:670-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 (13 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:817— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:817-829 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:849-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 (11 lines × 2) mistralrs/src/anymoe.rs:44— mistralrs/src/anymoe.rs:44-54 | mistralrs/src/anymoe.rs:68-78 — both copies are in the same file, so extract the block into 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/args/mod.rs:849— mistralrs-cli/src/args/mod.rs:849-859 | mistralrs-cli/src/args/mod.rs:922-932 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) mistralrs-cli/src/commands/run/mod.rs:123— mistralrs-cli/src/commands/run/mod.rs:123-133 | mistralrs-cli/src/commands/serve.rs:136-146 — 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 5 separate duplicated blocks between them, totalling at least 82 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (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/gdn/backend.rs:870— mistralrs-core/src/gdn/backend.rs:870-880 | mistralrs-core/src/gdn/backend.rs:992-1002 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) mistralrs-core/src/gguf/normal_config.rs:233— mistralrs-core/src/gguf/normal_config.rs:233-243 | mistralrs-core/src/gguf/normal_config.rs:294-304 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) mistralrs-core/src/kv_cache/mod.rs:1450— mistralrs-core/src/kv_cache/mod.rs:1450-1460 | mistralrs-core/src/kv_cache/mod.rs:1550-1560 — both copies are in the same file, so extract the block into 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:480— mistralrs-core/src/model_loader.rs:480-490 | 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:939— mistralrs-core/src/models/deepseek2.rs:939-949 | mistralrs-core/src/models/deepseek3.rs:1002-1012 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:736— mistralrs-core/src/models/glm4_moe.rs:736-746 | mistralrs-core/src/models/granite.rs:1972-1982 — 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/granite.rs:1412— mistralrs-core/src/models/granite.rs:1412-1422 | mistralrs-core/src/models/granite.rs:1433-1443 — both copies are in the same file, so extract the block into 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/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:5316— mistralrs-core/src/ops.rs:5316-5326 | mistralrs-core/src/ops.rs:5746-5756 — both copies are in the same file, so extract the block into 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:273-283 — 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:1129— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1129-1139 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1158-1168 — both copies are in the same file, so extract the block into 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:2822— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2822-2832 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2851-2861 — both copies are in the same file, so extract the block into 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:3136— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3136-3146 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3165-3175 — both copies are in the same file, so extract the block into 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:1002— mistralrs-core/src/pipeline/multimodal.rs:1002-1012 | mistralrs-core/src/pipeline/normal.rs:984-994 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:2534— mistralrs-core/src/pipeline/multimodal.rs:2534-2544 | mistralrs-core/src/pipeline/normal.rs:2256-2266 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:980-990 — 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.
mistralrs_quant::distributed::layers::load_packed_weights (cognitive 68) mistralrs-quant/src/distributed/layers.rs:434— 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::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:1106— 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::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::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::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::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:2362— 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:2142— 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:2252— 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::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::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::cutile::fp8_w8a8::launch (cognitive 24) mistralrs-quant/src/cutile/fp8_w8a8.rs:510— mistralrs_quant::cutile::fp8_w8a8::launch has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 5, match/switch 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
mistralrs_quant::fp8_config::compressed_tensors_spec (cognitive 24) mistralrs-quant/src/fp8_config.rs:930— mistralrs_quant::fp8_config::compressed_tensors_spec has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 4, match/switch 3 (4 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.
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.
mistralrs_quant::cutile::nvfp4_gemv::launch (cognitive 24) mistralrs-quant/src/cutile/nvfp4_gemv.rs:247— mistralrs_quant::cutile::nvfp4_gemv::launch has cognitive complexity 24 (threshold 15). Drivers by points: if/else 17 (19 pts), match/switch 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.
Duplicated block (15 lines × 2) mistralrs-cli/src/commands/config.rs:89— mistralrs-cli/src/commands/config.rs:89-103 | mistralrs-cli/src/commands/config.rs:261-275 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) mistralrs-core/src/cuda/gdn.rs:4560— mistralrs-core/src/cuda/gdn.rs:4560-4574 | mistralrs-core/src/cuda/gdn.rs:4809-4823 — both copies are in the same file, so extract the block into 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/model_loader.rs:838— mistralrs-core/src/model_loader.rs:838-852 | 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:1046— mistralrs-core/src/models/granite.rs:1046-1060 | mistralrs-core/src/models/granite.rs:1217-1231 — both copies are in the same file, so extract the block into 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:2136— mistralrs-core/src/models/granite.rs:2136-2150 | mistralrs-core/src/models/qwen3_next.rs:931-945 — 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/pipeline/loaders/multimodal_loaders.rs:2894— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2894-2908 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3208-3222 — both copies are in the same file, so extract the block into 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:915— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:915-929 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2197-2211 — both copies are in the same file, so extract the block into 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:4769— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4769-4783 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6376-6390 — both copies are in the same file, so extract the block into 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:1393— mistralrs-core/src/pipeline/multimodal.rs:1393-1407 | mistralrs-core/src/pipeline/normal.rs:1415-1429 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1573— mistralrs-core/src/pipeline/multimodal.rs:1573-1587 | mistralrs-core/src/pipeline/normal.rs:1504-1518 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:584— mistralrs-core/src/vision_models/gemma4/text.rs:584-598 | mistralrs-core/src/vision_models/gemma4/text.rs:617-631 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) 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 (15 lines × 2) REDACTED:1331— REDACTED:1331-1345 | REDACTED:277-291 — `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 (15 lines × 2) mistralrs-core/src/vision_models/llava/llava15.rs:318— mistralrs-core/src/vision_models/llava/llava15.rs:318-332 | mistralrs-core/src/vision_models/llava/llava_next.rs:517-531 — 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 (15 lines × 2) mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:242— mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:242-256 | mistralrs-core/src/vision_models/llava/llava_inputs_processor.rs:508-522 — both copies are in the same file, so extract the block into 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/llava/llava_next_inputs_processor.rs:278— mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:278-292 | mistralrs-core/src/vision_models/llava/llava_next_inputs_processor.rs:515-529 — both copies are in the same file, so extract the block into 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/qwen2vl/inputs_processor.rs:560— mistralrs-core/src/vision_models/qwen2vl/inputs_processor.rs:560-574 | mistralrs-core/src/vision_models/qwen3_vl/inputs_processor.rs:729-743 — `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 (15 lines × 2) mistralrs-core/src/vision_models/qwen3_5/text.rs:2135— mistralrs-core/src/vision_models/qwen3_5/text.rs:2135-2149 | mistralrs-core/src/vision_models/qwen3_5/text.rs:2161-2175 — both copies are in the same file, so extract the block into 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/src/agent.rs:253— mistralrs/src/agent.rs:253-268 | mistralrs/src/agent.rs:329-344 — both copies are in the same file, so extract the block into 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/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:5364— mistralrs-core/src/ops.rs:5364-5379 | mistralrs-core/src/ops.rs:5800-5815 — both copies are in the same file, so extract the block into 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:474— mistralrs-core/src/pipeline/embedding.rs:474-489 | mistralrs-core/src/pipeline/multimodal.rs:1005-1020 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 163 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:2156— mistralrs-core/src/pipeline/inputs_processor.rs:2156-2171 | mistralrs-core/src/pipeline/inputs_processor.rs:2245-2260 — both copies are in the same file, so extract the block into 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:1495— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1495-1510 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1531-1546 — both copies are in the same file, so extract the block into 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:2115— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2115-2130 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2153-2168 — both copies are in the same file, so extract the block into 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:6443— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6443-6458 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6867-6882 — both copies are in the same file, so extract the block into 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:8620— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8620-8635 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:9637-9652 — both copies are in the same file, so extract the block into 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:1728— mistralrs-core/src/pipeline/multimodal.rs:1728-1743 | mistralrs-core/src/pipeline/normal.rs:1657-1672 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:301— mistralrs-core/src/utils/gguf_metadata.rs:301-316 | mistralrs-core/src/utils/gguf_metadata.rs:350-365 — both copies are in the same file, so extract the block into 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:632-647 — both copies are in the same file, so extract the block into 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:562— mistralrs-core/src/vision_models/phi3/mod.rs:562-577 | 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:1334— mistralrs-core/src/vision_models/phi3/mod.rs:1334-1349 | mistralrs-core/src/vision_models/phi4/mod.rs:496-511 — `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 47 separate duplicated blocks between them, totalling at least 548 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 19 separate duplicated blocks between them, totalling at least 362 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.
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/models/quantized_llama.rs:212— // 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:598— // 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/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/attention/mod.rs:496— // TODO: bench? — 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/diffusion_models/clip/text.rs:43— // TODO rewrite to be more similar to https://github.com/huggingface/transformers/blob/f6fa0f0bf0796ac66f201f23bdb8585de1609add/src/transformers/models/clip/modeling_clip.py#L142
TodoComment mistralrs-core/src/diffusion_models/clip/text.rs:278— // TODO: rewrrite to newer version — 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/diffusion_models/t5/mod.rs:381— // TODO: Use flash_attn. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment mistralrs-core/src/diffusion_models/t5/mod.rs:449— // TODO: position_bias_masked? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment mistralrs-core/src/diffusion_models/t5/mod.rs:646— // TODO: Cache masks — 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/gguf/mod.rs:55— // - Case-insensitive variant matching (TODO: is this desirable?) — 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/gguf/gguf_tokenizer.rs:277— // TODO: Add support for additional tokenizer models: WordPiece, WordLevel — 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:281— // TODO: Normalize value types to spec — 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/normal.rs:959— // TODO: PagedAttention is not supported with CPU for now. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment mistralrs-core/src/pipeline/multimodal.rs:977— // TODO: PagedAttention is not supported with CPU for now. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment mistralrs-core/src/pipeline/mod.rs:1304— // TODO: Replace is_xlora queries to check via kind instead: — 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/amoe.rs:638— // TODO: get block tables/handle it for PagedAttention — 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/amoe.rs:751— // TODO incorrect for PagedAttention — 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/loaders/embedding_loaders.rs:567— // 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/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.
TodoComment mistralrs-core/src/utils/varbuilder_utils.rs:178— // 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:209— // 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:313— // 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/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.
Duplicated block (14 lines × 2) mistralrs/src/model_builder_trait.rs:784— mistralrs/src/model_builder_trait.rs:784-797 | mistralrs/src/model_builder_trait.rs:1373-1386 — both copies are in the same file, so extract the block into 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:927— mistralrs-core/src/cuda/gdn.rs:927-940 | mistralrs-core/src/cuda/gdn.rs:1053-1066 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) mistralrs-core/src/cuda/gdn.rs:4812— mistralrs-core/src/cuda/gdn.rs:4812-4825 | mistralrs-core/src/cuda/gdn.rs:5069-5082 — both copies are in the same file, so extract the block into 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:562— mistralrs-core/src/model_loader.rs:562-575 | 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:1287— mistralrs-core/src/models/granite.rs:1287-1300 | mistralrs-core/src/models/granite.rs:1309-1322 — both copies are in the same file, so extract the block into 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:332-345 — `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:1640— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1640-1653 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5447-5460 — both copies are in the same file, so extract the block into 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:3734— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3734-3747 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3972-3985 — both copies are in the same file, so extract the block into 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:612— mistralrs-core/src/vision_models/phi3/mod.rs:612-625 | 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:1169— mistralrs-core/src/vision_models/phi3/mod.rs:1169-1182 | 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 19 separate duplicated blocks between them, totalling at least 362 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-paged-attn/src/cuda/backend/flash_attn_sinks.rs:109— mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:109-122 | mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:265-278 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (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:77-90 — 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 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 (14 lines × 2) mistralrs-quant/src/afq/mod.rs:458— mistralrs-quant/src/afq/mod.rs:458-471 | mistralrs-quant/src/afq/mod.rs:504-517 — both copies are in the same file, so extract the block into 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.
mistralrs_quant::afq::ops::cuda_backend::afq_mm_op (cyclomatic 58) mistralrs-quant/src/afq/ops.rs:2942— 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::afq::ops::cuda_backend::afq_quantize_op (cyclomatic 36) mistralrs-quant/src/afq/ops.rs:1929— 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:434— 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:1106— 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:2142— 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::try_fused_gate_up_metal (cyclomatic 27) mistralrs-quant/src/lib.rs:2455— mistralrs_quant::try_fused_gate_up_metal 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:2362— 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_qkv_metal (cyclomatic 24) mistralrs-quant/src/lib.rs:2598— mistralrs_quant::try_fused_qkv_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::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::try_fused_quantized_gate_up (cyclomatic 23) mistralrs-quant/src/lib.rs:2252— 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::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::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::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::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::rotary::cuda::launch_rotary (cyclomatic 21) mistralrs-quant/src/rotary/mod.rs:916— mistralrs_quant::rotary::cuda::launch_rotary 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::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.
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::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.
Duplicated block (18 lines × 2) mistralrs/src/model_builder_trait.rs:433— mistralrs/src/model_builder_trait.rs:433-450 | mistralrs/src/model_builder_trait.rs:506-523 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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-cli/src/commands/config.rs:57— mistralrs-cli/src/commands/config.rs:57-74 | mistralrs-cli/src/commands/config.rs:229-246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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/cuda/gdn.rs:1918— mistralrs-core/src/cuda/gdn.rs:1918-1935 | mistralrs-core/src/cuda/gdn.rs:5770-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 (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:428-445 — `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 26 separate duplicated blocks between them, totalling at least 362 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:543— mistralrs-core/src/models/hunyuan_v1_dense.rs:543-560 | mistralrs-core/src/models/hunyuan_v1_moe.rs:1037-1054 — 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 686 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:493— mistralrs-core/src/models/llama.rs:493-510 | mistralrs-core/src/models/smollm3.rs:512-529 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:534— mistralrs-core/src/models/mistral.rs:534-551 | 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 42 separate duplicated blocks between them, totalling at least 550 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/inputs_processor.rs:2183— mistralrs-core/src/pipeline/inputs_processor.rs:2183-2200 | mistralrs-core/src/pipeline/inputs_processor.rs:2219-2236 — both copies are in the same file, so extract the block into 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:1626— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1626-1643 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1911-1928 — both copies are in the same file, so extract the block into 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:1892— mistralrs-core/src/pipeline/multimodal.rs:1892-1909 | mistralrs-core/src/pipeline/normal.rs:2214-2231 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:2066— mistralrs-core/src/pipeline/multimodal.rs:2066-2083 | mistralrs-core/src/pipeline/normal.rs:1896-1913 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:2101— mistralrs-core/src/pipeline/multimodal.rs:2101-2118 | mistralrs-core/src/pipeline/normal.rs:1924-1941 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1105-1122 — 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 (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-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:2243— mistralrs-core/src/models/granite.rs:2243-2259 | 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:5411— mistralrs-core/src/ops.rs:5411-5427 | mistralrs-core/src/ops.rs:6174-6190 — both copies are in the same file, so extract the block into 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:566— mistralrs-core/src/pipeline/ggml.rs:566-582 | mistralrs-core/src/pipeline/gguf.rs:1549-1565 — 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:3806— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3806-3822 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3841-3857 — both copies are in the same file, so extract the block into 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:488— mistralrs-core/src/pipeline/multimodal.rs:488-504 | mistralrs-core/src/pipeline/normal.rs:591-607 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:830— mistralrs-core/src/pipeline/multimodal.rs:830-846 | mistralrs-core/src/pipeline/normal.rs:814-830 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1607— mistralrs-core/src/pipeline/multimodal.rs:1607-1623 | mistralrs-core/src/pipeline/normal.rs:1538-1554 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1649— mistralrs-core/src/pipeline/multimodal.rs:1649-1665 | mistralrs-core/src/pipeline/normal.rs:1579-1595 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:277— mistralrs-core/src/tools/state.rs:277-293 | mistralrs-core/src/tools/state.rs:325-341 — both copies are in the same file, so extract the block into 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/mod.rs:524— mistralrs-core/src/vision_models/qwen3_5/mod.rs:524-540 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:520-536 — `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 408 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:2643— mistralrs-core/src/vision_models/qwen3_5/text.rs:2643-2659 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:904-920 — `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 416 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 28 separate duplicated blocks between them, totalling at least 500 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 28 separate duplicated blocks between them, totalling at least 500 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 28 separate duplicated blocks between them, totalling at least 500 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 28 separate duplicated blocks between them, totalling at least 500 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:527— mistralrs-core/src/xlora_models/mistral.rs:527-543 | mistralrs-core/src/xlora_models/mixtral.rs:657-673 — 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 53 separate duplicated blocks between them, totalling at least 787 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:400-416 — 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-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-paged-attn/src/cuda/backend/paged_attention.rs:275— mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:275-291 | mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:630-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.
+ 8 more in this group — see findings.md.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×30
Members sharing a duplicated core (4 members, 50+ identical tokens) 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:1078— mistralrs-core/src/layers.rs:1078-1183 | mistralrs-core/src/layers.rs:1190-1273 | mistralrs-core/src/layers.rs:1280-1357 | mistralrs-core/src/layers.rs:1437-1542 — 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-791 | mistralrs-core/src/models/deepseek3.rs:842-854 | mistralrs-core/src/models/glm4_moe.rs:679-691 | mistralrs-core/src/models/glm4_moe_lite.rs:789-801 — 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:1627— mistralrs-core/src/models/granite.rs:1627-1691 | 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/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/llama.rs:520— mistralrs-core/src/models/llama.rs:520-531 | mistralrs-core/src/models/smollm3.rs:539-550 | mistralrs-core/src/vision_models/llama4/text.rs:1014-1025 | 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:3437— mistralrs-core/src/pipeline/cuda_graph.rs:3437-3447 | mistralrs-core/src/pipeline/cuda_graph.rs:3455-3465 | mistralrs-core/src/pipeline/cuda_graph.rs:3474-3484 | mistralrs-core/src/pipeline/cuda_graph.rs:3493-3503 — 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:2884— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2884-2956 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3198-3263 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3529-3630 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4248-4322 — 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:2782— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2782-2845 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3088-3151 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4237-4295 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4538-4594 — 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:2930— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2930-3011 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3236-3317 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4380-4461 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4679-4759 — 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/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:163-278 | mistralrs-quant/src/utils/ops.rs:2229-2374 | mistralrs-quant/src/utils/ops.rs:2453-2544 — 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:59— mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:59-85 | mistralrs-quant/src/gguf/cuda.rs:102-124 | 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:1407— mistralrs-pyo3/src/lib.rs:1407-1777 | mistralrs-pyo3/src/lib.rs:1891-1993 | mistralrs-pyo3/src/lib.rs:2368-2738 | mistralrs-pyo3/src/lib.rs:2745-2847 — 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/blockwise_fp8/mma.rs:134— mistralrs-quant/src/blockwise_fp8/mma.rs:134-181 | mistralrs-quant/src/blockwise_fp8/ops.rs:778-890 | mistralrs-quant/src/blockwise_fp8/ops.rs:1624-1719 | mistralrs-quant/src/cutile/nvfp4_glu.rs:421-593 — 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/cutile/fp8_gemm.rs:157— mistralrs-quant/src/cutile/fp8_gemm.rs:157-169 | mistralrs-quant/src/cutile/fp8_w8a16.rs:336-348 | mistralrs-quant/src/cutile/fp8_w8a8.rs:292-304 | mistralrs-quant/src/cutile/mod.rs:332-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.
Duplicated block (19 lines × 2) mistralrs/src/anymoe.rs:118— mistralrs/src/anymoe.rs:118-136 | mistralrs/src/model_builder_trait.rs:939-957 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (19 lines × 2) 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-cli/src/commands/run/mod.rs:101— mistralrs-cli/src/commands/run/mod.rs:101-119 | mistralrs-cli/src/commands/serve.rs:112-130 — 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 5 separate duplicated blocks between them, totalling at least 82 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) mistralrs-core/src/cuda/gdn.rs:964— mistralrs-core/src/cuda/gdn.rs:964-982 | mistralrs-core/src/cuda/gdn.rs:1210-1228 — both copies are in the same file, so extract the block into 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:3403— mistralrs-core/src/cuda/gdn.rs:3403-3421 | mistralrs-core/src/cuda/gdn.rs:3952-3970 — both copies are in the same file, so extract the block into 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 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 48 separate duplicated blocks between them, totalling at least 605 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:320-338 — 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 27 separate duplicated blocks between them, totalling at least 411 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:5121-5139 — both copies are in the same file, so extract the block into 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:5381— mistralrs-core/src/ops.rs:5381-5399 | mistralrs-core/src/ops.rs:5817-5835 — both copies are in the same file, so extract the block into 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:2614— mistralrs-core/src/pipeline/inputs_processor.rs:2614-2632 | mistralrs-core/src/pipeline/inputs_processor.rs:2763-2781 — both copies are in the same file, so extract the block into 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:714— mistralrs-core/src/pipeline/multimodal.rs:714-732 | mistralrs-core/src/pipeline/normal.rs:1007-1025 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1708— mistralrs-core/src/pipeline/multimodal.rs:1708-1726 | mistralrs-core/src/pipeline/normal.rs:1637-1655 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:3082— mistralrs-core/src/pipeline/multimodal.rs:3082-3100 | mistralrs-core/src/pipeline/normal.rs:2721-2739 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/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:1257— mistralrs-core/src/vision_models/phi3/mod.rs:1257-1275 | mistralrs-core/src/vision_models/phi4/mod.rs:372-390 — `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 47 separate duplicated blocks between them, totalling at least 548 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-core/src/vision_models/qwen3_5/mod.rs:132— mistralrs-core/src/vision_models/qwen3_5/mod.rs:132-150 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:117-135 — `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 408 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 (10 lines × 3) mistralrs-core/src/cuda/gdn.rs:1647— mistralrs-core/src/cuda/gdn.rs:1647-1656 | mistralrs-core/src/cuda/gdn.rs:5513-5522 | mistralrs-core/src/cuda/gdn.rs:5751-5760 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:1174— mistralrs-core/src/layers.rs:1174-1183 | mistralrs-core/src/layers.rs:1264-1273 | mistralrs-core/src/layers.rs:1533-1542 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:3041— mistralrs-core/src/layers.rs:3041-3050 | mistralrs-core/src/layers.rs:3174-3183 | mistralrs-core/src/vision_models/gemma4/text.rs:132-144 — 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/ops.rs:5462— mistralrs-core/src/ops.rs:5462-5471 | mistralrs-core/src/ops.rs:5907-5916 | mistralrs-core/src/ops.rs:6225-6234 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:268— mistralrs-core/src/pipeline/embedding.rs:268-277 | mistralrs-core/src/pipeline/multimodal.rs:686-696 | mistralrs-core/src/pipeline/normal.rs:699-709 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 163 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/embedding.rs:542— mistralrs-core/src/pipeline/embedding.rs:542-551 | mistralrs-core/src/pipeline/multimodal.rs:1040-1049 | mistralrs-core/src/pipeline/normal.rs:1045-1054 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 163 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:566— mistralrs-core/src/pipeline/ggml.rs:566-575 | mistralrs-core/src/pipeline/gguf.rs:1538-1547 | mistralrs-core/src/pipeline/gguf.rs:1549-1558 — 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:567-576 | 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-core/src/metal/gdn.rs:416— mistralrs-core/src/metal/gdn.rs:416-425 | mistralrs-core/src/metal/gdn.rs:454-463 | mistralrs-core/src/metal/ssm.rs:187-196 — before extracting anything, compare `mistralrs-core/src/metal/gdn.rs` and `mistralrs-core/src/metal/ssm.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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-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:4921-4930 — all 3 copies are in the same file, so extract the block into one function there and call it from 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/models/gemma2.rs:588— mistralrs-core/src/models/gemma2.rs:588-594 | mistralrs-core/src/vision_models/gemma3/text.rs:760-766 | 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:387-393 | 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:606— mistralrs-core/src/pipeline/embedding.rs:606-612 | mistralrs-core/src/pipeline/multimodal.rs:1339-1345 | mistralrs-core/src/pipeline/normal.rs:1361-1367 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 163 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1101— mistralrs-core/src/pipeline/inputs_processor.rs:1101-1107 | mistralrs-core/src/pipeline/inputs_processor.rs:1118-1124 | mistralrs-core/src/pipeline/inputs_processor.rs:1198-1204 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
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/qwen3_5/text.rs:1473— mistralrs-core/src/vision_models/qwen3_5/text.rs:1473-1479 | mistralrs-core/src/vision_models/qwen3_5/text.rs:1502-1508 | mistralrs-core/src/vision_models/qwen3_5/text.rs:1691-1697 — all 3 copies are in the same file, so extract the block into one function there and call it from 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-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:66-72 — 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:37-43 | mistralrs-paged-attn/src/metal/backend/mod.rs:14-20 — 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:424— mistralrs-paged-attn/src/metal/kernels/mod.rs:424-430 | mistralrs-paged-attn/src/metal/kernels/mod.rs:567-573 | mistralrs-paged-attn/src/metal/kernels/mod.rs:646-652 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:302— mistralrs-quant/src/blockwise_fp8/mod.rs:302-308 | mistralrs-quant/src/blockwise_fp8/mod.rs:348-354 | mistralrs-quant/src/blockwise_fp8/mod.rs:654-660 — all 3 copies are in the same file, so extract the block into one function there and call it from 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/cutile/gdn_prefill.rs:195— mistralrs-quant/src/cutile/gdn_prefill.rs:195-201 | mistralrs-quant/src/cutile/gdn_prefill.rs:351-357 | mistralrs-quant/src/cutile/gdn_prefill.rs:365-371 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:591— mistralrs-core/src/models/llama.rs:591-597 | mistralrs-core/src/models/smollm3.rs:610-616 | 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 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:598— mistralrs-core/src/models/llama.rs:598-604 | mistralrs-core/src/models/smollm3.rs:617-623 | 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 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:234-240 | mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:241-247 — 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/cuda/gdn.rs:2159— mistralrs-core/src/cuda/gdn.rs:2159-2164 | mistralrs-core/src/cuda/gdn.rs:2170-2174 | mistralrs-core/src/cuda/gdn.rs:2180-2184 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:1165— mistralrs-core/src/layers.rs:1165-1169 | mistralrs-core/src/layers.rs:1255-1259 | mistralrs-core/src/layers.rs:1524-1528 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
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 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 (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 48 separate duplicated blocks between them, totalling at least 605 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/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:889— mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:889-893 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:543-547 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:665-669 — `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 19 separate duplicated blocks between them, totalling at least 218 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-paged-attn/src/cuda/backend/paged_attention.rs:62— mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:62-66 | mistralrs-quant/src/gguf/fast_mmq.rs:353-357 | mistralrs-quant/src/gguf/fast_mmvq.rs:95-99 — 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 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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/cuda.rs:107— mistralrs-quant/src/gguf/cuda.rs:107-111 | 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 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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-quant/src/afq/ops.rs:1969— mistralrs-quant/src/afq/ops.rs:1969-1973 | mistralrs-quant/src/afq/ops.rs:2087-2091 | mistralrs-quant/src/afq/ops.rs:2205-2209 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:2984— mistralrs-core/src/cuda/gdn.rs:2984-2988 | mistralrs-core/src/cuda/gdn.rs:4672-4676 | mistralrs-core/src/cuda/gdn.rs:4708-4712 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:231-235 | 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:899-903 | mistralrs-core/src/gguf/qwen_multimodal_bindings.rs:303-307 — 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:293-297 | mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:425-429 — 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 (5 lines × 3) mistralrs-quant/src/gemv/mod.rs:397— mistralrs-quant/src/gemv/mod.rs:397-401 | mistralrs-quant/src/gemv/mod.rs:465-469 | mistralrs-quant/src/gemv/mod.rs:533-537 — all 3 copies are in the same file, so extract the block into one function there and call it from 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 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-cli/src/commands/config.rs:110— mistralrs-cli/src/commands/config.rs:110-130 | mistralrs-cli/src/commands/config.rs:278-298 — both copies are in the same file, so extract the block into 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:844-864 — 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:1082— mistralrs-core/src/layers.rs:1082-1102 | mistralrs-core/src/layers.rs:1441-1461 — both copies are in the same file, so extract the block into 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:4640— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4640-4660 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5029-5049 — both copies are in the same file, so extract the block into 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:6183— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6183-6203 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6548-6568 — both copies are in the same file, so extract the block into 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:6985— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6985-7005 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7403-7423 — both copies are in the same file, so extract the block into 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:543— mistralrs-core/src/pipeline/multimodal.rs:543-563 | mistralrs-core/src/pipeline/normal.rs:645-665 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:778— mistralrs-core/src/pipeline/multimodal.rs:778-798 | mistralrs-core/src/pipeline/multimodal.rs:842-862 — both copies are in the same file, so extract the block into 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:1370— mistralrs-core/src/pipeline/multimodal.rs:1370-1390 | mistralrs-core/src/pipeline/normal.rs:1392-1412 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1892— mistralrs-core/src/speculative/dflash.rs:1892-1912 | mistralrs-core/src/speculative/dflash.rs:1985-2005 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (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 19 separate duplicated blocks between them, totalling at least 362 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/vision_models/qwen3_5/mod.rs:378— mistralrs-core/src/vision_models/qwen3_5/mod.rs:378-398 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:365-385 — `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 408 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/xlora_models/phi2.rs:315— mistralrs-core/src/xlora_models/phi2.rs:315-335 | mistralrs-core/src/xlora_models/starcoder2.rs:315-335 — 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:868— mistralrs-quant/src/distributed/layers.rs:868-888 | mistralrs-quant/src/distributed/layers.rs:1330-1350 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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 (11 lines × 3) mistralrs-core/src/cuda/gdn.rs:907— mistralrs-core/src/cuda/gdn.rs:907-917 | mistralrs-core/src/cuda/gdn.rs:1031-1041 | mistralrs-core/src/cuda/gdn.rs:1142-1152 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:1136— mistralrs-core/src/layers.rs:1136-1146 | mistralrs-core/src/layers.rs:1226-1236 | mistralrs-core/src/layers.rs:1495-1505 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:1054— mistralrs-core/src/models/deepseek2.rs:1054-1064 | mistralrs-core/src/models/deepseek3.rs:1119-1129 | mistralrs-core/src/models/glm4_moe_lite.rs:1073-1083 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 48 separate duplicated blocks between them, totalling at least 605 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:1139— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1139-1149 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2832-2842 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3146-3156 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:7219— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7219-7229 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7678-7688 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5863-5873 — 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:452— mistralrs-core/src/vision_models/gemma3/text.rs:452-462 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:407-417 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:528-538 — `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-core/src/vision_models/qwen3_5/text.rs:1242— mistralrs-core/src/vision_models/qwen3_5/text.rs:1242-1252 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:399-409 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:520-530 — `mistralrs-core/src/vision_models/qwen3_5/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 14 separate duplicated blocks between them, totalling at least 175 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/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/afq/ops.rs:2387— mistralrs-quant/src/afq/ops.rs:2387-2397 | mistralrs-quant/src/afq/ops.rs:2413-2423 | mistralrs-quant/src/afq/ops.rs:2439-2449 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:792— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:792-802 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3431-3441 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1722-1732 — 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:4907— mistralrs-core/src/cuda/gdn.rs:4907-4917 | mistralrs-core/src/cuda/gdn.rs:5107-5118 | mistralrs-core/src/cuda/gdn.rs:5334-5344 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:4938-4948 — all 3 copies are in the same file, so extract the block into one function there and call it from 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 (11 lines × 3) mistralrs-quant/src/distributed/layers.rs:2824— mistralrs-quant/src/distributed/layers.rs:2824-2834 | mistralrs-quant/src/distributed/layers.rs:2840-2850 | mistralrs-quant/src/distributed/layers.rs:2856-2866 — all 3 copies are in the same file, so extract the block into one function there and call 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_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:978— 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::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::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::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:303— 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:156— 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::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.
mistralrs_cli::commands::config::build_model_configs (cognitive 16) mistralrs-cli/src/commands/config.rs:334— 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.
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-cli/src/args/mod.rs:429— mistralrs-cli/src/args/mod.rs:429-436 | mistralrs-cli/src/commands/serve.rs:901-908 | mistralrs-cli/src/commands/serve.rs:911-918 — 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:1066— mistralrs-core/src/models/deepseek2.rs:1066-1073 | mistralrs-core/src/models/deepseek3.rs:1131-1138 | mistralrs-core/src/models/glm4_moe_lite.rs:1085-1092 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:601-608 | mistralrs-core/src/vision_models/gemma3/text.rs:744-751 — before extracting anything, compare `mistralrs-core/src/models/gemma2.rs` and `mistralrs-core/src/models/qwen2.rs` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 413 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:791-799 | 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:5034-5041 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:668-675 | mistralrs-core/src/pipeline/normal.rs:681-688 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 163 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 19 separate duplicated blocks between them, totalling at least 362 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/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:415— mistralrs-quant/src/gguf/mod.rs:415-422 | 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-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-core/src/pipeline/loaders/multimodal_loaders.rs:6908— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6908-6915 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7326-7333 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5950-5957 — 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 × 3) mistralrs-core/src/cuda/gdn.rs:901— mistralrs-core/src/cuda/gdn.rs:901-908 | mistralrs-core/src/cuda/gdn.rs:1025-1032 | mistralrs-core/src/cuda/gdn.rs:1129-1136 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:3186— mistralrs-core/src/pipeline/cuda_graph.rs:3186-3193 | mistralrs-core/src/pipeline/cuda_graph.rs:3231-3238 | mistralrs-core/src/pipeline/cuda_graph.rs:3276-3283 — all 3 copies are in the same file, so extract the block into one function there and call it from 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 (6 lines × 3) mistralrs-cli/src/commands/bench.rs:165— mistralrs-cli/src/commands/bench.rs:165-170 | mistralrs-cli/src/commands/config.rs:299-304 | mistralrs-cli/src/commands/run/mod.rs:135-140 — before extracting anything, compare `mistralrs-cli/src/commands/bench.rs` and `mistralrs-cli/src/commands/run/mod.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. 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/cuda/gdn.rs:1674— mistralrs-core/src/cuda/gdn.rs:1674-1679 | mistralrs-core/src/cuda/gdn.rs:5550-5555 | 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:1917— mistralrs-core/src/cuda/gdn.rs:1917-1922 | mistralrs-core/src/cuda/gdn.rs:2744-2749 | mistralrs-core/src/cuda/gdn.rs:5769-5774 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:1924— mistralrs-core/src/cuda/gdn.rs:1924-1929 | mistralrs-core/src/cuda/gdn.rs:2754-2759 | mistralrs-core/src/cuda/gdn.rs:5776-5781 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:645-650 — 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:1602— mistralrs-core/src/layers.rs:1602-1607 | mistralrs-core/src/layers.rs:1765-1773 | mistralrs-core/src/layers.rs:1913-1918 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:1567— mistralrs-core/src/models/granite.rs:1567-1572 | 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:908— mistralrs-core/src/moe/experts/backends.rs:908-913 | mistralrs-core/src/moe/experts/backends.rs:988-993 | 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:1280-1285 | mistralrs-core/src/pipeline/multimodal.rs:679-684 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 163 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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-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-quant/src/afq/ops.rs:2368— mistralrs-quant/src/afq/ops.rs:2368-2373 | mistralrs-quant/src/afq/ops.rs:2488-2493 | mistralrs-quant/src/afq/ops.rs:3014-3019 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:814-819 — 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 48 separate duplicated blocks between them, totalling at least 605 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:516— mistralrs-core/src/pipeline/ggml.rs:516-521 | mistralrs-core/src/pipeline/gguf.rs:1491-1496 | mistralrs-core/src/pipeline/normal.rs:1616-1621 — 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 (6 lines × 3) mistralrs-quant/src/gguf/fast_mmvq.rs:332— mistralrs-quant/src/gguf/fast_mmvq.rs:332-337 | mistralrs-quant/src/gguf/fast_mmvq.rs:532-537 | mistralrs-quant/src/gguf/fast_mmvq.rs:747-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 (23 lines × 2) mistralrs/src/model_builder_trait.rs:470— mistralrs/src/model_builder_trait.rs:470-492 | mistralrs/src/model_builder_trait.rs:544-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 (23 lines × 2) mistralrs/src/model_builder_trait.rs:627— mistralrs/src/model_builder_trait.rs:627-649 | mistralrs/src/model_builder_trait.rs:1349-1371 — both copies are in the same file, so extract the block into 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:1148— mistralrs/src/model_builder_trait.rs:1148-1170 | mistralrs/src/model_builder_trait.rs:1215-1237 — both copies are in the same file, so extract the block into 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/lib.rs:1421— mistralrs-core/src/lib.rs:1421-1443 | mistralrs-core/src/lib.rs:1477-1499 — both copies are in the same file, so extract the block into 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:5437— mistralrs-core/src/ops.rs:5437-5459 | mistralrs-core/src/ops.rs:5874-5896 — both copies are in the same file, so extract the block into 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:2728— mistralrs-core/src/pipeline/inputs_processor.rs:2728-2750 | mistralrs-core/src/pipeline/inputs_processor.rs:2777-2799 — both copies are in the same file, so extract the block into 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:910— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:910-932 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3559-3581 — both copies are in the same file, so extract the block into 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:3058— mistralrs-core/src/pipeline/multimodal.rs:3058-3080 | mistralrs-core/src/pipeline/normal.rs:2697-2719 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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) 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:12995— scripts/production_soak.py:12995-13017 | scripts/production_soak.py:13166-13188 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:12995` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) mistralrs-core/src/cuda/gdn.rs:4978— mistralrs-core/src/cuda/gdn.rs:4978-4997 | mistralrs-core/src/cuda/gdn.rs:5154-5173 — both copies are in the same file, so extract the block into 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:3862— mistralrs-core/src/layers.rs:3862-3881 | 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:364— mistralrs-core/src/models/gemma.rs:364-383 | 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 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:5280— mistralrs-core/src/ops.rs:5280-5299 | mistralrs-core/src/ops.rs:5703-5722 — both copies are in the same file, so extract the block into 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:763— mistralrs-core/src/pipeline/normal.rs:763-782 | mistralrs-core/src/pipeline/normal.rs:827-846 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) mistralrs-core/src/speculative/driver.rs:189— mistralrs-core/src/speculative/driver.rs:189-208 | mistralrs-core/src/speculative/driver.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-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:592— mistralrs-core/src/vision_models/phi3/mod.rs:592-611 | mistralrs-core/src/vision_models/phi3/mod.rs:624-643 — both copies are in the same file, so extract the block into 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/xlora_models/mistral.rs:579— mistralrs-core/src/xlora_models/mistral.rs:579-598 | mistralrs-core/src/xlora_models/mixtral.rs:709-728 — 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 53 separate duplicated blocks between them, totalling at least 787 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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 (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/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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:441— mistralrs-core/src/models/llama.rs:441-457 | mistralrs-core/src/models/smollm3.rs:464-480 | 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 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:615— mistralrs-core/src/models/llama.rs:615-631 | mistralrs-core/src/models/smollm3.rs:634-650 | 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 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/qwen2.rs:393— mistralrs-core/src/models/qwen2.rs:393-409 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:352-368 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:473-489 — before extracting anything, compare `mistralrs-core/src/models/qwen2.rs` and `mistralrs-core/src/vision_models/qwen3_vl/text.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 129 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 × 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:964— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:964-980 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3651-3667 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1821-1837 — 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_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 16 separate duplicated blocks between them, totalling at least 249 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-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.
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:5006-5012 | mistralrs-core/src/ops.rs:5278-5284 | mistralrs-core/src/ops.rs:5701-5707 — 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:638-644 — `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:393— mistralrs-core/src/vision_models/qwen3_5/mod.rs:393-399 | 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 408 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:2393— mistralrs-core/src/vision_models/qwen3_5/text.rs:2393-2399 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:801-807 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:569-575 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:691-697 — `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 416 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:2641— mistralrs-core/src/vision_models/qwen3_5/text.rs:2641-2647 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:902-908 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:558-564 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:680-686 — `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 416 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:1044— mistralrs-quant/src/blockwise_fp8/mod.rs:1044-1050 | mistralrs-quant/src/pertensor_fp8/mod.rs:632-638 | mistralrs-quant/src/unquantized/mod.rs:578-584 | 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 8 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:99— mistralrs-paged-attn/src/metal/backend/gather_kv.rs:99-105 | mistralrs-paged-attn/src/metal/backend/gather_kv.rs:109-115 | mistralrs-paged-attn/src/metal/backend/paged_attention.rs:414-422 | mistralrs-paged-attn/src/metal/backend/paged_attention.rs:426-434 — 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.
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 — 64 stored fields beside 147 methods. The bar is 30 stored fields; this is 34 over it, 2.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: 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: GgufModelBuilder mistralrs/src/gguf.rs:12— TooManyFields — 41 stored fields beside 47 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: 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: 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: ModelBuilder mistralrs/src/auto_model.rs:43— TooManyFields — 38 stored fields beside 10 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:183— TooManyFields — 37 stored fields beside 62 methods. The bar is 30 stored fields; this is 7 over it, 1.23× 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 — 37 stored fields beside 10 methods. The bar is 30 stored fields; this is 7 over it, 1.23× 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 — 36 stored fields beside 9 methods. The bar is 30 stored fields; this is 6 over it, 1.20× 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.
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::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::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::mistralrs_for_server_builder::init_mapper (cognitive 22) mistralrs-server-core/src/mistralrs_for_server_builder.rs:1412— 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::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::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::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::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::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.
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:966— 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:576— 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: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/hunyuan_v1_dense.rs:664— 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:704— 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:706— 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: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/vision_models/llava/llava_llm/mistral.rs:664— 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:647— 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:1484— 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.
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:478— mistralrs-core/src/models/qwen3.rs:478-502 | mistralrs-core/src/models/qwen3_moe.rs:661-685 — 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 59 separate duplicated blocks between them, totalling at least 760 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:2671— mistralrs-core/src/pipeline/inputs_processor.rs:2671-2695 | mistralrs-core/src/pipeline/inputs_processor.rs:2715-2739 — both copies are in the same file, so extract the block into 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:2547— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2547-2571 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3876-3900 — both copies are in the same file, so extract the block into 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:1968— mistralrs-core/src/pipeline/multimodal.rs:1968-1992 | mistralrs-core/src/pipeline/normal.rs:1809-1833 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/multimodal.rs:2313— mistralrs-core/src/pipeline/multimodal.rs:2313-2337 | mistralrs-core/src/pipeline/normal.rs:2055-2079 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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_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 28 separate duplicated blocks between them, totalling at least 500 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/text.rs:462— mistralrs-core/src/vision_models/qwen3_vl/text.rs:462-486 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:584-608 — `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 45 separate duplicated blocks between them, totalling at least 653 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:2041— mistralrs-pyo3/src/lib.rs:2041-2065 | mistralrs-pyo3/src/lib.rs:2107-2131 — both copies are in the same file, so extract the block into 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:2721— mistralrs-quant/src/distributed/layers.rs:2721-2745 | mistralrs-quant/src/distributed/layers.rs:2886-2910 — both copies are in the same file, so extract the block into 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 (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.
Duplicated block (15 lines × 3) mistralrs-core/src/models/mistral.rs:537— mistralrs-core/src/models/mistral.rs:537-551 | 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 42 separate duplicated blocks between them, totalling at least 550 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:410-424 | mistralrs-core/src/models/qwen2.rs:435-449 — 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 309 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (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 48 separate duplicated blocks between them, totalling at least 605 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:505— mistralrs-core/src/models/phi3.rs:505-519 | mistralrs-core/src/models/phi3_5_moe.rs:576-590 | mistralrs-core/src/vision_models/phi3/mod.rs:1286-1301 — 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 29 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:447-461 — 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:1168— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1168-1182 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2861-2875 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3175-3189 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:285— mistralrs-core/src/utils/gguf_metadata.rs:285-299 | mistralrs-core/src/utils/gguf_metadata.rs:318-332 | mistralrs-core/src/utils/gguf_metadata.rs:334-348 — all 3 copies are in the same file, so extract the block into one function there and call it from 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 53 separate duplicated blocks between them, totalling at least 787 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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.
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:978— 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:303— 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::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::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::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.
TooManyMethods: Sequence mistralrs-core/src/sequence.rs:752— TooManyMethods — 147 methods. The bar is 30 methods; this is 117 over it, 4.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: MistralRs mistralrs-core/src/lib.rs:440— 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 — 67 methods. The bar is 30 methods; this is 37 over it, 2.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
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:183— TooManyMethods — 62 methods. The bar is 30 methods; this is 32 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.
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: GgufModelBuilder mistralrs/src/gguf.rs:12— TooManyMethods — 47 methods. The bar is 30 methods; this is 17 over it, 1.57× 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:1283— 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: Runner mistralrs-pyo3/src/lib.rs:302— 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: PagedAttentionScheduler mistralrs-core/src/paged_attention/scheduler.rs:100— 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.
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:821— mistralrs-core/src/model_loader.rs:821-842 | mistralrs-core/src/model_loader.rs:854-875 — both copies are in the same file, so extract the block into 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:381— mistralrs-core/src/models/llama.rs:381-402 | mistralrs-core/src/models/smollm3.rs:397-418 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 29 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:5214— mistralrs-core/src/ops.rs:5214-5235 | mistralrs-core/src/ops.rs:5649-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 (22 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:9258— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:9258-9279 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:6346-6367 — 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:2808— mistralrs-core/src/pipeline/multimodal.rs:2808-2829 | mistralrs-core/src/pipeline/normal.rs:2536-2557 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/metal/backend/paged_attention.rs:173— mistralrs-paged-attn/src/metal/backend/paged_attention.rs:173-194 | mistralrs-paged-attn/src/metal/backend/paged_attention.rs:448-469 — both copies are in the same file, so extract the block into 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-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 24 separate duplicated blocks between them, totalling at least 300 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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-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:3627-3635 — 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:209-217 | 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 10 separate duplicated blocks between them, totalling at least 110 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:5299-5307 | mistralrs-core/src/ops.rs:5727-5735 | mistralrs-core/src/ops.rs:6075-6083 — 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:2342— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2342-2350 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3007-3015 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3314-3322 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7756-7764 — 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:311— mistralrs-core/src/vision_models/qwen3_5/mod.rs:311-319 | 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 408 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-core/src/vision_models/qwen3_5/text.rs:1244— mistralrs-core/src/vision_models/qwen3_5/text.rs:1244-1252 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:533-541 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:401-409 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:522-530 — `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 416 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/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:265-273 | 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 24 separate duplicated blocks between them, totalling at least 300 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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-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:2219— mistralrs-core/src/models/granite.rs:2219-2227 | mistralrs-core/src/models/lfm2.rs:1210-1218 | mistralrs-core/src/models/qwen3_next.rs:1012-1020 | 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 8 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:109— mistralrs-cli/src/commands/config.rs:109-116 | mistralrs-cli/src/commands/config.rs:277-284 | mistralrs-cli/src/commands/run/mod.rs:114-121 | mistralrs-cli/src/commands/serve.rs:125-132 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:923-931 | mistralrs-core/src/vision_models/qwen3_5/text.rs:1403-1411 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:708-716 — 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 14 separate duplicated blocks between them, totalling at least 141 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 4) mistralrs-core/src/models/phi3.rs:425— mistralrs-core/src/models/phi3.rs:425-432 | mistralrs-core/src/vision_models/gemma3/text.rs:451-459 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:406-414 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:527-535 — 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:187— mistralrs-core/src/vision_models/qwen3_5/mod.rs:187-194 | 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 408 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:250— mistralrs-core/src/vision_models/qwen3_5/mod.rs:250-257 | 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 408 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:1408— mistralrs-pyo3/src/lib.rs:1408-1415 | mistralrs-pyo3/src/lib.rs:1892-1899 | mistralrs-pyo3/src/lib.rs:2369-2376 | mistralrs-pyo3/src/lib.rs:2746-2753 — 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-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-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.
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:1914— mistralrs-core/src/cuda/gdn.rs:1914-1919 | mistralrs-core/src/cuda/gdn.rs:1921-1926 | mistralrs-core/src/cuda/gdn.rs:5773-5778 | 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:600-605 | mistralrs-core/src/vision_models/gemma3/text.rs:743-748 | mistralrs-core/src/xlora_models/gemma2.rs:645-650 — before extracting anything, compare `mistralrs-core/src/models/gemma2.rs` and `mistralrs-core/src/models/qwen2.rs` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 413 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:525— mistralrs-core/src/models/llama.rs:525-531 | mistralrs-core/src/models/smollm3.rs:544-550 | mistralrs-core/src/vision_models/llama4/text.rs:1019-1025 | 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 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:179— mistralrs-core/src/vision_models/qwen3_5/mod.rs:179-184 | 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 408 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-paged-attn/src/cuda/backend/flash_attn_sinks.rs:28— mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:28-33 | mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:166-171 | mistralrs-quant/src/utils/ops.rs:2231-2236 | mistralrs-quant/src/utils/ops.rs:2455-2460 — 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/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:584-589 — 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:303— mistralrs-quant/src/blockwise_fp8/mod.rs:303-308 | mistralrs-quant/src/blockwise_fp8/mod.rs:349-354 | mistralrs-quant/src/blockwise_fp8/mod.rs:655-660 | mistralrs-quant/src/lib.rs:1627-1632 — 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 (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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/lfm2.rs:284— 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:316-320 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:104-108 — before extracting anything, compare `mistralrs-core/src/models/lfm2.rs` and `mistralrs-core/src/models/qwen3_moe.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 129 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:560— mistralrs-core/src/models/phi3.rs:560-564 | mistralrs-core/src/models/phi3_5_moe.rs:632-636 | mistralrs-core/src/vision_models/phi3/mod.rs:1363-1367 | mistralrs-core/src/vision_models/phi4/mod.rs:525-529 — 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 29 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:3441— mistralrs-core/src/pipeline/cuda_graph.rs:3441-3445 | mistralrs-core/src/pipeline/cuda_graph.rs:3459-3463 | mistralrs-core/src/pipeline/cuda_graph.rs:3478-3482 | mistralrs-core/src/pipeline/cuda_graph.rs:3497-3501 — 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 19 separate duplicated blocks between them, totalling at least 362 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-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:213— mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:213-217 | mistralrs-paged-attn/src/cuda/backend/flash_attn_sinks.rs:222-226 | 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.
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::metal::backend::paged_attention::reshape_and_cache (cognitive 28) mistralrs-paged-attn/src/metal/backend/paged_attention.rs:392— mistralrs_paged_attn::metal::backend::paged_attention::reshape_and_cache has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 9 (11 pts), boolean chains 4 (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::cuda::backend::paged_attention::update_cache (cognitive 26) mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:485— 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::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::gather_kv::gather_kv_cache (cognitive 18) mistralrs-paged-attn/src/metal/backend/gather_kv.rs:8— 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::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::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::metal::backend::cache::swap_blocks (cognitive 16) mistralrs-paged-attn/src/metal/backend/cache.rs:112— mistralrs_paged_attn::metal::backend::cache::swap_blocks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 7). Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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:1448— 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:440— 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: PagedAttentionConfig (LCOM4 4) mistralrs-core/src/paged_attention/mod.rs:197— PagedAttentionConfig'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.
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::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::metal::backend::paged_attention::reshape_and_cache (cyclomatic 29) mistralrs-paged-attn/src/metal/backend/paged_attention.rs:392— mistralrs_paged_attn::metal::backend::paged_attention::reshape_and_cache has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
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:485— 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::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:8— 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::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::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.
Duplicated block (16 lines × 3) mistralrs/src/model_builder_trait.rs:670— mistralrs/src/model_builder_trait.rs:670-685 | mistralrs/src/model_builder_trait.rs:818-833 | mistralrs/src/model_builder_trait.rs:1425-1440 — all 3 copies are in the same file, so extract the block into one function there and call it from 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 48 separate duplicated blocks between them, totalling at least 605 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:482— mistralrs-core/src/models/phi3.rs:482-497 | mistralrs-core/src/vision_models/phi3/mod.rs:1263-1278 | mistralrs-core/src/vision_models/phi4/mod.rs:378-393 — 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 48 separate duplicated blocks between them, totalling at least 605 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:5409— mistralrs-core/src/ops.rs:5409-5424 | mistralrs-core/src/ops.rs:5846-5861 | mistralrs-core/src/ops.rs:6172-6187 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:454— mistralrs-core/src/pipeline/embedding.rs:454-469 | mistralrs-core/src/pipeline/multimodal.rs:985-1000 | mistralrs-core/src/pipeline/normal.rs:967-982 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 163 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:211— mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:211-226 | 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 19 separate duplicated blocks between them, totalling at least 218 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:527— mistralrs-core/src/xlora_models/mistral.rs:527-542 | mistralrs-core/src/xlora_models/mixtral.rs:657-672 | mistralrs-core/src/xlora_models/starcoder2.rs:510-525 — 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 53 separate duplicated blocks between them, totalling at least 787 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:397-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 (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 (12 lines × 3) mistralrs/src/model_builder_trait.rs:756— mistralrs/src/model_builder_trait.rs:756-767 | mistralrs/src/model_builder_trait.rs:1102-1113 | mistralrs/src/model_builder_trait.rs:1513-1524 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:1116— mistralrs-core/src/layers.rs:1116-1127 | mistralrs-core/src/layers.rs:1206-1217 | mistralrs-core/src/layers.rs:1475-1486 — all 3 copies are in the same file, so extract the block into one function there and call it from 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1484— mistralrs-core/src/models/granite.rs:1484-1495 | mistralrs-core/src/models/granite.rs:1771-1782 | 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 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:920— mistralrs-core/src/models/qwen3_next.rs:920-931 | mistralrs-core/src/vision_models/qwen3_5/text.rs:1400-1411 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:705-716 — 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:5170— mistralrs-core/src/ops.rs:5170-5181 | mistralrs-core/src/ops.rs:5599-5610 | mistralrs-core/src/ops.rs:5935-5946 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:340— mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:340-351 | mistralrs-core/src/vision_models/mllama/text.rs:280-291 | mistralrs-core/src/vision_models/mllama/text.rs:640-651 — 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-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:1240-1251 | mistralrs-core/src/vision_models/phi4/mod.rs:355-366 — 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 (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:487-498 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:424-434 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:545-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 (11 lines × 4) mistralrs-core/src/layers.rs:894— mistralrs-core/src/layers.rs:894-904 | mistralrs-core/src/layers.rs:911-921 | mistralrs-core/src/layers.rs:2217-2227 | mistralrs-core/src/layers.rs:2234-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 (11 lines × 4) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4396— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4396-4406 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7758-7768 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:986-996 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5918-5928 — 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:595— mistralrs-core/src/vision_models/phi3/mod.rs:595-605 | mistralrs-core/src/vision_models/phi3/mod.rs:627-637 | 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 19 separate duplicated blocks between them, totalling at least 362 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 28 separate duplicated blocks between them, totalling at least 500 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:650— mistralrs-core/src/xlora_models/gemma2.rs:650-660 | 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:477-487 — 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:1009— mistralrs-quant/src/blockwise_fp8/mod.rs:1009-1019 | mistralrs-quant/src/pertensor_fp8/mod.rs:598-608 | mistralrs-quant/src/unquantized/mod.rs:532-542 | 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:1071— mistralrs-quant/src/blockwise_fp8/mod.rs:1071-1081 | mistralrs-quant/src/pertensor_fp8/mod.rs:658-668 | mistralrs-quant/src/unquantized/mod.rs:590-600 | 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:334-344 — 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 (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.
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:590-599 — before extracting anything, compare `mistralrs-core/src/models/gemma2.rs` and `mistralrs-core/src/models/qwen2.rs` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 413 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1010-1019 — 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:422— mistralrs-core/src/models/phi3.rs:422-431 | mistralrs-core/src/vision_models/gemma3/text.rs:448-458 — 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:194-203 — 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 27 separate duplicated blocks between them, totalling at least 411 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:855— mistralrs-core/src/pipeline/multimodal.rs:855-865 | mistralrs-core/src/pipeline/normal.rs:839-848 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:3335— mistralrs-core/src/speculative/dflash.rs:3335-3345 | mistralrs-core/src/speculative/dflash.rs:3557-3566 — both copies are in the same file, so extract the block into 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-paged-attn/src/cuda/backend/paged_attention.rs:72— mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:72-82 | mistralrs-quant/src/gguf/cuda.rs:113-122 — 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-paged-attn/src/metal/backend/paged_attention.rs:253— mistralrs-paged-attn/src/metal/backend/paged_attention.rs:253-262 | mistralrs-paged-attn/src/metal/backend/paged_attention.rs:311-321 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) mistralrs-quant/src/afq/mod.rs:251— mistralrs-quant/src/afq/mod.rs:251-261 | mistralrs-quant/src/gguf/mod.rs:503-512 — 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 × 3) mistralrs-core/src/lib.rs:2485— mistralrs-core/src/lib.rs:2485-2493 | mistralrs-core/src/lib.rs:2548-2556 | mistralrs-core/src/lib.rs:2565-2573 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:222— mistralrs-core/src/paged_attention/cache_engine.rs:222-231 | mistralrs-core/src/paged_attention/cache_engine.rs:271-279 | mistralrs-core/src/paged_attention/cache_engine.rs:325-333 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:6823— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6823-6831 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7719-7727 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4960-4968 — 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/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:716-724 — 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 24 separate duplicated blocks between them, totalling at least 300 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/ops.rs:2359— mistralrs-quant/src/afq/ops.rs:2359-2367 | mistralrs-quant/src/afq/ops.rs:2481-2489 | mistralrs-quant/src/afq/ops.rs:3007-3015 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:207— mistralrs-quant/src/afq/mod.rs:207-215 | mistralrs-quant/src/gguf/mod.rs:731-739 | mistralrs-quant/src/unquantized/mod.rs:627-635 — 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.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×11
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:890-903 | mistralrs-core/src/gguf/qwen_multimodal_bindings.rs:291-307 | 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/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:2470— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2470-2501 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6220-6252 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6622-6654 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7042-7070 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7501-7529 — 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:3874— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3874-3943 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6296-6385 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6698-6787 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7112-7198 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7571-7657 — 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-core/src/metal/gdn.rs:119— mistralrs-core/src/metal/gdn.rs:119-194 | mistralrs-core/src/metal/gdn.rs:229-298 | mistralrs-core/src/metal/gdn.rs:330-480 | mistralrs-core/src/metal/gdn.rs:509-573 | mistralrs-core/src/metal/ssm.rs:126-215 — 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-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.
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:857-869 — 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:259-271 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/phi2.rs` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 375 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:692— mistralrs-core/src/models/llama.rs:692-704 | mistralrs-core/src/models/smollm3.rs:711-723 | 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 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:944— mistralrs-core/src/moe/experts/backends.rs:944-956 | mistralrs-core/src/moe/experts/backends.rs:1023-1035 | 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:3195— mistralrs-core/src/pipeline/cuda_graph.rs:3195-3207 | mistralrs-core/src/pipeline/cuda_graph.rs:3240-3252 | mistralrs-core/src/pipeline/cuda_graph.rs:3285-3297 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:1472— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1472-1484 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1765-1777 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4519-4531 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:4397— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4397-4409 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:987-999 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5919-5931 — 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/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:613— mistralrs-quant/src/safetensors.rs:613-625 | mistralrs-quant/src/safetensors.rs:663-675 | mistralrs-quant/src/safetensors.rs:739-751 — all 3 copies are in the same file, so extract the block into one function there and call it from 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 × 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:1631— mistralrs-core/src/gguf/normal_config.rs:1631-1642 | mistralrs-core/src/gguf/normal_config.rs:1701-1713 — both copies are in the same file, so extract the block into 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:1263— mistralrs-core/src/pipeline/inputs_processor.rs:1263-1274 | mistralrs-core/src/pipeline/inputs_processor.rs:1301-1313 — both copies are in the same file, so extract the block into 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/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:388— mistralrs-core/src/utils/gguf_metadata.rs:388-399 | mistralrs-core/src/utils/gguf_metadata.rs:613-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 (12–13 lines × 2) mistralrs-core/src/vision_models/gemma3n/text.rs:1539— mistralrs-core/src/vision_models/gemma3n/text.rs:1539-1550 | mistralrs-core/src/vision_models/gemma4/text.rs:1828-1840 — `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 8 separate duplicated blocks between them, totalling at least 83 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-core/src/vision_models/phi4/mod.rs:508— mistralrs-core/src/vision_models/phi4/mod.rs:508-519 | mistralrs-core/src/vision_models/voxtral/mod.rs:885-897 — `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-core/src/vision_models/qwen3_5/speculative.rs:302— mistralrs-core/src/vision_models/qwen3_5/speculative.rs:302-313 | mistralrs-core/src/vision_models/qwen3_5/speculative.rs:978-990 — both copies are in the same file, so extract the block into 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-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 24 separate duplicated blocks between them, totalling at least 300 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 (12 lines × 4) mistralrs/src/model_builder_trait.rs:741— mistralrs/src/model_builder_trait.rs:741-752 | mistralrs/src/model_builder_trait.rs:896-907 | mistralrs/src/model_builder_trait.rs:1087-1098 | mistralrs/src/model_builder_trait.rs:1498-1509 — 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-core/src/model_loader.rs:739— mistralrs-core/src/model_loader.rs:739-750 | mistralrs-core/src/model_loader.rs:773-784 | 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/deepseek2.rs:780— mistralrs-core/src/models/deepseek2.rs:780-791 | mistralrs-core/src/models/deepseek3.rs:843-854 | mistralrs-core/src/models/glm4_moe.rs:680-691 | mistralrs-core/src/models/glm4_moe_lite.rs:790-801 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:366— mistralrs-core/src/models/gemma.rs:366-377 | mistralrs-core/src/models/gemma2.rs:438-449 | mistralrs-core/src/xlora_models/gemma.rs:445-456 | mistralrs-core/src/xlora_models/gemma2.rs:480-491 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1541— mistralrs-core/src/models/granite.rs:1541-1552 | 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 48 separate duplicated blocks between them, totalling at least 605 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:93— mistralrs-core/src/vision_models/qwen3_5/mod.rs:93-104 | 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 408 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:379-390 | mistralrs-core/src/xlora_models/phi3.rs:345-357 | mistralrs-core/src/xlora_models/starcoder2.rs:368-379 — 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.
TextModel::forward_embeds_scaled (cognitive 63) mistralrs-core/src/vision_models/gemma4/text.rs:2096— TextModel::forward_embeds_scaled has cognitive complexity 63 (threshold 15). Drivers by points: if/else 32 (45 pts), match/switch 6 (9 pts), boolean chains 8, 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:597— 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::new (cognitive 31) mistralrs-core/src/vision_models/gemma4/text.rs:1574— TextModel::new has cognitive complexity 31 (threshold 15). Drivers by points: if/else 21 (25 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::create_anymoe_layers (cognitive 27) mistralrs-core/src/vision_models/gemma3/text.rs:918— 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 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:2423— 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:2558— 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:771— 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.
Duplicated block (29 lines × 2) mistralrs-core/src/model_metadata.rs:385— mistralrs-core/src/model_metadata.rs:385-413 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:236-264 — 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 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 33 separate duplicated blocks between them, totalling at least 375 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 27 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. 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:398— mistralrs-core/src/paged_attention/cache_engine.rs:398-426 | mistralrs-core/src/paged_attention/cache_engine.rs:436-464 — both copies are in the same file, so extract the block into 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:1248— mistralrs-core/src/paged_attention/layers/paged_attention.rs:1248-1276 | mistralrs-core/src/paged_attention/layers/paged_attention.rs:1365-1393 — both copies are in the same file, so extract the block into 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:683— mistralrs-core/src/pipeline/multimodal.rs:683-711 | mistralrs-core/src/pipeline/normal.rs:696-724 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/pipeline/multimodal.rs:967— mistralrs-core/src/pipeline/multimodal.rs:967-995 | mistralrs-core/src/pipeline/normal.rs:949-977 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/pipeline/multimodal.rs:1339— mistralrs-core/src/pipeline/multimodal.rs:1339-1367 | mistralrs-core/src/pipeline/normal.rs:1361-1389 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:2817— mistralrs-quant/src/lib.rs:2817-2845 | mistralrs-quant/src/lib.rs:2883-2911 — both copies are in the same file, so extract the block into 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 × 3) mistralrs-core/src/models/gemma.rs:418— mistralrs-core/src/models/gemma.rs:418-435 | 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 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/glm4.rs:531— mistralrs-core/src/models/glm4.rs:531-548 | mistralrs-core/src/models/qwen3.rs:491-508 | mistralrs-core/src/models/qwen3_moe.rs:674-691 — before extracting anything, compare `mistralrs-core/src/models/glm4.rs` and `mistralrs-core/src/models/qwen3.rs` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 588 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:688-705 — before extracting anything, compare `mistralrs-core/src/models/phi2.rs` and `mistralrs-core/src/models/starcoder2.rs` as WHOLE FILES: this scan already matched 28 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 (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:533-550 | mistralrs-core/src/xlora_models/mistral.rs:499-516 — 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 (10 lines × 4) mistralrs-core/src/ops.rs:5294— mistralrs-core/src/ops.rs:5294-5303 | mistralrs-core/src/ops.rs:5506-5515 | mistralrs-core/src/ops.rs:5717-5726 | mistralrs-core/src/ops.rs:6035-6044 — 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 19 separate duplicated blocks between them, totalling at least 362 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:953— mistralrs-quant/src/blockwise_fp8/mod.rs:953-962 | mistralrs-quant/src/pertensor_fp8/mod.rs:543-552 | mistralrs-quant/src/unquantized/mod.rs:442-451 | 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:1027— mistralrs-quant/src/blockwise_fp8/mod.rs:1027-1036 | mistralrs-quant/src/pertensor_fp8/mod.rs:615-624 | mistralrs-quant/src/unquantized/mod.rs:550-559 | 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:871— mistralrs-quant/src/distributed/layers.rs:871-880 | mistralrs-quant/src/distributed/layers.rs:1333-1342 | mistralrs-quant/src/distributed/layers.rs:1988-1997 | mistralrs-quant/src/distributed/layers.rs:2204-2213 — 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 (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:464-495 — 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:1606— mistralrs-core/src/layers.rs:1606-1637 | mistralrs-core/src/layers.rs:1917-1948 — both copies are in the same file, so extract the block into 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:690— mistralrs-core/src/model_loader.rs:690-721 | 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 48 separate duplicated blocks between them, totalling at least 605 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:2905— mistralrs-core/src/pipeline/multimodal.rs:2905-2936 | mistralrs-core/src/pipeline/normal.rs:2582-2613 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/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 19 separate duplicated blocks between them, totalling at least 362 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:682-713 — `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 45 separate duplicated blocks between them, totalling at least 653 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/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 573 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:139— mistralrs-core/src/moe/experts/mod.rs:139-166 | mistralrs-core/src/moe/experts/mod.rs:213-240 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (28 lines × 2) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:702— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:702-729 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3494-3521 — 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:403— mistralrs-core/src/vision_models/qwen3_5/mod.rs:403-430 | 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 408 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:639-666 — `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 45 separate duplicated blocks between them, totalling at least 653 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-paged-attn/src/metal/kernels/mod.rs:79— mistralrs-paged-attn/src/metal/kernels/mod.rs:79-106 | mistralrs-quant/src/metal_kernels/mod.rs:87-114 — 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 48 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 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 24 separate duplicated blocks between them, totalling at least 300 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/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:1101— mistralrs-core/src/layers.rs:1101-1126 | mistralrs-core/src/layers.rs:1191-1216 — both copies are in the same file, so extract the block into 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 48 separate duplicated blocks between them, totalling at least 605 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:1208— mistralrs-core/src/pipeline/multimodal.rs:1208-1233 | mistralrs-core/src/pipeline/normal.rs:1263-1288 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:2498— mistralrs-core/src/pipeline/multimodal.rs:2498-2523 | mistralrs-core/src/pipeline/normal.rs:2173-2198 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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-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-quant/src/safetensors.rs:696— mistralrs-quant/src/safetensors.rs:696-721 | mistralrs-quant/src/safetensors.rs:763-788 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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:2323— mistralrs-core/src/layers.rs:2323-2341 | mistralrs-core/src/layers.rs:2421-2439 | mistralrs-core/src/layers.rs:2468-2486 — all 3 copies are in the same file, so extract the block into one function there and call it from 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:530— mistralrs-core/src/model_loader.rs:530-548 | 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:732— mistralrs-core/src/model_loader.rs:732-750 | mistralrs-core/src/model_loader.rs:766-784 | 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:900— mistralrs-core/src/models/qwen3_next.rs:900-918 | mistralrs-core/src/vision_models/qwen3_5/text.rs:1380-1398 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:685-703 — 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:510-528 | mistralrs-core/src/pipeline/normal.rs:613-631 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 163 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:395— mistralrs-core/src/vision_models/qwen3_5/mod.rs:395-413 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:382-400 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:412-430 — `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 408 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/embedding_models/qwen3_embedding.rs:360— mistralrs-core/src/embedding_models/qwen3_embedding.rs:360-374 | mistralrs-core/src/models/hunyuan_v1_dense.rs:440-454 | mistralrs-core/src/models/hunyuan_v1_moe.rs:934-948 | mistralrs-core/src/models/qwen3.rs:431-445 — 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 314 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1277-1292 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:464-478 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:586-600 — 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 291 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:6371— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6371-6385 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6773-6787 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7184-7198 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7643-7657 — 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:73— mistralrs-core/src/vision_models/qwen3_5/mod.rs:73-87 | 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 408 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/text.rs:1363— mistralrs-core/src/vision_models/qwen3_5/text.rs:1363-1377 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:668-682 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:459-473 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:581-595 — `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 416 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:337-351 | mistralrs-core/src/xlora_models/mixtral.rs:464-478 | mistralrs-core/src/xlora_models/phi3.rs:302-316 — 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:526— mistralrs-core/src/xlora_models/mistral.rs:526-540 | mistralrs-core/src/xlora_models/mixtral.rs:656-670 | mistralrs-core/src/xlora_models/phi2.rs:496-510 | mistralrs-core/src/xlora_models/phi3.rs:476-490 — 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 53 separate duplicated blocks between them, totalling at least 787 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/cuda/gdn.rs:4974— mistralrs-core/src/cuda/gdn.rs:4974-4987 | mistralrs-core/src/cuda/gdn.rs:5150-5163 | mistralrs-core/src/cuda/gdn.rs:5420-5433 — all 3 copies are in the same file, so extract the block into one function there and call it from 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:405— mistralrs-core/src/models/gemma.rs:405-418 | mistralrs-core/src/models/gemma2.rs:477-490 | mistralrs-core/src/vision_models/gemma3/text.rs:518-531 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:155-168 | 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 680 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/normal_loaders.rs:3021— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3021-3034 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3327-3340 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4471-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 (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:1107-1120 — 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:2222— mistralrs-core/src/models/granite.rs:2222-2235 | mistralrs-core/src/models/lfm2.rs:1213-1226 | mistralrs-core/src/models/qwen3_next.rs:1015-1028 — before extracting anything, compare `mistralrs-core/src/models/granite.rs` and `mistralrs-core/src/models/lfm2.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:597-601 | mistralrs-core/src/xlora_models/mixtral.rs:727-731 | mistralrs-core/src/xlora_models/phi2.rs:563-567 | mistralrs-core/src/xlora_models/phi3.rs:548-553 | mistralrs-core/src/xlora_models/starcoder2.rs:581-586 — 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:847— mistralrs-core/src/layers.rs:847-851 | mistralrs-core/src/layers.rs:2009-2013 | mistralrs-core/src/layers.rs:2183-2187 | mistralrs-core/src/layers.rs:3040-3045 | mistralrs-core/src/layers.rs:3173-3178 | mistralrs-core/src/vision_models/gemma4/text.rs:131-139 — 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/models/lfm2.rs:330— 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:376-380 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:142-146 — before extracting anything, compare `mistralrs-core/src/models/lfm2.rs` and `mistralrs-core/src/models/phi3_5_moe.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (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.
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.
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:3628-3634 | mistralrs-core/src/layers.rs:3690-3696 — 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-core/src/metal/gdn.rs:151— mistralrs-core/src/metal/gdn.rs:151-157 | mistralrs-core/src/metal/gdn.rs:265-271 | mistralrs-core/src/metal/gdn.rs:361-367 | mistralrs-core/src/metal/gdn.rs:542-548 | mistralrs-core/src/metal/ssm.rs:173-179 — before extracting anything, compare `mistralrs-core/src/metal/gdn.rs` and `mistralrs-core/src/metal/ssm.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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:96— mistralrs-paged-attn/src/metal/backend/gather_kv.rs:96-102 | mistralrs-paged-attn/src/metal/backend/gather_kv.rs:106-112 | mistralrs-paged-attn/src/metal/backend/gather_kv.rs:116-122 | mistralrs-paged-attn/src/metal/backend/paged_attention.rs:417-424 | mistralrs-paged-attn/src/metal/backend/paged_attention.rs:429-436 — 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:5014-5020 — 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:838-844 | mistralrs-quant/src/afq/ops.rs:846-852 — 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/layers.rs:839— mistralrs-core/src/layers.rs:839-843 | mistralrs-core/src/layers.rs:2175-2179 | mistralrs-core/src/layers.rs:2326-2330 | mistralrs-core/src/layers.rs:2424-2428 | mistralrs-core/src/layers.rs:2471-2475 — 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-paged-attn/src/metal/kernels/mod.rs:277— mistralrs-paged-attn/src/metal/kernels/mod.rs:277-282 | mistralrs-paged-attn/src/metal/kernels/mod.rs:711-716 | mistralrs-paged-attn/src/metal/kernels/mod.rs:802-807 | mistralrs-quant/src/metal_kernels/mod.rs:1527-1531 | mistralrs-quant/src/metal_kernels/mod.rs:4878-4882 — 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 48 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/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.
Change coupling: embedding.rs ↔ multimodal.rs mistralrs-core/src/pipeline/embedding.rs— `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` change together 86% of the time (12 of the 14 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 (#…; `cf55746a` feat(multi-model): support planning for loading multi-model (#2299); `4a72ef32` feat(distributed): more sophisticated TP fallback and resolution syst… — run `git show` on any of them.
Change coupling: embedding.rs ↔ normal.rs mistralrs-core/src/pipeline/embedding.rs— `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/normal.rs` change together 79% of the time (11 of the 14 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 `d1ffbe7e` fix(qwen3.5): better support for hybrid models and auto device map (#…; `cf55746a` feat(multi-model): support planning for loading multi-model (#2299); `4a72ef32` feat(distributed): more sophisticated TP fallback and resolution syst… — run `git show` on any of them.
Change coupling: REDACTED ↔ REDACTED mistralrs-quant/src/fp8/mod.rs— `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: model_selected.rs ↔ toml_selector.rs mistralrs-core/src/model_selected.rs— `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— `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— `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.
Change coupling: REDACTED ↔ gptq_cuda.rs mistralrs-quant/src/blockwise_fp8/mod.rs— `mistralrs-quant/src/blockwise_fp8/mod.rs` and `mistralrs-quant/src/gptq/gptq_cuda.rs` change together 50% of the time (7 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 `aed0b295` feat(quant): add isq executor and planning (#2283); `a5470517` fix(quant): fail missing dummy layers outside uqff (#2138); `741b4788` Support Ministral 3 (#1816) — run `git show` on any of them.
Duplicated block (16–17 lines × 2) mistralrs-core/src/models/gpt_oss.rs:820— mistralrs-core/src/models/gpt_oss.rs:820-836 | mistralrs-core/src/models/phi3.rs:490-505 — 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 17 separate duplicated blocks between them, totalling at least 166 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:942— mistralrs-core/src/moe/experts/backends.rs:942-958 | mistralrs-core/src/moe/experts/backends.rs:1021-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 (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:2038-2054 — `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 8 separate duplicated blocks between them, totalling at least 83 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:477-492 — 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-paged-attn/src/cuda/backend/paged_attention.rs:336— mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:336-351 | mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:388-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 (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 24 separate duplicated blocks between them, totalling at least 300 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 (11–12 lines × 2) mistralrs-cli/src/commands/config.rs:128— mistralrs-cli/src/commands/config.rs:128-138 | mistralrs-cli/src/commands/serve.rs:144-155 — 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:1079— mistralrs-core/src/pipeline/multimodal.rs:1079-1089 | mistralrs-core/src/pipeline/multimodal.rs:1183-1194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (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/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-quant/src/distributed/layers.rs:2018— mistralrs-quant/src/distributed/layers.rs:2018-2028 | mistralrs-quant/src/distributed/layers.rs:2248-2259 — both copies are in the same file, so extract the block into 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.
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::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::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::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 61) mistralrs-core/src/vision_models/gemma4/text.rs:490— Attention::forward has cognitive complexity 61 (threshold 15). Drivers by points: if/else 35 (49 pts), match/switch 5 (11 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:296— 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:408— mistralrs-core/src/models/phi3.rs:408-533 | mistralrs-core/src/vision_models/gemma3/text.rs:433-582 — 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:631— mistralrs-core/src/models/qwen3_next.rs:631-703 | 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:935— mistralrs-quant/src/distributed/layers.rs:935-1021 | mistralrs-quant/src/distributed/layers.rs:1414-1505 — 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 (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:121-155 — 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/models/hunyuan_v1_dense.rs:113— 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/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 686 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 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:282— mistralrs-core/src/paged_attention/cache_engine.rs:282-316 | mistralrs-core/src/paged_attention/cache_engine.rs:336-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 (35 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1566— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1566-1600 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1851-1885 — both copies are in the same file, so extract the block into 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 (20 lines × 3) mistralrs/src/model_builder_trait.rs:1157— mistralrs/src/model_builder_trait.rs:1157-1176 | mistralrs/src/model_builder_trait.rs:1224-1243 | mistralrs/src/model_builder_trait.rs:1322-1341 — all 3 copies are in the same file, so extract the block into one function there and call it from 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-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 48 separate duplicated blocks between them, totalling at least 605 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:620— mistralrs-core/src/pipeline/embedding.rs:620-639 | mistralrs-core/src/pipeline/multimodal.rs:1356-1375 | mistralrs-core/src/pipeline/normal.rs:1378-1397 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 163 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 (14–15 lines × 2) mistralrs-core/src/kv_cache/mod.rs:1267— mistralrs-core/src/kv_cache/mod.rs:1267-1281 | mistralrs-core/src/kv_cache/mod.rs:1330-1343 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (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:391-405 — 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:367-381 — `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 (9–10 lines × 2) mistralrs/src/anymoe.rs:141— mistralrs/src/anymoe.rs:141-150 | mistralrs/src/model_builder_trait.rs:964-972 — 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 (9–10 lines × 2) mistralrs-core/src/pipeline/chat_template.rs:610— mistralrs-core/src/pipeline/chat_template.rs:610-619 | mistralrs-core/src/pipeline/chat_template.rs:643-651 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–10 lines × 2) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:953— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:953-961 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1809-1818 — 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 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:363-371 | mistralrs-core/src/models/gemma2.rs:435-443 | mistralrs-core/src/vision_models/gemma3/text.rs:453-462 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:408-417 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:529-538 — `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:482-490 | mistralrs-core/src/models/hunyuan_v1_dense.rs:451-459 | mistralrs-core/src/models/hunyuan_v1_moe.rs:945-953 | mistralrs-core/src/models/qwen2.rs:477-485 | mistralrs-core/src/models/qwen3.rs:442-450 — 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:1359— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1359-1367 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1652-1660 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1937-1945 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4749-4757 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6443-6451 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6867-6875 — 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.
Engine::run (cognitive 398) mistralrs-core/src/engine/mod.rs:1107— Engine::run has cognitive complexity 398 (threshold 15). Drivers by points: if/else 90 (289 pts), loops 17 (61 pts), match/switch 8 (30 pts), boolean chains 18 (nesting depth added 265). 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:136— 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 21) mistralrs-core/src/engine/mod.rs:535— Engine::new has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (12 pts), match/switch 4 (5 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.
Engine::handle_request (cognitive 19) mistralrs-core/src/engine/add_request.rs:58— 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:752— 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.
DFlashDraftModel::prepare_ctx_batch (cognitive 24) mistralrs-core/src/speculative/dflash.rs:2997— 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:3806— 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:2457— 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:3255— 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:3376— 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
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×5
Members sharing a duplicated core (6 members, 50+ identical tokens) mistralrs-core/src/layers.rs:835— mistralrs-core/src/layers.rs:835-858 | mistralrs-core/src/layers.rs:1997-2016 | mistralrs-core/src/layers.rs:2171-2194 | mistralrs-core/src/layers.rs:3031-3050 | mistralrs-core/src/layers.rs:3164-3183 | mistralrs-core/src/vision_models/gemma4/text.rs:116-144 — 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-255 | mistralrs-core/src/pipeline/embedding.rs:232-713 | mistralrs-core/src/pipeline/gguf.rs:1201-1419 | mistralrs-core/src/pipeline/multimodal.rs:540-1548 | mistralrs-core/src/pipeline/normal.rs:643-1482 | mistralrs-core/src/pipeline/speech.rs:247-336 — 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/vision_models/llava/llava_llm/llama.rs:219— 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 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/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:450-494 | 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 — 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.
Duplicated block (40 lines × 2) mistralrs-cli/src/commands/config.rs:170— mistralrs-cli/src/commands/config.rs:170-209 | mistralrs-cli/src/commands/serve.rs:189-228 — 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:684— mistralrs-core/src/models/phi3.rs:684-723 | mistralrs-core/src/vision_models/phi3/mod.rs:1520-1559 — 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 48 separate duplicated blocks between them, totalling at least 605 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:868— mistralrs-core/src/pipeline/multimodal.rs:868-907 | mistralrs-core/src/pipeline/normal.rs:850-889 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:513-552 — `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 45 separate duplicated blocks between them, totalling at least 653 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:401— mistralrs-core/src/models/gemma.rs:401-437 | 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 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 (34 lines × 2) mistralrs/src/model_builder_trait.rs:680— mistralrs/src/model_builder_trait.rs:680-713 | mistralrs/src/model_builder_trait.rs:1435-1468 — both copies are in the same file, so extract the block into 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/vision_models/qwen3_5/text.rs:1391— mistralrs-core/src/vision_models/qwen3_5/text.rs:1391-1424 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:696-729 — `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 416 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:1282— mistralrs-core/src/pipeline/multimodal.rs:1282-1314 | mistralrs-core/src/pipeline/normal.rs:1323-1355 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:3107— mistralrs-core/src/pipeline/multimodal.rs:3107-3139 | mistralrs-core/src/pipeline/normal.rs:2746-2778 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 28 separate duplicated blocks between them, totalling at least 500 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 (27 lines × 2) mistralrs-core/src/models/llama.rs:430— mistralrs-core/src/models/llama.rs:430-456 | mistralrs-core/src/models/smollm3.rs:453-479 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:339-365 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 (24 lines × 2) mistralrs-core/src/models/hunyuan_v1_dense.rs:431— mistralrs-core/src/models/hunyuan_v1_dense.rs:431-454 | mistralrs-core/src/models/hunyuan_v1_moe.rs:925-948 — 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 686 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:487— mistralrs-core/src/models/hunyuan_v1_dense.rs:487-510 | mistralrs-core/src/models/hunyuan_v1_moe.rs:981-1004 — 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 686 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1397— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1397-1420 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2680-2703 — both copies are in the same file, so extract the block into 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:212— mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:212-235 | mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:595-618 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) mistralrs-paged-attn/src/metal/kernels/mod.rs:310— mistralrs-paged-attn/src/metal/kernels/mod.rs:310-333 | mistralrs-paged-attn/src/metal/kernels/mod.rs:750-773 — both copies are in the same file, so extract the block into 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/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 573 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 24 separate duplicated blocks between them, totalling at least 300 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/cuda/gdn.rs:3828— mistralrs-core/src/cuda/gdn.rs:3828-3846 | mistralrs-core/src/cuda/gdn.rs:4285-4304 — both copies are in the same file, so extract the block into 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:500— mistralrs-core/src/models/phi3.rs:500-518 | mistralrs-core/src/vision_models/phi3/mod.rs:1281-1300 — 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 48 separate duplicated blocks between them, totalling at least 605 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:2175— mistralrs-core/src/pipeline/multimodal.rs:2175-2194 | mistralrs-core/src/pipeline/normal.rs:1972-1990 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 (17–18 lines × 2) mistralrs-core/src/models/llama.rs:404— mistralrs-core/src/models/llama.rs:404-421 | mistralrs-core/src/models/smollm3.rs:420-436 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/smollm3.rs` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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_moe.rs:487— 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/qwen3_moe.rs` and `mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs` as WHOLE FILES: this scan already matched 27 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. 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/models/qwen3_next.rs:676— mistralrs-core/src/models/qwen3_next.rs:676-692 | 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:1409— mistralrs-core/src/moe/experts/backends.rs:1409-1426 | mistralrs-core/src/moe/experts/backends.rs:1581-1597 — both copies are in the same file, so extract the block into 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 (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:477-490 | mistralrs-core/src/models/hunyuan_v1_dense.rs:446-459 | mistralrs-core/src/models/hunyuan_v1_moe.rs:940-953 | mistralrs-core/src/models/qwen3.rs:437-450 — 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:887— mistralrs-core/src/models/deepseek2.rs:887-900 | mistralrs-core/src/models/deepseek3.rs:950-963 | mistralrs-core/src/models/glm4_moe.rs:786-799 | mistralrs-core/src/models/glm4_moe_lite.rs:897-910 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:566-579 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/pipeline/loaders/multimodal_loaders.rs:990— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:990-1003 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4751-4764 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:775-788 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1848-1861 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2714-2727 — 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 × 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:525-538 | mistralrs-core/src/xlora_models/mistral.rs:491-504 | mistralrs-core/src/xlora_models/mixtral.rs:622-635 | mistralrs-core/src/xlora_models/starcoder2.rs:479-492 — 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:604-617 | mistralrs-core/src/xlora_models/mixtral.rs:734-747 | mistralrs-core/src/xlora_models/phi3.rs:557-570 | mistralrs-core/src/xlora_models/starcoder2.rs:589-602 — 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–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:346— mistralrs-core/src/models/quantized_llama.rs:346-359 | 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:144— mistralrs-core/src/vision_models/gemma3/text.rs:144-157 | 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:969— mistralrs-quant/src/distributed/layers.rs:969-982 | mistralrs-quant/src/distributed/layers.rs:1458-1470 — both copies are in the same file, so extract the block into 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:417— mistralrs-core/src/models/gemma.rs:417-429 | 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 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:880— mistralrs-core/src/models/glm4_moe.rs:880-892 | mistralrs-core/src/models/glm4_moe.rs:925-937 | mistralrs-core/src/models/glm4_moe_lite.rs:1014-1026 | mistralrs-core/src/models/glm4_moe_lite.rs:1057-1069 — 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 573 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:607— mistralrs-core/src/vision_models/phi3/mod.rs:607-619 | mistralrs-core/src/vision_models/phi3/mod.rs:639-651 | 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/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) mistralrs-paged-attn/src/metal/kernels/mod.rs:442— mistralrs-paged-attn/src/metal/kernels/mod.rs:442-454 | mistralrs-paged-attn/src/metal/kernels/mod.rs:585-597 | mistralrs-paged-attn/src/metal/kernels/mod.rs:647-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 (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 (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:601-609 — before extracting anything, compare `mistralrs-core/src/models/gemma2.rs` and `mistralrs-core/src/models/qwen2.rs` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 413 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:464-472 — 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-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 (7–8 lines × 2) mistralrs-core/src/pipeline/gguf.rs:793— mistralrs-core/src/pipeline/gguf.rs:793-800 | mistralrs-core/src/pipeline/gguf.rs:925-931 — both copies are in the same file, so extract the block into 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-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-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.
Duplicated block (6–7 lines × 2) mistralrs-cli/src/commands/bench.rs:165— mistralrs-cli/src/commands/bench.rs:165-171 | mistralrs-cli/src/commands/run/mod.rs:135-140 — before extracting anything, compare `mistralrs-cli/src/commands/bench.rs` and `mistralrs-cli/src/commands/run/mod.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. 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–7 lines × 2) mistralrs-core/src/cuda/gdn.rs:5636— mistralrs-core/src/cuda/gdn.rs:5636-5641 | mistralrs-core/src/cuda/gdn.rs:5650-5656 — both copies are in the same file, so extract the block into 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 (6 lines × 5) mistralrs-core/src/cuda/gdn.rs:1928— mistralrs-core/src/cuda/gdn.rs:1928-1933 | mistralrs-core/src/cuda/gdn.rs:1935-1940 | mistralrs-core/src/cuda/gdn.rs:2768-2773 | mistralrs-core/src/cuda/gdn.rs:5780-5785 | mistralrs-core/src/cuda/gdn.rs:5787-5792 — 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/ops.rs:4464— mistralrs-core/src/ops.rs:4464-4469 | mistralrs-core/src/ops.rs:4750-4755 | mistralrs-core/src/ops.rs:5005-5010 | mistralrs-core/src/ops.rs:5277-5282 | mistralrs-core/src/ops.rs:5700-5705 — 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:161— mistralrs-core/src/metal/gdn.rs:161-166 | mistralrs-core/src/metal/gdn.rs:275-280 | mistralrs-core/src/metal/gdn.rs:368-373 | mistralrs-core/src/metal/gdn.rs:551-556 | mistralrs-core/src/metal/ssm.rs:185-190 — before extracting anything, compare `mistralrs-core/src/metal/gdn.rs` and `mistralrs-core/src/metal/ssm.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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.
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 2 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.
Engine::run (cyclomatic 119) mistralrs-core/src/engine/mod.rs:1107— Engine::run has cyclomatic complexity 119 (threshold 15). To reduce it, separate the cases: extract each independent 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:136— 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:58— 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 16) mistralrs-core/src/engine/mod.rs:535— Engine::new 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.
Qwen3_5TextModel::forward_embeds (cyclomatic 49) mistralrs-core/src/vision_models/qwen3_5/text.rs:2268— 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.
Qwen3_5TextModel::replay_recurrent_prefixes (cyclomatic 28) mistralrs-core/src/vision_models/qwen3_5/text.rs:1894— Qwen3_5TextModel::replay_recurrent_prefixes 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.
Qwen3_5TextModel::stage_recurrent_prefixes (cyclomatic 22) mistralrs-core/src/vision_models/qwen3_5/text.rs:1758— Qwen3_5TextModel::stage_recurrent_prefixes 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.
Qwen3_5TextModel::apply_pending_recurrent_transitions (cyclomatic 16) mistralrs-core/src/vision_models/qwen3_5/text.rs:1569— Qwen3_5TextModel::apply_pending_recurrent_transitions 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.
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/speech.rs:316— // 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:692— // 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/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.
Qwen3_5TextModel::forward_embeds (cognitive 81) mistralrs-core/src/vision_models/qwen3_5/text.rs:2268— 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::replay_recurrent_prefixes (cognitive 43) mistralrs-core/src/vision_models/qwen3_5/text.rs:1894— Qwen3_5TextModel::replay_recurrent_prefixes has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (27 pts), loops 4 (7 pts), match/switch 3 (5 pts), boolean chains 4 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen3_5TextModel::stage_recurrent_prefixes (cognitive 33) mistralrs-core/src/vision_models/qwen3_5/text.rs:1758— Qwen3_5TextModel::stage_recurrent_prefixes has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen3_5TextModel::apply_pending_recurrent_transitions (cognitive 28) mistralrs-core/src/vision_models/qwen3_5/text.rs:1569— Qwen3_5TextModel::apply_pending_recurrent_transitions has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 4 (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.
Qwen3_5Model::dflash_propose (cognitive 70) mistralrs-core/src/vision_models/qwen3_5/speculative.rs:431— 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:113— 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.
Qwen3_5Model::mtp_propose (cognitive 28) mistralrs-core/src/vision_models/qwen3_5/speculative.rs:664— Qwen3_5Model::mtp_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.
Qwen3_5Model::mtp_prefill (cognitive 18) mistralrs-core/src/vision_models/qwen3_5/speculative.rs:820— Qwen3_5Model::mtp_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.
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.
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.
BlockwiseFP8Linear::forward_raw (cognitive 36) mistralrs-quant/src/blockwise_fp8/mod.rs:296— BlockwiseFP8Linear::forward_raw has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (30 pts), boolean chains 4, match/switch 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.
BlockwiseFP8Linear::apply_isq (cognitive 30) mistralrs-quant/src/blockwise_fp8/mod.rs:912— 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:772— 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.
MultimodalPipeline::try_cuda_decode_graph_forward (cognitive 30) mistralrs-core/src/pipeline/multimodal.rs:1925— MultimodalPipeline::try_cuda_decode_graph_forward has cognitive complexity 30 (threshold 15). Drivers by points: if/else 20 (25 pts), boolean chains 5 (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 26) mistralrs-core/src/pipeline/multimodal.rs:2133— MultimodalPipeline::precapture_cuda_decode_graphs_impl has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 3 (4 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.
MultimodalPipeline::forward_step (cognitive 17) mistralrs-core/src/pipeline/multimodal.rs:2624— 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.
MultimodalPipeline::capture_cuda_decode_graph_step (cognitive 16) mistralrs-core/src/pipeline/multimodal.rs:2293— MultimodalPipeline::capture_cuda_decode_graph_step has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, 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.
D30 · Dependency Vulnerabilities· Medium vulnerability · ×4
Near-duplicate member pair (29 shared lines) mistralrs-core/src/vision_models/gemma3/text.rs:183— mistralrs-core/src/vision_models/gemma3/text.rs:183-303 | 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:183— mistralrs-core/src/vision_models/gemma3/text.rs:183-303 | 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:183— mistralrs-core/src/vision_models/gemma3/text.rs:183-303 | 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:183— mistralrs-core/src/vision_models/gemma3/text.rs:183-303 | 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.
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 27 separate duplicated blocks between them, totalling at least 411 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:2687— mistralrs-core/src/pipeline/multimodal.rs:2687-2729 | mistralrs-core/src/pipeline/normal.rs:2416-2459 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 19 separate duplicated blocks between them, totalling at least 362 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:13683— scripts/production_soak.py:13683-13725 | scripts/production_soak.py:13841-13884 — both copies are in the same file, so extract the 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:13727` calls `ValueError` and `scripts/production_soak.py:13885` 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 (38 lines × 2) mistralrs-core/src/models/granite.rs:1461— mistralrs-core/src/models/granite.rs:1461-1498 | mistralrs-core/src/models/granite.rs:1748-1785 — both copies are in the same file, so extract the block into 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-core/src/pipeline/multimodal.rs:791— mistralrs-core/src/pipeline/multimodal.rs:791-828 | mistralrs-core/src/pipeline/normal.rs:775-812 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 lines × 2) mistralrs-core/src/vision_models/qwen3_5/text.rs:1352— mistralrs-core/src/vision_models/qwen3_5/text.rs:1352-1389 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:657-694 — `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 416 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-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 (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/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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:4547— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4547-4576 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4593-4622 — both copies are in the same file, so extract the block into 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 × 3) mistralrs-core/src/models/qwen3_next.rs:1138— mistralrs-core/src/models/qwen3_next.rs:1138-1164 | mistralrs-core/src/vision_models/qwen3_5/text.rs:2674-2700 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:931-957 — 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:426— mistralrs-core/src/pipeline/embedding.rs:426-452 | mistralrs-core/src/pipeline/multimodal.rs:949-975 | mistralrs-core/src/pipeline/normal.rs:931-957 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 163 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:348-367 | mistralrs-core/src/xlora_models/gemma2.rs:360-379 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:704-723 | mistralrs-core/src/models/starcoder2.rs:699-718 | mistralrs-core/src/vision_models/phi3/mod.rs:1540-1559 — 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 (18–19 lines × 2) mistralrs/src/model_builder_trait.rs:1127— mistralrs/src/model_builder_trait.rs:1127-1145 | mistralrs/src/model_builder_trait.rs:1194-1211 — both copies are in the same file, so extract the block into 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-core/src/models/mixtral.rs:480— mistralrs-core/src/models/mixtral.rs:480-497 | mistralrs-core/src/vision_models/phi3/mod.rs:1275-1293 — 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 291 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-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-quant/src/afq/ops.rs:874— mistralrs-quant/src/afq/ops.rs:874-891 | mistralrs-quant/src/afq/ops.rs:1000-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 (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:461-476 | mistralrs-core/src/xlora_models/mistral.rs:426-441 | mistralrs-core/src/xlora_models/mixtral.rs:556-571 | mistralrs-core/src/xlora_models/phi3.rs:393-408 | mistralrs-core/src/xlora_models/starcoder2.rs:415-430 — 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–16 lines × 4) mistralrs-core/src/models/qwen3_moe.rs:366— mistralrs-core/src/models/qwen3_moe.rs:366-381 | mistralrs-core/src/models/qwen3_next.rs:413-427 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:317-331 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:105-120 — 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 25 separate duplicated blocks between them, totalling at least 307 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:191— mistralrs-core/src/vision_models/qwen3_5/mod.rs:191-206 | mistralrs-core/src/vision_models/qwen3_5/mod.rs:254-268 | 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 408 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 28 separate duplicated blocks between them, totalling at least 500 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 28 separate duplicated blocks between them, totalling at least 500 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-core/src/models/deepseek2.rs:1006— mistralrs-core/src/models/deepseek2.rs:1006-1018 | mistralrs-core/src/models/deepseek3.rs:1068-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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:95— mistralrs-paged-attn/src/metal/backend/gather_kv.rs:95-107 | mistralrs-paged-attn/src/metal/backend/paged_attention.rs:428-442 — 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 24 separate duplicated blocks between them, totalling at least 300 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:344-355 | mistralrs-core/src/xlora_models/gemma.rs:343-354 | mistralrs-core/src/xlora_models/gemma2.rs:356-367 — `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:109-120 | 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 26 separate duplicated blocks between them, totalling at least 362 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/pipeline/loaders/multimodal_loaders.rs:2525— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2525-2536 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3854-3865 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6276-6287 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6678-6689 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7092-7103 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7551-7562 — 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 (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 (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:111-122 | 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:133-144 | 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:153-164 | 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 26 separate duplicated blocks between them, totalling at least 362 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/xlora_models/gemma.rs:599— mistralrs-core/src/xlora_models/gemma.rs:599-610 | mistralrs-core/src/xlora_models/mistral.rs:599-610 | mistralrs-core/src/xlora_models/mixtral.rs:729-740 | mistralrs-core/src/xlora_models/phi2.rs:565-576 | mistralrs-core/src/xlora_models/starcoder2.rs:584-595 — 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 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:553-561 | mistralrs-core/src/models/mistral.rs:558-566 | mistralrs-core/src/models/qwen3.rs:513-521 | mistralrs-core/src/models/qwen3_moe.rs:696-704 — 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:383— mistralrs-core/src/models/llama.rs:383-391 | mistralrs-core/src/models/mistral.rs:437-445 | mistralrs-core/src/models/phi3.rs:429-437 | mistralrs-core/src/models/phi3_5_moe.rs:497-505 | mistralrs-core/src/models/smollm3.rs:399-407 — before extracting anything, compare `mistralrs-core/src/models/llama.rs` and `mistralrs-core/src/models/mistral.rs` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 340 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:209-217 | 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-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 (6 lines × 7) mistralrs-core/src/metal/gdn.rs:153— mistralrs-core/src/metal/gdn.rs:153-158 | mistralrs-core/src/metal/gdn.rs:267-272 | mistralrs-core/src/metal/gdn.rs:363-368 | mistralrs-core/src/metal/gdn.rs:409-414 | mistralrs-core/src/metal/gdn.rs:448-453 | mistralrs-core/src/metal/gdn.rs:544-549 | mistralrs-core/src/metal/ssm.rs:175-180 — before extracting anything, compare `mistralrs-core/src/metal/gdn.rs` and `mistralrs-core/src/metal/ssm.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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) 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/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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 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:600-604 | mistralrs-core/src/vision_models/gemma3/text.rs:743-747 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:523-527 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:645-649 | mistralrs-core/src/xlora_models/gemma2.rs:645-649 — 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:1588— mistralrs-core/src/layers.rs:1588-1592 | mistralrs-core/src/layers.rs:1728-1732 | mistralrs-core/src/layers.rs:1899-1903 | mistralrs-core/src/layers.rs:3032-3036 | mistralrs-core/src/layers.rs:3165-3169 | 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/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.
Runner::new (cyclomatic 40) mistralrs-pyo3/src/lib.rs:972— Runner::new 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.
Runner::send_chat_completion_request (cyclomatic 30) mistralrs-pyo3/src/lib.rs:1403— 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:2364— 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.
PagedAttention::try_prefix_gather_prefill (cyclomatic 38) mistralrs-core/src/paged_attention/layers/paged_attention.rs:1005— PagedAttention::try_prefix_gather_prefill has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PagedAttention::cuda_fwd_t (cyclomatic 37) mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:103— PagedAttention::cuda_fwd_t 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.
PagedAttention::metal_fwd (cyclomatic 35) mistralrs-paged-attn/src/metal/backend/paged_attention.rs:36— 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.
TextModel::forward_embeds_scaled (cyclomatic 36) mistralrs-core/src/vision_models/gemma4/text.rs:2096— TextModel::forward_embeds_scaled 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.
TextModel::forward_embeds (cyclomatic 22) mistralrs-core/src/vision_models/gemma3/text.rs:597— 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 19) mistralrs-core/src/vision_models/gemma4/text.rs:1574— TextModel::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.
Qwen3_5Model::dflash_propose (cyclomatic 34) mistralrs-core/src/vision_models/qwen3_5/speculative.rs:431— 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:113— 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.
Qwen3_5Model::mtp_propose (cyclomatic 20) mistralrs-core/src/vision_models/qwen3_5/speculative.rs:664— Qwen3_5Model::mtp_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.
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:966— 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.
MultimodalPipeline::try_cuda_decode_graph_forward (cyclomatic 25) mistralrs-core/src/pipeline/multimodal.rs:1925— MultimodalPipeline::try_cuda_decode_graph_forward 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.
MultimodalPipeline::precapture_cuda_decode_graphs_impl (cyclomatic 17) mistralrs-core/src/pipeline/multimodal.rs:2133— MultimodalPipeline::precapture_cuda_decode_graphs_impl has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: MultimodalLoaderBuilder::build_inner (cyclomatic 24) 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:2624— 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 24) 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.
BlockwiseFP8Linear::apply_isq (cyclomatic 24) mistralrs-quant/src/blockwise_fp8/mod.rs:912— 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::forward_raw (cyclomatic 21) mistralrs-quant/src/blockwise_fp8/mod.rs:296— BlockwiseFP8Linear::forward_raw 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.
BlockwiseFP8Linear::try_forward_fused_split_glu (cyclomatic 16) mistralrs-quant/src/blockwise_fp8/mod.rs:772— 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:698— 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:885— 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:741— 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:1403— 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:2364— 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:972— Runner::new has cognitive complexity 58 (threshold 15). Drivers by points: if/else 28 (38 pts), loops 3 (9 pts), match/switch 7 (8 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.
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.
PagedAttention::try_prefix_gather_prefill (cognitive 55) mistralrs-core/src/paged_attention/layers/paged_attention.rs:1005— PagedAttention::try_prefix_gather_prefill has cognitive complexity 55 (threshold 15). Drivers by points: if/else 32 (45 pts), boolean chains 7, match/switch 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PagedAttention::cuda_fwd_t (cognitive 41) mistralrs-paged-attn/src/cuda/backend/paged_attention.rs:103— PagedAttention::cuda_fwd_t has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (22 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 39) mistralrs-paged-attn/src/metal/backend/paged_attention.rs:36— PagedAttention::metal_fwd has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (20 pts), match/switch 10 (14 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
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.
D30 · Dependency Vulnerabilities· Medium advisory (unsound) · ×3
REDACTED
REDACTED
REDACTED
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:347— mistralrs-core/src/models/gemma.rs:347-457 | 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:574-617 | mistralrs-core/src/xlora_models/mixtral.rs:704-747 | mistralrs-core/src/xlora_models/phi3.rs:525-570 | mistralrs-core/src/xlora_models/starcoder2.rs:557-602 — 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:574-617 | mistralrs-core/src/xlora_models/mixtral.rs:704-747 | mistralrs-core/src/xlora_models/phi2.rs:543-583 | mistralrs-core/src/xlora_models/starcoder2.rs:557-602 — 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:327-374 | mistralrs-core/src/xlora_models/gemma2.rs:334-386 — 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:1210-1318 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:391-500 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:512-622 — 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.
Near-duplicate member pair (37 shared lines) mistralrs-core/src/models/llama.rs:346— mistralrs-core/src/models/llama.rs:346-469 | mistralrs-core/src/models/mistral.rs:415-566 — 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 (37 shared lines) mistralrs-quant/src/lib.rs:2460— mistralrs-quant/src/lib.rs:2460-2593 | mistralrs-quant/src/lib.rs:2603-2757 — These two members are variants of one another: 37 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (35 shared lines) 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:870— mistralrs-core/src/layers.rs:870-933 | mistralrs-core/src/layers.rs:2203-2257 — 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.
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:5169-5471 | mistralrs-core/src/ops.rs:5598-5916 | mistralrs-core/src/ops.rs:5934-6234 — 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:2792— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2792-2845 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3098-3151 — both copies are in the same file, so extract the block into 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 53 separate duplicated blocks between them, totalling at least 787 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:4253— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4253-4295 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4552-4594 — both copies are in the same file, so extract the block into 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:917— mistralrs-core/src/pipeline/multimodal.rs:917-959 | mistralrs-core/src/pipeline/normal.rs:899-941 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/multimodal.rs:2013— mistralrs-core/src/pipeline/multimodal.rs:2013-2055 | mistralrs-core/src/pipeline/normal.rs:1844-1886 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/pipeline/multimodal.rs:1022— mistralrs-core/src/pipeline/multimodal.rs:1022-1063 | mistralrs-core/src/pipeline/normal.rs:1027-1068 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/pipeline/multimodal.rs:1424— mistralrs-core/src/pipeline/multimodal.rs:1424-1465 | mistralrs-core/src/pipeline/normal.rs:187-228 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 47 separate duplicated blocks between them, totalling at least 548 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 19 separate duplicated blocks between them, totalling at least 362 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:1181— mistralrs-pyo3/src/lib.rs:1181-1210 | mistralrs-server-core/src/mistralrs_for_server_builder.rs:1419-1447 — 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 24 separate duplicated blocks between them, totalling at least 300 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/pipeline/embedding.rs:402— mistralrs-core/src/pipeline/embedding.rs:402-424 | mistralrs-core/src/pipeline/multimodal.rs:925-947 | mistralrs-core/src/pipeline/normal.rs:907-929 — before extracting anything, compare `mistralrs-core/src/pipeline/embedding.rs` and `mistralrs-core/src/pipeline/multimodal.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 163 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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-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 (20 lines × 6) mistralrs-core/src/models/deepseek2.rs:981— mistralrs-core/src/models/deepseek2.rs:981-1000 | mistralrs-core/src/models/deepseek2.rs:1021-1040 | mistralrs-core/src/models/deepseek3.rs:1044-1063 | mistralrs-core/src/models/deepseek3.rs:1085-1104 | mistralrs-core/src/models/glm4_moe_lite.rs:996-1015 | mistralrs-core/src/models/glm4_moe_lite.rs:1039-1058 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 42 separate duplicated blocks between them, totalling at least 550 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 (18–20 lines × 2) mistralrs-core/src/layers.rs:3936— mistralrs-core/src/layers.rs:3936-3955 | mistralrs-core/src/layers.rs:3964-3981 — both copies are in the same file, so extract the block into 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/models/qwen3_moe.rs:766— mistralrs-core/src/models/qwen3_moe.rs:766-783 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:730-749 — 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 27 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. 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–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 (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:277-293 | mistralrs-core/src/models/mistral.rs:323-339 | mistralrs-core/src/models/qwen2.rs:355-371 | mistralrs-core/src/models/qwen3.rs:308-324 | mistralrs-core/src/models/smollm3.rs:293-309 — 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:2623— mistralrs-quant/src/afq/ops.rs:2623-2639 | mistralrs-quant/src/afq/ops.rs:2771-2787 | mistralrs-quant/src/afq/ops.rs:2919-2935 | mistralrs-quant/src/afq/ops.rs:3182-3198 | mistralrs-quant/src/afq/ops.rs:3362-3378 | mistralrs-quant/src/afq/ops.rs:3545-3561 — 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:378-394 | 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 25 separate duplicated blocks between them, totalling at least 307 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:3047— mistralrs-core/src/pipeline/multimodal.rs:3047-3063 | mistralrs-core/src/pipeline/multimodal.rs:3096-3112 | mistralrs-core/src/pipeline/normal.rs:2686-2702 | mistralrs-core/src/pipeline/normal.rs:2735-2751 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 19 separate duplicated blocks between them, totalling at least 362 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:560-576 | mistralrs-core/src/xlora_models/starcoder2.rs:508-523 — 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:1099— mistralrs-core/src/models/granite.rs:1099-1110 | mistralrs-core/src/models/granite.rs:1133-1149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–17 lines × 2) mistralrs-core/src/moe/experts/backends.rs:1385— mistralrs-core/src/moe/experts/backends.rs:1385-1396 | mistralrs-core/src/moe/experts/backends.rs:1483-1499 — both copies are in the same file, so extract the block into 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:349— mistralrs-core/src/models/gemma.rs:349-364 | 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 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:165-180 | 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 41 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 (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/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-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 (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:2143— mistralrs-core/src/pipeline/mod.rs:2143-2158 | mistralrs-core/src/pipeline/mod.rs:2788-2801 — both copies are in the same file, so extract the block into 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:2149— mistralrs-quant/src/lib.rs:2149-2164 | mistralrs-quant/src/lib.rs:2368-2380 — both copies are in the same file, so extract the block into 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:901— mistralrs-server-core/src/mistralrs_for_server_builder.rs:901-916 | mistralrs-server-core/src/mistralrs_for_server_builder.rs:1120-1132 — both copies are in the same file, so extract the block into 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:458-472 | mistralrs-core/src/models/qwen3.rs:424-438 | mistralrs-core/src/models/qwen3_moe.rs:601-615 | 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 28 separate duplicated blocks between them, totalling at least 289 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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-core/src/models/glm4.rs:513— mistralrs-core/src/models/glm4.rs:513-527 | mistralrs-core/src/models/hunyuan_v1_dense.rs:482-496 | mistralrs-core/src/models/hunyuan_v1_moe.rs:976-990 | mistralrs-core/src/models/mistral.rs:523-537 | mistralrs-core/src/models/qwen3.rs:473-487 | mistralrs-core/src/models/qwen3_moe.rs:656-670 — 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 462 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:208— mistralrs-core/src/vision_models/qwen3_5/mod.rs:208-222 | mistralrs-core/src/vision_models/qwen3_5/mod.rs:270-283 | 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 408 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:375-388 | mistralrs-core/src/xlora_models/mixtral.rs:502-516 | mistralrs-core/src/xlora_models/starcoder2.rs:364-377 — 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–14 lines × 3) mistralrs-core/src/pipeline/gguf.rs:671— mistralrs-core/src/pipeline/gguf.rs:671-684 | mistralrs-core/src/pipeline/gguf.rs:760-772 | mistralrs-core/src/pipeline/gguf.rs:880-892 — all 3 copies are in the same file, so extract the block into one function there and call it from 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–14 lines × 2) mistralrs-core/src/engine/add_request.rs:696— mistralrs-core/src/engine/add_request.rs:696-707 | mistralrs-core/src/engine/add_request.rs:712-725 — both copies are in the same file, so extract the block into 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:910— mistralrs-quant/src/distributed/layers.rs:910-921 | mistralrs-quant/src/distributed/layers.rs:1005-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 (12–14 lines × 2) mistralrs-quant/src/distributed/layers.rs:1371— mistralrs-quant/src/distributed/layers.rs:1371-1384 | mistralrs-quant/src/distributed/layers.rs:1491-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 (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:323-335 | 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:156-169 | 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:156-168 — 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:615-627 | mistralrs-core/src/xlora_models/mistral.rs:575-587 | mistralrs-core/src/xlora_models/mixtral.rs:705-717 | mistralrs-core/src/xlora_models/phi2.rs:545-557 | mistralrs-core/src/xlora_models/phi3.rs:527-539 | mistralrs-core/src/xlora_models/starcoder2.rs:560-572 — 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:1202— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1202-1214 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6309-6321 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6711-6723 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7125-7137 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7584-7596 — 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:523-535 | mistralrs-core/src/xlora_models/mixtral.rs:653-665 | mistralrs-core/src/xlora_models/phi2.rs:493-505 | mistralrs-core/src/xlora_models/phi3.rs:473-485 — 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:706-718 | 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/pipeline/mod.rs:2078— mistralrs-core/src/pipeline/mod.rs:2078-2088 | mistralrs-core/src/pipeline/mod.rs:2659-2671 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (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:1223— mistralrs-quant/src/distributed/layers.rs:1223-1235 | mistralrs-quant/src/distributed/layers.rs:1873-1883 — both copies are in the same file, so extract the block into 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:457-468 | mistralrs-core/src/models/qwen3.rs:423-434 | mistralrs-core/src/models/qwen3_moe.rs:600-611 | mistralrs-core/src/models/starcoder2.rs:426-437 | mistralrs-core/src/xlora_models/mistral.rs:446-457 | mistralrs-core/src/xlora_models/mixtral.rs:576-587 | mistralrs-core/src/xlora_models/starcoder2.rs:435-446 — 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:341-352 | mistralrs-core/src/xlora_models/mixtral.rs:468-479 | mistralrs-core/src/xlora_models/phi3.rs:306-317 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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: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:545-557 | mistralrs-core/src/models/qwen2.rs:572-583 | 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/models/llama.rs:500— mistralrs-core/src/models/llama.rs:500-510 | mistralrs-core/src/models/smollm3.rs:519-529 | 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 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:829— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:829-839 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3468-3478 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4202-4211 — all 3 copies are in the same file, so extract the block into one function there and call it from 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–11 lines × 2) mistralrs/src/model_builder_trait.rs:452— mistralrs/src/model_builder_trait.rs:452-462 | mistralrs/src/model_builder_trait.rs:1424-1432 — both copies are in the same file, so extract the block into 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/engine/mod.rs:1983— mistralrs-core/src/engine/mod.rs:1983-1993 | mistralrs-core/src/engine/mod.rs:2094-2102 — both copies are in the same file, so extract the block into 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:1257— mistralrs-core/src/kv_cache/mod.rs:1257-1265 | mistralrs-core/src/kv_cache/mod.rs:1318-1328 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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:377-384 | 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 8 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 (8 lines × 6) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:511— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:511-518 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4346-4353 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:947-954 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2229-2236 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2671-2678 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5622-5629 — 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:531-538 | mistralrs-core/src/xlora_models/mistral.rs:497-504 | mistralrs-core/src/xlora_models/mixtral.rs:628-635 | mistralrs-core/src/xlora_models/phi2.rs:479-486 | mistralrs-core/src/xlora_models/starcoder2.rs:485-492 — 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/models/gemma.rs:312— mistralrs-core/src/models/gemma.rs:312-318 | mistralrs-core/src/models/gpt_oss.rs:682-689 | mistralrs-core/src/models/hunyuan_v1_dense.rs:339-345 | mistralrs-core/src/models/hunyuan_v1_moe.rs:829-835 | mistralrs-core/src/models/mistral.rs:360-366 | mistralrs-core/src/models/mixtral.rs:369-375 | mistralrs-core/src/models/phi3.rs:373-379 | mistralrs-core/src/models/phi3_5_moe.rs:444-450 | mistralrs-core/src/models/qwen3.rs:345-351 | mistralrs-core/src/models/qwen3_moe.rs:522-528 | mistralrs-core/src/models/starcoder2.rs:369-375 | mistralrs-core/src/vision_models/phi3/mod.rs:464-470 | mistralrs-core/src/vision_models/phi4/mod.rs:294-300 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gpt_oss.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 188 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:562— mistralrs-core/src/models/gemma.rs:562-568 | mistralrs-core/src/models/gemma2.rs:678-684 | mistralrs-core/src/models/glm4.rs:678-684 | mistralrs-core/src/models/hunyuan_v1_dense.rs:650-656 | mistralrs-core/src/models/mistral.rs:690-696 | mistralrs-core/src/models/phi2.rs:637-643 | mistralrs-core/src/models/phi3.rs:633-639 | mistralrs-core/src/models/qwen2.rs:692-698 | mistralrs-core/src/models/qwen3.rs:649-655 | mistralrs-core/src/models/starcoder2.rs:628-634 | mistralrs-core/src/vision_models/gemma3/text.rs:904-910 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:650-656 | mistralrs-core/src/vision_models/phi3/mod.rs:1470-1476 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:569— mistralrs-core/src/models/gemma.rs:569-575 | mistralrs-core/src/models/gemma2.rs:685-691 | mistralrs-core/src/models/glm4.rs:685-691 | mistralrs-core/src/models/hunyuan_v1_dense.rs:657-663 | mistralrs-core/src/models/mistral.rs:697-703 | mistralrs-core/src/models/phi2.rs:644-650 | mistralrs-core/src/models/phi3.rs:640-646 | mistralrs-core/src/models/qwen2.rs:699-705 | mistralrs-core/src/models/qwen3.rs:656-662 | mistralrs-core/src/models/starcoder2.rs:635-641 | mistralrs-core/src/vision_models/gemma3/text.rs:911-917 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:657-663 | mistralrs-core/src/vision_models/phi3/mod.rs:1477-1483 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:210— mistralrs-core/src/vision_models/qwen3_5/mod.rs:210-215 | mistralrs-core/src/vision_models/qwen3_5/mod.rs:272-276 | 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 408 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.
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. 3 of the 10 files that make outbound calls are unbounded; the first 3 are listed.
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.
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:698— 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:885— 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.
Sdpa::run_attention_noflash (cyclomatic 30) mistralrs-core/src/attention/mod.rs:380— Sdpa::run_attention_noflash 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.
Sdpa::run_attention (cyclomatic 19) mistralrs-core/src/attention/mod.rs:254— Sdpa::run_attention 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.
UnquantLinear::apply_isq (cyclomatic 29) mistralrs-quant/src/unquantized/mod.rs:407— 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:133— 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.
Attention::forward (cyclomatic 27) mistralrs-core/src/vision_models/gemma4/text.rs:490— Attention::forward 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.
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.
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.
TextConfig::validate (cyclomatic 26) mistralrs-core/src/vision_models/qwen3_5_moe/config.rs:68— 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:263— 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.
GGUFLoader::load_model_from_path (cyclomatic 25) mistralrs-core/src/pipeline/gguf.rs:1192— 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 19) mistralrs-core/src/pipeline/gguf.rs:944— GGUFLoader::infer_multimodal_asset_paths 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.
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.
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:1191— 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.
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:1336— 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:1515— 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:2178— 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:1938— 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:1192— 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:1285— 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.
UnquantLinear::apply_isq (cognitive 39) mistralrs-quant/src/unquantized/mod.rs:407— 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:133— 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.
Sdpa::run_attention_noflash (cognitive 38) mistralrs-core/src/attention/mod.rs:380— Sdpa::run_attention_noflash has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 11, 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 28) mistralrs-core/src/attention/mod.rs:254— Sdpa::run_attention has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 7, 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.
FastExpertsWeights::forward_grouped (cognitive 35) mistralrs-core/src/moe/experts/backends.rs:1453— 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 17) mistralrs-core/src/moe/experts/backends.rs:1070— FastExpertsWeights::forward_impl has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:1192— 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 21) mistralrs-core/src/pipeline/gguf.rs:944— GGUFLoader::infer_multimodal_asset_paths has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 6 (7 pts), boolean chains 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.
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:605— 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:373— 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:275— 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:1225— 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:625— 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.
TextConfig::validate (cognitive 26) mistralrs-core/src/vision_models/qwen3_5_moe/config.rs:68— 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:263— 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.
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.
NormalPipeline::try_cuda_decode_graph_forward (cognitive 20) mistralrs-core/src/pipeline/normal.rs:1762— NormalPipeline::try_cuda_decode_graph_forward has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16 (17 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:2361— 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.
ToolCallingMatcher::new_with_format (cognitive 20) mistralrs-core/src/tools/mod.rs:114— 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 18) mistralrs-core/src/tools/mod.rs:232— ToolCallingMatcher::get_call_with_content has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (17 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 (17 members, 22 shared lines) · ×2
Near-duplicate member family (17 members, 22 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/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:189-279 | 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 17 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 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.
Near-duplicate member family (17 members, 22 shared lines) mistralrs-core/src/models/gemma2.rs:208— 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:189-279 | 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-310 — These 17 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 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 (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:101-180 | 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:101-180 | 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:393-523 | mistralrs-core/src/models/hunyuan_v1_moe.rs:883-1017 | mistralrs-core/src/models/qwen3.rs:400-521 — 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:433-550 | 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:858— mistralrs-core/src/models/glm4_moe.rs:858-896 | mistralrs-core/src/models/glm4_moe.rs:898-941 | mistralrs-core/src/models/glm4_moe_lite.rs:995-1036 | mistralrs-core/src/models/glm4_moe_lite.rs:1038-1092 — 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 (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 (84 shared lines) mistralrs-paged-attn/src/metal/kernels/mod.rs:368— mistralrs-paged-attn/src/metal/kernels/mod.rs:368-464 | mistralrs-paged-attn/src/metal/kernels/mod.rs:502-669 — 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 (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 (54 shared lines) mistralrs-core/src/models/phi3.rs:408— mistralrs-core/src/models/phi3.rs:408-533 | mistralrs-core/src/vision_models/phi3/mod.rs:1210-1318 — 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 (49 shared lines) mistralrs-core/src/cuda/gdn.rs:4799— mistralrs-core/src/cuda/gdn.rs:4799-5036 | mistralrs-core/src/cuda/gdn.rs:5065-5191 — 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:7206— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7206-7272 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7665-7747 — 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:107— mistralrs-core/src/moe/experts/mod.rs:107-188 | mistralrs-core/src/moe/experts/mod.rs:199-259 — 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.
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:183— mistralrs-core/src/vision_models/gemma3/text.rs:183-303 | mistralrs-core/src/xlora_models/starcoder2.rs:209-287 — 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 (13 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (13 members, 50+ identical tokens) mistralrs-core/src/models/deepseek2.rs:951— mistralrs-core/src/models/deepseek2.rs:951-976 | mistralrs-core/src/models/deepseek3.rs:1014-1039 | mistralrs-core/src/models/gemma.rs:463-489 | mistralrs-core/src/models/glm4.rs:576-603 | mistralrs-core/src/models/glm4_moe.rs:830-854 | mistralrs-core/src/models/glm4_moe_lite.rs:967-991 | mistralrs-core/src/models/hunyuan_v1_dense.rs:542-569 | mistralrs-core/src/models/hunyuan_v1_moe.rs:1036-1063 | mistralrs-core/src/models/mistral.rs:589-617 | mistralrs-core/src/models/mixtral.rs:526-554 | mistralrs-core/src/models/phi2.rs:542-567 | mistralrs-core/src/models/qwen3.rs:540-568 | mistralrs-core/src/models/qwen3_moe.rs:723-752 — These 13 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 13 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 13 times.
Members sharing a duplicated core (13 members, 50+ identical tokens) mistralrs-core/src/models/gemma.rs:311— mistralrs-core/src/models/gemma.rs:311-323 | mistralrs-core/src/models/gpt_oss.rs:681-694 | mistralrs-core/src/models/hunyuan_v1_dense.rs:338-350 | mistralrs-core/src/models/hunyuan_v1_moe.rs:828-840 | mistralrs-core/src/models/mistral.rs:359-371 | mistralrs-core/src/models/mixtral.rs:368-381 | mistralrs-core/src/models/phi3.rs:372-384 | mistralrs-core/src/models/phi3_5_moe.rs:443-455 | mistralrs-core/src/models/qwen3.rs:344-356 | mistralrs-core/src/models/qwen3_moe.rs:521-533 | mistralrs-core/src/models/starcoder2.rs:368-380 | mistralrs-core/src/vision_models/phi3/mod.rs:463-475 | mistralrs-core/src/vision_models/phi4/mod.rs:293-305 — These 13 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 13 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 13 times.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×2
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.
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.
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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 28 separate duplicated blocks between them, totalling at least 500 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:2932— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2932-2989 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3238-3295 — both copies are in the same file, so extract the block into 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:640— mistralrs-core/src/models/llama.rs:640-689 | mistralrs-core/src/models/smollm3.rs:659-708 | 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 50 separate duplicated blocks between them, totalling at least 696 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 (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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 2) mistralrs-paged-attn/src/metal/kernels/mod.rs:403— mistralrs-paged-attn/src/metal/kernels/mod.rs:403-450 | mistralrs-paged-attn/src/metal/kernels/mod.rs:546-593 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (41 lines × 2) mistralrs-core/src/vision_models/qwen3_5/mod.rs:152— mistralrs-core/src/vision_models/qwen3_5/mod.rs:152-192 | 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 408 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:1257— mistralrs-core/src/vision_models/qwen3_5/text.rs:1257-1297 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:561-601 — `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 416 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 × 2) mistralrs-core/src/pipeline/mod.rs:2105— mistralrs-core/src/pipeline/mod.rs:2105-2140 | mistralrs-core/src/pipeline/mod.rs:2681-2716 — both copies are in the same file, so extract the block into 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 (33 lines × 4) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2918— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2918-2950 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3225-3257 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3586-3618 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4282-4314 — 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 (33 lines × 4) mistralrs-core/src/vision_models/qwen3_5/mod.rs:451— mistralrs-core/src/vision_models/qwen3_5/mod.rs:451-483 | 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/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 408 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 × 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 (32 lines × 3) mistralrs-quant/src/afq/ops.rs:2050— mistralrs-quant/src/afq/ops.rs:2050-2081 | mistralrs-quant/src/afq/ops.rs:2168-2199 | mistralrs-quant/src/afq/ops.rs:2288-2319 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
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:384-410 — 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 27 separate duplicated blocks between them, totalling at least 411 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:896— mistralrs-core/src/moe/experts/backends.rs:896-925 | mistralrs-core/src/moe/experts/backends.rs:977-1003 — both copies are in the same file, so extract the block into 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:7231— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7231-7256 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7690-7718 — both copies are in the same file, so extract the block into 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 (27–28 lines × 2) mistralrs/src/model_builder_trait.rs:247— mistralrs/src/model_builder_trait.rs:247-274 | mistralrs/src/model_builder_trait.rs:590-616 — both copies are in the same file, so extract the block into 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-core/src/models/qwen3_next.rs:1082— mistralrs-core/src/models/qwen3_next.rs:1082-1109 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:847-873 — 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 27 separate duplicated blocks between them, totalling at least 411 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–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 (25–27 lines × 2) mistralrs-core/src/xlora_models/mixtral.rs:401— mistralrs-core/src/xlora_models/mixtral.rs:401-425 | 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 (24–26 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:1931— mistralrs-core/src/pipeline/multimodal.rs:1931-1956 | mistralrs-core/src/pipeline/normal.rs:1767-1790 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 (21–25 lines × 2) mistralrs-cli/src/commands/run/mod.rs:59— mistralrs-cli/src/commands/run/mod.rs:59-79 | mistralrs-cli/src/commands/serve.rs:65-89 — 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 5 separate duplicated blocks between them, totalling at least 82 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (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 (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:849— mistralrs-core/src/models/deepseek2.rs:849-872 | mistralrs-core/src/models/deepseek3.rs:912-935 | mistralrs-core/src/models/glm4_moe_lite.rs:859-882 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:822— mistralrs-core/src/models/deepseek2.rs:822-844 | mistralrs-core/src/models/deepseek3.rs:885-907 | mistralrs-core/src/models/glm4_moe.rs:722-744 | mistralrs-core/src/models/glm4_moe_lite.rs:832-854 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:335-357 | mistralrs-core/src/xlora_models/mistral.rs:322-344 | mistralrs-core/src/xlora_models/starcoder2.rs:311-333 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:2676— mistralrs-core/src/pipeline/inputs_processor.rs:2676-2697 | mistralrs-core/src/pipeline/inputs_processor.rs:2720-2741 | mistralrs-core/src/pipeline/inputs_processor.rs:2769-2790 — all 3 copies are in the same file, so extract the block into one function there and call it from 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 lines × 6) mistralrs-core/src/models/glm4.rs:499— mistralrs-core/src/models/glm4.rs:499-519 | mistralrs-core/src/models/hunyuan_v1_dense.rs:468-488 | mistralrs-core/src/models/hunyuan_v1_moe.rs:962-982 | mistralrs-core/src/models/mistral.rs:509-529 | mistralrs-core/src/models/mixtral.rs:463-483 | mistralrs-core/src/models/qwen3.rs:459-479 — 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 462 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 6) 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:474-494 | 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/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 19 separate duplicated blocks between them, totalling at least 362 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–21 lines × 3) mistralrs-core/src/xlora_models/mistral.rs:447— mistralrs-core/src/xlora_models/mistral.rs:447-466 | mistralrs-core/src/xlora_models/mixtral.rs:577-597 | mistralrs-core/src/xlora_models/starcoder2.rs:436-455 — 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 53 separate duplicated blocks between them, totalling at least 787 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 (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 (16–17 lines × 4) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2820— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2820-2835 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3126-3141 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4267-4283 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4566-4582 — 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–17 lines × 4) mistralrs-core/src/vision_models/qwen3_5/mod.rs:401— mistralrs-core/src/vision_models/qwen3_5/mod.rs:401-417 | 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/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 408 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 × 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:1599-1614 | 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:390-404 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:259-273 — 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:494-508 | mistralrs-core/src/xlora_models/mistral.rs:460-474 | mistralrs-core/src/xlora_models/mixtral.rs:590-605 | mistralrs-core/src/xlora_models/phi2.rs:442-456 | mistralrs-core/src/xlora_models/phi3.rs:419-433 | mistralrs-core/src/xlora_models/starcoder2.rs:449-463 — 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:1111— mistralrs-core/src/pipeline/multimodal.rs:1111-1126 | mistralrs-core/src/pipeline/multimodal.rs:1220-1235 | mistralrs-core/src/pipeline/normal.rs:1142-1157 | mistralrs-core/src/pipeline/normal.rs:1275-1290 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:615— mistralrs-core/src/xlora_models/gemma2.rs:615-630 | mistralrs-core/src/xlora_models/phi2.rs:545-560 | mistralrs-core/src/xlora_models/phi3.rs:527-542 | mistralrs-core/src/xlora_models/starcoder2.rs:560-575 — 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:1116— mistralrs-core/src/pipeline/multimodal.rs:1116-1130 | mistralrs-core/src/pipeline/multimodal.rs:1166-1180 | mistralrs-core/src/pipeline/normal.rs:1147-1161 | mistralrs-core/src/pipeline/normal.rs:1197-1211 | mistralrs-core/src/pipeline/normal.rs:1280-1294 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:73— mistralrs-core/src/models/quantized_llama.rs:73-85 | 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 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:339-352 | mistralrs-core/src/xlora_models/mixtral.rs:466-479 | mistralrs-core/src/xlora_models/phi3.rs:304-317 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:551— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:551-564 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2344-2357 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3009-3022 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3316-3329 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6080-6093 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1199-1212 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2268-2281 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5209-5222 — 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 (13–14 lines × 5) mistralrs-core/src/embedding_models/qwen3_embedding.rs:476— mistralrs-core/src/embedding_models/qwen3_embedding.rs:476-488 | mistralrs-core/src/models/qwen3.rs:580-592 | mistralrs-core/src/models/qwen3_moe.rs:764-776 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:606-619 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:728-741 — `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 26 separate duplicated blocks between them, totalling at least 362 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 × 5) mistralrs-core/src/xlora_models/mistral.rs:276— mistralrs-core/src/xlora_models/mistral.rs:276-289 | mistralrs-core/src/xlora_models/mixtral.rs:189-202 | mistralrs-core/src/xlora_models/phi3.rs:164-177 | mistralrs-core/src/xlora_models/quantized_phi3.rs:201-213 | mistralrs-core/src/xlora_models/starcoder2.rs:263-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 53 separate duplicated blocks between them, totalling at least 787 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:883— mistralrs-quant/src/distributed/layers.rs:883-896 | mistralrs-quant/src/distributed/layers.rs:1345-1358 | mistralrs-quant/src/distributed/layers.rs:2000-2013 | mistralrs-quant/src/distributed/layers.rs:2216-2229 — 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 × 11) mistralrs-core/src/models/glm4.rs:438— mistralrs-core/src/models/glm4.rs:438-450 | mistralrs-core/src/models/granite.rs:1947-1959 | mistralrs-core/src/models/hunyuan_v1_dense.rs:411-423 | mistralrs-core/src/models/hunyuan_v1_moe.rs:905-917 | mistralrs-core/src/models/lfm2.rs:1018-1030 | mistralrs-core/src/models/llama.rs:348-360 | mistralrs-core/src/models/mistral.rs:417-429 | mistralrs-core/src/models/qwen3.rs:402-414 | mistralrs-core/src/models/qwen3_moe.rs:579-591 | mistralrs-core/src/models/smollm3.rs:364-376 | mistralrs-core/src/vision_models/llama4/text.rs:796-808 — 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 (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 × 10) mistralrs-core/src/models/glm4.rs:510— mistralrs-core/src/models/glm4.rs:510-522 | mistralrs-core/src/models/hunyuan_v1_dense.rs:479-491 | mistralrs-core/src/models/hunyuan_v1_moe.rs:973-985 | mistralrs-core/src/models/mistral.rs:520-532 | mistralrs-core/src/models/mixtral.rs:474-486 | mistralrs-core/src/models/qwen2.rs:506-518 | mistralrs-core/src/models/qwen3.rs:470-482 | mistralrs-core/src/models/qwen3_moe.rs:653-665 | mistralrs-core/src/vision_models/phi3/mod.rs:1269-1281 | mistralrs-core/src/vision_models/phi4/mod.rs:384-396 — 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 462 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 10) mistralrs-core/src/models/gpt_oss.rs:659— 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:349-361 | mistralrs-core/src/xlora_models/mixtral.rs:476-488 | mistralrs-core/src/xlora_models/phi3.rs:314-326 — before extracting anything, compare `mistralrs-core/src/models/gpt_oss.rs` and `mistralrs-core/src/models/hunyuan_v1_moe.rs` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 292 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/deepseek2.rs:955— mistralrs-core/src/models/deepseek2.rs:955-967 | mistralrs-core/src/models/deepseek3.rs:1018-1030 | mistralrs-core/src/models/gemma.rs:468-480 | mistralrs-core/src/models/glm4_moe.rs:834-845 | mistralrs-core/src/models/glm4_moe_lite.rs:971-982 | mistralrs-core/src/models/llama.rs:496-508 | mistralrs-core/src/models/phi2.rs:546-558 | mistralrs-core/src/models/smollm3.rs:515-527 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:511-522 | mistralrs-core/src/vision_models/gemma3/text.rs:530-542 | mistralrs-core/src/vision_models/gemma3n/text.rs:1469-1481 | 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: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 43 separate duplicated blocks between them, totalling at least 514 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/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 (11–12 lines × 3) mistralrs-quant/src/afq/ops.rs:2374— mistralrs-quant/src/afq/ops.rs:2374-2384 | mistralrs-quant/src/afq/ops.rs:2494-2504 | mistralrs-quant/src/afq/ops.rs:3022-3033 — all 3 copies are in the same file, so extract the block into one function there and call it from 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–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 (11 lines × 11) mistralrs-core/src/models/gemma.rs:313— mistralrs-core/src/models/gemma.rs:313-323 | mistralrs-core/src/models/hunyuan_v1_dense.rs:340-350 | mistralrs-core/src/models/hunyuan_v1_moe.rs:830-840 | mistralrs-core/src/models/mistral.rs:361-371 | mistralrs-core/src/models/phi3.rs:374-384 | mistralrs-core/src/models/phi3_5_moe.rs:445-455 | mistralrs-core/src/models/qwen3.rs:346-356 | mistralrs-core/src/models/qwen3_moe.rs:523-533 | mistralrs-core/src/models/starcoder2.rs:370-380 | mistralrs-core/src/vision_models/phi3/mod.rs:465-475 | mistralrs-core/src/vision_models/phi4/mod.rs:295-305 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/hunyuan_v1_dense.rs` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 353 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 11) mistralrs-core/src/models/glm4.rs:510— mistralrs-core/src/models/glm4.rs:510-520 | mistralrs-core/src/models/hunyuan_v1_dense.rs:479-489 | mistralrs-core/src/models/hunyuan_v1_moe.rs:973-983 | mistralrs-core/src/models/mistral.rs:520-530 | mistralrs-core/src/models/mixtral.rs:474-484 | mistralrs-core/src/models/phi3.rs:487-498 | mistralrs-core/src/models/qwen2.rs:506-516 | mistralrs-core/src/models/qwen3.rs:470-480 | mistralrs-core/src/models/qwen3_moe.rs:653-663 | mistralrs-core/src/vision_models/phi3/mod.rs:1268-1279 | mistralrs-core/src/vision_models/phi4/mod.rs:383-394 — 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 462 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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-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:111-121 | 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:332-342 | 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 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 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:519-529 | mistralrs-core/src/xlora_models/mistral.rs:485-495 | mistralrs-core/src/xlora_models/mixtral.rs:616-626 | 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 (11 lines × 5) mistralrs-quant/src/cutile/fused_moe.rs:82— mistralrs-quant/src/cutile/fused_moe.rs:82-92 | mistralrs-quant/src/cutile/fused_moe.rs:123-133 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:95-105 | mistralrs-quant/src/cutile/fused_moe_fp8.rs:134-144 | mistralrs-quant/src/cutile/gdn_prefill.rs:265-275 — 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 24 separate duplicated blocks between them, totalling at least 300 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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-paged-attn/src/metal/kernels/mod.rs:269— mistralrs-paged-attn/src/metal/kernels/mod.rs:269-279 | mistralrs-paged-attn/src/metal/kernels/mod.rs:627-635 | mistralrs-paged-attn/src/metal/kernels/mod.rs:703-713 — all 3 copies are in the same file, so extract the block into one function there and call it from 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 × 3) mistralrs-quant/src/afq/ops.rs:2349— mistralrs-quant/src/afq/ops.rs:2349-2357 | mistralrs-quant/src/afq/ops.rs:2473-2483 | mistralrs-quant/src/afq/ops.rs:2995-3005 — all 3 copies are in the same file, so extract the block into one function there and call it from 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-quant/src/afq/ops.rs:2400— mistralrs-quant/src/afq/ops.rs:2400-2410 | mistralrs-quant/src/afq/ops.rs:2642-2652 | mistralrs-quant/src/afq/ops.rs:3199-3201 | mistralrs-quant/src/afq/ops.rs:3203-3213 — 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:905— mistralrs-core/src/layers.rs:905-907 | mistralrs-core/src/layers.rs:924-933 | mistralrs-core/src/layers.rs:2228-2230 | mistralrs-core/src/layers.rs:2247-2257 — 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 × 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:491-500 | mistralrs-core/src/vision_models/gemma4/text.rs:1672-1681 | mistralrs-core/src/vision_models/phi3/mod.rs:1242-1251 | mistralrs-core/src/vision_models/phi4/mod.rs:357-366 | 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:548-557 — 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 × 7) mistralrs-core/src/pipeline/multimodal.rs:1091— mistralrs-core/src/pipeline/multimodal.rs:1091-1100 | mistralrs-core/src/pipeline/multimodal.rs:1148-1157 | mistralrs-core/src/pipeline/multimodal.rs:1200-1209 | mistralrs-core/src/pipeline/normal.rs:1069-1078 | mistralrs-core/src/pipeline/normal.rs:1122-1131 | mistralrs-core/src/pipeline/normal.rs:1179-1188 | mistralrs-core/src/pipeline/normal.rs:1255-1264 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:603-613 | mistralrs-core/src/xlora_models/mixtral.rs:733-743 | 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:477-486 | mistralrs-core/src/xlora_models/starcoder2.rs:588-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 (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:592-600 | mistralrs-core/src/xlora_models/mixtral.rs:722-730 | mistralrs-core/src/xlora_models/phi3.rs:543-552 | mistralrs-core/src/xlora_models/starcoder2.rs:576-585 — 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:815— mistralrs-core/src/models/deepseek2.rs:815-824 | mistralrs-core/src/models/deepseek3.rs:878-887 | mistralrs-core/src/models/glm4_moe.rs:715-724 | mistralrs-core/src/models/glm4_moe_lite.rs:825-834 | mistralrs-core/src/models/gpt_oss.rs:721-729 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/models/granite.rs:1412— mistralrs-core/src/models/granite.rs:1412-1420 | mistralrs-core/src/models/granite.rs:1433-1441 | mistralrs-core/src/models/granite.rs:1719-1728 — all 3 copies are in the same file, so extract the block into one function there and call it from 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–10 lines × 3) mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:802— mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:802-810 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:570-579 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:692-701 — `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 19 separate duplicated blocks between them, totalling at least 218 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 (7–10 lines × 2) mistralrs-core/src/utils/tiktoken.rs:99— mistralrs-core/src/utils/tiktoken.rs:99-108 | mistralrs-core/src/utils/tokenizer.rs:109-115 — 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 × 10) mistralrs-core/src/layers.rs:1150— mistralrs-core/src/layers.rs:1150-1158 | mistralrs-core/src/layers.rs:1173-1181 | mistralrs-core/src/layers.rs:1240-1248 | mistralrs-core/src/layers.rs:1263-1271 | mistralrs-core/src/layers.rs:1340-1348 | mistralrs-core/src/layers.rs:1509-1517 | mistralrs-core/src/layers.rs:1532-1540 | mistralrs-core/src/layers.rs:2337-2345 | mistralrs-core/src/layers.rs:2435-2443 | mistralrs-core/src/layers.rs:2482-2490 — 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: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:2250-2259 | mistralrs-core/src/models/llama.rs:499-508 | mistralrs-core/src/models/phi2.rs:549-558 | mistralrs-core/src/models/smollm3.rs:518-527 | 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:706-714 | 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 × 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 (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 (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 (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 × 12) mistralrs-core/src/models/gemma.rs:312— 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/phi3.rs:373-380 | mistralrs-core/src/models/phi3_5_moe.rs:444-451 | mistralrs-core/src/models/qwen3.rs:345-352 | mistralrs-core/src/models/qwen3_moe.rs:522-529 | mistralrs-core/src/models/starcoder2.rs:369-376 | 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/gemma.rs` and `mistralrs-core/src/models/gpt_oss.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 188 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:501— mistralrs-core/src/models/gemma.rs:501-509 | mistralrs-core/src/models/mistral.rs:629-637 | mistralrs-core/src/models/mixtral.rs:566-574 | mistralrs-core/src/models/phi3.rs:576-584 | mistralrs-core/src/models/qwen2.rs:631-639 | 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:582-589 | mistralrs-core/src/vision_models/phi3/mod.rs:1382-1390 | mistralrs-core/src/vision_models/phi4/mod.rs:644-652 | 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 383 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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-core/src/models/mixtral.rs:426— mistralrs-core/src/models/mixtral.rs:426-433 | mistralrs-core/src/models/qwen2.rs:454-462 | 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:433-440 — before extracting anything, compare `mistralrs-core/src/models/mixtral.rs` and `mistralrs-core/src/models/qwen2.rs` as WHOLE FILES: this scan already matched 43 separate duplicated blocks between them, totalling at least 514 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1967— mistralrs-core/src/engine/mod.rs:1967-1974 | mistralrs-core/src/engine/mod.rs:2042-2049 | mistralrs-core/src/engine/mod.rs:2061-2068 | mistralrs-core/src/engine/mod.rs:2087-2092 — 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:414— mistralrs-quant/src/blockwise_fp8/mod.rs:414-419 | 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–8 lines × 4) mistralrs-core/src/models/gemma2.rs:566— mistralrs-core/src/models/gemma2.rs:566-572 | mistralrs-core/src/models/gpt_oss.rs:916-923 | mistralrs-core/src/models/qwen2.rs:594-600 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:593-600 — before extracting anything, compare `mistralrs-core/src/models/gemma2.rs` and `mistralrs-core/src/models/gpt_oss.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 219 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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 lines × 12) 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:988-995 | mistralrs-core/src/models/deepseek2.rs:1028-1035 | mistralrs-core/src/models/deepseek3.rs:1051-1058 | mistralrs-core/src/models/deepseek3.rs:1092-1099 | mistralrs-core/src/models/glm4_moe_lite.rs:1003-1010 | mistralrs-core/src/models/glm4_moe_lite.rs:1046-1053 | mistralrs-core/src/models/hunyuan_v1_dense.rs:581-587 | mistralrs-core/src/models/qwen3.rs:580-586 | mistralrs-core/src/models/qwen3_moe.rs:764-770 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:606-613 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:728-735 — 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 × 12) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1319— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1319-1325 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2300-2306 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2625-2631 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2967-2973 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3274-3280 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3953-3959 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4707-4713 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:733-739 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1157-1163 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1385-1391 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2013-2019 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5167-5173 — 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 × 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:523-529 | mistralrs-core/src/xlora_models/mistral.rs:489-495 | mistralrs-core/src/xlora_models/mixtral.rs:620-626 | mistralrs-core/src/xlora_models/phi2.rs:471-477 | mistralrs-core/src/xlora_models/starcoder2.rs:477-483 — 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:1274-1280 | mistralrs-core/src/pipeline/speech.rs:267-272 — 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:1975— mistralrs-quant/src/afq/ops.rs:1975-1980 | mistralrs-quant/src/afq/ops.rs:2093-2098 | mistralrs-quant/src/afq/ops.rs:2212-2218 — all 3 copies are in the same file, so extract the block into one function there and call it from 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 (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 (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 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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.
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 21 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:13305— 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 100) mistralrs-core/src/pipeline/mod.rs:2002— Pipeline::submit_step has cyclomatic complexity 100 (threshold 15). To reduce it, separate the cases: extract each independent 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 87) mistralrs-core/src/pipeline/multimodal.rs:531— MultimodalLoader::load_model_from_path has cyclomatic complexity 87 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NormalLoader::load_model_from_path (cyclomatic 63) mistralrs-core/src/pipeline/normal.rs:634— NormalLoader::load_model_from_path has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent 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.
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 literals 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.
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:1336— 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.
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.
MistralRsForServerBuilder::build_multi_model (cyclomatic 25) mistralrs-server-core/src/mistralrs_for_server_builder.rs:967— MistralRsForServerBuilder::build_multi_model 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.
FastExpertsWeights::forward_grouped (cyclomatic 24) mistralrs-core/src/moe/experts/backends.rs:1453— 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.
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:596— 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:2123— 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.
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:443— 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:11761— 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:14083— 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:2178— 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.
NormalPipeline::try_cuda_decode_graph_forward (cyclomatic 19) mistralrs-core/src/pipeline/normal.rs:1762— NormalPipeline::try_cuda_decode_graph_forward 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: NormalLoaderBuilder::build_inner (cyclomatic 27) 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.
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:1129— 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:11401— 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.
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.
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:432— 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:2457— 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.
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:197— 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:595— 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:3098— 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:1976— 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:2461— 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:373— 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:805— 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:2565— 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.
Repeated repair: mistralrs-server-core/src/media_source.rs mistralrs-server-core/src/media_source.rs:142— mistralrs-server-core/src/media_source.rs changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is mistralrs_server_core::media_source::ui_upload_filename at line 142), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(search): share the remote fetch guard with the web search and extraction tools (#2449)”; “fix(server): judge IPv6 transition addresses by their embedded IPv4 in the media guard (#2446)”; “fix(core): address recent correctness regressions (#2345)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-06-27..2026-09-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-27 09:50:28 -04:00' --until='2026-09-25 09:50:28 -04:00' --full-history --no-merges -- mistralrs-server-core/src/media_source.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.
production_soak.validate_args (cognitive 332) scripts/production_soak.py:13305— 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 226) mistralrs-core/src/pipeline/mod.rs:2002— Pipeline::submit_step has cognitive complexity 226 (threshold 15). Drivers by points: if/else 50 (134 pts), loops 15 (49 pts), boolean chains 24, match/switch 7 (19 pts) (nesting depth added 130). 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 142) mistralrs-core/src/pipeline/multimodal.rs:531— MultimodalLoader::load_model_from_path has cognitive complexity 142 (threshold 15). Drivers by points: if/else 78 (106 pts), match/switch 16 (24 pts), boolean chains 6, loops 5 (6 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
NormalLoader::load_model_from_path (cognitive 105) mistralrs-core/src/pipeline/normal.rs:634— NormalLoader::load_model_from_path has cognitive complexity 105 (threshold 15). Drivers by points: if/else 59 (79 pts), match/switch 12 (18 pts), boolean chains 4, loops 3 (4 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.
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.
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 literals 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:596— 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.
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.
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.
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.
MistralRsForServerBuilder::build_multi_model (cognitive 35) mistralrs-server-core/src/mistralrs_for_server_builder.rs:967— MistralRsForServerBuilder::build_multi_model has cognitive complexity 35 (threshold 15). Drivers by points: if/else 27 (34 pts), 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.
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:2123— 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.
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.
CacheEngine::allocate_gpu_cache (cognitive 30) mistralrs-core/src/paged_attention/cache_engine.rs:178— CacheEngine::allocate_gpu_cache has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (26 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen3_5MoeTextModel::forward_embeds (cognitive 30) mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:753— 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:5537— 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:443— 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:624— 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:595— 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:2565— 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:633— 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:805— 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:261— 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.
FixedBucketingManager::bucket_and_waitlist_seqs_waiting (cognitive 23) mistralrs-core/src/scheduler/default_scheduler.rs:82— FixedBucketingManager::bucket_and_waitlist_seqs_waiting has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (6 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SequenceGroup::maybe_send_streaming_response (cognitive 23) mistralrs-core/src/sequence.rs:2461— 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.
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:11761— 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:39— 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.
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:463— 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.
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:1129— 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:197— 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:381— 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:1902— 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.
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:11401— 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:153— 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.
Sequence::take_ready_streaming_emissions (cognitive 18) mistralrs-core/src/sequence.rs:1544— Sequence::take_ready_streaming_emissions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (5 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.
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:8376— 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.
DefaultScheduler::schedule (cognitive 16) mistralrs-core/src/scheduler/default_scheduler.rs:201— DefaultScheduler::schedule has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (4 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:1863— 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:1291— 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:14083— 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.
D22 · Internal API Consistency· Inconsistent tool registration API across Agent and AgentBuilder. Agent uses a single with_tool method with a generic callback type, while AgentBuilder splits this into with_sync_tool, with_async_tool, and register_tool with different signatures and naming conventions. · ×1
Inconsistent tool registration API across Agent and AgentBuilder. Agent uses a single with_tool method with a generic callback type, while AgentBuilder splits this into with_sync_tool, with_async_tool, and register_tool with different signatures and naming conventions. — Unify to a single register_tool or with_tool method on both Agent and AgentBuilder that accepts a unified callback type or trait object, removing the sync/async distinction from the API surface. (signatures: Agent.with_tool(tool: Tool, callback: ToolCallbackType): Self | AgentBuilder.with_sync_tool(tool: Tool, callback: ToolCallback): Self | AgentBuilder.with_async_tool(tool: Tool, callback: AsyncToolCallback): Self | AgentBuilder.register_tool(_: (Tool, ToolCallbackType)): Self)
D22 · Internal API Consistency· Redundant high-level chat methods. Both Model and BlockingModel expose chat() and send_chat_request() which appear to do similar things. The distinction between 'chat' and 'send_chat_request' is unclear, and having both on both types creates confusion about which to use. · ×1
Redundant high-level chat methods. Both Model and BlockingModel expose chat() and send_chat_request() which appear to do similar things. The distinction between 'chat' and 'send_chat_request' is unclear, and having both on both types creates confusion about which to use. — Remove send_chat_request from the public API if chat() provides equivalent functionality, or clearly distinguish them (e.g., chat for simple text, send_chat_request for complex request objects). Consider removing one of the two types or consolidating their interfaces. (signatures: Model.chat(message: impl ToString): Result | BlockingModel.chat(message: impl ToString): Result | Model.send_chat_request(request: R): Result | BlockingModel.send_chat_request(request: R): Result)
D22 · Internal API Consistency· Inconsistent naming for embedding generation. The singular 'generate_embedding' and plural 'generate_embeddings' methods exist alongside their _with_model variants, but the distinction between singular and plural is unclear (single prompt vs batch?). This creates confusion about when to use which method. · ×1
Inconsistent naming for embedding generation. The singular 'generate_embedding' and plural 'generate_embeddings' methods exist alongside their _with_model variants, but the distinction between singular and plural is unclear (single prompt vs batch?). This creates confusion about when to use which method. — Standardize on either singular/plural naming based on input type (e.g., generate_embedding for single, generate_embeddings for batch) and remove redundant _with_model variants by using a model_id parameter in the main method. (signatures: Model.generate_embedding(prompt: impl ToString): Result | Model.generate_embeddings(request: EmbeddingRequestBuilder): Result | Model.generate_embedding_with_model(prompt: impl ToString, model_id: str): Result | Model.generate_embeddings_with_model(request: EmbeddingRequestBuilder, model_id: str): Result)
D22 · Internal API Consistency· Redundant tool callback registration methods. with_tool_callback and with_tool_callback_and_tool differ only by whether a Tool object is passed, but the distinction is unclear. If the callback implies the tool, the second method is redundant; if not, the naming is confusing. · ×1
Redundant tool callback registration methods. with_tool_callback and with_tool_callback_and_tool differ only by whether a Tool object is passed, but the distinction is unclear. If the callback implies the tool, the second method is redundant; if not, the naming is confusing. — Remove with_tool_callback_and_tool and require the Tool to be passed separately or inferred from the callback, or rename to clarify the difference (e.g., with_tool_callback_only vs with_tool_and_callback). (signatures: GgufModelBuilder.with_tool_callback(name: impl Into<String>, callback: ToolCallback): Self | GgufModelBuilder.with_tool_callback_and_tool(name: impl Into<String>, callback: ToolCallback, tool: Tool): Self)
D22 · Internal API Consistency· Excessive method proliferation for LoRA adapter loading. Four variants exist with different combinations of model_id and policy parameters, creating a combinatorial explosion that is hard to remember and use correctly. · ×1
Excessive method proliferation for LoRA adapter loading. Four variants exist with different combinations of model_id and policy parameters, creating a combinatorial explosion that is hard to remember and use correctly. — Consolidate into a single load_lora_adapter method that accepts optional parameters via a builder pattern or a config struct, reducing the four methods to one. (signatures: Model.load_lora_adapter(alias: impl Into<String>, adapter_dir: impl Into<PathBuf>): Result | Model.load_lora_adapter_with_policy(alias: impl Into<String>, adapter_dir: impl Into<PathBuf>, policy: LoraAdapterLoadPolicy): Result | Model.load_lora_adapter_with_model(alias: impl Into<String>, adapter_dir: impl Into<PathBuf>, model_id: str): Result | Model.load_lora_adapter_with_model_and_policy(alias: impl Into<String>, adapter_dir: impl Into<PathBuf>, model_id: str, policy: LoraAdapterLoadPolicy): Result)
D4 · Code Duplication· Near-duplicate member family (24 members, 30 shared lines) · ×1
Near-duplicate member family (24 members, 30 shared lines) mistralrs-core/src/models/gemma2.rs:208— 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:1535-1619 | 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:189-279 | 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:274-421 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:187-283 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:194-287 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:300-390 — These 24 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 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· Near-duplicate member family (22 members, 23 shared lines) · ×1
Near-duplicate member family (22 members, 23 shared lines) mistralrs-core/src/models/gemma2.rs:208— 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:1535-1619 | 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:189-279 | 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-310 | 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 22 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 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 (21 members, 22 shared lines) · ×1
Near-duplicate member family (21 members, 22 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/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:189-279 | 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 21 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 21 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 21 times.
D4 · Code Duplication· Near-duplicate member family (19 members, 22 shared lines) · ×1
Near-duplicate member family (19 members, 22 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/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:189-279 | 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-310 | mistralrs-core/src/vision_models/voxtral/mod.rs:126-208 — These 19 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 19 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 19 times.
D4 · Code Duplication· Near-duplicate member family (17 members, 38 shared lines) · ×1
Near-duplicate member family (17 members, 38 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/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:189-279 | 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 17 members are variants of one another: a block of 38 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, 31 shared lines) · ×1
Near-duplicate member family (16 members, 31 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/gpt_oss.rs:248-326 | mistralrs-core/src/models/granite.rs:1535-1619 | 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:189-279 | 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 16 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 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 (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:189-279 | 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:584— mistralrs-core/src/models/gemma.rs:584-675 | mistralrs-core/src/models/gemma2.rs:700-791 | mistralrs-core/src/models/glm4.rs:700-791 | mistralrs-core/src/models/hunyuan_v1_dense.rs:672-763 | mistralrs-core/src/models/mistral.rs:712-803 | mistralrs-core/src/models/phi2.rs:659-742 | mistralrs-core/src/models/phi3.rs:655-738 | mistralrs-core/src/models/qwen2.rs:714-805 | mistralrs-core/src/models/qwen3.rs:671-762 | mistralrs-core/src/models/starcoder2.rs:650-733 | mistralrs-core/src/vision_models/gemma3/text.rs:926-1017 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:672-766 | mistralrs-core/src/vision_models/phi3/mod.rs:1492-1574 — 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:1316— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1316-1351 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1608-1643 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1893-1928 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2286-2333 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2623-2657 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2964-2999 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3271-3306 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3951-3985 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4703-4739 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:730-765 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1154-1189 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2010-2045 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5164-5199 — 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:584— mistralrs-core/src/models/gemma.rs:584-675 | mistralrs-core/src/models/gemma2.rs:700-791 | mistralrs-core/src/models/glm4.rs:700-791 | mistralrs-core/src/models/hunyuan_v1_dense.rs:672-763 | mistralrs-core/src/models/mistral.rs:712-803 | mistralrs-core/src/models/qwen2.rs:714-805 | mistralrs-core/src/models/qwen3.rs:671-762 | mistralrs-core/src/vision_models/gemma3/text.rs:926-1017 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:672-766 | 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:686-745 | mistralrs-core/src/xlora_models/llama.rs:459-518 | mistralrs-core/src/xlora_models/mistral.rs:631-690 | mistralrs-core/src/xlora_models/mixtral.rs:761-820 | 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:518-577 | mistralrs-core/src/xlora_models/starcoder2.rs:616-675 — 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:187-283 | 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:1535-1619 | 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:951— mistralrs-core/src/models/deepseek2.rs:951-976 | mistralrs-core/src/models/deepseek3.rs:1014-1039 | mistralrs-core/src/models/glm4_moe.rs:830-854 | mistralrs-core/src/models/glm4_moe_lite.rs:967-991 | mistralrs-core/src/models/mixtral.rs:526-554 | mistralrs-core/src/models/phi2.rs:542-567 | mistralrs-core/src/models/phi3.rs:535-564 | 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, 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-309 | mistralrs-core/src/xlora_models/llama.rs:55-115 | mistralrs-core/src/xlora_models/mistral.rs:222-298 | mistralrs-core/src/xlora_models/mixtral.rs:135-211 | mistralrs-core/src/xlora_models/phi2.rs:217-288 | mistralrs-core/src/xlora_models/starcoder2.rs:209-287 — 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-309 | mistralrs-core/src/xlora_models/mistral.rs:222-298 | mistralrs-core/src/xlora_models/mixtral.rs:135-211 | mistralrs-core/src/xlora_models/phi2.rs:217-288 | mistralrs-core/src/xlora_models/phi3.rs:113-186 | mistralrs-core/src/xlora_models/starcoder2.rs:209-287 — 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:1535-1619 | 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:187-283 — 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, 37 shared lines) · ×1
Near-duplicate member family (6 members, 37 shared lines) mistralrs-core/src/models/glm4.rs:436— mistralrs-core/src/models/glm4.rs:436-561 | mistralrs-core/src/models/hunyuan_v1_dense.rs:393-523 | mistralrs-core/src/models/hunyuan_v1_moe.rs:883-1017 | mistralrs-core/src/models/mistral.rs:415-566 | mistralrs-core/src/models/qwen3.rs:400-521 | mistralrs-core/src/models/qwen3_moe.rs:577-704 — These 6 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 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:433-582 | mistralrs-core/src/vision_models/phi3/mod.rs:1210-1318 | mistralrs-core/src/vision_models/phi4/mod.rs:331-439 | 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:272-304 | mistralrs-core/src/models/mistral.rs:318-350 | mistralrs-core/src/models/qwen2.rs:349-382 | mistralrs-core/src/models/qwen3.rs:300-335 | mistralrs-core/src/models/smollm3.rs:288-320 — 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:87-171 | 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:814— mistralrs-core/src/models/deepseek2.rs:814-949 | mistralrs-core/src/models/deepseek3.rs:877-1012 | mistralrs-core/src/models/glm4_moe.rs:714-828 | mistralrs-core/src/models/glm4_moe_lite.rs:824-965 | 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, 22 shared lines) · ×1
Near-duplicate member family (5 members, 22 shared lines) mistralrs-core/src/xlora_models/mistral.rs:222— mistralrs-core/src/xlora_models/mistral.rs:222-298 | mistralrs-core/src/xlora_models/mixtral.rs:135-211 | mistralrs-core/src/xlora_models/phi3.rs:113-186 | mistralrs-core/src/xlora_models/quantized_phi3.rs:153-223 | mistralrs-core/src/xlora_models/starcoder2.rs:209-287 — These 5 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 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:574— mistralrs-core/src/xlora_models/mistral.rs:574-617 | mistralrs-core/src/xlora_models/mixtral.rs:704-747 | mistralrs-core/src/xlora_models/phi2.rs:543-583 | mistralrs-core/src/xlora_models/phi3.rs:525-570 | mistralrs-core/src/xlora_models/starcoder2.rs:557-602 — These 5 members are variants of one another: a block of 18 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Near-duplicate member family (4 members, 182 shared lines) · ×1
Near-duplicate member family (4 members, 182 shared lines) mistralrs-core/src/vision_models/qwen3_5/mod.rs:131— mistralrs-core/src/vision_models/qwen3_5/mod.rs:131-430 | 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:919— mistralrs-quant/src/blockwise_fp8/mod.rs:919-1081 | mistralrs-quant/src/pertensor_fp8/mod.rs:519-668 | mistralrs-quant/src/unquantized/mod.rs:414-600 | 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, 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/src/model_builder_trait.rs:626— mistralrs/src/model_builder_trait.rs:626-767 | mistralrs/src/model_builder_trait.rs:773-922 | mistralrs/src/model_builder_trait.rs:928-1113 | mistralrs/src/model_builder_trait.rs:1348-1524 — 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:433-550 | mistralrs-core/src/models/qwen3.rs:400-521 | mistralrs-core/src/models/qwen3_moe.rs:577-704 — 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:71— mistralrs-core/src/vision_models/qwen3_5/mod.rs:71-110 | 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:433-550 | mistralrs-core/src/vision_models/phi3/mod.rs:1210-1318 | mistralrs-core/src/vision_models/phi4/mod.rs:331-439 — 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:535— mistralrs-core/src/models/phi3.rs:535-564 | mistralrs-core/src/models/phi3_5_moe.rs:607-636 | mistralrs-core/src/vision_models/phi3/mod.rs:1328-1367 | mistralrs-core/src/vision_models/phi4/mod.rs:457-529 — 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:612— mistralrs-core/src/xlora_models/gemma2.rs:612-672 | 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:441-504 — 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:441-504 | mistralrs-core/src/xlora_models/starcoder2.rs:557-602 — 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, 8 shared lines) · ×1
Near-duplicate member family (4 members, 8 shared lines) mistralrs-cli/src/commands/config.rs:38— mistralrs-cli/src/commands/config.rs:38-209 | mistralrs-cli/src/commands/config.rs:211-332 | mistralrs-cli/src/commands/run/mod.rs:41-199 | mistralrs-cli/src/commands/serve.rs:44-228 — These 4 members are variants of one another: a block of 8 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 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:613— mistralrs-core/src/models/llama.rs:613-704 | mistralrs-core/src/models/smollm3.rs:632-723 | 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:4918-5147 — 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:1020— mistralrs-core/src/models/deepseek2.rs:1020-1073 | mistralrs-core/src/models/deepseek3.rs:1084-1138 | mistralrs-core/src/models/glm4_moe_lite.rs:1038-1092 — 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:66— mistralrs-core/src/models/quantized_llama.rs:66-125 | mistralrs-core/src/xlora_models/quantized_llama.rs:199-248 | mistralrs-core/src/xlora_models/quantized_phi3.rs:153-223 — 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-918 | 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 (128 shared lines) mistralrs-core/src/pipeline/multimodal.rs:1928— mistralrs-core/src/pipeline/multimodal.rs:1928-2131 | mistralrs-core/src/pipeline/normal.rs:1765-1948 — These two members are variants of one another: 128 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 (123 shared lines) mistralrs-core/src/vision_models/qwen3_5/text.rs:1203— mistralrs-core/src/vision_models/qwen3_5/text.rs:1203-1449 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:528-746 — These two members are variants of one another: 123 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:346— mistralrs-core/src/models/llama.rs:346-469 | mistralrs-core/src/models/smollm3.rs:362-492 — 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 (82 shared lines) mistralrs-core/src/vision_models/phi3/mod.rs:533— mistralrs-core/src/vision_models/phi3/mod.rs:533-680 | 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 (69 shared lines) mistralrs-core/src/models/phi3.rs:408— mistralrs-core/src/models/phi3.rs:408-533 | 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 (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 (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 (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-paged-attn/src/metal/kernels/mod.rs:264— mistralrs-paged-attn/src/metal/kernels/mod.rs:264-333 | mistralrs-paged-attn/src/metal/kernels/mod.rs:698-773 — 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 (50 shared lines) mistralrs-core/src/xlora_models/mixtral.rs:358— mistralrs-core/src/xlora_models/mixtral.rs:358-425 | 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 (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 (42 shared lines) mistralrs-core/src/models/granite.rs:2178— mistralrs-core/src/models/granite.rs:2178-2342 | mistralrs-core/src/models/lfm2.rs:1176-1306 — These two members are variants of one another: 42 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 (34 shared lines) mistralrs-core/src/models/phi3.rs:408— mistralrs-core/src/models/phi3.rs:408-533 | mistralrs-core/src/vision_models/phi4/mod.rs:331-439 — 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 (30 shared lines) mistralrs-quant/src/gguf/cuda.rs:646— mistralrs-quant/src/gguf/cuda.rs:646-693 | mistralrs-quant/src/gguf/cuda.rs:709-753 — 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.
Near-duplicate member pair (20 shared lines) mistralrs-core/src/cuda/gdn.rs:5512— mistralrs-core/src/cuda/gdn.rs:5512-5600 | mistralrs-core/src/cuda/gdn.rs:5750-5834 — These two members are variants of one another: 20 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:1000— mistralrs-pyo3/src/lib.rs:1000-1399 | mistralrs-server-core/src/mistralrs_for_server_builder.rs:1415-1451 — 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:1452— mistralrs-core/src/models/granite.rs:1452-1498 | mistralrs-core/src/models/granite.rs:1743-1785 — 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 (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 (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:3861— mistralrs-core/src/layers.rs:3861-3887 | 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· 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:878— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:878-943 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3529-3630 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4248-4322 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4634-4695 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5024-5102 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:699-722 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1123-1146 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1351-1374 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1568-1591 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1775-1798 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1979-2002 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2630-2653 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2900-2922 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3206-3228 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3452-3474 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3654-3676 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3878-3900 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4096-4118 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4350-4372 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4649-4671 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4911-4933 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5133-5156 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5347-5370 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5580-5603 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5821-5844 — 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:420— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:420-433 | mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:612-625 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1091-1104 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1457-1470 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1750-1763 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2446-2459 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3779-3792 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4119-4132 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4504-4517 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5279-5313 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8219-8239 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:9406-9421 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:643-656 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:856-869 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1067-1080 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1919-1936 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2138-2151 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3396-3409 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3600-3611 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3803-3824 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4839-4857 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5077-5090 — 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 (14 members, 50+ identical tokens) · ×1
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.
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:460-600 | mistralrs-core/src/xlora_models/llama.rs:530-667 | mistralrs-core/src/xlora_models/mistral.rs:425-562 | mistralrs-core/src/xlora_models/mixtral.rs:555-692 | mistralrs-core/src/xlora_models/phi2.rs:402-531 | mistralrs-core/src/xlora_models/phi3.rs:392-512 | mistralrs-core/src/xlora_models/starcoder2.rs:414-545 — 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:2176— mistralrs-core/src/pipeline/mod.rs:2176-2285 | mistralrs-core/src/pipeline/mod.rs:2822-2931 — both copies are in the same file, so extract the block into 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:264— mistralrs-core/src/vision_models/qwen3_5/config.rs:264-351 | mistralrs-core/src/vision_models/qwen3_5_moe/config.rs:69-156 — 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 45 separate duplicated blocks between them, totalling at least 653 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:3926— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3926-3929 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6298-6365 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6700-6767 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7114-7179 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7573-7638 — 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:102-166 | 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 26 separate duplicated blocks between them, totalling at least 362 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:1099— mistralrs-core/src/pipeline/multimodal.rs:1099-1163 | mistralrs-core/src/pipeline/normal.rs:1130-1194 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 19 separate duplicated blocks between them, totalling at least 362 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:957— mistralrs-quant/src/blockwise_fp8/mod.rs:957-1014 | 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:1019— mistralrs-quant/src/blockwise_fp8/mod.rs:1019-1076 | 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (53 lines × 4) mistralrs-core/src/vision_models/qwen3_5/mod.rs:320— mistralrs-core/src/vision_models/qwen3_5/mod.rs:320-372 | 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 408 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:696-745 | mistralrs-core/src/xlora_models/llama.rs:469-518 | mistralrs-core/src/xlora_models/mistral.rs:641-690 | mistralrs-core/src/xlora_models/mixtral.rs:771-820 | mistralrs-core/src/xlora_models/phi2.rs:607-656 | mistralrs-core/src/xlora_models/starcoder2.rs:626-675 — 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:528-577 — 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 (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 573 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 42 separate duplicated blocks between them, totalling at least 550 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:611— mistralrs-core/src/models/gemma.rs:611-650 | mistralrs-core/src/models/gemma2.rs:727-766 | mistralrs-core/src/models/glm4.rs:727-766 | mistralrs-core/src/models/hunyuan_v1_dense.rs:699-738 | mistralrs-core/src/models/mistral.rs:739-778 | mistralrs-core/src/models/qwen2.rs:741-780 | mistralrs-core/src/models/qwen3.rs:698-737 | mistralrs-core/src/vision_models/gemma3/text.rs:953-992 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:702-741 | 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 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 (30–40 lines × 2) mistralrs-core/src/vision_models/gemma3/text.rs:793— mistralrs-core/src/vision_models/gemma3/text.rs:793-832 | mistralrs-core/src/vision_models/gemma4/text.rs:2444-2473 — `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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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/models/phi3.rs:427— mistralrs-core/src/models/phi3.rs:427-465 | 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 29 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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–37 lines × 2) mistralrs-core/src/vision_models/qwen3_5/text.rs:1986— mistralrs-core/src/vision_models/qwen3_5/text.rs:1986-2021 | mistralrs-core/src/vision_models/qwen3_5/text.rs:2058-2094 — both copies are in the same file, so extract the block into 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 × 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:1086— mistralrs-core/src/pipeline/normal.rs:1086-1120 | mistralrs-core/src/pipeline/normal.rs:1214-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 (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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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–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 (32–33 lines × 4) mistralrs-core/src/models/granite.rs:1641— mistralrs-core/src/models/granite.rs:1641-1672 | 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 (28–33 lines × 4) mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2984— mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2984-3011 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3290-3317 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4429-4461 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4727-4759 — 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 (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:1570-1598 | 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:358-386 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:230-258 | 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:925— mistralrs-quant/src/blockwise_fp8/mod.rs:925-956 | 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–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:341-370 — 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 27 separate duplicated blocks between them, totalling at least 411 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 × 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:505— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:505-534 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4340-4369 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:941-970 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2223-2252 — 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 573 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 6) mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:222— 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/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.
Duplicated block (28–29 lines × 2) mistralrs-core/src/paged_attention/cache_engine.rs:218— mistralrs-core/src/paged_attention/cache_engine.rs:218-246 | mistralrs-core/src/paged_attention/cache_engine.rs:321-348 — both copies are in the same file, so extract the block into 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:1106— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1106-1118 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2783-2811 — both copies are in the same file, so extract the block into 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 × 16) mistralrs-core/src/models/gemma2.rs:247— 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:230-257 | 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/gemma2.rs` and `mistralrs-core/src/models/gpt_oss.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 219 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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:887— mistralrs-core/src/models/deepseek2.rs:887-914 | mistralrs-core/src/models/deepseek3.rs:950-977 | mistralrs-core/src/models/glm4_moe.rs:786-813 | mistralrs-core/src/models/glm4_moe_lite.rs:897-924 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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–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 (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 (25–27 lines × 17) mistralrs-core/src/models/gemma.rs:215— mistralrs-core/src/models/gemma.rs:215-240 | mistralrs-core/src/models/gemma2.rs:262-288 | mistralrs-core/src/models/gpt_oss.rs:292-317 | mistralrs-core/src/models/hunyuan_v1_dense.rs:238-263 | mistralrs-core/src/models/hunyuan_v1_moe.rs:424-449 | mistralrs-core/src/models/lfm2.rs:532-556 | mistralrs-core/src/models/llama.rs:123-148 | mistralrs-core/src/models/mistral.rs:263-288 | mistralrs-core/src/models/mixtral.rs:199-224 | mistralrs-core/src/models/phi2.rs:311-336 | mistralrs-core/src/models/qwen2.rs:293-318 | mistralrs-core/src/models/qwen3.rs:245-270 | mistralrs-core/src/models/qwen3_moe.rs:251-276 | mistralrs-core/src/models/qwen3_next.rs:332-356 | mistralrs-core/src/models/smollm3.rs:140-165 | mistralrs-core/src/models/starcoder2.rs:275-300 | mistralrs-core/src/vision_models/voxtral/mod.rs:175-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 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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–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:103-128 | 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:500-526 | mistralrs-core/src/xlora_models/mistral.rs:466-492 | mistralrs-core/src/xlora_models/mixtral.rs:597-623 | mistralrs-core/src/xlora_models/phi3.rs:425-451 — 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 (26–27 lines × 2) mistralrs-core/src/pipeline/multimodal.rs:747— mistralrs-core/src/pipeline/multimodal.rs:747-773 | mistralrs-core/src/pipeline/normal.rs:737-762 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 (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:687-712 | mistralrs-core/src/xlora_models/llama.rs:460-485 | mistralrs-core/src/xlora_models/mistral.rs:632-657 | mistralrs-core/src/xlora_models/mixtral.rs:762-787 | 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:519-544 | mistralrs-core/src/xlora_models/starcoder2.rs:617-642 — 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:654— mistralrs-quant/src/safetensors.rs:654-679 | mistralrs-quant/src/safetensors.rs:731-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 (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 (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 (22–24 lines × 4) mistralrs-core/src/xlora_models/mistral.rs:270— mistralrs-core/src/xlora_models/mistral.rs:270-291 | mistralrs-core/src/xlora_models/mixtral.rs:183-204 | mistralrs-core/src/xlora_models/phi3.rs:158-179 | mistralrs-core/src/xlora_models/starcoder2.rs:257-280 — 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 53 separate duplicated blocks between them, totalling at least 787 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1415— mistralrs-core/src/pipeline/sampling.rs:1415-1436 | mistralrs-core/src/pipeline/sampling.rs:1494-1517 — both copies are in the same file, so extract the block into 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 × 3) mistralrs-core/src/models/glm4_moe.rs:195— 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/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 (19–23 lines × 2) mistralrs-paged-attn/src/metal/kernels/mod.rs:375— mistralrs-paged-attn/src/metal/kernels/mod.rs:375-393 | mistralrs-paged-attn/src/metal/kernels/mod.rs:512-534 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (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:1589-1610 | 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:249-269 — 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:689— mistralrs/src/model_builder_trait.rs:689-710 | mistralrs/src/model_builder_trait.rs:839-860 | mistralrs/src/model_builder_trait.rs:1000-1021 | mistralrs/src/model_builder_trait.rs:1444-1465 — 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 (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 (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:228— mistralrs-core/src/vision_models/qwen3_5/mod.rs:228-248 | mistralrs-core/src/vision_models/qwen3_5/mod.rs:289-309 | 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 408 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 × 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:242-262 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:152-172 — 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 (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:1091— mistralrs-core/src/pipeline/multimodal.rs:1091-1109 | mistralrs-core/src/pipeline/multimodal.rs:1199-1218 | mistralrs-core/src/pipeline/normal.rs:1122-1140 | mistralrs-core/src/pipeline/normal.rs:1254-1273 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:926— mistralrs-quant/src/blockwise_fp8/mod.rs:926-945 | mistralrs-quant/src/pertensor_fp8/mod.rs:521-535 | mistralrs-quant/src/unquantized/mod.rs:415-434 | 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:636— mistralrs-core/src/models/gemma.rs:636-653 | mistralrs-core/src/models/gemma2.rs:752-769 | mistralrs-core/src/models/glm4.rs:752-769 | mistralrs-core/src/models/hunyuan_v1_dense.rs:724-741 | mistralrs-core/src/models/mistral.rs:764-781 | mistralrs-core/src/models/phi3.rs:699-717 | mistralrs-core/src/models/qwen2.rs:766-783 | mistralrs-core/src/models/qwen3.rs:723-740 | mistralrs-core/src/vision_models/gemma3/text.rs:978-995 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:727-744 | mistralrs-core/src/vision_models/phi3/mod.rs:1535-1553 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1958— mistralrs-core/src/models/granite.rs:1958-1975 | mistralrs-core/src/models/llama.rs:359-376 | mistralrs-core/src/models/qwen3_next.rs:752-770 | mistralrs-core/src/models/smollm3.rs:375-392 | 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 (15–19 lines × 3) mistralrs-cli/src/commands/bench.rs:119— mistralrs-cli/src/commands/bench.rs:119-133 | mistralrs-cli/src/commands/run/mod.rs:55-69 | mistralrs-cli/src/commands/serve.rs:61-79 — before extracting anything, compare `mistralrs-cli/src/commands/bench.rs` and `mistralrs-cli/src/commands/run/mod.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. 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 × 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:474-491 | 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:523— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:523-540 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1334-1351 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2640-2657 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2982-2999 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3289-3306 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3968-3985 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4358-4375 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4722-4739 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:748-765 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:959-976 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1172-1189 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2028-2045 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2241-2258 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4143-4160 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5182-5199 — 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 (7–18 lines × 3) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7236— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7236-7250 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7695-7712 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5882-5888 — 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:2424— mistralrs-quant/src/afq/ops.rs:2424-2436 | mistralrs-quant/src/afq/ops.rs:2788-2800 | mistralrs-quant/src/afq/ops.rs:3379-3396 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16–18 lines × 2) 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–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:442-459 — 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:880— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:880-896 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3531-3547 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:702-718 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1126-1142 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1354-1370 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1571-1587 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1778-1794 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1982-1998 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2633-2649 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2902-2918 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3208-3224 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3454-3470 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3656-3672 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3880-3896 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4098-4114 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4352-4368 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4651-4667 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4913-4929 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5136-5152 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5350-5366 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5583-5599 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5824-5840 — 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:521— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:521-537 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1332-1348 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1624-1640 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1909-1925 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2638-2654 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2980-2996 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3287-3303 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3966-3982 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4356-4372 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4720-4736 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:746-762 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:957-973 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1170-1186 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2026-2042 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2239-2255 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4141-4157 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5180-5196 — 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:1329— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1329-1345 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1621-1637 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1906-1922 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2310-2326 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2635-2651 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2977-2993 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3284-3300 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3963-3979 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4717-4733 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:743-759 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1167-1183 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2023-2039 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4138-4154 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5177-5193 — 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:586— mistralrs-core/src/models/gemma.rs:586-602 | mistralrs-core/src/models/gemma2.rs:702-718 | mistralrs-core/src/models/glm4.rs:702-718 | mistralrs-core/src/models/hunyuan_v1_dense.rs:674-690 | mistralrs-core/src/models/mistral.rs:714-730 | mistralrs-core/src/models/phi2.rs:661-677 | mistralrs-core/src/models/phi3.rs:657-673 | mistralrs-core/src/models/qwen2.rs:716-732 | mistralrs-core/src/models/qwen3.rs:673-689 | mistralrs-core/src/models/starcoder2.rs:652-668 | mistralrs-core/src/vision_models/gemma3/text.rs:928-944 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:674-690 | mistralrs-core/src/vision_models/phi3/mod.rs:1494-1510 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:824— mistralrs-core/src/models/deepseek2.rs:824-838 | mistralrs-core/src/models/deepseek3.rs:887-901 | mistralrs-core/src/models/glm4_moe.rs:724-738 | mistralrs-core/src/models/glm4_moe_lite.rs:834-848 | mistralrs-core/src/vision_models/mllama/text.rs:766-782 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 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:475-489 — 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 × 26) mistralrs-core/src/models/gemma2.rs:255— 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:1581-1593 | 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:238-253 | 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:369-381 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:241-253 | 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/gemma2.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 21 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 (16 lines × 18) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:520— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:520-535 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1331-1346 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1623-1638 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1908-1923 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2312-2327 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2637-2652 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2979-2994 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3286-3301 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3965-3980 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4355-4370 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4719-4734 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:745-760 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:956-971 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1169-1184 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2025-2040 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2238-2253 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4140-4155 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5179-5194 — 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:704-719 | mistralrs-core/src/xlora_models/llama.rs:477-492 | mistralrs-core/src/xlora_models/mistral.rs:649-664 | mistralrs-core/src/xlora_models/mixtral.rs:779-794 | mistralrs-core/src/xlora_models/phi2.rs:615-630 | mistralrs-core/src/xlora_models/phi3.rs:605-619 | mistralrs-core/src/xlora_models/starcoder2.rs:634-649 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 4) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6237— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6237-6252 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6639-6654 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7057-7070 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7516-7529 — 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:582-596 | 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 26 separate duplicated blocks between them, totalling at least 362 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:261-273 | 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 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 17) mistralrs-core/src/models/gemma2.rs:249— 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:232-246 | 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/gemma2.rs` and `mistralrs-core/src/models/gpt_oss.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 219 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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:1575-1586 | 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:363-374 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:235-246 | 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:578— mistralrs-core/src/models/glm4.rs:578-591 | mistralrs-core/src/models/mistral.rs:591-605 | mistralrs-core/src/models/mixtral.rs:528-542 | mistralrs-core/src/models/phi3.rs:537-551 | mistralrs-core/src/models/phi3_5_moe.rs:609-623 | mistralrs-core/src/models/qwen3.rs:542-556 | mistralrs-core/src/models/qwen3_moe.rs:725-739 | mistralrs-core/src/models/starcoder2.rs:530-543 | mistralrs-core/src/vision_models/phi3/mod.rs:1341-1354 | mistralrs-core/src/vision_models/phi4/mod.rs:503-516 — 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 484 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:719-733 | mistralrs-core/src/xlora_models/llama.rs:492-506 | mistralrs-core/src/xlora_models/mistral.rs:664-678 | mistralrs-core/src/xlora_models/mixtral.rs:794-808 | mistralrs-core/src/xlora_models/phi2.rs:630-644 | mistralrs-core/src/xlora_models/phi3.rs:621-634 | mistralrs-core/src/xlora_models/starcoder2.rs:649-663 — 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–15 lines × 6) mistralrs-paged-attn/src/metal/kernels/mod.rs:290— mistralrs-paged-attn/src/metal/kernels/mod.rs:290-304 | mistralrs-paged-attn/src/metal/kernels/mod.rs:408-422 | mistralrs-paged-attn/src/metal/kernels/mod.rs:433-447 | mistralrs-paged-attn/src/metal/kernels/mod.rs:551-565 | mistralrs-paged-attn/src/metal/kernels/mod.rs:576-590 | mistralrs-paged-attn/src/metal/kernels/mod.rs:725-738 — 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:88-101 | 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 × 3) mistralrs-core/src/models/glm4_moe.rs:178— 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/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 (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 × 12) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:739— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:739-752 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1361-1374 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1654-1667 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1939-1952 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2667-2680 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3995-4008 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1431-1444 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2056-2069 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2474-2487 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3531-3544 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4170-4183 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5007-5020 — 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:580— mistralrs-core/src/models/glm4.rs:580-593 | mistralrs-core/src/models/mistral.rs:593-607 | mistralrs-core/src/models/mixtral.rs:530-544 | mistralrs-core/src/models/phi3.rs:539-553 | mistralrs-core/src/models/phi3_5_moe.rs:611-625 | mistralrs-core/src/models/qwen2.rs:584-597 | mistralrs-core/src/models/qwen3.rs:544-558 | mistralrs-core/src/models/qwen3_moe.rs:727-741 | mistralrs-core/src/models/starcoder2.rs:532-545 | mistralrs-core/src/vision_models/phi3/mod.rs:1343-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 484 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:714-727 | mistralrs-core/src/xlora_models/llama.rs:487-500 | mistralrs-core/src/xlora_models/mistral.rs:659-672 | mistralrs-core/src/xlora_models/mixtral.rs:789-802 | 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:546-559 | mistralrs-core/src/xlora_models/starcoder2.rs:644-657 — 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 × 6) mistralrs-core/src/pipeline/multimodal.rs:1091— mistralrs-core/src/pipeline/multimodal.rs:1091-1104 | mistralrs-core/src/pipeline/multimodal.rs:1148-1161 | mistralrs-core/src/pipeline/multimodal.rs:1200-1213 | mistralrs-core/src/pipeline/normal.rs:1122-1135 | mistralrs-core/src/pipeline/normal.rs:1179-1192 | mistralrs-core/src/pipeline/normal.rs:1255-1268 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 4) mistralrs-core/src/models/mixtral.rs:420— mistralrs-core/src/models/mixtral.rs:420-432 | mistralrs-core/src/models/qwen2.rs:448-461 | 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 43 separate duplicated blocks between them, totalling at least 514 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:4264— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4264-4276 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4645-4657 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5034-5046 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:708-720 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1132-1144 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1360-1372 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1577-1589 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1784-1796 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1988-2000 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2639-2651 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2908-2920 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3214-3226 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3460-3472 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3662-3674 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3886-3898 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4104-4116 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4358-4370 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4657-4669 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4919-4931 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5142-5154 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5356-5368 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5589-5601 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5830-5842 — 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:663— mistralrs-core/src/models/gemma.rs:663-675 | mistralrs-core/src/models/gemma2.rs:779-791 | mistralrs-core/src/models/glm4.rs:779-791 | mistralrs-core/src/models/hunyuan_v1_dense.rs:751-763 | mistralrs-core/src/models/mistral.rs:791-803 | mistralrs-core/src/models/phi2.rs:730-742 | mistralrs-core/src/models/phi3.rs:726-738 | mistralrs-core/src/models/qwen2.rs:793-805 | mistralrs-core/src/models/qwen3.rs:750-762 | mistralrs-core/src/models/starcoder2.rs:721-733 | mistralrs-core/src/vision_models/gemma3/text.rs:1005-1017 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:754-766 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:755-767 | mistralrs-core/src/vision_models/phi3/mod.rs:1562-1574 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:864— mistralrs-core/src/models/deepseek2.rs:864-876 | mistralrs-core/src/models/deepseek3.rs:927-939 | mistralrs-core/src/models/gemma.rs:380-391 | mistralrs-core/src/models/gemma2.rs:452-463 | mistralrs-core/src/models/glm4_moe.rs:763-775 | mistralrs-core/src/models/glm4_moe_lite.rs:874-886 | mistralrs-core/src/models/mistral.rs:490-499 | mistralrs-core/src/models/mixtral.rs:442-453 | mistralrs-core/src/models/phi2.rs:469-480 | mistralrs-core/src/models/phi3.rs:458-469 | 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:583— mistralrs-core/src/models/glm4.rs:583-594 | mistralrs-core/src/models/mistral.rs:596-608 | mistralrs-core/src/models/mixtral.rs:533-545 | mistralrs-core/src/models/phi3.rs:542-554 | mistralrs-core/src/models/phi3_5_moe.rs:614-626 | mistralrs-core/src/models/qwen2.rs:587-598 | mistralrs-core/src/models/qwen3.rs:547-559 | mistralrs-core/src/models/qwen3_moe.rs:730-742 | mistralrs-core/src/models/starcoder2.rs:535-546 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:551-563 | mistralrs-core/src/vision_models/phi3/mod.rs:1346-1357 — 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 484 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:401— mistralrs-core/src/models/gemma.rs:401-413 | mistralrs-core/src/models/gemma2.rs:473-485 | mistralrs-core/src/models/glm4.rs:499-511 | mistralrs-core/src/models/hunyuan_v1_dense.rs:468-480 | mistralrs-core/src/models/hunyuan_v1_moe.rs:962-974 | mistralrs-core/src/models/mistral.rs:509-521 | mistralrs-core/src/models/mixtral.rs:463-475 | mistralrs-core/src/models/qwen3.rs:459-471 | 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 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1115— mistralrs-core/src/pipeline/multimodal.rs:1115-1127 | mistralrs-core/src/pipeline/multimodal.rs:1165-1177 | mistralrs-core/src/pipeline/multimodal.rs:1224-1236 | mistralrs-core/src/pipeline/normal.rs:1146-1158 | mistralrs-core/src/pipeline/normal.rs:1196-1208 | mistralrs-core/src/pipeline/normal.rs:1279-1291 — before extracting anything, compare `mistralrs-core/src/pipeline/multimodal.rs` and `mistralrs-core/src/pipeline/normal.rs` as WHOLE FILES: this scan already matched 71 separate duplicated blocks between them, totalling at least 1436 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 5) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2521— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2521-2533 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6272-6284 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6674-6686 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7089-7100 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7548-7559 — 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–13 lines × 4) mistralrs/src/model_builder_trait.rs:676— mistralrs/src/model_builder_trait.rs:676-687 | mistralrs/src/model_builder_trait.rs:824-836 | mistralrs/src/model_builder_trait.rs:1271-1281 | mistralrs/src/model_builder_trait.rs:1431-1442 — 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 × 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:287-298 | mistralrs-core/src/xlora_models/mixtral.rs:200-211 | mistralrs-core/src/xlora_models/phi3.rs:175-186 — 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 (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:169— mistralrs-quant/src/unquantized/mod.rs:169-181 | mistralrs-quant/src/unquantized/mod.rs:218-226 — both copies are in the same file, so extract the block into 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 × 27) mistralrs-core/src/models/gemma2.rs:255— 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:1581-1592 | 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:238-252 | 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:369-380 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:241-252 | 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/gemma2.rs` and `mistralrs-core/src/models/glm4.rs` as WHOLE FILES: this scan already matched 21 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 (12 lines × 21) mistralrs-core/src/models/gemma.rs:198— 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:228-239 | 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/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 17) mistralrs-core/src/models/gemma.rs:194— 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:224-234 | 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:246-255 | 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/gemma.rs` and `mistralrs-core/src/models/gpt_oss.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 188 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:828— mistralrs-core/src/models/deepseek2.rs:828-839 | mistralrs-core/src/models/deepseek3.rs:891-902 | mistralrs-core/src/models/glm4_moe.rs:728-739 | mistralrs-core/src/models/glm4_moe_lite.rs:838-849 | mistralrs-core/src/models/mixtral.rs:480-491 | mistralrs-core/src/models/qwen2.rs:512-523 | mistralrs-core/src/vision_models/gemma3/text.rs:531-543 | mistralrs-core/src/vision_models/gemma3n/text.rs:1470-1482 | mistralrs-core/src/vision_models/mllama/text.rs:771-783 | mistralrs-core/src/vision_models/phi3/mod.rs:1275-1286 | mistralrs-core/src/vision_models/phi4/mod.rs:390-401 | 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:586— mistralrs-core/src/models/glm4.rs:586-595 | mistralrs-core/src/models/hunyuan_v1_dense.rs:552-561 | mistralrs-core/src/models/hunyuan_v1_moe.rs:1046-1055 | mistralrs-core/src/models/mistral.rs:599-609 | mistralrs-core/src/models/mixtral.rs:536-546 | mistralrs-core/src/models/phi3.rs:545-556 | mistralrs-core/src/models/phi3_5_moe.rs:617-628 | mistralrs-core/src/models/qwen3.rs:550-560 | mistralrs-core/src/models/qwen3_moe.rs:733-743 | mistralrs-core/src/models/starcoder2.rs:538-548 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:555-564 | mistralrs-core/src/vision_models/phi3/mod.rs:1349-1359 — 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 462 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 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:284-295 | mistralrs-core/src/models/mistral.rs:330-341 | mistralrs-core/src/models/qwen2.rs:362-373 | mistralrs-core/src/models/qwen3.rs:315-326 | mistralrs-core/src/models/smollm3.rs:300-311 — 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:3931— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3931-3939 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6369-6380 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6771-6782 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7182-7193 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7641-7652 — 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:359-369 | 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:868— mistralrs-quant/src/distributed/layers.rs:868-879 | mistralrs-quant/src/distributed/layers.rs:1330-1341 | mistralrs-quant/src/distributed/layers.rs:2204-2212 — all 3 copies are in the same file, so extract the block into one function there and call it from 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 × 30) mistralrs-core/src/models/gemma.rs:237— 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:1607-1615 | 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:267-275 | 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:298-306 | 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:397-405 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:266-274 | 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/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 24) mistralrs-core/src/embedding_models/qwen3_embedding.rs:255— mistralrs-core/src/embedding_models/qwen3_embedding.rs:255-264 | mistralrs-core/src/models/gpt_oss.rs:657-667 | mistralrs-core/src/models/granite.rs:1482-1491 | mistralrs-core/src/models/granite.rs:1769-1778 | 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:290-299 | 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:321-330 | mistralrs-core/src/models/qwen3_moe.rs:498-507 | mistralrs-core/src/models/smollm3.rs:306-315 | 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:346-355 | 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:347-356 | mistralrs-core/src/xlora_models/mixtral.rs:474-483 | mistralrs-core/src/xlora_models/phi3.rs:312-321 — before extracting anything, compare `mistralrs-core/src/embedding_models/qwen3_embedding.rs` and `mistralrs-core/src/models/gpt_oss.rs` as WHOLE FILES: this scan already matched 5 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 × 12) mistralrs-core/src/models/glm4.rs:437— mistralrs-core/src/models/glm4.rs:437-447 | mistralrs-core/src/models/granite.rs:1946-1956 | mistralrs-core/src/models/hunyuan_v1_dense.rs:410-420 | mistralrs-core/src/models/hunyuan_v1_moe.rs:904-914 | mistralrs-core/src/models/lfm2.rs:1017-1027 | mistralrs-core/src/models/llama.rs:347-357 | mistralrs-core/src/models/mistral.rs:416-426 | mistralrs-core/src/models/qwen3.rs:401-411 | mistralrs-core/src/models/qwen3_moe.rs:578-588 | mistralrs-core/src/models/smollm3.rs:363-373 | mistralrs-core/src/vision_models/llama4/text.rs:795-805 | mistralrs-core/src/vision_models/mllama/text.rs:750-760 — 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 (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:342-352 | mistralrs-core/src/xlora_models/mixtral.rs:469-479 | mistralrs-core/src/xlora_models/phi3.rs:307-317 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:348— mistralrs-core/src/models/gemma.rs:348-358 | 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:409-418 | mistralrs-core/src/models/phi3_5_moe.rs:480-489 | mistralrs-core/src/models/qwen2.rs:434-443 | mistralrs-core/src/models/starcoder2.rs:405-414 | mistralrs-core/src/vision_models/gemma3/text.rs:434-444 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:455-465 | mistralrs-core/src/models/glm4_moe.rs:744-754 | mistralrs-core/src/models/hunyuan_v1_dense.rs:428-438 | mistralrs-core/src/models/hunyuan_v1_moe.rs:922-932 | mistralrs-core/src/models/qwen3.rs:419-429 | mistralrs-core/src/models/qwen3_moe.rs:596-606 — 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:2484— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2484-2494 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6234-6244 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:6636-6646 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7055-7063 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:7514-7522 — 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–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:438-448 — 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 27 separate duplicated blocks between them, totalling at least 411 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 24 separate duplicated blocks between them, totalling at least 300 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 32) 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/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:1480-1489 | mistralrs-core/src/models/granite.rs:1767-1776 | 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:288-297 | 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:319-328 | mistralrs-core/src/models/qwen3_moe.rs:496-505 | mistralrs-core/src/models/smollm3.rs:304-313 | mistralrs-core/src/vision_models/gemma4/text.rs:1007-1016 | 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:344-353 | mistralrs-core/src/vision_models/mllama/text.rs:284-293 | mistralrs-core/src/vision_models/mllama/text.rs:644-653 | 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:345-354 | mistralrs-core/src/xlora_models/mixtral.rs:472-481 | mistralrs-core/src/xlora_models/phi3.rs:310-319 — 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 × 30) mistralrs-core/src/models/gemma.rs:197— 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:1570-1579 | 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:227-236 | 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:248-257 | 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:358-367 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:230-239 | 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/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 21) mistralrs-core/src/models/gemma.rs:196— 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:1569-1578 | 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:226-235 | 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:247-256 | 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/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 (10 lines × 16) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:422— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:422-433 | mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:614-625 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1093-1104 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1459-1470 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1752-1763 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2448-2459 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3781-3792 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4121-4132 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4506-4517 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:645-656 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:858-869 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1069-1080 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2140-2151 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3398-3409 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3602-3611 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5079-5090 — 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 × 13) mistralrs-core/src/models/glm4.rs:513— mistralrs-core/src/models/glm4.rs:513-522 | mistralrs-core/src/models/hunyuan_v1_dense.rs:482-491 | mistralrs-core/src/models/hunyuan_v1_moe.rs:976-985 | mistralrs-core/src/models/mistral.rs:523-532 | mistralrs-core/src/models/mixtral.rs:477-486 | mistralrs-core/src/models/qwen2.rs:509-518 | mistralrs-core/src/models/qwen3.rs:473-482 | mistralrs-core/src/models/qwen3_moe.rs:656-665 | mistralrs-core/src/vision_models/gemma3/text.rs:528-538 | mistralrs-core/src/vision_models/phi3/mod.rs:1272-1281 | mistralrs-core/src/vision_models/phi4/mod.rs:387-396 | 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/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 462 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:868— mistralrs-core/src/models/deepseek2.rs:868-877 | mistralrs-core/src/models/deepseek3.rs:931-940 | mistralrs-core/src/models/gemma.rs:383-392 | mistralrs-core/src/models/gemma2.rs:455-464 | mistralrs-core/src/models/glm4_moe.rs:767-776 | mistralrs-core/src/models/glm4_moe_lite.rs:878-887 | mistralrs-core/src/models/mistral.rs:491-500 | mistralrs-core/src/models/mixtral.rs:445-454 | mistralrs-core/src/models/phi2.rs:472-481 | mistralrs-core/src/models/phi3.rs:461-470 | 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1326— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1326-1335 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1618-1627 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1903-1912 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2307-2316 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2974-2983 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3281-3290 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4714-4723 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:740-749 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1164-1173 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3694-3703 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5174-5183 — 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 (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:819-828 | mistralrs-core/src/vision_models/gemma3/text.rs:490-499 | mistralrs-core/src/vision_models/gemma4/text.rs:1671-1680 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:449-458 | 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: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 (9–10 lines × 7) mistralrs-core/src/models/deepseek2.rs:959— mistralrs-core/src/models/deepseek2.rs:959-968 | mistralrs-core/src/models/deepseek3.rs:1022-1031 | mistralrs-core/src/models/gemma.rs:472-481 | mistralrs-core/src/models/glm4_moe.rs:838-846 | mistralrs-core/src/models/glm4_moe_lite.rs:975-983 | mistralrs-core/src/models/granite.rs:2252-2261 | 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:699— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:699-708 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2632-2641 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3960-3969 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2020-2029 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3491-3500 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4135-4144 — 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:856-865 | mistralrs-core/src/vision_models/gemma3n/text.rs:1952-1961 | mistralrs-core/src/vision_models/gemma4/text.rs:2594-2603 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 29 separate duplicated blocks between them, totalling at least 339 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8–10 lines × 2) 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:869-877 | mistralrs-core/src/models/deepseek3.rs:932-940 | mistralrs-core/src/models/gemma.rs:384-392 | mistralrs-core/src/models/gemma2.rs:456-464 | mistralrs-core/src/models/glm4_moe.rs:768-776 | mistralrs-core/src/models/glm4_moe_lite.rs:879-887 | mistralrs-core/src/models/llama.rs:413-421 | mistralrs-core/src/models/mistral.rs:492-500 | mistralrs-core/src/models/mixtral.rs:446-454 | mistralrs-core/src/models/phi2.rs:473-481 | mistralrs-core/src/models/phi3.rs:462-470 | 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:492-500 | mistralrs-core/src/vision_models/gemma4/text.rs:1673-1681 | mistralrs-core/src/vision_models/phi3/mod.rs:1243-1251 | mistralrs-core/src/vision_models/phi4/mod.rs:358-366 | 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:549-557 — `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:962— mistralrs-core/src/models/deepseek2.rs:962-969 | mistralrs-core/src/models/deepseek3.rs:1025-1032 | mistralrs-core/src/models/gemma.rs:475-482 | mistralrs-core/src/models/glm4.rs:589-596 | mistralrs-core/src/models/glm4_moe.rs:840-847 | mistralrs-core/src/models/glm4_moe_lite.rs:977-984 | mistralrs-core/src/models/granite.rs:2254-2262 | mistralrs-core/src/models/hunyuan_v1_dense.rs:555-562 | mistralrs-core/src/models/hunyuan_v1_moe.rs:1049-1056 | mistralrs-core/src/models/mistral.rs:603-610 | mistralrs-core/src/models/mixtral.rs:540-547 | mistralrs-core/src/models/phi2.rs:553-560 | mistralrs-core/src/models/phi3.rs:549-557 | mistralrs-core/src/models/phi3_5_moe.rs:621-629 | mistralrs-core/src/models/qwen3.rs:554-561 | mistralrs-core/src/models/qwen3_moe.rs:737-744 | mistralrs-core/src/models/qwen3_next.rs:1047-1055 | mistralrs-core/src/models/starcoder2.rs:541-549 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:558-565 | mistralrs-core/src/vision_models/phi3/mod.rs:1352-1360 | mistralrs-core/src/vision_models/phi4/mod.rs:522-524 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:589— mistralrs-core/src/models/gemma.rs:589-597 | mistralrs-core/src/models/gemma2.rs:705-713 | mistralrs-core/src/models/glm4.rs:705-713 | mistralrs-core/src/models/hunyuan_v1_dense.rs:677-685 | mistralrs-core/src/models/llama.rs:618-626 | mistralrs-core/src/models/mistral.rs:717-725 | mistralrs-core/src/models/phi2.rs:664-672 | mistralrs-core/src/models/phi3.rs:660-668 | mistralrs-core/src/models/qwen2.rs:719-727 | mistralrs-core/src/models/qwen3.rs:676-684 | mistralrs-core/src/models/smollm3.rs:637-645 | mistralrs-core/src/models/starcoder2.rs:655-663 | mistralrs-core/src/vision_models/gemma3/text.rs:931-939 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:630-638 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:677-685 | mistralrs-core/src/vision_models/phi3/mod.rs:1497-1505 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:365-373 | mistralrs-core/src/models/gemma2.rs:437-445 | mistralrs-core/src/models/glm4.rs:458-466 | mistralrs-core/src/models/glm4_moe.rs:747-755 | mistralrs-core/src/models/mixtral.rs:427-435 | mistralrs-core/src/models/qwen2.rs:456-464 | mistralrs-core/src/models/qwen3.rs:422-430 | mistralrs-core/src/models/qwen3_moe.rs:599-607 | mistralrs-core/src/models/starcoder2.rs:425-433 | mistralrs-core/src/xlora_models/gemma.rs:444-452 | mistralrs-core/src/xlora_models/gemma2.rs:479-487 | mistralrs-core/src/xlora_models/mistral.rs:445-453 | mistralrs-core/src/xlora_models/mixtral.rs:575-583 | mistralrs-core/src/xlora_models/starcoder2.rs:434-442 — 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 × 12) mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1321— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1321-1329 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1613-1621 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1898-1906 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2302-2310 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2969-2977 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3276-3284 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4709-4717 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5118-5126 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:735-743 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1159-1167 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1387-1395 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5169-5177 — 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 × 11) mistralrs-core/src/models/glm4.rs:447— mistralrs-core/src/models/glm4.rs:447-455 | mistralrs-core/src/models/granite.rs:1956-1964 | mistralrs-core/src/models/hunyuan_v1_dense.rs:420-428 | mistralrs-core/src/models/hunyuan_v1_moe.rs:914-922 | mistralrs-core/src/models/llama.rs:357-365 | mistralrs-core/src/models/mistral.rs:426-434 | mistralrs-core/src/models/qwen3.rs:411-419 | mistralrs-core/src/models/qwen3_moe.rs:588-596 | mistralrs-core/src/models/qwen3_next.rs:750-758 | mistralrs-core/src/models/smollm3.rs:373-381 | mistralrs-core/src/vision_models/llama4/text.rs:805-813 — 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 (8–9 lines × 9) mistralrs-core/src/models/deepseek2.rs:818— mistralrs-core/src/models/deepseek2.rs:818-826 | mistralrs-core/src/models/deepseek3.rs:881-889 | mistralrs-core/src/models/glm4_moe.rs:718-726 | mistralrs-core/src/models/glm4_moe_lite.rs:828-836 | mistralrs-core/src/models/gpt_oss.rs:723-731 | mistralrs-core/src/models/mixtral.rs:415-423 | mistralrs-core/src/models/phi3.rs:418-426 | mistralrs-core/src/models/qwen2.rs:443-451 | 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 (9 lines × 8) mistralrs-core/src/vision_models/qwen3_5/mod.rs:218— mistralrs-core/src/vision_models/qwen3_5/mod.rs:218-226 | mistralrs-core/src/vision_models/qwen3_5/mod.rs:279-287 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:203-211 | mistralrs-core/src/vision_models/qwen3_5_moe/mod.rs:264-272 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:741-749 | mistralrs-core/src/vision_models/qwen3_vl/mod.rs:816-824 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:186-194 | mistralrs-core/src/vision_models/qwen3_vl_moe/mod.rs:261-269 — `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 408 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 × 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:477-484 | mistralrs-core/src/xlora_models/mistral.rs:443-450 | mistralrs-core/src/xlora_models/mixtral.rs:573-580 | mistralrs-core/src/xlora_models/phi2.rs:424-432 | mistralrs-core/src/xlora_models/phi3.rs:409-416 — 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:622— mistralrs-core/src/xlora_models/gemma2.rs:622-630 | mistralrs-core/src/xlora_models/phi2.rs:552-560 | mistralrs-core/src/xlora_models/phi3.rs:534-542 | mistralrs-core/src/xlora_models/quantized_llama.rs:784-790 | mistralrs-core/src/xlora_models/quantized_phi3.rs:450-458 | mistralrs-core/src/xlora_models/starcoder2.rs:567-575 — 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–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 lines × 36) mistralrs-core/src/models/gemma.rs:177— 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:199-206 | 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:193-200 | 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:201-208 | 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/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 31) mistralrs-core/src/models/gemma.rs:238— 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:1608-1615 | 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:268-275 | 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:299-306 | 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:398-405 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:267-274 | 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/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 22) mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:421— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:421-430 | mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:613-622 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1092-1101 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1458-1467 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1751-1760 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2447-2456 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3780-3789 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4120-4129 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4505-4514 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5280-5289 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:8221-8228 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:9407-9414 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:644-653 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:857-866 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1068-1077 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1920-1929 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2139-2148 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3397-3406 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3601-3608 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3804-3813 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:4840-4849 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5078-5087 — 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 × 15) mistralrs-core/src/models/deepseek2.rs:817— mistralrs-core/src/models/deepseek2.rs:817-824 | mistralrs-core/src/models/deepseek3.rs:880-887 | mistralrs-core/src/models/glm4.rs:444-451 | mistralrs-core/src/models/glm4_moe.rs:717-724 | mistralrs-core/src/models/glm4_moe_lite.rs:827-834 | mistralrs-core/src/models/gpt_oss.rs:722-729 | mistralrs-core/src/models/granite.rs:1953-1960 | mistralrs-core/src/models/hunyuan_v1_dense.rs:417-424 | mistralrs-core/src/models/hunyuan_v1_moe.rs:911-918 | mistralrs-core/src/models/llama.rs:354-361 | mistralrs-core/src/models/mistral.rs:423-430 | mistralrs-core/src/models/qwen3.rs:408-415 | mistralrs-core/src/models/qwen3_moe.rs:585-592 | mistralrs-core/src/models/smollm3.rs:370-377 | 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:821— mistralrs-core/src/models/deepseek2.rs:821-828 | mistralrs-core/src/models/deepseek3.rs:884-891 | mistralrs-core/src/models/glm4_moe.rs:721-728 | mistralrs-core/src/models/glm4_moe_lite.rs:831-838 | mistralrs-core/src/models/mixtral.rs:418-425 | mistralrs-core/src/models/phi3.rs:421-428 | mistralrs-core/src/models/qwen2.rs:446-453 | mistralrs-core/src/vision_models/gemma3/text.rs:447-454 | 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:1216-1223 | mistralrs-core/src/vision_models/phi4/mod.rs:337-344 | 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:458-465 | mistralrs-core/src/models/glm4_moe.rs:747-754 | mistralrs-core/src/models/hunyuan_v1_dense.rs:431-438 | mistralrs-core/src/models/hunyuan_v1_moe.rs:925-932 | mistralrs-core/src/models/qwen3.rs:422-429 | mistralrs-core/src/models/qwen3_moe.rs:599-606 | mistralrs-core/src/xlora_models/gemma.rs:444-451 | mistralrs-core/src/xlora_models/gemma2.rs:479-486 | mistralrs-core/src/xlora_models/mistral.rs:445-452 | mistralrs-core/src/xlora_models/mixtral.rs:575-582 — 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:952— mistralrs-core/src/models/deepseek2.rs:952-958 | mistralrs-core/src/models/deepseek3.rs:1015-1021 | mistralrs-core/src/models/glm4_moe.rs:831-837 | mistralrs-core/src/models/glm4_moe_lite.rs:968-974 | mistralrs-core/src/models/mixtral.rs:527-533 | mistralrs-core/src/models/phi2.rs:543-549 | mistralrs-core/src/models/phi3.rs:536-542 | 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:1231— mistralrs-core/src/vision_models/phi3/mod.rs:1231-1238 | mistralrs-core/src/vision_models/phi4/mod.rs:346-353 | mistralrs-core/src/xlora_models/gemma.rs:443-450 | mistralrs-core/src/xlora_models/gemma2.rs:478-485 | mistralrs-core/src/xlora_models/mistral.rs:444-451 | mistralrs-core/src/xlora_models/mixtral.rs:574-581 | mistralrs-core/src/xlora_models/phi2.rs:425-433 | mistralrs-core/src/xlora_models/phi3.rs:410-417 — `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 47 separate duplicated blocks between them, totalling at least 548 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:692— mistralrs-core/src/pipeline/loaders/embedding_loaders.rs:692-698 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2664-2671 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:3484-3490 — 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:86— mistralrs-core/src/models/quantized_llama.rs:86-93 | 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 × 36) mistralrs-core/src/models/gemma.rs:173— 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:195-201 | 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:189-195 | mistralrs-core/src/vision_models/gemma4/text.rs:823-829 | 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/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 33) mistralrs-core/src/models/gemma.rs:238— 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:1608-1616 | 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:268-276 | 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:299-307 | 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:398-406 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:267-275 | 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/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 28) mistralrs-core/src/models/gemma.rs:243— 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:1613-1619 | 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:273-279 | 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:297-303 | mistralrs-core/src/vision_models/gemma4/text.rs:781-787 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:126-132 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:304-310 | 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/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:208-213 | 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 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:821— mistralrs-core/src/models/deepseek2.rs:821-827 | mistralrs-core/src/models/deepseek3.rs:884-890 | mistralrs-core/src/models/glm4_moe.rs:721-727 | mistralrs-core/src/models/glm4_moe_lite.rs:831-837 | mistralrs-core/src/models/mixtral.rs:418-424 | mistralrs-core/src/models/phi3.rs:421-427 | mistralrs-core/src/models/qwen2.rs:446-452 | mistralrs-core/src/vision_models/gemma3/text.rs:447-453 | mistralrs-core/src/vision_models/gemma3n/text.rs:1337-1343 | mistralrs-core/src/vision_models/gemma4/text.rs:1607-1615 | mistralrs-core/src/vision_models/muse_glimmer/text.rs:441-447 | mistralrs-core/src/vision_models/phi3/mod.rs:1216-1222 | mistralrs-core/src/vision_models/phi4/mod.rs:337-343 | 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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: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/gpt_oss.rs:725-731 | mistralrs-core/src/models/mixtral.rs:417-423 | 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: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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:190— mistralrs-core/src/vision_models/qwen3_5/mod.rs:190-196 | mistralrs-core/src/vision_models/qwen3_5/mod.rs:253-259 | 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 408 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 × 38) mistralrs-core/src/models/gemma.rs:176— 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:198-203 | 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:192-197 | mistralrs-core/src/vision_models/gemma4/text.rs:826-831 | 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:200-205 | 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/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 36) 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:987-992 | mistralrs-core/src/models/deepseek2.rs:1027-1032 | mistralrs-core/src/models/deepseek3.rs:1050-1055 | mistralrs-core/src/models/deepseek3.rs:1091-1096 | mistralrs-core/src/models/gemma.rs:500-505 | mistralrs-core/src/models/gemma2.rs:605-610 | mistralrs-core/src/models/glm4.rs:614-619 | mistralrs-core/src/models/glm4_moe.rs:865-870 | mistralrs-core/src/models/glm4_moe.rs:905-910 | mistralrs-core/src/models/glm4_moe_lite.rs:1002-1007 | mistralrs-core/src/models/glm4_moe_lite.rs:1045-1050 | mistralrs-core/src/models/gpt_oss.rs:952-957 | mistralrs-core/src/models/hunyuan_v1_dense.rs:580-585 | mistralrs-core/src/models/hunyuan_v1_moe.rs:1072-1077 | mistralrs-core/src/models/mistral.rs:628-633 | mistralrs-core/src/models/mixtral.rs:565-570 | mistralrs-core/src/models/phi3.rs:575-580 | 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:630-635 | mistralrs-core/src/models/qwen3.rs:579-584 | mistralrs-core/src/models/qwen3_moe.rs:763-768 | mistralrs-core/src/models/qwen3_next.rs:1137-1142 | 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:581-586 | mistralrs-core/src/vision_models/mllama/vision.rs:400-405 | mistralrs-core/src/vision_models/phi3/mod.rs:1381-1386 | mistralrs-core/src/vision_models/phi4/mod.rs:643-648 | 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:2673-2678 | mistralrs-core/src/vision_models/qwen3_5_moe/text.rs:930-935 | mistralrs-core/src/vision_models/qwen3_vl/text.rs:605-610 | mistralrs-core/src/vision_models/qwen3_vl_moe/text.rs:727-732 — 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:1320— mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1320-1325 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1612-1617 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:1897-1902 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2301-2306 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2626-2631 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:2968-2973 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3275-3280 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:3954-3959 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:4708-4713 | mistralrs-core/src/pipeline/loaders/multimodal_loaders.rs:5117-5122 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:734-739 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1158-1163 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:1386-1391 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:2014-2019 | mistralrs-core/src/pipeline/loaders/normal_loaders.rs:5168-5173 — 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:586— mistralrs-core/src/models/gemma.rs:586-591 | mistralrs-core/src/models/gemma2.rs:702-707 | mistralrs-core/src/models/glm4.rs:702-707 | mistralrs-core/src/models/granite.rs:2468-2473 | mistralrs-core/src/models/hunyuan_v1_dense.rs:674-679 | mistralrs-core/src/models/mistral.rs:714-719 | mistralrs-core/src/models/phi2.rs:661-666 | mistralrs-core/src/models/phi3.rs:657-662 | mistralrs-core/src/models/qwen2.rs:716-721 | mistralrs-core/src/models/qwen3.rs:673-678 | mistralrs-core/src/models/starcoder2.rs:652-657 | mistralrs-core/src/vision_models/gemma3/text.rs:928-933 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:674-679 | mistralrs-core/src/vision_models/phi3/mod.rs:1494-1499 — before extracting anything, compare `mistralrs-core/src/models/gemma.rs` and `mistralrs-core/src/models/gemma2.rs` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:705— mistralrs-core/src/vision_models/gemma4/mtp.rs:705-710 | 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 × 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 44 separate duplicated blocks between them, totalling at least 596 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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:5001-5006 | mistralrs-core/src/ops.rs:5274-5279 | mistralrs-core/src/ops.rs:5696-5701 | mistralrs-core/src/ops.rs:6025-6030 — 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:1553— mistralrs-core/src/models/granite.rs:1553-1556 | 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 × 13) mistralrs-core/src/models/deepseek2.rs:972— mistralrs-core/src/models/deepseek2.rs:972-976 | mistralrs-core/src/models/deepseek3.rs:1035-1039 | mistralrs-core/src/models/gemma.rs:485-489 | mistralrs-core/src/models/glm4.rs:599-603 | mistralrs-core/src/models/glm4_moe.rs:850-854 | mistralrs-core/src/models/glm4_moe_lite.rs:987-991 | mistralrs-core/src/models/hunyuan_v1_dense.rs:565-569 | mistralrs-core/src/models/hunyuan_v1_moe.rs:1059-1063 | mistralrs-core/src/models/mistral.rs:613-617 | mistralrs-core/src/models/mixtral.rs:550-554 | mistralrs-core/src/models/phi2.rs:561-563 | mistralrs-core/src/models/qwen3.rs:564-568 | mistralrs-core/src/models/qwen3_moe.rs:748-752 — 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 1040 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call 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 × 9) mistralrs-core/src/layers.rs:842— mistralrs-core/src/layers.rs:842-846 | mistralrs-core/src/layers.rs:900-904 | mistralrs-core/src/layers.rs:917-921 | mistralrs-core/src/layers.rs:2004-2008 | mistralrs-core/src/layers.rs:2178-2182 | mistralrs-core/src/layers.rs:2223-2227 | mistralrs-core/src/layers.rs:2240-2244 | mistralrs-core/src/layers.rs:3035-3039 | mistralrs-core/src/layers.rs:3168-3172 — 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 × 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:891-895 | mistralrs-core/src/gguf/qwen_multimodal_bindings.rs:295-299 | 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:1143— mistralrs-core/src/layers.rs:1143-1147 | mistralrs-core/src/layers.rs:1170-1172 | mistralrs-core/src/layers.rs:1233-1237 | mistralrs-core/src/layers.rs:1260-1262 | mistralrs-core/src/layers.rs:1332-1337 | mistralrs-core/src/layers.rs:1502-1506 | mistralrs-core/src/layers.rs:1529-1531 — 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 (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 (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:5270-5271 | mistralrs-core/src/ops.rs:5693-5694 | mistralrs-core/src/ops.rs:6022-6023 — 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:2237-2241 | mistralrs-core/src/vision_models/gemma4/mtp.rs:126-130 — 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 (12 lines × 11) mistralrs-core/src/models/glm4.rs:416— mistralrs-core/src/models/glm4.rs:416-427 | mistralrs-core/src/models/granite.rs:1925-1936 | mistralrs-core/src/models/hunyuan_v1_dense.rs:373-384 | mistralrs-core/src/models/hunyuan_v1_moe.rs:863-874 | mistralrs-core/src/models/llama.rs:326-337 | mistralrs-core/src/models/mistral.rs:395-406 | mistralrs-core/src/models/qwen3.rs:380-391 | mistralrs-core/src/models/qwen3_moe.rs:557-568 | mistralrs-core/src/models/smollm3.rs:342-353 | mistralrs-core/src/vision_models/llama4/text.rs:774-785 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:412-423 — 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:5256-5269 | mistralrs-core/src/ops.rs:5680-5692 | mistralrs-core/src/ops.rs:6009-6021 — 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:286-295 | 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:317-326 | mistralrs-core/src/models/smollm3.rs:302-311 | mistralrs-core/src/vision_models/gemma4/text.rs:1004-1014 | mistralrs-core/src/vision_models/gemma4/text.rs:1075-1084 | mistralrs-core/src/vision_models/llava/llava_llm/llama.rs:356-365 | mistralrs-core/src/vision_models/llava/llava_llm/mistral.rs:342-351 | mistralrs-core/src/vision_models/mllama/text.rs:282-291 | mistralrs-core/src/vision_models/mllama/text.rs:642-651 | mistralrs-core/src/xlora_models/llama.rs:359-368 | 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/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.
No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
Split mistralrs-core — A huge catch-all at 299k LoC across 66 namespaces is a sprawling grab-bag. Suggested:
D28 · Secrets (history)· Rotate the exposed credentials · ×1
REDACTED
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 4 of 611 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 and example/demo trees and test files identified by path convention, largest first; 611 of the 719 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-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.
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: proc-macro2 — `proc-macro2` is locked at 1.0.106 but 1.0.107 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in mistralrs-macros/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p proc-macro2` and commit the updated REDACTED.
Outdated: quote — `quote` is locked at 1.0.44 but 1.0.47 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in mistralrs-macros/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p quote` and commit the updated REDACTED.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
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 01a0ecee-5bae-7033-8822-77c4ed654386 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 131 · Warnings: 4052 · Recommendations: 22 · Info: 3 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 29-09-2026 @ 11:30 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.