O'Reilly logo

Mastering Rust by Vesa Kaihlavirta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Linter plugins

Linter plugins can be used to add new validation checks for code, which the standard Rust compiler does not. Using linter plugins looks similar to using other compiler plugins but with minute differences. They also require a nightly version of the compiler.

To create a minimal linter plugin, you first create a custom struct and then implement the LintPass and EarlyLintPass traits for it. LintPass is for adding human-readable descriptions of the custom lints. EarlyLintPass is for creating the actual lint functionality. There is also a LateLintPass, the difference being that EarlyLintPass hooks up to an earlier phase in the compilation process and LateLintPass to a later one. They offer the same hooks but a later phase has access ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required