Skip to content

Instantly share code, notes, and snippets.

@justanotherdot
Created January 29, 2021 21:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justanotherdot/01f25394df97486a0ab3eeb14203b4c0 to your computer and use it in GitHub Desktop.
Save justanotherdot/01f25394df97486a0ab3eeb14203b4c0 to your computer and use it in GitHub Desktop.
Avoid prefixing variables you will use with an underscore.
// Rust Idiom:
// prefixing a variable with an underscore
// signals to others that the variable
// isn't going to be used, not that it is
// intentionally private or an updated
// variable.
main () {
let x = 12;
// _x reads as
// "I don't care about this x but I want
// to tell you it's x-like or from x"
let _x = x + 1;
dbg!(_x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment