dylint

Example Dylint libraries

The example libraries are separated into the following three categories:

General

Example Description/check
abs_home_path String literals that are absolute paths into the user’s home directory
await_holding_span_guard Span guards held while calling await inside an async function
basic_dead_store A lint to find simple instances of dead stores in arrays
crate_wide_allow #![allow(...)] used at the crate level
incorrect_matches_operation Incorrect operators used with matches! macros
non_local_effect_before_error_return Non-local effects before return of an error
non_thread_safe_call_in_test Non-thread-safe function calls in tests
wrong_serialize_struct_arg Calls to serialize_struct with incorrect len arguments

Supplementary

Example Description/check
commented_code Code that has been commented out
escaping_doc_link Doc comment links that escape their packages
local_ref_cell RefCell local variables
redundant_reference Reference fields used only to read one copyable subfield
unnamed_constant Unnamed constants, aka magic numbers
unnecessary_borrow_mut Calls to RefCell::borrow_mut that could be RefCell::borrow
unnecessary_conversion_for_trait Unnecessary trait-behavior-preserving calls

Restriction

Example Description/check
assert_eq_arg_misordering assert_eq!(actual, expected)
collapsible_unwrap An unwrap that could be combined with an expect or unwrap using and_then
const_path_join Joining of constant path components
env_literal Environment variables referred to with string literals
inconsistent_qualification Inconsistent qualification of module items
misleading_variable_name Variables whose names suggest they have types other than the ones they have
overscoped_allow allow attributes whose scope could be reduced
question_mark_in_expression The ? operator in expressions
ref_aware_redundant_closure_for_method_calls A ref-aware fork of redundant_closure_for_method_calls
register_lints_warn Calls to rustc_errors::DiagCtxtHandle::warn from within a register_lints function
suboptimal_pattern Patterns that could perform additional destructuring
try_io_result The ? operator applied to std::io::Result

Experimental

Example Description/check
derive_opportunity Traits that could be derived
missing_doc_comment_openai A lint that suggests doc comments using OpenAI

Testing

Example Description/check
clippy All of the Clippy lints as a Dylint library
marker Marker lints run from a Dylint library
straggler A lint that uses an old toolchain for testing purposes

Notes

  1. Each example is in its own workspace so that it can have its own rust-toolchain.
  2. Each example is configured to use the installed copy of dylint-link. To use the copy within this repository, change the example’s .cargo/config.toml file as follows:
    [target.x86_64-unknown-linux-gnu]
    linker = "../../../target/debug/dylint-link"