]> git.lizzy.rs Git - rust.git/blob - tests/target/imports.rs
Merge pull request #2769 from topecongiro/issue-2765
[rust.git] / tests / target / imports.rs
1 // rustfmt-normalize_comments: true
2 // rustfmt-error_on_line_overflow: false
3
4 // Imports.
5
6 // Long import.
7 use exceedingly::loooooooooooooooooooooooooooooooooooooooooooooooooooooooong::import::path::{
8     ItemA, ItemB,
9 };
10 use exceedingly::looooooooooooooooooooooooooooooooooooooooooooooooooooooooooong::import::path::{
11     ItemA, ItemB,
12 };
13 use syntax::ast::{ItemDefaultImpl, ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic};
14
15 use list::{
16     // Another item
17     AnotherItem, // Another Comment
18     // Last Item
19     LastItem,
20     // Some item
21     SomeItem, // Comment
22 };
23
24 use test::{/* A */ self /* B */, Other /* C */};
25
26 use syntax;
27 pub use syntax::ast::{Expr, ExprAssign, ExprCall, ExprMethodCall, ExprPath, Expr_};
28 use Foo::{Bar, Baz};
29 use {Bar /* comment */, /* Pre-comment! */ Foo};
30
31 use std::io;
32 use std::io;
33
34 mod Foo {
35     pub use syntax::ast::{
36         ItemDefaultImpl, ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic,
37     };
38
39     mod Foo2 {
40         pub use syntax::ast::{
41             self, ItemDefaultImpl, ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic,
42         };
43     }
44 }
45
46 fn test() {
47     use Baz::*;
48     use Qux;
49 }
50
51 // Simple imports
52 use bar::quux as kaas;
53 use foo;
54 use foo::bar::baz;
55
56 // With aliases.
57 use foo as bar;
58 use foo::qux as bar;
59 use foo::{self as bar, baz};
60 use foo::{baz, qux as bar};
61
62 // With absolute paths
63 use foo;
64 use foo::Bar;
65 use foo::{Bar, Baz};
66 use Foo;
67 use {Bar, Baz};
68
69 // Root globs
70 use *;
71 use *;
72
73 // spaces used to cause glob imports to disappear (#1356)
74 use super::*;
75 use foo::issue_1356::*;
76
77 // We shouldn't remove imports which have attributes attached (#1858)
78 #[cfg(unix)]
79 use self::unix::{};
80
81 // nested imports
82 use foo::{
83     a, b,
84     bar::{
85         baz,
86         foo::{a, b, cxxxxxxxxxxxxx, yyyyyyyyyyyyyy, zzzzzzzzzzzzzzzz},
87         qux, xxxxxxxxxxx, yyyyyyyyyyyyy, zzzzzzzzzzzzzzzz,
88     },
89     boo, c,
90 };
91
92 use fooo::{
93     baar::foobar::{
94         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
95         zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz,
96     },
97     bar,
98     bar::*,
99     x, y, z,
100 };
101
102 use exonum::{
103     api::{Api, ApiError},
104     blockchain::{self, BlockProof, Blockchain, Transaction, TransactionSet},
105     crypto::{Hash, PublicKey},
106     helpers::Height,
107     node::TransactionSend,
108     storage::{ListProof, MapProof},
109 };
110
111 // nested imports with a single sub-tree.
112 use a::b::c::d;
113 use a::b::c::*;
114 use a::b::c::{xxx, yyy, zzz};
115
116 // #2645
117 /// This line is not affected.
118 // This line is deleted.
119 use c;
120
121 // #2670
122 #[macro_use]
123 use imports_with_attr;