cd /news/large-language-models/idiomatic-rust-code-and-llms · home › topics › large-language-models › article
[ARTICLE · art-148380] src=dotnetperls.com ↗ pub= topic=large-language-models verified=true sentiment=· neutral

Idiomatic Rust Code and LLMs

A developer's hands-on comparison found that StepFun's Step 5 Preview and Mistral Large 4 generate working Rust code that is not idiomatic, relying on C-style `idx` local variables and byte accesses, while Claude (Opus through Haiku, including the cheap Claude Haiku 5.5) and GPT models produce idiomatic Rust using standard library functions such as `position` and `is_ascii_whitespace`, plus `Option`, `iter` and `map`. The author says the non-idiomatic output still works but leads him to prefer Claude or GPT, and recommends some AI companies change their training data.

key takeaway

Claude (Opus to Haiku, including Claude Haiku 5.5) and GPT models write idiomatic Rust using `position` and `is_ascii_whitespace` with `Option`, `iter` and `map`, whereas StepFun's Step 5 Preview and Mistral Large 4 fall back to C-style `idx` variables and byte accesses.

read1 min views16 publishedOct 9, 2026

I used Step 5 Preview today (from StepFun) to generate some Rust code. It worked correctly, but like the code I generated with Mistral Large 4, it was not really idiomatic Rust code. Instead it uses a lot of idx local variables and byte accesses like you would see in C code.

Meanwhile, Claude (From Opus to Haiku) and GPT seem to have become proficient at writing idiomatic Rust code. This means using standard library functions (like position and is_ascii_whitespace), Option, iter, map.

For example, in Rust it is much cleaner to use is_ascii_whitespace to test for a whitespace byte, and use position instead of a loop. Even though code from models that do not write idiomatic Rust code as eagerly works, I tend to end up preferring Claude or GPT. Even Claude Haiku 5.5, which is really cheap, can do this, but large, expensive competing models cannot. I recommend a change in training data for some of the AI companies.

── more in #large-language-models 4 stories · sorted by recency
── more on @stepfun 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/idiomatic-rust-code-…] indexed:0 read:1min 2026-10-09 · —