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

For unused vars you can do this and the compiler will ignore it.

_ = my_unsed_var;



Doesn't that entirely defeat the purpose of having the compiler not allow unused variables.


Add a pre-commit hook to forbid use of '_ ='.

   grep '$ *_ ?=' *


Not exactly. Because a quick grep of _ = gives you the variables which are needed to be checked before whether used or unused




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: