]> git.lizzy.rs Git - rust.git/blob - src/docs/tabs_in_doc_comments.txt
Auto merge of #9475 - Nemo157:mod-files-remap, r=xFrednet
[rust.git] / src / docs / tabs_in_doc_comments.txt
1 ### What it does
2 Checks doc comments for usage of tab characters.
3
4 ### Why is this bad?
5 The rust style-guide promotes spaces instead of tabs for indentation.
6 To keep a consistent view on the source, also doc comments should not have tabs.
7 Also, explaining ascii-diagrams containing tabs can get displayed incorrectly when the
8 display settings of the author and reader differ.
9
10 ### Example
11 ```
12 ///
13 /// Struct to hold two strings:
14 ///     - first         one
15 ///     - second        one
16 pub struct DoubleString {
17    ///
18    ///  - First String:
19    ///          - needs to be inside here
20    first_string: String,
21    ///
22    ///  - Second String:
23    ///          - needs to be inside here
24    second_string: String,
25 }
26 ```
27
28 Will be converted to:
29 ```
30 ///
31 /// Struct to hold two strings:
32 ///     - first        one
33 ///     - second    one
34 pub struct DoubleString {
35    ///
36    ///     - First String:
37    ///         - needs to be inside here
38    first_string: String,
39    ///
40    ///     - Second String:
41    ///         - needs to be inside here
42    second_string: String,
43 }
44 ```