(no title)
perth
|
2 years ago
The thing that really ticks me off about RUST is it has compiler optimizations that can’t be turned off. In C++, you can typically turn off all optimizations, including optimizing away unused variables, in most compilers. In RUST it’s part of the language specification that you cannot have an unused variable, which, for me kills the language for me since I like having unused variables for debug while I’m stepping through the code.
vacuity|2 years ago
I'm not sure what you mean by "optimizing away unused variables", so I'm interpreting it as variables that are literally unused after declaration.
cesarb|2 years ago
I believe you're confusing Rust with Go. In Rust, an unused variable is just a warning, unless you explicitly asked the compiler to turn that warning (or all warnings) into an error.
coldtea|2 years ago
If they're unused, then they're not helping with debugging either...
It's quite a bizarre reason
Buttons840|2 years ago
groos|2 years ago
At least this is how it works in C and C++.
dralley|2 years ago
What you cannot have, is uninitialized variables which are used.
justinpombrio|2 years ago
And as someone else said, if all you want is unused variables without warnings, you can say at the top of the root of the crate (`main.rs` or `lib.rs`):
unknown|2 years ago
[deleted]
IceSentry|2 years ago
fruffy|2 years ago