Inspectopedia Help

Rust

'crate' misplaced in path   New in this release

Reports incorrect use of the literal `crate` in a path.

A non-constant value was used in a constant expression   New in this release

Reports a non-constant value or function call used in a constant expression.

Additional non-auto trait in trait object   New in this release

Reports trait objects with additional non-auto traits.

Anonymous function parameters not allowed   New in this release

Reports the use of anonymous parameters in functions that do not allow it.

Approximated constants   New in this release

Reports hard coded numeric constants such as std::f64::consts::PI.

At least one trait is required for an object type   New in this release

Reports trait objects declared without a single trait, as well as trait objects with multiple lifetime bounds.

Attempt to call not a function   New in this release

When calling somethings, checks that it is function or method.

Attribute error   New in this release

Reports issues with attributes including misuse, redundancy, formatting errors, invalid entries, outdated syntax, and more.

Attribute without parentheses   New in this release

Detects incomplete attributes that require parentheses.

Base expression required after `..`   New in this release

Highlights .

Blocking `sleep` function cannot be used in `async` context   New in this release

Detects usages of blocking thread::sleep() function in async contexts.

Boolean expression can be simplified   New in this release

Detects boolean expressions that can be safely simplified like a || true.

Borrow checker errors   New in this release

Reports basic borrow checker errors.

Both `Copy` and `Drop` implemented   New in this release

Reports cases where the `Copy` trait is implemented along with `Drop`, which is considered unsafe and currently not allowed in the Rust language.

C-variadic function should use a compatible calling convention   New in this release

Reports C-variadic function that don't have a compatible calling convention.

Check the proper usage of place expressions.   New in this release

Reports invalid place expression, for example: invalid left-hand of assignment.

Circular modules   New in this release

Reports circular module declarations with the #path attribute.

Comma-separated trait bounds   New in this release

Reports trait bounds for a single type that are separated with a comma instead of a `+` sign.

Compiler feature is unavailable   New in this release

Reports code that uses unavailable compiler features.

Complex pattern in function   New in this release

Reports incorrect use of patterns in functions.

Const generic argument expression without braces   New in this release

Reports const generic argument expressions with missing braces.

Constants cannot refer to statics   New in this release

Detects constant variables that refer to static variables.

Dangling `else`   New in this release

Detects suspiciously looking else if-statements split by new lines.

Default parameter values (unsupported)   New in this release

Reports the use of default parameter values, which are not supported in Rust.

Default type parameters syntax   New in this release

Report incorrect usage of default type parameters.

Defaults for const parameters not allowed   New in this release

Reports invalid use of defaults for const parameters.

Deprecated `...` syntax   New in this release

Reports the use of `...` deprecated syntax.

Derived trait not implemented   New in this release

Reports members that do not implement the traits being derived.

Detached file   New in this release

Detects files that are not attached to any Rust module.

Double negation   New in this release

Detects expressions of the form --x which might be mistook for pre-decrements.

Duplicate definition   New in this release

Reports duplicate items (such as field declarations, type parameters, etc.).

Duplicate hash key   New in this release

Reports duplicate keys when creating hash maps.

Duplicate macro pattern   New in this release

Checks duplicated patterns in macro definitions.

Duplicate trait method parameter name   New in this release

Checks duplicated parameter names of abstract trait methods.

Dynamic environment capture in `fn`   New in this release

Reports captures of a dynamic environment in a `fn` item.

Entry point is async   New in this release

Checks if the entry point of the program was marked as async.

Equality assertion can be simplified   New in this release

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   New in this release

Some unstable experimental checks which are disabled by default.

Explicit call to `drop`   New in this release

Reports explicit calls to `drop`.

External linter   New in this release

This inspection runs external linter to check for rustc or clippy errors.

Failed line in test   New in this release

Reports failed function calls or assertions in tests.

Foreign trait implementation   New in this release

Reports implementations of foreign traits (traits defined outside the current crate) for arbitrary types.

Format macro error   New in this release

Reports errors in the use of macros that support formatting.

Forward-declared identifier for parameter with default value   New in this release

