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