News for hackers. Stuff that matters.
Re:I stopped everything and started writing C again by kstrauser on Wednesday March 12, 2025 @02:52PM (#43346478)
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.
Re:I stopped everything and started writing C again by maleldil on Wednesday March 12, 2025 @09:43PM (#43349595)
You can also add #![warn(clippy::all, clippy::pedantic)] to your main.rs/lib.rs file to get those lints project-wide.
Re:I stopped everything and started writing C again by jpc0 on Thursday March 13, 2025 @01:09AM (#43350549)
The 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.