4017a73d62
Before this change, the example code doesn't run on the current rust stable release(1.49). This is because `Path` inherently has a u8 that requires the sized trait which requires either statics or replacing Path with PathBuf. After this change, the example code will run "as-is" without warnings or errors. |
||
---|---|---|
.. | ||
concat-format.md | ||
ctor.md | ||
default.md | ||
deref.md | ||
dtor-finally.md | ||
mem-replace.md | ||
on-stack-dyn-dispatch.md | ||
option-iter.md | ||
pass-var-to-closure.md | ||
priv-extend.md | ||
README.md | ||
rustdoc-init.md | ||
temporary-mutability.md |
Idioms
Idioms are commonly used styles and patterns largely agreed upon by a community. They are guidelines. Writing idiomatic code allows other developers to understand what is happening because they are familiar with the form that it has.
The computer understands the machine code that is generated by the compiler. The language is therefore mostly beneficial to the developer. So, since we have this abstraction layer, why not put it to good use and make it simple?
Remember the KISS principle: "Keep It Simple, Stupid". It claims that "most systems work best if they are kept simple rather than made complicated; therefore, simplicity should be a key goal in design, and unnecessary complexity should be avoided".
Code is there for humans, not computers, to understand.