Lints

In software, a "lint" is a tool used to help improve your source code. TheRust compiler contains a number of lints, and when it compiles your code, it willalso run the lints. These lints may produce a warning, an error, or nothing at all,depending on how you've configured things.

Here's a small example:

  1. $ cat main.rs
  2. fn main() {
  3. let x = 5;
  4. }
  5. $ rustc main.rs
  6. warning: unused variable: `x`
  7. --> main.rs:2:9
  8. |
  9. 2 | let x = 5;
  10. | ^
  11. |
  12. = note: `#[warn(unused_variables)]` on by default
  13. = note: to avoid this warning, consider using `_x` instead

This is the unusedvariables lint, and it tells you that you've introduceda variable that you don't use in your code. That's not _wrong, so it's notan error, but it might be a bug, so you get a warning.