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.

Syntax Error RS-E1000
Bug risk
Critical

Encountered a syntax error.

Found explicit self-assignment RS-W1013
Bug risk
Major

Self-assignments are redundant and are unlikely to be intentional. This is probably the result of a copy-paste.

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.

Found .clone() call on a double reference RS-W1100
Bug risk
Major

Calling .clone() clone on a &&T copies the inner &T and not the underlying T.

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.

Potentially unsafe usage of Arc::get_mut RS-S1000
Security
Minor

In the standard library in Rust before 1.29.0, there is weak synchronization in the Arc::get_mut method. This synchronization issue can be lead to memory safety issues through race conditions.

Use of FIXME/XXX/TODO RS-D1000
Documentation
Minor

This block has been marked as FIXME/XXX/TODO. Perhaps you meant to address this?

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!.