Skip to content

Documentation mistakenly using /// instead of //! #14402

@ojeda

Description

@ojeda

What it does

In the Linux kernel we had some documentation added with /// instead of //!, which meant the docs applied to a use line and thus silently discarded.

Advantage

Documentation is not discarded silently.

Drawbacks

False positives when someone does want to document an item that follows. However, if it is something like a private use, it is likely it was a mistake. Thus the lint should limit itself to such cases.

Example

Both

//! Title.
/// Long...
///
/// ...description.
use ...;

and

//! Title.

/// Long...
///
/// ...description.
use ...;

should probably have been written as

//! Title.
//!
//! Long...
//!
//! ...description.

use ...;

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions