File tree 3 files changed +12
-6
lines changed
3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,6 @@ use profile::Count;
21
21
use rustc_hash:: FxHashMap ;
22
22
use syntax:: { ast, AstNode , AstPtr } ;
23
23
24
- pub use lower:: LowerCtx ;
25
-
26
24
use crate :: {
27
25
attr:: { Attrs , RawAttrs } ,
28
26
db:: DefDatabase ,
@@ -35,6 +33,8 @@ use crate::{
35
33
UnresolvedMacro ,
36
34
} ;
37
35
36
+ pub use lower:: LowerCtx ;
37
+
38
38
/// A subset of Expander that only deals with cfg attributes. We only need it to
39
39
/// avoid cyclic queries in crate def map during enum processing.
40
40
#[ derive( Debug ) ]
Original file line number Diff line number Diff line change @@ -6,14 +6,13 @@ mod text_token_source;
6
6
mod text_tree_sink;
7
7
mod reparsing;
8
8
9
- use crate :: { syntax_node :: GreenNode , AstNode , SyntaxError , SyntaxNode } ;
9
+ use parser :: SyntaxKind ;
10
10
use text_token_source:: TextTokenSource ;
11
11
use text_tree_sink:: TextTreeSink ;
12
12
13
- pub ( crate ) use lexer :: * ;
13
+ use crate :: { syntax_node :: GreenNode , AstNode , SyntaxError , SyntaxNode } ;
14
14
15
- pub ( crate ) use self :: reparsing:: incremental_reparse;
16
- use parser:: SyntaxKind ;
15
+ pub ( crate ) use crate :: parsing:: { lexer:: * , reparsing:: incremental_reparse} ;
17
16
18
17
pub ( crate ) fn parse_text ( text : & str ) -> ( GreenNode , Vec < SyntaxError > ) {
19
18
let ( tokens, lexer_errors) = tokenize ( & text) ;
Original file line number Diff line number Diff line change @@ -636,6 +636,10 @@ use crate::{}
636
636
637
637
// Finally, parent and child modules, but prefer `use crate::`.
638
638
use super :: {}
639
+
640
+ // Re-exports are treated as item definitions rather than imports, so they go
641
+ // after imports and modules. Use them sparingly.
642
+ pub use crate :: x :: Z ;
639
643
```
640
644
641
645
** Rationale:** consistency.
@@ -694,6 +698,9 @@ Avoid local `use MyEnum::*` imports.
694
698
Prefer ` use crate::foo::bar ` to ` use super::bar ` or ` use self::bar::baz ` .
695
699
** Rationale:** consistency, this is the style which works in all cases.
696
700
701
+ By default, avoid re-exports.
702
+ ** Rationale:** for non-library code, re-exports introduce two ways to use something and allow for inconsistency.
703
+
697
704
## Order of Items
698
705
699
706
Optimize for the reader who sees the file for the first time, and wants to get a general idea about what's going on.
You can’t perform that action at this time.
0 commit comments