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

Not OP, but what happens in the case you want to add by subtracting a negative value?


You disable the warning for the function?


Yes, which also serves as a way to explicitly point out that the "surprising operation" is intended. Hopefully this even reminds you of putting an explanatory comment there.


Clippy is a linter. You don't use linters by mechanically following its warnings as gospel, you use it by double-checking the code wherever it warns and removing the warning from that function if it's a false positive.


Knowing clippy I wouldn’t be surprised if that compiled, but resulted in a warning that you can simplify the double negative.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: