Hello,
I want to start programmng in Rust but before, is there an official norme / style guide / guidelines like PEP for Python ?
If i'm going to learn Rust, I need to do it correctly and don't produce code that make a headache at others.
Thanks
Hello,
I want to start programmng in Rust but before, is there an official norme / style guide / guidelines like PEP for Python ?
If i'm going to learn Rust, I need to do it correctly and don't produce code that make a headache at others.
Thanks
There are the Rust Guidelines by @aturon at https://aturon.github.io/. I also recommend installing rustfmt
and using cargo fmt
to automatically format code in your projects.
Thanks !
I had install rustfmt too, pretty nice (cheat) program
Also use rust-clippy
The Rust Guidelines at https://doc.rust-lang.org/style/ have a more official-looking URL, but otherwise the contents seems to be the same.
(I vaguely remember it to be more up to date than https://aturon.github.io/, but now I can't find any substantial difference.)
They were imported in-tree, but we recently removed them; check that link
on nightly.
As soon as it doesn't require nightlies ...
I follow a lot of the guidelines of PEP8 and PEP20 and I find my Rust code quite good, if I do say so myself!
Python and Rust have a lot of similarities, in terms of how we like to write code. Explicit over implicit, Forgiveness over permission, etc.