]> git.lizzy.rs Git - rust.git/blob - src/docs/pub_use.txt
[Arithmetic] Consider literals
[rust.git] / src / docs / pub_use.txt
1 ### What it does
2
3 Restricts the usage of `pub use ...`
4
5 ### Why is this bad?
6
7 `pub use` is usually fine, but a project may wish to limit `pub use` instances to prevent
8 unintentional exports or to encourage placing exported items directly in public modules
9
10 ### Example
11 ```
12 pub mod outer {
13     mod inner {
14         pub struct Test {}
15     }
16     pub use inner::Test;
17 }
18
19 use outer::Test;
20 ```
21 Use instead:
22 ```
23 pub mod outer {
24     pub struct Test {}
25 }
26
27 use outer::Test;
28 ```