]> git.lizzy.rs Git - rust.git/blob - tests/target/imports.rs
b6d939fc125f313a68e937aa0f389a5c43f1b9b7
[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::{ItemA,
8                                                                                              ItemB};
9 use exceedingly::looooooooooooooooooooooooooooooooooooooooooooooooooooooooooong::import::path::{ItemA,
10                                                                                                 ItemB};
11 use syntax::ast::{ItemDefaultImpl, ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic};
12
13 use list::{// Another item
14            AnotherItem, // Another Comment
15            // Last Item
16            LastItem,
17            // Some item
18            SomeItem /* Comment */};
19
20 use test::{/* A */ self /* B */, Other /* C */};
21
22 use syntax;
23 pub use syntax::ast::{Expr, ExprAssign, ExprCall, ExprMethodCall, ExprPath, Expr_};
24 use Foo::{Bar, Baz};
25 use {Bar /* comment */, /* Pre-comment! */ Foo};
26
27 use std::io;
28 use std::io;
29
30 mod Foo {
31     pub use syntax::ast::{ItemDefaultImpl, ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic};
32
33     mod Foo2 {
34         pub use syntax::ast::{self, ItemDefaultImpl, ItemForeignMod, ItemImpl, ItemMac, ItemMod,
35                               ItemStatic};
36     }
37 }
38
39 fn test() {
40     use Baz::*;
41     use Qux;
42 }
43
44 // Simple imports
45 use bar::quux as kaas;
46 use foo;
47 use foo::bar::baz;
48
49 // With aliases.
50 use foo as bar;
51 use foo::qux as bar;
52 use foo::{self as bar, baz};
53 use foo::{baz, qux as bar};
54
55 // With absolute paths
56 use foo;
57 use Foo;
58 use foo::Bar;
59 use foo::{Bar, Baz};
60 use {Bar, Baz};
61
62 // Root globs
63 use *;
64 use *;
65
66 // spaces used to cause glob imports to disappear (#1356)
67 use super::*;
68 use foo::issue_1356::*;
69
70 // We shouldn't remove imports which have attributes attached (#1858)
71 #[cfg(unix)]
72 use self::unix::{};
73
74 // nested imports
75 use foo::{a,
76           b,
77           bar::{baz,
78                 foo::{a, b, cxxxxxxxxxxxxx, yyyyyyyyyyyyyy, zzzzzzzzzzzzzzzz},
79                 qux,
80                 xxxxxxxxxxx,
81                 yyyyyyyyyyyyy,
82                 zzzzzzzzzzzzzzzz},
83           boo,
84           c};
85
86 use fooo::{baar::foobar::{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
87                           zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz},
88            bar,
89            bar::*,
90            x,
91            y,
92            z};
93
94 // nested imports with a single sub-tree.
95 use a::b::c::d;
96 use a::b::c::*;
97 use a::b::c::{xxx, yyy, zzz};