Reports generic parameters with default values that use forward-declared identifiers.

Function cannot be variadic   New in this release

Reports functions that cannot be declared variadic.

Generic arguments must be specified before the first constraint   New in this release

Reports generic arguments specified after the first constraint.

Immutable reassigned   New in this release

Reports format! calls with missing format arguments.

Immutable variable reassigned   New in this release

Detects immutable bindings reassignments.

Inclusive range without an end bound   New in this release

Reports inclusive ranges without a specified end bound (`..=b` or `a..=b`).

Incorrect const syntax   New in this release

Reports incorrect const syntax.

Incorrect function syntax   New in this release

Reports incorrect function syntax.

Incorrect order of lifetime/type/const parameters   New in this release

Reports incorrectly ordered lifetime, type, and const parameters.

Incorrect type alias syntax   New in this release

Reports incorrect type alias syntax.

Incorrect visibility restriction   New in this release

Reports incorrect visibility restrictions.

Index expression has a wrong type   New in this release

Checks type of index expression.

Inherent `impl` block not allowed for item   New in this release

Reports inherent `impl` blocks defined for items other than structs, enums, unions, or trait objects.

Inherent `impl` defined outside type's containing crate   New in this release

Reports inherent type implementations defined outside the type's original crate.

Inherent `impl` for dyn auto trait   New in this release

Reports inherent implementations for dynamic auto traits.

Invalid 'break' or 'continue'   New in this release

Reports invalid usages of break and continue in loops.

Invalid `#[start]` attribute   New in this release

Reports incorrect usage of the #[start] attribute.

Invalid `?` usage   New in this release

Reports incorrect usage of the ? operator.

Invalid `Copy` implementation   New in this release

Reports invalid `Copy` implementations.

Invalid `Drop` implementation   New in this release

Reports invalid `Drop` implementations.

Invalid `self` import   New in this release

Reports invalid `self` imports.

Invalid char literal length   New in this release

Reports char literal with incorrect length.

Invalid crate name   New in this release

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   New in this release

Reports incorrect field use in struct literals.

Invalid fields in struct or tuple struct pattern   New in this release

Reports invalid fields in struct and tuple struct patterns.

Invalid label name   New in this release

Reports labels with invalid names.

Invalid lifetime name   New in this release

Reports lifetimes with invalid names.

Invalid literal suffix   New in this release

Reports literals with invalid suffixes.

Invalid macro call   New in this release

Reports errors when calling macros.

Invalid macro variable type   New in this release

Reports invalid fragment specifier of a macro variable.

Invalid private field/method access   New in this release

Reports invalid attempts to access private fields or methods.

Item cannot be inside another item   New in this release

Reports structs, enums, macro definitions and traits placed inside other structs, enums, macro definitions or traits.

Lifetime bounds in parentheses   New in this release

Reports lifetime bounds in parentheses.

Literal out of range   New in this release

Check if a numerical value is out of the range of the receiver.

Main function not found   New in this release

Checks if the main function exists in the binary crates.

Manual implementation of `Fn`, `FnMut`, or `FnOnce`   New in this release

Reports manual implementations of `Fn`, `FnMut`, and `FnOnce` traits.

Match expression can be replaced with a method call   New in this release

Reports match expressions that can be replaced with a method call.

Misordered generic arguments   New in this release

Generic arguments were not provided in the same order as the corresponding generic parameters are declared.

Misplaced `...` argument   New in this release

Reports variadic functions where `...` is not positioned as the last argument.

Missing `dyn` in trait objects   New in this release

Checks if trait objects are explicitly specified with dyn keyword.

Missing `else`   New in this release

Detects suspiciously looking if-statements with potentially missing elses.

Missing features   New in this release

Detects Cargo packages with missing cargo features in some of their dependency packages.

Missing parentheses for chained comparison   New in this release

Reports chained comparison operators with missing parentheses.

Missing struct field type   New in this release

Reports struct fields declared without a type.

Missing type for constant   New in this release

Reports constant declarations with missing types.

Module declared outside mod.rs   New in this release

Reports module declarations in files other than mod.rs.

Multiple relaxed default bounds for type parameter   New in this release

Reports type parameters with multiple relaxed default bounds.

Nested `impl Trait` not allowed   New in this release

Reports the use of nested `impl Trait`.

Nested lifetime quantification   New in this release

Reports where clauses containing nested quantification over lifetimes, which is not supported.

No boxing for async recursion   New in this release

Reports recursion used in async functions without boxing.

No file found for module   New in this release

Reports module declarations with no corresponding file found.

Non-exhaustive match   New in this release

Checks that match expression is exhaustive, i.e.

Non-existent field access   New in this release

Reports attempts to access non-existent fields.

Non-inline module declaration missing path attribute   New in this release

Reports non-inline modules declared inside a block and missing the path attribute.

Non-shorthand field initialization   New in this release

Reports cases where field initialization shorthand (RFC 1682) can be used.

Non-string ABI literal   New in this release

Reports non-string ABI literals.

Non-structural-match type used for const generic parameter   New in this release

Reports the use of non-structural-match types for const generic parameters.

Parameter type with unknown size   New in this release

Reports function parameters whose types are unknown at compile time.

Proc macro defined outside `proc-macro` crate   New in this release

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   New in this release

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   New in this release

Reports private items that were re-exported publicly.

Redundant `::`   New in this release

Reports redundant ::.

Redundant `else`   New in this release

Detects else-statements preceded by irrefutable patterns.

Reference dropped   New in this release

Reports calls to std::mem::drop with a reference instead of an owned value.

Repeated discriminant value   New in this release

Reports discriminant values that are present more than once in a single enum.

Repeated identifier in pattern   New in this release

Reports identifiers bound more than once in the same pattern.

Reserved keyword used as an identifier   New in this release

Reports the use of reserved keywords.

Reserved lifetime name   New in this release

Reports the use of reserved lifetime names.

Rust 2018 edition violation   New in this release

Reports the use of keywords reserved in Rust 2018 edition, as well as features unavailable in Rust 2018 edition.

Rust 2024 edition violation   New in this release

Reports the use of keywords reserved in Rust 2024 edition, as well as features unavailable in Rust 2024 edition.

Struct inheritance (unsupported)   New in this release

Reports struct inheritance, which is not supported in Rust.

Supertrait is not implemented   New in this release

Reports missing supertrait implementations.

Suspicious assignment   New in this release

Detects use of the non-existent =*, =! and =- operators that are probably typos.

Trait expected   New in this release

Reports non-trait items referenced as traits.

Trait implementation issue   New in this release

Reports errors in trait implementation like "Missing members", "Unknown member", etc.

Trait safety mismatch   New in this release

Reports mismatches between the safety of a trait's definition and its implementation.

Tuple-like union   New in this release

Reports union declarations with tuple syntax.

Type checker   New in this release

The Rust type checker.

Type checker (experimental)   New in this release

The Rust type checker (experimental).

Type does not implement trait   New in this release

Reports the use of types that do not implement the necessary traits.

Type does not implement trait (experimental)   New in this release

Reports the use of types that do not implement the necessary traits.

Type mismatched the trait's associated type.   New in this release

A type mismatched an associated type of a trait.

Type placeholder used in item signature   New in this release

Reports the use of type placeholders (_) in an item's signature.

Unclosed text literal   New in this release

Reports unclosed text literals.

Undeclared label   New in this release

Reports undeclared labels.

Undeclared lifetime name   New in this release

Reports undeclared lifetimes.

Union expression fields count   New in this release

Checks that union expr has exactly one field.

Unlabeled `continue`/`break` in `while` loop condition   New in this release

Reports the use of `break`/`continue` keywords without labels in `while` loop conditions.

Unlabeled `continue`/`break` in labeled block   New in this release

Reports the use of unlabeled `break`/`continue` statements inside labeled blocks.

Unnecessary visibility qualifier   New in this release

Reports unnecessary visibility qualifiers.

Unreachable label   New in this release

Reports unreachable labels.

Unresolved method   New in this release

Reports unresolved method references.

Unresolved method (experimental)   New in this release

Reports unresolved method references.

