Rust

Rust

Made by DeepSource
Function with cyclomatic complexity higher than threshold RS-R1000
Anti-pattern
Minor

A function with high cyclomatic complexity can be hard to understand and maintain. Cyclomatic complexity is a software metric that measures the number of independent paths through a function. A higher cyclomatic complexity indicates that the function has more decision points and is more complex.

Found duplicate underscore arguments RS-W1014
Anti-pattern
Minor

Function arguments having similar names that differ by an underscore affect code readability.

Found error-prone cast to u8 RS-W1080
Anti-pattern
Minor
Autofix

Casting values from a larger type to a smaller type is error-prone. This can be avoided when casting char literals to u8 by using the byte literal directly.

Comparing with "" or [] when .is_empty() could be used RS-W1102
Anti-pattern
Minor

The intent expressed by .is_empty() is a lot clearer than comparison to "" or []. Prefer .is_empty() where applicable.

Found redundant wildcard patterns RS-W1213
Anti-pattern
Minor
Autofix

Successive wildcard patterns (_) add noise to code, use the rest pattern (..) instead.

Found occurrence of .filter(..).next() RS-W1023
Anti-pattern
Minor

.filter(..).next() is equivalent to .find(..). Prefer .find(..) for readability.

Unnecessary parentheses RS-C1001
Anti-pattern
Minor
Autofix

Arguments in method calls need not be parenthesized. The level of nesting in code is more obvious when unnecessary parentheses are omitted.

Unnecessary braces in use statement RS-C1002
Anti-pattern
Minor
Autofix

An import list with just one item can be simplified. The unnecessary braces can be safely omitted.

Found redundant pattern RS-W1000
Anti-pattern
Minor
Autofix

Patterns of the form name @ _ are redundant. It is always more readable to use a direct binding.

Found unnecessary boolean comparison RS-W1001
Anti-pattern
Minor
Autofix

Expressions of the form x == true, !y == false are unnecessary. Consider using the variable directly.

Found assertion on boolean constant RS-W1021
Anti-pattern
Minor
Autofix

Assertions on true are optimized out by the compiler and can be removed safely. Asserting false will always result in a panic, prefer using panic!() or unreachable!() with a meaningful message.

Unnecessary double parentheses RS-C1000
Anti-pattern
Minor
Autofix

Extra parentheses increase expression nesting without adding meaning. They make code harder to read.

Found enum variants with similar prefixes or suffixes RS-C1003
Anti-pattern
Minor

Enumeration variants with the same prefix or suffix as the enumeration name are repetitive. Variants should describe themselves, and not include the name of the parent enum in their names.

Unneeded wildcard pattern RS-C1004
Anti-pattern
Minor
Autofix

In tuple or struct patterns, zero or more "remaining" elements can be discarded using the rest (..) pattern and exactly one element can be discarded using the wildcard pattern (_). This checker looks for wildcard patterns next to a rest pattern. The wildcard is unnecessary because the rest pattern can match that element as well.

Usage of print! macro with newline RS-C1005
Anti-pattern
Minor

Several macros in the standard library such as print! and eprint! have analogous macros such as println! and eprintln! that append a newline. Instead of calling print! with an explicit newline character at the end of the format string, prefer its alternative, println!.

Empty format string in macro call RS-C1006
Anti-pattern
Minor
Autofix

Empty format strings in macros such as println! and eprintln! have no effect. Simply use println!() instead of println!(""), which is much simpler.

Found hexadecimal literal with mixed-case letter digits RS-C1007
Anti-pattern
Minor

Hexadecimal literals with mixed-case letter digits look confusing.

Found block expression in if condition RS-C1008
Anti-pattern
Minor

Using block expressions as if conditions can confuse readers of this code.

Found unneeded field pattern RS-C1010
Anti-pattern
Minor
Autofix

This checker looks for struct field patterns bound to wildcards. Prefer .. instead, as it is shorter and directs focus towards fields that are actually bound.

Matching over boolean RS-C1011
Anti-pattern
Minor
Autofix

Matching over a boolean expression is less readable than using an if-else block.