]> git.lizzy.rs Git - rust.git/blob - tests/target/multiple.rs
716b77a2d300ea0402e2017d0b55eb2c64761af4
[rust.git] / tests / target / multiple.rs
1 // rustfmt-normalize_comments: true
2 // rustfmt-wrap_comments: true
3 // rustfmt-format_strings: true
4 // Test of lots of random stuff.
5 // FIXME split this into multiple, self-contained tests.
6
7
8 #[attr1]
9 extern crate foo;
10 #[attr2]
11 #[attr3]
12 extern crate foo;
13 #[attr1]
14 extern crate foo;
15 #[attr2]
16 #[attr3]
17 extern crate foo;
18
19 use std::cell::*;
20 use std::{self, any, ascii, borrow, boxed, char, borrow, boxed, char, borrow, borrow, boxed, char,
21           borrow, boxed, char, borrow, boxed, char, borrow, boxed, char, borrow, boxed, char,
22           borrow, boxed, char, borrow, boxed, char, borrow, boxed, char};
23
24 mod doc;
25 mod other;
26
27
28 // sfdgfffffffffffffffffffffffffffffffffffffffffffffffffffffff
29 // ffffffffffffffffffffffffffffffffffffffffff
30
31 fn foo(a: isize, b: u32 /* blah blah */, c: f64) {}
32
33 fn foo() -> Box<Write + 'static>
34     where 'a: 'b,
35           for<'a> D<'b>: 'a
36 {
37     hello!()
38 }
39
40 fn baz<'a: 'b, // comment on 'a
41        T: SomsssssssssssssssssssssssssssssssssssssssssssssssssssssseType /* comment on T */>
42     (a: A,
43      b: B, // comment on b
44      c: C)
45      -> Bob {
46     #[attr1]
47     extern crate foo;
48     #[attr2]
49     #[attr3]
50     extern crate foo;
51     #[attr1]
52     extern crate foo;
53     #[attr2]
54     #[attr3]
55     extern crate foo;
56 }
57
58 #[rustfmt_skip]
59 fn qux(a: dadsfa,   // Comment 1
60        b: sdfasdfa, // Comment 2
61        c: dsfdsafa) // Comment 3
62 {
63
64 }
65
66 /// Blah blah blah.
67 impl Bar {
68     fn foo(&mut self,
69            a: sdfsdfcccccccccccccccccccccccccccccccccccccccccccccccccc, // comment on a
70            b: sdfasdfsdfasfs /* closing comment */)
71            -> isize {
72     }
73
74     /// Blah blah blah.
75     pub fn f2(self) {
76         (foo, bar)
77     }
78
79     #[an_attribute]
80     fn f3(self) -> Dog {}
81 }
82
83 /// The `nodes` and `edges` method each return instantiations of
84 /// `Cow<[T]>` to leave implementers the freedom to create
85
86 /// entirely new vectors or to pass back slices into internally owned
87 /// vectors.
88 pub trait GraphWalk<'a, N, E> {
89     /// Returns all the nodes in this graph.
90     fn nodes(&'a self) -> Nodes<'a, N>;
91     /// Returns all of the edges in this graph.
92     fn edges(&'a self) -> Edges<'a, E>;
93     /// The source node for `edge`.
94     fn source(&'a self, edge: &E) -> N;
95     /// The target node for `edge`.
96     fn target(&'a self, edge: &E) -> N;
97 }
98
99 /// A Doc comment
100 #[AnAttribute]
101 pub struct Foo {
102     #[rustfmt_skip]
103     f :   SomeType, // Comment beside a field
104     f: SomeType, // Comment beside a field
105     // Comment on a field
106     g: SomeOtherType,
107     /// A doc comment on a field
108     h: AThirdType,
109 }
110
111 struct Bar;
112
113 // With a where clause and generics.
114 pub struct Foo<'a, Y: Baz>
115     where X: Whatever
116 {
117     f: SomeType, // Comment beside a field
118 }
119
120 fn foo(ann: &'a (PpAnn + 'a)) {}
121
122 fn main() {
123     for i in 0i32..4 {
124         println!("{}", i);
125     }
126
127
128     while true {
129         hello();
130     }
131
132     let rc = Cell::new(42usize,
133                        42usize,
134                        Cell::new(42usize,
135                                  remaining_widthremaining_widthremaining_widthremaining_width),
136                        42usize);
137     let rc = RefCell::new(42usize, remaining_width, remaining_width); // a comment
138     let x = "Hello!!!!!!!!! abcd  abcd abcd abcd abcd abcd\n abcd abcd abcd abcd abcd abcd abcd \
139              abcd abcd abcd  abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd \
140              abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd \
141              abcd abcd";
142     let s = expand(a, b);
143 }
144
145 fn deconstruct()
146     -> (SocketAddr,
147         Method,
148         Headers,
149         RequestUri,
150         HttpVersion,
151         AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
152 {
153 }
154
155 fn deconstruct(foo: Bar)
156                -> (SocketAddr,
157                    Method,
158                    Headers,
159                    RequestUri,
160                    HttpVersion,
161                    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) {
162 }
163
164 #[rustfmt_skip]
165 mod a{
166 fn foo(x:    T) {
167     let x:    T = dfasdf;
168 }
169 }