Skip to content
sagan-softwarePublic

About

Rust compiler lints for maintainability, correctness and performance, loaded through Dylint.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Dylints mark

Dylints

CI GitHub stars

Compiler lints for Rust rules that are hard to enforce consistently in review. Dylints adds deterministic, type-aware checks for APIs, project policy and maintenance patterns that otherwise depend on a reviewer remembering every edge case. That makes the checks useful for human and AI-assisted changes alike. They complement compiler diagnostics, Clippy, tests and code review.

The catalog contains 297 lints in nine general groups and 13 crate-specific groups. Every lint has examples, known limits and a default Warn level. The optional crates/sagan-lints aggregate selects every group, including the stricter policy checks.

Lint catalog · Guide · Coverage · Benchmarks

Quick start

Install Dylint's command-line tools using the upstream installation guide. The examples below use Dylint 6.0.3 and the compiler used to validate this repository, nightly-2026-07-15:

rustup toolchain install nightly-2026-07-15 --component rustc-dev --component llvm-tools-preview
cargo install --locked --version 6.0.3 cargo-dylint dylint-link

Install the CLI tools with your normal Cargo toolchain. The lint libraries and Dylint driver use rustc's unstable compiler interfaces, so run Dylint with the pinned nightly shown above. The target workspace and its dependencies must compile under that nightly when Dylint checks them; ordinary application builds can continue using stable Rust. The repository development environment and compatibility details are in the usage guide.

Workspace metadata in Cargo.toml

In the root Cargo.toml of the workspace you want to lint, add a library entry under workspace.metadata.dylint. Keep any entries already there. This example selects the three recommended general groups:

[[workspace.metadata.dylint.libraries]]
git = "https://github.com/sagan-software/dylints"
branch = "main"
pattern = ["crates/correctness", "crates/perf", "crates/suspicious"]

Run Dylint from that workspace root:

cargo +nightly-2026-07-15 dylint --all --workspace -- --all-targets

Direct command for Bevy lints

To try only the Bevy-specific group without changing the workspace manifest, run this from the target workspace:

cargo +nightly-2026-07-15 dylint \
    --git https://github.com/sagan-software/dylints \
    --branch main \
    --pattern crates/bevy \
    --workspace -- \
    --all-targets

Choose a Git tag or exact rev instead of branch = "main" for reproducible builds. Do not load a parent group and its child libraries together: that registers the same lints more than once.

Lint groups

Each general group is a Dylint library. Its directory is selected through the pattern field above. The crates group contains the crate-specific groups; select the parent or a child, never both.

General groups

  • cargo checks Cargo manifests, workspace dependencies and toolchain configuration.
  • complexity finds control flow and iteration that can be simplified.
  • correctness catches likely bugs and failure-prone behavior.
  • crates registers the crate-specific groups described below.
  • maintainability measures complexity, coupling and public surface size.
  • perf flags unnecessary allocations, copies and repeated work.
  • restriction enforces stricter project policies that may not suit every codebase.
  • style checks Rust conventions and consistent implementations.
  • suspicious highlights error handling and constructs that deserve review.

Crate-specific groups

Each linked name is the crate's canonical spelling and points to its official project or documentation.

  • axum checks router paths, nesting and service configuration for the Axum web framework.
  • bevy checks ECS queries, systems, schedules and selected engine API usage in Bevy.
  • clap checks derive attributes and command-line argument configuration for Clap.
  • insta checks snapshot assertions, filters and snapshot file handling in Insta.
  • reqwest checks HTTP client construction, request loops, retries and TLS settings in reqwest.
  • schemars checks derives and schema metadata for Schemars, a Rust library for generating JSON Schema.
  • serde checks serialization and deserialization attributes and round-trip behavior in Serde.
  • sqlx checks query-builder use, row access and connection-pool settings in SQLx.
  • strum checks enum representation and derive behavior in Strum.
  • test-case checks parameterized test declarations and case matrices in test-case.
  • thiserror checks error derives, source fields and display formatting in thiserror.
  • tokio checks runtime, task, channel and blocking-call patterns in Tokio.
  • tracing checks spans, fields and instrumentation in tracing.

Development

Use the pinned environment for repository development and its compiler-based UI tests:

nix --accept-flake-config develop
cargo xtask --help

See contributing, performance and metric interpretation for validation and report details. The catalog and guide are built as one Pages artifact by cargo xtask site.

License notes

The catalog's crates/sagan-lints-web/static/ assets and crates/sagan-lints-web/templates/index.html.jinja adapt the Clippy lint list. Clippy releases those assets under MIT or Apache-2.0. See the Clippy MIT license.

About

Rust compiler lints for maintainability, correctness and performance, loaded through Dylint.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages