Good guy Rust, if I catch you forgetting to clean up your unused imports, I will ask you to fix it in the pull request. Not because it's a big deal, but that it's a sign you didn't check the warnings before pushing the code.
Is it worst than TypeScript where if you declare that a variable could contain "Apple", "Banana" or "Orange" in refuses to compile saying "Sorry bro, there is no case where your function returns Apple so your code is invalid"?
244
u/cmk__ Sep 05 '26
Rust does not have warnings. It has strongly worded disappointment.
72
u/Bomaruto Sep 05 '26
Good guy Rust, if I catch you forgetting to clean up your unused imports, I will ask you to fix it in the pull request. Not because it's a big deal, but that it's a sign you didn't check the warnings before pushing the code.
32
u/tttima Sep 05 '26
In C, we have additional tools to tell us about unused imports.
12
u/eanat Sep 05 '26
time to do tree shaking!
9
u/paholg Sep 06 '26
I think you mean the go compiler? Rust issues a friendly warning; go refuses to compile at all.
4
u/KyxeMusic Sep 06 '26
Go won't even compile with an unused import
1
u/DT-Sodium Sep 06 '26
Is it worst than TypeScript where if you declare that a variable could contain "Apple", "Banana" or "Orange" in refuses to compile saying "Sorry bro, there is no case where your function returns Apple so your code is invalid"?
1
u/UUDDLRLRBadAlchemy Sep 07 '26
She's all like "don't you have a linter to catch that?"