aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-08-28 15:54:14 +0100
committerGitHub <[email protected]>2020-08-28 15:54:14 +0100
commit8146700f82b75cd3cda5191108b4277a9908c744 (patch)
tree8e931baf0c9673b71c18949d39c66a4f63e57030
parent32b089d6ec8e0ede0871f201437d16efd341b150 (diff)
parent4f5d2ffac2c15d00207f7452e7eb356b01de7317 (diff)
Merge #5908
5908: fmt import r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--docs/dev/style.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/dev/style.md b/docs/dev/style.md
index bb99c4855..397e85b35 100644
--- a/docs/dev/style.md
+++ b/docs/dev/style.md
@@ -112,6 +112,22 @@ Avoid local `use MyEnum::*` imports.
112 112
113Prefer `use crate::foo::bar` to `use super::bar`. 113Prefer `use crate::foo::bar` to `use super::bar`.
114 114
115When implementing `Debug` or `Display`, import `std::fmt`:
116
117```rust
118// Good
119use std::fmt;
120
121impl fmt::Display for RenameError {
122 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { .. }
123}
124
125// Not as good
126impl std::fmt::Display for RenameError {
127 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { .. }
128}
129```
130
115# Order of Items 131# Order of Items
116 132
117Optimize for the reader who sees the file for the first time, and wants to get a general idea about what's going on. 133Optimize for the reader who sees the file for the first time, and wants to get a general idea about what's going on.