about summary refs log tree commit diff
path: root/docs/dev
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2021-05-13 13:44:47 +0300
committerAleksey Kladov <aleksey.kladov@gmail.com>2021-05-13 13:44:47 +0300
commitad0648dc95d2d1e9d35cd825c2661fe002c02fc9 (patch)
tree474ae2b2bc65146e757c894369e4be27b20cc319 /docs/dev
parenta5b55828365b602f0ed117c9f1cc2a9eddd42512 (diff)
downloadrust-ad0648dc95d2d1e9d35cd825c2661fe002c02fc9.tar.gz
rust-ad0648dc95d2d1e9d35cd825c2661fe002c02fc9.zip
Cleanup imports
Diffstat (limited to 'docs/dev')
-rw-r--r--docs/dev/style.md7
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/dev/style.md b/docs/dev/style.md
index d24a5952eda..9b0ddec6620 100644
--- a/docs/dev/style.md
+++ b/docs/dev/style.md
@@ -636,6 +636,10 @@ use crate::{}
 
 // Finally, parent and child modules, but prefer `use crate::`.
 use super::{}
+
+// Re-exports are treated as item definitions rather than imports, so they go
+// after imports and modules. Use them sparingly.
+pub use crate::x::Z;
 ```
 
 **Rationale:** consistency.
@@ -694,6 +698,9 @@ Avoid local `use MyEnum::*` imports.
 Prefer `use crate::foo::bar` to `use super::bar` or `use self::bar::baz`.
 **Rationale:** consistency, this is the style which works in all cases.
 
+By default, avoid re-exports.
+**Rationale:** for non-library code, re-exports introduce two ways to use something and allow for inconsistency.
+
 ## 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.