Earlier quoted context omitted.
The "idiomatic Rust" thing rubs me the wrong way. If someone writes Rust that compiles and works, that's Rust. full stop. Telling people it doesn't count until it's "idiomatic" is just gatekeeping. It quietly says you're not a real Rust dev until you've put in years and absorbed all the unwritten rules, which shuts out exactly the people who are still learning. Everyone writes "non-idiomatic" code when they start. Th…
I get the feeling, and shooting for idiomatic on a rewrite is definitely wrong. That being said, "idiomatic" is more just saying "clean and familiar". It's using the right language features in the right places. For example, you could write something like this fn add_double(a: f64, b: f64) -> f64 { return a + b; } fn add_float(a: f32, b: f32) -> f32 { return a + b; } But that's not idiomatic. Idiomatic would look some…
fn add>(a: T, b: T) -> T {
a + b
}