Skip to content

no_trailing_whitespace

No line may end with space or tab.

This rule takes no kind-specific options.

Plus the common paths, level, id, when, and expect_matches fields. This table is generated from the JSON Schema; option types and defaults are authoritative.

Source files with trailing spaces or tabs

Section titled "Source files with trailing spaces or tabs"

The rule fires on this repository:

  • src/
  • src/bad.rs

    ✗ error no-ws

    1:1 trailing whitespace on line 1

  • src/good.rs✓
  • src/tabbed.md

    ✗ error no-ws

    1:1 trailing whitespace on line 1

src/bad.rs
fn bad() {}
src/good.rs
fn good() {}
src/tabbed.md
# Heading

With this .alint.yml:

version: 1
rules:
- id: no-ws
kind: no_trailing_whitespace
paths: "src/**/*"
level: error

alint check reports:

Terminal window
--- src/bad.rs -----------------------------------------------------------------
x error no-ws
1:1 trailing whitespace on line 1
--- src/tabbed.md --------------------------------------------------------------
x error no-ws
1:1 trailing whitespace on line 1
Summary (2 violations):
x 2 errors
0 passing * 1 failing

Every source file is free of trailing whitespace

Section titled "Every source file is free of trailing whitespace"

This repository is compliant:

  • src/
  • src/one.rs✓
  • src/two.rs✓
src/one.rs
fn one() {}
src/two.rs
fn two() {}

With this .alint.yml:

version: 1
rules:
- id: no-ws
kind: no_trailing_whitespace
paths: "src/**/*.rs"
level: error

alint check reports:

Terminal window
v All 1 rule(s) passed.