Lints for kernel or embedded system development.
Clone the repository and run cargo install:
git clone https://github.com/Rust-for-Linux/klint.git
cd klint
cargo install --path .Note that klint currently is pinned to a Rust version so it is likely that running cargo install --git will not work as it will not use the rust-toolchain file in the repository.
klint is developed against latest nightly rustc; if you would like to use it with a stable Rust version, check the tagged releases.
klint will behave like rustc, just with additional lints.
If you use nix, you can also build and run klint directly:
nix run github:Rust-for-Linux/klintcargo install --path .klint is a tool and would need to be registered with rustc, to do so, apply this patch to the kernel tree.
This patch can be used even if plain rustc or clippy is used for kernel build.
To run this tool for Linux kernel build, use make RUSTC=<path to klint> to use klint in place of a Rust compiler.
If you compile kernel with rustdoc tests as kunit tests, you also need a matching version of rustdoc.
For Nix users, this is available as symlink klint-rustdoc, you can use add RUSTDOC=klint-rustdoc to make command line.
klint's atomic context checker is not lint-clean on Linux kernel tree.
If you want to check it out, you can opt into it with -Dklint::atomic_context.