2017-01-15 19:50:27 -06:00
|
|
|
// rustfmt-normalize_comments: true
|
2015-11-09 13:03:01 -06:00
|
|
|
// rustfmt-wrap_comments: true
|
2017-01-26 13:11:59 -06:00
|
|
|
// rustfmt-format_strings: true
|
2015-06-10 21:36:31 -05:00
|
|
|
// 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::*;
|
2015-07-17 08:58:47 -05:00
|
|
|
use std::{self, any, ascii, borrow, boxed, char, borrow, boxed, char, borrow, borrow, boxed, char,
|
|
|
|
borrow, boxed, char, borrow, boxed, char, borrow, boxed, char, borrow, boxed, char,
|
|
|
|
borrow, boxed, char, borrow, boxed, char, borrow, boxed, char};
|
2015-06-10 21:36:31 -05:00
|
|
|
|
|
|
|
mod doc;
|
|
|
|
mod other;
|
|
|
|
|
|
|
|
|
2015-10-19 14:41:47 -05:00
|
|
|
// sfdgfffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
|
|
|
// ffffffffffffffffffffffffffffffffffffffffff
|
2015-06-10 21:36:31 -05:00
|
|
|
|
2015-11-19 20:11:32 -06:00
|
|
|
fn foo(a: isize, b: u32 /* blah blah */, c: f64) {}
|
2015-06-10 21:36:31 -05:00
|
|
|
|
2015-09-02 15:57:22 -05:00
|
|
|
fn foo() -> Box<Write + 'static>
|
2015-06-10 21:36:31 -05:00
|
|
|
where 'a: 'b,
|
|
|
|
for<'a> D<'b>: 'a
|
|
|
|
{
|
|
|
|
hello!()
|
|
|
|
}
|
|
|
|
|
2015-06-23 08:58:58 -05:00
|
|
|
fn baz<'a: 'b, // comment on 'a
|
2015-06-10 21:36:31 -05:00
|
|
|
T: SomsssssssssssssssssssssssssssssssssssssssssssssssssssssseType /* comment on T */>
|
|
|
|
(a: A,
|
2015-06-23 08:58:58 -05:00
|
|
|
b: B, // comment on b
|
2015-06-10 21:36:31 -05:00
|
|
|
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 {
|
|
|
|
fn foo(&mut self,
|
2015-09-27 01:39:58 -05:00
|
|
|
a: sdfsdfcccccccccccccccccccccccccccccccccccccccccccccccccc, // comment on a
|
2015-06-23 08:58:58 -05:00
|
|
|
b: sdfasdfsdfasfs /* closing comment */)
|
2015-06-10 21:36:31 -05:00
|
|
|
-> isize {
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Blah blah blah.
|
|
|
|
pub fn f2(self) {
|
|
|
|
(foo, bar)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[an_attribute]
|
2015-11-19 20:11:32 -06:00
|
|
|
fn f3(self) -> Dog {}
|
2015-06-10 21:36:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/// 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>
|
|
|
|
where X: Whatever
|
|
|
|
{
|
|
|
|
f: SomeType, // Comment beside a field
|
|
|
|
}
|
|
|
|
|
2015-11-19 20:11:32 -06:00
|
|
|
fn foo(ann: &'a (PpAnn + 'a)) {}
|
2015-09-23 15:36:21 -05:00
|
|
|
|
2015-06-10 21:36:31 -05:00
|
|
|
fn main() {
|
|
|
|
for i in 0i32..4 {
|
|
|
|
println!("{}", i);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
while true {
|
|
|
|
hello();
|
|
|
|
}
|
|
|
|
|
|
|
|
let rc = Cell::new(42usize,
|
|
|
|
42usize,
|
|
|
|
Cell::new(42usize,
|
|
|
|
remaining_widthremaining_widthremaining_widthremaining_width),
|
|
|
|
42usize);
|
2017-01-16 17:01:10 -06:00
|
|
|
let rc = RefCell::new(42usize, remaining_width, remaining_width); // a comment
|
2015-06-10 21:36:31 -05:00
|
|
|
let x = "Hello!!!!!!!!! abcd abcd abcd abcd abcd abcd\n abcd abcd abcd abcd abcd abcd abcd \
|
2015-08-21 06:31:09 -05:00
|
|
|
abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd \
|
2015-06-10 21:36:31 -05:00
|
|
|
abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd \
|
2015-08-21 06:31:09 -05:00
|
|
|
abcd abcd";
|
2015-10-09 00:49:16 -05:00
|
|
|
let s = expand(a, b);
|
2015-06-10 21:36:31 -05:00
|
|
|
}
|
2015-10-08 22:07:14 -05:00
|
|
|
|
|
|
|
fn deconstruct()
|
2015-10-17 08:56:53 -05:00
|
|
|
-> (SocketAddr,
|
|
|
|
Method,
|
|
|
|
Headers,
|
|
|
|
RequestUri,
|
|
|
|
HttpVersion,
|
2015-10-08 22:07:14 -05:00
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
fn deconstruct(foo: Bar)
|
2015-10-17 08:56:53 -05:00
|
|
|
-> (SocketAddr,
|
|
|
|
Method,
|
|
|
|
Headers,
|
|
|
|
RequestUri,
|
|
|
|
HttpVersion,
|
2015-10-08 22:07:14 -05:00
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) {
|
|
|
|
}
|
2015-11-22 14:20:53 -06:00
|
|
|
|
|
|
|
#[rustfmt_skip]
|
|
|
|
mod a{
|
|
|
|
fn foo(x: T) {
|
|
|
|
let x: T = dfasdf;
|
|
|
|
}
|
|
|
|
}
|