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