Skip to content

Lint against tabs in doc comments #4623

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

Closed
Lythenas opened this issue Oct 3, 2019 · 2 comments · Fixed by #4806
Closed

Lint against tabs in doc comments #4623

Lythenas opened this issue Oct 3, 2019 · 2 comments · Fixed by #4806
Labels
A-lint Area: New lints good first issue These issues are a good way to get started with Clippy L-style Lint: Belongs in the style lint group

Comments

@Lythenas
Copy link
Contributor

Lythenas commented Oct 3, 2019

Mixing spaces and tabs is always a bad idea but for doc comments it's especially bad because the rendered output might be different when using tabs or spaces.

See #4622

The actual output is/was
image

But the output should be
image

The only difference is the indentation:

With tabs:

/// 		- Recommends a signed suffix, even though the number might be too big and an unsigned
///		suffix is required
/// 		- Does not match on `_128` since that is a valid grouping for decimal and octal numbers

(depending on your editor settings the suffix ... is aligned with the - or left of it)

With spaces (and without leading whitespace):

/// - Recommends a signed suffix, even though the number might be too big and an unsigned
///   suffix is required
/// - Does not match on `_128` since that is a valid grouping for decimal and octal numbers

I'm not sure if tabs should be linted in normal rust code too but IMO it is necessary in doc comments.

@flip1995 flip1995 added L-style Lint: Belongs in the style lint group good first issue These issues are a good way to get started with Clippy A-lint Area: New lints labels Oct 4, 2019
@flip1995
Copy link
Member

flip1995 commented Oct 4, 2019

In normal rust code rustfmt has a config option for this IIRC. So this lint should only lint doc comments.

@FlorianRohm
Copy link

would try this as a first issue at impl Days :)

@FlorianRohm FlorianRohm mentioned this issue Nov 11, 2019
6 tasks
bors added a commit that referenced this issue Nov 23, 2019
Issue/4623

Greetings.
This PR is intended to close #4623

Feedback very welcome, as this is out first contribution to the rust ecosystem :)

---
- [x] Followed [lint naming conventions][lint_naming]
  - allow tabs_in_doc_comments reads well
- [x] Added passing UI tests (including committed `.stderr` file)
- [x] `cargo test` passes locally
- [x] Executed `./util/dev update_lints`
- [x] Added lint documentation
- [x] Run `./util/dev fmt`

---

changelog: added lint "tabs_in_doc_comments"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints good first issue These issues are a good way to get started with Clippy L-style Lint: Belongs in the style lint group
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants