variablesrustunused-variables

Why do underscore prefixed variables exist?


I am learning Rust, and came across the fact that adding an underscore at the beginning of a variable name will make the compiler not warn if it is unused. I am wondering why that feature exists, since unused variables are frowned upon.


Solution

  • I can see several reasons: