Rust
- 'crate' misplaced in path
Reports incorrect use of the literal `crate` in a path.
- A non-constant value was used in a constant expression
Reports a non-constant value or function call used in a constant expression.
- Additional non-auto trait in trait object
Reports trait objects with additional non-auto traits.
- Anonymous function parameters not allowed
Reports the use of anonymous parameters in functions that do not allow it.
- Approximated constants
Reports hard coded numeric constants such as std::f64::consts::PI.
- Attempt to call not a function
When calling somethings, checks that it is function or method.
- Attribute error
Reports issues with attributes including misuse, redundancy, formatting errors, invalid entries, outdated syntax, and more.
- Attribute without parentheses
Detects incomplete attributes that require parentheses.
- Base expression required after `..`
Highlights .
- Blocking `sleep` function cannot be used in `async` context
Detects usages of blocking thread::sleep() function in async contexts.
- Boolean expression can be simplified
Detects boolean expressions that can be safely simplified like a || true.
- Borrow checker errors
Reports basic borrow checker errors.
- Both `Copy` and `Drop` implemented
Reports cases where the `Copy` trait is implemented along with `Drop`, which is considered unsafe and currently not allowed in the Rust language.
- Char literal empty or too long
Reports char literals which are empty or too long.
- Circular modules
Reports circular module declarations with the #path attribute.
- Comma-separated trait bounds
Reports trait bounds for a single type that are separated with a comma instead of a `+` sign.
- Compiler feature is unavailable
Reports code that uses unavailable compiler features.
- Complex pattern in function
Reports incorrect use of patterns in functions.
- Const generic argument expression without braces
Reports const generic argument expressions with missing braces.
- Constants cannot refer to statics
Detects constant variables that refer to static variables.
- Dangling `else`
Detects suspiciously looking else if-statements split by new lines.
- Default parameter values (unsupported)
Reports the use of default parameter values, which are not supported in Rust.
- Default type parameters syntax
Report incorrect usage of default type parameters.
- Defaults for const parameters not allowed
Reports invalid use of defaults for const parameters.
- Deprecated `...` syntax
Reports the use of `...` deprecated syntax.
- Derived trait not implemented
Reports members that do not implement the traits being derived.
- Detached file
Detects files that are not attached to any Rust module.
- Double negation
Detects expressions of the form --x which might be mistook for pre-decrements.
- Duplicate definition
Reports duplicate items (such as field declarations, type parameters, etc.).
- Duplicate hash key
Reports duplicate keys when creating hash maps.
- Duplicate macro pattern
Checks duplicated patterns in macro definitions.
- Duplicate trait method parameter name
Checks duplicated parameter names of abstract trait methods.
- Dynamic environment capture in `fn`
Reports captures of a dynamic environment in a `fn` item.
- Entry point is async
Checks if the entry point of the program was marked as async.
- Equality assertion can be simplified
Detect assert!(a == b) (and assert!(a != b)) macro call that can be simplified into assert_eq!(a, b) (or assert_ne!(a, b)).
- Experimental inspections
Some unstable experimental checks which are disabled by default.
- Explicit call to `drop`
Reports explicit calls to `drop`.
- External linter
This inspection runs external linter to check for rustc or clippy errors.
- Failed line in test
Reports failed function calls or assertions in tests.
- Foreign trait implementation
Reports implementations of foreign traits (traits defined outside the current crate) for arbitrary types.
- Format macro error
Reports errors in the use of macros that support formatting.
- Forward-declared identifier for parameter with default value
Reports generic parameters with default values that use forward-declared identifiers.
- Function cannot be variadic
Reports functions that cannot be declared variadic.
- Generic arguments must be specified before the first constraint
Reports generic arguments specified after the first constraint.
- Immutable reassigned
Reports format! calls with missing format arguments.
- Immutable variable reassigned
Detects immutable bindings reassignments.
- Inclusive range without an end bound
Reports inclusive ranges without a specified end bound (`..=b` or `a..=b`).
- Incorrect const syntax
Reports incorrect const syntax.
- Incorrect function syntax
Reports incorrect function syntax.
- Incorrect order of lifetime/type/const parameters
Reports incorrectly ordered lifetime, type, and const parameters.
- Incorrect type alias syntax
Reports incorrect type alias syntax.
- Incorrect visibility restriction
Reports incorrect visibility restrictions.
- Index expression has a wrong type
Checks type of index expression.
- Inherent `impl` block not allowed for item
Reports inherent `impl` blocks defined for items other than structs, enums, unions, or trait objects.
- Inherent `impl` defined outside type's containing crate
Reports inherent type implementations defined outside the type's original crate.
- Inherent `impl` for dyn auto trait
Reports inherent implementations for dynamic auto traits.
- Invalid 'break' or 'continue'
Reports invalid usages of break and continue in loops.
- Invalid `#[start]` attribute
Reports incorrect usage of the #[start] attribute.
- Invalid `?` usage
Reports incorrect usage of the ? operator.
- Invalid `Copy` implementation
Reports invalid `Copy` implementations.
- Invalid `Drop` implementation
Reports invalid `Drop` implementations.
- Invalid `self` import
Reports invalid `self` imports.
- Invalid crate name
Check if the crate name is valid, namely the crate name must not be empty, and must only contain Unicode alphanumeric or _ (U+005F) characters.
- Invalid fields in struct
Reports incorrect field use in struct literals.
- Invalid fields in struct or tuple struct pattern
Reports invalid fields in struct and tuple struct patterns.
- Invalid label name
Reports labels with invalid names.
- Invalid lifetime name
Reports lifetimes with invalid names.
- Invalid literal suffix
Reports literals with invalid suffixes.
- Invalid macro call
Reports errors when calling macros.
- Invalid macro variable type
Reports invalid fragment specifier of a macro variable.
- Invalid place expression
Reports invalid place expressions.
- Invalid private field/method access
Reports invalid attempts to access private fields or methods.
- Item cannot be inside another item
Reports structs, enums, macro definitions and traits placed inside other structs, enums, macro definitions or traits.
- Lifetime bounds in parentheses
Reports lifetime bounds in parentheses.
- Literal out of range
Check if a numerical value is out of the range of the receiver.
- Main function not found
Checks if the main function exists in the binary crates.
- Manual implementation of `Fn`, `FnMut`, or `FnOnce`
Reports manual implementations of `Fn`, `FnMut`, and `FnOnce` traits.
- Match expression can be replaced with a method call
Reports match expressions that can be replaced with a method call.
- Misordered generic arguments
Generic arguments were not provided in the same order as the corresponding generic parameters are declared.
- Misplaced `...` argument
Reports variadic functions where `...` is not positioned as the last argument.
- Missing `dyn` in trait objects
Checks if trait objects are explicitly specified with dyn keyword.
- Missing `else`
Detects suspiciously looking if-statements with potentially missing elses.
- Missing features
Detects Cargo packages with missing cargo features in some of their dependency packages.
- Missing parentheses for chained comparison
Reports chained comparison operators with missing parentheses.
- Missing struct field type
Reports struct fields declared without a type.
- Missing type for constant
Reports constant declarations with missing types.
- Module declared outside mod.rs
Reports module declarations in files other than mod.rs.
- Multiple lifetime bounds for trait object
Reports trait objects with multiple lifetime bounds.
- Multiple relaxed default bounds for type parameter
Reports type parameters with multiple relaxed default bounds.
- Nested `impl Trait` not allowed
Reports the use of nested `impl Trait`.
- Nested lifetime quantification
Reports where clauses containing nested quantification over lifetimes, which is not supported.
- No boxing for async recursion
Reports recursion used in async functions without boxing.
- No file found for module
Reports module declarations with no corresponding file found.
- Non-exhaustive match
Checks that match expression is exhaustive, i.e.
- Non-existent field access
Reports attempts to access non-existent fields.
- Non-inline module declaration missing path attribute
Reports non-inline modules declared inside a block and missing the path attribute.
- Non-shorthand field initialization
Reports cases where field initialization shorthand (RFC 1682) can be used.
- Non-string ABI literal
Reports non-string ABI literals.
- Non-structural-match type used for const generic parameter
Reports the use of non-structural-match types for const generic parameters.
- Object type with no traits
Reports trait objects declared without a single trait.
- Parameter type with unknown size
Reports function parameters whose types are unknown at compile time.
- Proc macro defined outside `proc-macro` crate
Reports the use of #[proc_macro], #[proc_macro_attribute], and #[proc_macro_derive] attributes in non-procedural macro crates.
- Public item in proc-macro crate
Reports public items located in the root of a procedural macro crate and not marked with a #[proc_macro], #[proc_macro_attribute], or #[proc_macro_derive] attribute.
- Re-export of a private item
Reports private items that were re-exported publicly.
- Redundant `::`
Reports redundant ::.
- Redundant `else`
Detects else-statements preceded by irrefutable patterns.
- Reference dropped
Reports calls to std::mem::drop with a reference instead of an owned value.
- Repeated discriminant value
Reports discriminant values that are present more than once in a single enum.
- Repeated identifier in pattern
Reports identifiers bound more than once in the same pattern.
- Reserved keyword used as an identifier
Reports the use of reserved keywords.
- Reserved lifetime name
Reports the use of reserved lifetime names.
- Rust 2018 edition violation
Reports the use of keywords reserved in Rust 2018 edition, as well as features unavailable in Rust 2018 edition.
- Rust 2024 edition violation
Reports the use of keywords reserved in Rust 2024 edition, as well as features unavailable in Rust 2024 edition.
- Struct inheritance (unsupported)
Reports struct inheritance, which is not supported in Rust.
- Supertrait is not implemented
Reports missing supertrait implementations.
- Suspicious assignment
Detects use of the non-existent =*, =! and =- operators that are probably typos.
- Trait expected
Reports non-trait items referenced as traits.
- Trait implementation issue
Reports errors in trait implementation like "Missing members", "Unknown member", etc.
- Trait safety mismatch
Reports mismatches between the safety of a trait's definition and its implementation.
- Tuple-like union
Reports union declarations with tuple syntax.
- Type checker
The Rust type checker.
- Type checker (experimental)
The Rust type checker (experimental).
- Type does not implement trait
Reports the use of types that do not implement the necessary traits.
- Type does not implement trait (experimental)
Reports the use of types that do not implement the necessary traits.
- Type mismatched the trait's associated type.
A type mismatched an associated type of a trait.
- Type placeholder used in item signature
Reports the use of type placeholders (_) in an item's signature.
- Unclosed text literal
Reports unclosed text literals.
- Undeclared label
Reports undeclared labels.
- Undeclared lifetime name
Reports undeclared lifetimes.
- Union expression fields count
Checks that union expr has exactly one field.
- Unlabeled `continue`/`break` in `while` loop condition
Reports the use of `break`/`continue` keywords without labels in `while` loop conditions.
- Unlabeled `continue`/`break` in labeled block
Reports the use of unlabeled `break`/`continue` statements inside labeled blocks.
- Unnecessary visibility qualifier
Reports unnecessary visibility qualifiers.
- Unreachable label
Reports unreachable labels.
- Unresolved method
Reports unresolved method references.
- Unresolved method (experimental)
Reports unresolved method references.
- Unresolved path
Reports unresolved path references.
- Unresolved path (experimental)
Reports unresolved path references.
- Unsafe CString pointer
Detects unsafe usage of CString.
- Unsafe inherent implementation
Reports inherent implementations marked as unsafe.
- Unsafe item in safe context
Reports the use of unsafe items in a safe context.
- Unsafe module
Reports modules declared as unsafe.
- Unstable item
Reports the use of unstable items.
- Unsupported `let` expression
Reports `let` expressions in places where they are unsupported.
- Use of `dyn`/`impl Trait` in type parameter bounds
Reports the use of `dyn` and `impl Trait` in type parameter bounds.
- Use of increment/decrement operator (unsupported)
Reports the use of `++` and `--` operators, which are not supported in Rust.
- Variadic parameters for non-C ABI function
Reports C-variadic functions that do not use a compatible calling convention.
- Wrong associated type arguments
Checks if correct associated type arguments were used for a type or a trait reference.
- Wrong number of arguments
Reports function calls with an incorrect number of arguments.
- Wrong number of generic arguments
Checks if the right number of generic arguments was used for a type, trait, function call or method call.
- Wrong number of lifetime parameters
Checks if the right number of lifetime parameters was used for a type or trait.
- Wrong number of type or const parameters
Checks if an attempted implementation of a trait method or an associated type has the right number of type or const parameters.
- `#[dbg]` usage
Reports usages of dbg! macro.
- `#[derive]` not allowed
Reports `derive` attributes applied to items other than structs, enums, or unions.
- `#[inline]` not allowed
Reports `inline` attributes applied to items other than functions or closures.
- `#[repr(inttype)]` missing for enum
Reports enums that require a `#[repr(inttype)]` attribute.
- `Copy` type dropped
Reports calls to std::mem::drop with values that derive the Copy trait.
- `Sized`/`Unsized` trait implemented explicitly
Reports explicit implementations of the `Sized` and `Unsized` traits.
- `ToString` should not be implemented directly
Detects implementations of ToString trait which, as its documentation states, shouldn't be implemented directly and Display trait should be implemented instead.
- `_` on the right-hand side of assignment
Reports invalid use of underscores (`_`) in expressions: they are only allowed on the left-hand side of an assignment.
- `async` non-`move` closure with parameters (unsupported)
Reports the use of `async` non-`move` closures with parameters for Rust 1.76 or earlier versions that do not support it.
- `compile_error!` macro
Highlights `compile_error!()` macro invocation.
- `continue`/`break` used outside `loop`/`while`
Reports the use of `break`/`continue` keywords outside `loop`/`while` blocks.
- `crate` in paths
Reports `crate` used in paths.
- `default` qualifier not allowed
Reports invalid `default` keyword placement.
- `extern crate self` missing `as <name>`
Reports `extern crate self` that is not followed by `as <name>`.
- `if` condition is constant
Reports if expressions that have true or false constant literal condition and can be simplified.
- `impl Trait` not allowed
Reports incorrect use of `impl Trait`.
- `impl` member order differs from trait
Checks if members in the impl have a same order as in the trait.
- `main` function with generic parameters
Reports `main` functions defined with generic parameters.
- `println!` macro can be simplified
Detects usages of println!("") which can be simplified to println!() since from Rust 1.14.0.
- `return` can be lifted
Reports if and match statements that can be converted to expressions by lifting a return out.
- `return` must have a value
Reports `return;` statements contained in functions whose return type is not `()`.
- `self` function parameter not allowed
Reports the use of `self` as a function parameter in case it is not allowed.
- `self` in static method
Reports the use of the `self` keyword in static methods.
- `self` unavailable in context
Reports the use of `self` in contexts where it is not available.
- `self`/`super` misplaced in path
Reports the use of `self` and `super` keywords not at the beginning of the path.
- `thread_rng().gen()` can be replaced with `random()`
Detects usage of thread_rng().gen() that can be replaced with random() from rand crate.
- `try!` macro usage
Finds usages of the try! macro which can be replaced with ? operator starting from Rust 1.13.0.
- `with` call can be replaced with thread local stable method
Detects usages of LocalKey::with() method that can be replaced with stable thread local methods.
- Cargo.toml
Sub-group of 9 inspections that provide checks for Cargo.toml
- Lints
Sub-group of 21 inspections that provide checks for Lints