SonarSource Rules
  • Products

    In-IDE

    Code Quality and Security in your IDE with SonarQube Ide

    IDE extension that lets you fix coding issues before they exist!

    Discover SonarQube for IDE

    SaaS

    Code Quality and Security in the cloud with SonarQube Cloud

    Setup is effortless and analysis is automatic for most languages

    Discover SonarQube Cloud

    Self-Hosted

    Code Quality and Security Self-Hosted with SonarQube Server

    Fast, accurate analysis; enterprise scalability

    Discover SonarQube Server
  • SecretsSecrets
  • ABAPABAP
  • AnsibleAnsible
  • ApexApex
  • AzureResourceManagerAzureResourceManager
  • CC
  • C#C#
  • C++C++
  • CloudFormationCloudFormation
  • COBOLCOBOL
  • CSSCSS
  • DartDart
  • DockerDocker
  • FlexFlex
  • GitHub ActionsGitHub Actions
  • GoGo
  • HTMLHTML
  • JavaJava
  • JavaScriptJavaScript
  • JSONJSON
  • JCLJCL
  • KotlinKotlin
  • KubernetesKubernetes
  • Objective CObjective C
  • PHPPHP
  • PL/IPL/I
  • PL/SQLPL/SQL
  • PythonPython
  • RPGRPG
  • RubyRuby
  • RustRust
  • ScalaScala
  • ShellShell
  • SwiftSwift
  • TerraformTerraform
  • TextText
  • TypeScriptTypeScript
  • T-SQLT-SQL
  • VB.NETVB.NET
  • VB6VB6
  • XMLXML
  • YAMLYAML
Rust

Rust static code analysis

Unique rules to find Bugs, Vulnerabilities, Security Hotspots, and Code Smells in your RUST code

  • All rules 85
  • Bug60
  • Code Smell25

  • Quick Fix 4
Filtered: 4 rules found
suspicious
    Impact
      Clean code attribute
        1. Boolean expressions should not be gratuitous

           Code Smell
        2. Unnecessary bit operations should not be performed

           Code Smell
        3. Rust source files should not have syntax errors

           Code Smell
        4. Unnecessary mathematical comparisons should not be made

           Code Smell

        Unnecessary mathematical comparisons should not be made

        intentionality - logical
        maintainability
        Code Smell
        • clippy
        • suspicious

        Why is this an issue?

        More Info

        An expression like min ⇐ x may misleadingly imply that it is possible for x to be less than the minimum. Expressions like max < x are likely mistakes, as they can never be true. These comparisons involving minimum or maximum values for their type with integer and boolean types are often unintentional and can lead to confusion and potentially incorrect program logic.

        Noncompliant code example

        let vec: Vec<isize> = Vec::new();
        if vec.len() <= 0 {} // Noncompliant: 0 is the minimum value for usize, this is always true.
        
        if 100 > i32::MAX {} // Noncompliant: i32::MAX is the maximum value for i32, this is always false.
        
          Available In:
        • SonarQube CloudDetect issues in your GitHub, Azure DevOps Services, Bitbucket Cloud, GitLab repositories

        © 2008-2025 SonarSource SA. All rights reserved.

        Privacy Policy | Cookie Policy | Terms of Use