3 ms·
That's a fair distinction. Basically, it's easier to write C that compiles than Rust that compiles, but it's harder to write correct C than correct Rust. Regar
by kstrauser 2y ago
That's a fair distinction. Basically, it's easier to write C that compiles than Rust that compiles, but it's harder to write correct C than correct Rust.
Regarding Clippy, you can also crank it up with `cargo clippy -- -Wclippy::pedantic`. Some of the advice at that level gets a little suspect. Don't just blindly follow it. It offers some nice suggestions though, like:
warning: long literal lacking separators
--> src/main.rs:94:22
|
94 | if num > 1000000000000 {
| ^^^^^^^^^^^^^ help: consider: `1_000_000_000_000`
|
that you don't get by default.
- maleldil 2y agoYou can also add #![warn(clippy::all, clippy::pedantic)] to your main.rs/lib.rs file to get those lints project-wide.
- jpc0 2y agoThe truly pedantic setting here would by complaining about the magic number. Why 1_000_000_000_000, what does that number mean. It is for free to: let my_special_thing = 1_000_000_000_000 since the compiler will just inline it. The readability problem was never the lack of separators, since that number might be the wrong number regardless.