And even better, it's entierly customizable using directives within the code itself!
It evencan be set for the whole project, or for a specific module.
If you are still prototyping, you can add a little
#![allow(unused)]
and change it into a deny/forbid on the production build.
On the other end, a
#![forbid(unsafe)]
is a wonderful guarantee for your codebase.
There also a lot of very specific lints you can turn on, relating to endianness, and a bunch of more domain-specific things.
Quick edit:
More specifically, there's the whole restriction lint group, which is allow per default.
It has a lot of things related to enforcing some uncommon coding guidelines (like no else if without an else).
And there's also the whole pedantic lint group, also allow per default.
It's instead lints that are technically good, but more among the realm of micro optimizations and pedantic bullshit than the realm of actually important errors (like using an unstable sort to sort primitives, as it's slightly faster than a stable one).
But they can be very useful in contexts where these actually matter.
But some coding guidelines enforces that, so there is a lint that you can toggle on, in order to enforce this guideline.
A maybe better example would be the implicit_return lint, which guards against Rust's implicit returning of the last expression of a block. It's very much idiomatic Rust, but there could (and most likely is) a team that is still somewhat unfamiliar with Rust, and prefers to ban as much implicit things as possible.
I hate that for a second I suspected your post to be an AI-copypasta; only because at first glance I saw proper formatting and an upbeat/enthusiastic intro ("And even better, it's entierly customizable[...]!").
I love proper formatting and enthusiastic posts, darn it.
View all comments
Show parent comment
3
u/TiF4H3- 2d ago edited 2d ago
And even better, it's entierly customizable using directives within the code itself!
It evencan be set for the whole project, or for a specific module.
If you are still prototyping, you can add a little
and change it into a
deny/forbidon the production build.On the other end, a
is a wonderful guarantee for your codebase.
There also a lot of very specific lints you can turn on, relating to endianness, and a bunch of more domain-specific things.
Quick edit:
More specifically, there's the whole
restrictionlint group, which is allow per default.It has a lot of things related to enforcing some uncommon coding guidelines (like no
else ifwithout anelse).And there's also the whole
pedanticlint group, also allow per default.It's instead lints that are technically good, but more among the realm of micro optimizations and pedantic bullshit than the realm of actually important errors (like using an unstable sort to sort primitives, as it's slightly faster than a stable one).
But they can be very useful in contexts where these actually matter.