Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ojeda opened this issue Mar 13, 2025 · 0 comments
Open

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

ojeda opened this issue Mar 13, 2025 · 0 comments
Labels
A-lint Area: New lints

Comments

@ojeda
Copy link
Contributor

ojeda commented Mar 13, 2025

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 ...;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

No branches or pull requests

1 participant