diff options
| author | Aleksey Kladov <aleksey.kladov@gmail.com> | 2021-05-10 19:04:41 +0300 |
|---|---|---|
| committer | Aleksey Kladov <aleksey.kladov@gmail.com> | 2021-05-14 16:19:27 +0300 |
| commit | 0650f77dd9defaf352f81c5ee4ee73a1eae942b7 (patch) | |
| tree | 4758b6ea999292cf18a078dd942f51621a2d68ea /docs/dev | |
| parent | ab528e85f71da188722ae031b31a3a70bac1cadd (diff) | |
| download | rust-0650f77dd9defaf352f81c5ee4ee73a1eae942b7.tar.gz rust-0650f77dd9defaf352f81c5ee4ee73a1eae942b7.zip | |
internal: remove one more immutable tree
Diffstat (limited to 'docs/dev')
| -rw-r--r-- | docs/dev/style.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/docs/dev/style.md b/docs/dev/style.md index 9b0ddec6620..f22b6976814 100644 --- a/docs/dev/style.md +++ b/docs/dev/style.md @@ -951,6 +951,28 @@ match p.current() { ## Documentation +Style inline code comments as proper sentences. +Start with a capital letter, end with a dot. + +```rust +// GOOD + +// Only simple single segment paths are allowed. +MergeBehavior::Last => { + tree.use_tree_list().is_none() && tree.path().map(path_len) <= Some(1) +} + +// BAD + +// only simple single segment paths are allowed +MergeBehavior::Last => { + tree.use_tree_list().is_none() && tree.path().map(path_len) <= Some(1) +} +``` + +**Rationale:** writing a sentence (or maybe even a paragraph) rather just "a comment" creates a more appropriate frame of mind. +It tricks you into writing down more of the context you keep in your head while coding. + For `.md` and `.adoc` files, prefer a sentence-per-line format, don't wrap lines. If the line is too long, you want to split the sentence in two :-) |
