4 ms·
I am convinced that `rustc` should have an "optimizer lint" phase with all the same checks other languages perform to change the behavior of the code and instea
by estebank 6y ago
I am convinced that `rustc` should have an "optimizer lint" phase with all the same checks other languages perform to change the behavior of the code and instead suggest changes that affect running code and compile time, like `Box`ing fields or variants that disproportionately affect the size of an `enum`[1] or to suggest changing generic params to trait objects or vice versa[2] when it makes sense.
The advantage of not doing it automatically is that the behavior of the code once compiled can be always inferred from looking at the code, no magic and sudden changes in behavior because some threshold has been passed in some optimizer.
[1]: https://github.com/rust-lang/rust-clippy/pull/5466 https://github.com/rust-lang/rust-clippy/pull/5466
[2]: https://github.com/rust-lang/rust-clippy/issues/14 https://github.com/rust-lang/rust-clippy/issues/14