rust-lang / rust-lang/rust-clippy

Restriction lint for `/*` comments

Open
#9,784 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lint
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

What it does

This allow-by-default restriction lint detects any use of /* comments instead of // comments. This helps with codebases trying to maintain a uniform comment style, as well as codebases wanting to avoid the possibility of mid-line comments (with further code to the right of them).

Note: while in simple cases it might be easy to provide a rustfix suggestion, this lint has value even if it doesn't offer a suggestion. In complex cases I can easily imagine that providing a suggestion would require non-trivial changes.

Lint Name

slash_star_comment

Category

restriction

Advantage
  • Helps enforce uniform comment style.
  • Avoids mid-line comments (code /* comment */ more code).
  • Reduces visual noise
Drawbacks

This is an intentionally opinionated restriction lint; it should remain allow-by-default, and should only be enabled by users wanting to check for it.

Example
code(); /* comment */

Could be written as:

code(); // comment

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by locating Clippy's restriction-lint implementation and existing lint tests, using the slash_star_comment examples as acceptance criteria. Done means the allow-by-default lint detects /* comments and does not require a rustfix suggestion.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.