Using AI to generate Rust code

I’ve been tinkering with using AI prompts in my Rust workflow in VS Code, and I ended up building a small repo of ready-to-use instruction sets.

They cover things like:

  • Rust-specific coding workflows
  • Lint analysis & false positive tracing
  • Pest parser / PEGs help
  • RON format guidance

There are also some general-purpose helpers (debugging, syntax error diagnosis) that work in any language.

Repo is here: github.com/Ranrar/rustic-prompt

If anyone’s curious, I’d love to hear how you might use/extend these, or if you have ideas for other useful “modes” to add. Contributions are welcome.

This isn’t a tool in itself — more like a growing library of AI instructions tailored for Rust dev.

Not really. ChatGPT-5 is, in may ways, worse than ChatGPT-4.5 (but cheaper). And ChatGPT-4.5 wasn't much improvement over ChatGPT-4. This:

Is the most important thing. AI is not changing fast, contrary to predictions. But it already can do many things, the biggest problem is that you could never trust it 100% and tools that we are using to verify it (Wikipedia, Official Docs, etc) are deteriorating because people think AI would replace them.

It would be interesting to see which particular way the catastrophe will arrive, but on the direction that we are going it's pretty much inevitable.

I’m pretty impressed with Claude Code in generating a Rust application. It does require familiarity with Rust syntax, however. Letting it stamp out code relatively unattended is folly.

My experience is that it’s best to be as specific as possible in your prompts and limit things to creating, editing or modifying specific structures and functions to perform a task.

As an example, I essentially vibe-coded a complex formal logic theorem prover in a matter of a few afternoons rather than weeks or months. You can check out the result here, GitHub - glancey/axiom · GitHub.

Claude Code saved time with its ability to construct accurate syntax, which in Rust can be a pain to do manually. It also generated the code comments and the readme. Impressive to say the least. The sky’s the limit as far as I’m concerned.

Glenn

Yeah, it is a completely new world.

Why it doesn't pre fetch a string len in some variable and do at every loop iteration?

 while i < s.len() {

Or Rust compiler is the smart to do it for Claude? I also do not like the list:

[dependencies]
clap = { version = "4", features = ["derive"] }
anyhow = "1"
formalisms = { path = "formalisms" }
axiom_parser = { path = "axiom_parser" }

Don't I write a worse code than the guys? Claude is certainly biased to them.

That's idiomatic Rust; the compiler can very easily see that optimization opportunity. It should be done this way.

You're right, the compiler even see if, for example you declared s as a mutable, but do not change it, the length calculation can be pulled of the loop. Certainly, Claude is smarter than we can ever imagine. Currently we can focus on licensing an application idea, then its code, what we did before.

I'm a little confused where you got that conclusion from... that tidbit about optimization is common knowledge.

Most smart, well educated, and experienced people consider others having the same level or better. Unfortunately, it isn't true, for example I just learned something about programming myself and now trying to combine the "knowledge" with "vibe coding", so Claude is the top coding power which can be. And trust me, I am not alone. So, sorry for confusing you.

"Common knowledge" doesn't mean everyone knows it, but that it's well-known. My intent was not to demean anyone who didn't/doesn't know that.

Nonetheless, I think your standards for what constitutes astounding programming intelligence are rather low. By the same standards you seem to apply to Claude, there are a good number of people here who are "the top coding power which can be", who would never accept such a title. :wink:

If you think that Claude knows more than you do, then you should try and learn what you can from it. If you can't check the output AI gives you, then you really shouldn't be trusting the output in the first place.