about summary refs log tree commit diff
path: root/docs/dev
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2020-08-28 16:53:49 +0200
committerAleksey Kladov <aleksey.kladov@gmail.com>2020-08-28 16:53:49 +0200
commit4f5d2ffac2c15d00207f7452e7eb356b01de7317 (patch)
tree8e931baf0c9673b71c18949d39c66a4f63e57030 /docs/dev
parent32b089d6ec8e0ede0871f201437d16efd341b150 (diff)
downloadrust-4f5d2ffac2c15d00207f7452e7eb356b01de7317.tar.gz
rust-4f5d2ffac2c15d00207f7452e7eb356b01de7317.zip
fmt import
Diffstat (limited to 'docs/dev')
-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 bb99c485504..397e85b35e0 100644
--- a/docs/dev/style.md
+++ b/docs/dev/style.md
@@ -112,6 +112,22 @@ Avoid local `use MyEnum::*` imports.
 
 Prefer `use crate::foo::bar` to `use super::bar`.
 
+When implementing `Debug` or `Display`, import `std::fmt`:
+
+```rust
+// Good
+use std::fmt;
+
+impl fmt::Display for RenameError {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { .. }
+}
+
+// Not as good
+impl std::fmt::Display for RenameError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { .. }
+}
+```
+
 # Order of Items
 
 Optimize for the reader who sees the file for the first time, and wants to get a general idea about what's going on.