Unresolved path   New in this release

Reports unresolved path references.

Unresolved path (experimental)   New in this release

Reports unresolved path references.

Unsafe CString pointer   New in this release

Detects unsafe usage of CString.

Unsafe inherent implementation   New in this release

Reports inherent implementations marked as unsafe.

Unsafe item in safe context   New in this release

Reports the use of unsafe items in a safe context.

Unsafe module   New in this release

Reports modules declared as unsafe.

Unstable item   New in this release

Reports the use of unstable items.

Unsupported `let` expression   New in this release

Reports `let` expressions in places where they are unsupported.

Use of `dyn`/`impl Trait` in type parameter bounds   New in this release

Reports the use of `dyn` and `impl Trait` in type parameter bounds.

Use of increment/decrement operator (unsupported)   New in this release

Reports the use of `++` and `--` operators, which are not supported in Rust.

Wrong associated type arguments   New in this release

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   New in this release

Checks if the right number of generic arguments was used for a type, trait, function call or method call.

Wrong number of lifetime parameters   New in this release

Checks if the right number of lifetime parameters was used for a type or trait.

Wrong number of type or const parameters   New in this release

Checks if an attempted implementation of a trait method or an associated type has the right number of type or const parameters.

`#[dbg]` usage   New in this release

Reports usages of dbg! macro.

`#[derive]` not allowed   New in this release

Reports `derive` attributes applied to items other than structs, enums, or unions.

`#[inline]` not allowed   New in this release

Reports `inline` attributes applied to items other than functions or closures.

`#[repr(inttype)]` missing for enum   New in this release

Reports enums that require a `#[repr(inttype)]` attribute.

`Copy` type dropped   New in this release

Reports calls to std::mem::drop with values that derive the Copy trait.

`Sized`/`Unsized` trait implemented explicitly   New in this release

Reports explicit implementations of the `Sized` and `Unsized` traits.

`ToString` should not be implemented directly   New in this release

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   New in this release

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)   New in this release

Reports the use of `async` non-`move` closures with parameters, which are not supported.

`compile_error!` macro   New in this release

Highlights `compile_error!()` macro invocation.

`continue`/`break` used outside `loop`/`while`   New in this release

Reports the use of `break`/`continue` keywords outside `loop`/`while` blocks.

`crate` in paths   New in this release

Reports `crate` used in paths.

`default` qualifier not allowed   New in this release

Reports invalid `default` keyword placement.

`extern crate self` missing `as <name>`   New in this release

Reports `extern crate self` that is not followed by `as <name>`.

`if` condition is constant   New in this release

Reports if expressions that have true or false constant literal condition and can be simplified.

`impl Trait` not allowed   New in this release

Reports incorrect use of `impl Trait`.

`impl` member order differs from trait   New in this release

Checks if members in the impl have a same order as in the trait.

`main` function with generic parameters   New in this release

Reports `main` functions defined with generic parameters.

`println!` macro can be simplified   New in this release

Detects usages of println!("") which can be simplified to println!() since from Rust 1.14.0.

`return` can be lifted   New in this release

Reports if and match statements that can be converted to expressions by lifting a return out.

`return` must have a value   New in this release

Reports `return;` statements contained in functions whose return type is not `()`.

`self` function parameter not allowed   New in this release

Reports the use of `self` as a function parameter in case it is not allowed.

`self` in static method   New in this release

Reports the use of the `self` keyword in static methods.

`self` unavailable in context   New in this release

Reports the use of `self` in contexts where it is not available.

`self`/`super` misplaced in path   New in this release

Reports the use of `self` and `super` keywords not at the beginning of the path.

`thread_rng().gen()` can be replaced with `random()`   New in this release

Detects usage of thread_rng().gen() that can be replaced with random() from rand crate.

`try!` macro usage   New in this release

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   New in this release

Detects usages of LocalKey::with() method that can be replaced with stable thread local methods.

Cargo.toml  

Sub-group of 8 inspections that provide checks for Cargo.toml

Lints  

Sub-group of 21 inspections that provide checks for Lints

Last modified: 11 September 2024