{"slug": "idiomatic-rust-code-and-llms", "title": "Idiomatic Rust Code and LLMs", "summary": "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.", "body_md": "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.\n\nMeanwhile, **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`.\n\nFor 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.", "url": "https://wpnews.pro/news/idiomatic-rust-code-and-llms", "canonical_source": "https://www.dotnetperls.com/2026_10_9_idiomatic-rust-code-llms", "published_at": "2026-10-09 07:00:00+00:00", "updated_at": "2026-10-09 16:51:48.337282+00:00", "lang": "en", "topics": ["large-language-models", "generative-ai", "ai-research"], "entities": ["StepFun", "Step 5 Preview", "Mistral Large 4", "Claude", "Claude Haiku 5.5", "GPT", "Rust"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/idiomatic-rust-code-and-llms", "markdown": "https://wpnews.pro/news/idiomatic-rust-code-and-llms.md", "text": "https://wpnews.pro/news/idiomatic-rust-code-and-llms.txt", "jsonld": "https://wpnews.pro/news/idiomatic-rust-code-and-llms.jsonld"}}