Skip to content

Commit 1f4cf0e

Browse files
committed
Update per feedback
1 parent 40d369a commit 1f4cf0e

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

text/0000-api-comment-conventions.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ but it tries to motivate and clarify them.
1717

1818
# Detailed design
1919

20-
There are a number of indivudal guidelines:
20+
There are a number of individual guidelines. Most of these guidelines are for
21+
any Rust project, but some are specific to documenting `rustc` itself and the
22+
standard library. These are called out specifically in the text itself.
2123

2224
## Use line comments
2325

@@ -37,17 +39,34 @@ Instead of:
3739
*/
3840
```
3941

40-
Only use inner doc comments //! to write crate and module-level documentation, nothing else.
42+
Only use inner doc comments //! to write crate and module-level documentation,
43+
nothing else. When using `mod` blocks, prefer `///` outside of the block:
44+
45+
```rust
46+
/// This module contains tests
47+
mod test {
48+
// ...
49+
}
50+
```
51+
52+
over
53+
54+
```rust
55+
mod test {
56+
//! This module contains tests
57+
58+
// ...
59+
}
60+
```
4161

4262
## Formatting
4363

4464
The first line in any doc comment should be a single-line short sentence
4565
providing a summary of the code. This line is used as a summary description
4666
throughout Rustdoc's output, so it's a good idea to keep it short.
4767

48-
All doc comments, including the summary line, should begin with a capital
49-
letter and end with a period, question mark, or exclamation point. Prefer full
50-
sentences to fragments.
68+
All doc comments, including the summary line, should be property punctuated.
69+
Prefer full sentences to fragments.
5170

5271
The summary line should be written in third person singular present indicative
5372
form. Basically, this means write "Returns" instead of "Return".
@@ -91,22 +110,24 @@ being explicit, so that it highlights syntax in places that do not, like GitHub.
91110
Rustdoc is able to test all Rust examples embedded inside of documentation, so
92111
it's important to mark what is not Rust so your tests don't fail.
93112

94-
References and citation should be linked inline. Prefer
113+
References and citation should be linked 'reference style.' Prefer
95114

96115
```
97-
[some paper](http://www.foo.edu/something.pdf)
116+
[some paper][something]
117+
118+
[something]: http://www.foo.edu/something.pdf)
98119
```
99120

100121
to
101122

102123
```
103-
some paper[1]
104-
105-
1: http://www.foo.edu/something.pdf
124+
[some paper][http://www.foo.edu/something.pdf]
106125
```
107126

108127
## English
109128

129+
This section applies to `rustc` and the standard library.
130+
110131
All documentation is standardized on American English, with regards to
111132
spelling, grammar, and punctuation conventions. Language changes over time,
112133
so this doesn't mean that there is always a correct answer to every grammar

0 commit comments

Comments
 (0)