rustfmt
status: evaluated
tags: tool_management
safety_affected: YES
security_affected: YES
tcl: HIGH
version: 1.8.0 (exact version shall be derived from qualified Rust compiler)

Rustfmt Verification Report#

Introduction#

Scope and purpose#

Rustfmt is the standard formatting tool for the Rust programming language. It automatically formats Rust code according to style guidelines defined in the Rust community. By using Rustfmt, developers can ensure that their code adheres to a consistent style, improving readability and maintainability across projects. Rustfmt can be integrated into development workflows, including IDEs and continuous integration pipelines, to enforce coding standards automatically.

Inputs and outputs#

Inputs: Software sources (Rust)
Outputs: Formatted software sources (Rust)
Rustfmt overview

Fig. 17 Rustfmt overview#

Available information#

Installation and integration#

Installation#

To add the Rustfmt Bazel targets to your project or module, include the following line in your MODULE.bazel file:
To be added once https://github.com/eclipse-score/score/issues/2011 is done

Integration#

Integrated in bazel.

Environment#

Requires Rust toolchain and Bazel build environment.

Safety evaluation#

This section outlines the safety evaluation of Rustfmt for its use within the S-CORE project.

Table 60 Safety evaluation#

Malfunction identification

Use case description

Malfunctions

Impact on safety?

Impact safety measures available?

Impact safety detection sufficient?

Further additional safety measure required?

Confidence (automatic calculation)

1

Run formatting on source files and does not format according to rules

The source code is not formatted according to the defined style guidelines, leading to inconsistent code style across the project.

no

no

yes

no

high

2

Run formatting on source files changes code unintentionally

The source code changes its logical structure or behavior due to incorrect formatting, potentially introducing bugs.

yes

Likelihood: Low. Rustfmt is used in virtually every Rust project. This gives high confidence in its quality.
Also, auto formatting happens only before commiter commits it’s changes, so before compilation (CI), testing(CI) and review.
Countermeasures:
  • The compiler will catch syntax errors introduced by incorrect formatting and fail to compile

  • The logic change can be detected by code reviews and automated testing (CI).

yes

no

high

Security evaluation#

This section outlines the security evaluation of Rustfmt for its use within the S-CORE project.

Table 61 Security evaluation#

Threat identification

Use case description

Threats

Impact on security?

Impact security measures available?

Impact security detection sufficient?

1

TBD

TBD

TBD

TBD

TBD

Result#

Rustfmt does not require qualification for use in safety-related software development according to ISO 26262.