Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't know what the difference was, but 1-2 years ago it definitely did not warn me. Perhaps it doesn't show a warning when you assign a different datatype?


The unused variable warning has been around since before 1.0, and works even when the types of the variables are different.


There's only one case where shadowing has bitten me in the past: long methods with loops dealing usize almost exclusively, where shadowing external bindings inside the loop might make sense, but any mistake would be silent. This was in the context of terminal layout code. The solution there has been extensive testing, but what I should have done is split the megafunction into multiple smaller ones.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: