Hacker News new | ask | show | jobs
by coldtea 1067 days ago
>which, for me kills the language for me since I like having unused variables for debug while I’m stepping through the code.

If they're unused, then they're not helping with debugging either...

It's quite a bizarre reason

2 comments

Not true. Their debugger might display the value of the variables, which are unused outside the debugger. There are other options in Rust though, like logging. Create your "unused variable", and then use it in a debug log or dbg macro, etc.
v = function_call(); // inspect v in debugger but it's 'unused' to the compiler.

At least this is how it works in C and C++.