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