rust/tests/target/multiple.rs

181 lines
3.9 KiB
Rust
Raw Normal View History

// rustfmt-normalize_comments: true
// rustfmt-wrap_comments: true
2017-01-26 20:11:59 +01:00
// rustfmt-format_strings: true
// Test of lots of random stuff.
// FIXME split this into multiple, self-contained tests.
#[attr1]
extern crate foo;
#[attr2]
#[attr3]
extern crate foo;
#[attr1]
extern crate foo;
#[attr2]
#[attr3]
extern crate foo;
use std::cell::*;
2018-04-29 15:03:49 +02:00
use std::{
self, any, ascii, borrow, borrow, borrow, borrow, borrow, borrow, borrow, borrow, borrow,
borrow, borrow, boxed, boxed, boxed, boxed, boxed, boxed, boxed, boxed, boxed, boxed, char,
char, char, char, char, char, char, char, char, char,
};
mod doc;
mod other;
2015-10-19 21:41:47 +02:00
// sfdgfffffffffffffffffffffffffffffffffffffffffffffffffffffff
// ffffffffffffffffffffffffffffffffffffffffff
fn foo(a: isize, b: u32 /* blah blah */, c: f64) {}
2015-09-02 22:57:22 +02:00
fn foo() -> Box<Write + 'static>
2017-06-12 06:01:41 +02:00
where
'a: 'b,
for<'a> D<'b>: 'a,
{
hello!()
}
2017-06-12 06:01:41 +02:00
fn baz<
2017-07-05 18:03:20 +02:00
'a: 'b, // comment on 'a
2017-06-24 12:49:01 +02:00
T: SomsssssssssssssssssssssssssssssssssssssssssssssssssssssseType, // comment on T
2017-06-12 06:01:41 +02:00
>(
a: A,
b: B, // comment on b
c: C,
) -> Bob {
#[attr1]
extern crate foo;
#[attr2]
#[attr3]
extern crate foo;
#[attr1]
extern crate foo;
#[attr2]
#[attr3]
extern crate foo;
}
#[rustfmt::skip]
fn qux(a: dadsfa, // Comment 1
b: sdfasdfa, // Comment 2
c: dsfdsafa) // Comment 3
{
}
/// Blah blah blah.
impl Bar {
2017-06-12 06:01:41 +02:00
fn foo(
&mut self,
a: sdfsdfcccccccccccccccccccccccccccccccccccccccccccccccccc, // comment on a
2017-07-05 18:03:20 +02:00
b: sdfasdfsdfasfs, // closing comment
2017-06-12 06:01:41 +02:00
) -> isize {
}
/// Blah blah blah.
pub fn f2(self) {
(foo, bar)
}
#[an_attribute]
fn f3(self) -> Dog {}
}
/// The `nodes` and `edges` method each return instantiations of
/// `Cow<[T]>` to leave implementers the freedom to create
/// entirely new vectors or to pass back slices into internally owned
/// vectors.
pub trait GraphWalk<'a, N, E> {
/// Returns all the nodes in this graph.
fn nodes(&'a self) -> Nodes<'a, N>;
/// Returns all of the edges in this graph.
fn edges(&'a self) -> Edges<'a, E>;
/// The source node for `edge`.
fn source(&'a self, edge: &E) -> N;
/// The target node for `edge`.
fn target(&'a self, edge: &E) -> N;
}
/// A Doc comment
#[AnAttribute]
pub struct Foo {
#[rustfmt::skip]
f : SomeType, // Comment beside a field
f: SomeType, // Comment beside a field
// Comment on a field
g: SomeOtherType,
/// A doc comment on a field
h: AThirdType,
}
struct Bar;
// With a where clause and generics.
pub struct Foo<'a, Y: Baz>
2017-06-12 06:01:41 +02:00
where
X: Whatever,
{
f: SomeType, // Comment beside a field
}
fn foo(ann: &'a (PpAnn + 'a)) {}
2015-09-23 22:36:21 +02:00
fn main() {
for i in 0i32..4 {
println!("{}", i);
}
while true {
hello();
}
2017-06-12 06:01:41 +02:00
let rc = Cell::new(
42usize,
42usize,
Cell::new(
42usize,
remaining_widthremaining_widthremaining_widthremaining_width,
),
42usize,
);
let rc = RefCell::new(42usize, remaining_width, remaining_width); // a comment
let x = "Hello!!!!!!!!! abcd abcd abcd abcd abcd abcd\n abcd abcd abcd abcd abcd abcd abcd \
2015-08-21 13:31:09 +02:00
abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd \
abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd \
2015-08-21 13:31:09 +02:00
abcd abcd";
let s = expand(a, b);
}
2017-08-01 15:26:37 +02:00
fn deconstruct() -> (
2017-06-14 02:30:04 +02:00
SocketAddr,
Method,
Headers,
RequestUri,
HttpVersion,
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
2017-08-01 15:26:37 +02:00
) {
}
2017-06-12 06:01:41 +02:00
fn deconstruct(
foo: Bar,
2017-06-14 02:30:04 +02:00
) -> (
SocketAddr,
Method,
Headers,
RequestUri,
HttpVersion,
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
) {
}
#[rustfmt::skip]
mod a{
fn foo(x: T) {
let x: T = dfasdf;
}
}