Open printfn opened 9 months ago
@rustbot claim
Note that rustfmt doesn't change the formatting/indentation of doctests like this regardless of whether hard_tabs = true is set in .rustfmt.toml.
I noticed this as well. After this lands, should an issue be opened on the rustfmt repository as well to handle this case? Would be really nice!
If I may add to the original issue, tabs as an indentation mechanism wouldn't break ascii-diagrams as vaguely implied by the wording in the "Why is this bad?" section of the lint documentation. They're only a problem when used as an alignment mechanism and, of course, it would be perfectly fine for Clippy to report this kind of usage.
For example, none of the following examples have issues, independently of the tab width preference configured by the user:
///<space>if n > 42 {
///<space><tab>println!("correctly aligned by the space and indented by the tab");
///<space>}
or even
/// <space><tab><space>test 1< 4 spaces>one
/// <space><tab><space>test 10<3 spaces>two
Summary
The
tabs_in_doc_comments
complains about tab-indented doctests.Running
cargo doc
generates nice-looking and correctly-indented documentation when using tabs in this way, so I see no reason for Clippy to emit a lint.Note that rustfmt doesn't change the formatting/indentation of doctests like this regardless of whether
hard_tabs = true
is set in.rustfmt.toml
.Lint Name
tabs_in_doc_comments
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen: Clippy should not have linted that line.
Version
Additional Labels
No response