RS.CLIPPY.TABS_IN_DOC_COMMENTS

Using tabs in doc comments is not recommended

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: tabs_in_doc_comments. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks doc comments for usage of tab characters.

Why is this bad?

The rust style-guide promotes spaces instead of tabs for indentation. To keep a consistent view on the source, also doc comments should not have tabs. Also, explaining ascii-diagrams containing tabs can get displayed incorrectly when the display settings of the author and reader differ.

Example

///
/// Struct to hold two strings:
/// \t- first\t\tone
/// \t- second\tone
pub struct DoubleString {
   ///
   /// \t- First String:
   /// \t\t- needs to be inside here
   first_string: String,
   ///
   /// \t- Second String:
   /// \t\t- needs to be inside here
   second_string: String,
}

Will be converted to:

///
/// Struct to hold two strings:
///     - first        one
///     - second    one
pub struct DoubleString {
   ///
   ///     - First String:
   ///         - needs to be inside here
   first_string: String,
   ///
   ///     - Second String:
   ///         - needs to be inside here
   second_string: String,
}