Skip to content

Commit 73ef372

Browse files
committed
run rustfmt on test/run-fail folder
1 parent 97e3a24 commit 73ef372

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+278
-107
lines changed

src/test/run-fail/args-panic.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
#![allow(unknown_features)]
1515
#![feature(box_syntax)]
1616

17-
fn f(_a: isize, _b: isize, _c: Box<isize>) { panic!("moop"); }
17+
fn f(_a: isize, _b: isize, _c: Box<isize>) {
18+
panic!("moop");
19+
}
1820

19-
fn main() { f(1, panic!("meep"), box 42); }
21+
fn main() {
22+
f(1, panic!("meep"), box 42);
23+
}

src/test/run-fail/assert-eq-macro-panic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
// error-pattern:assertion failed: `(left == right)` (left: `14`, right: `15`)
1212

1313
fn main() {
14-
assert_eq!(14,15);
14+
assert_eq!(14, 15);
1515
}

src/test/run-fail/binop-fail-3.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
// except according to those terms.
1010

1111
// error-pattern:quux
12-
fn foo() -> ! { panic!("quux"); }
12+
fn foo() -> ! {
13+
panic!("quux");
14+
}
1315
fn main() {
1416
foo() == foo(); // these types wind up being defaulted to ()
1517
}

src/test/run-fail/binop-panic.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,10 @@
99
// except according to those terms.
1010

1111
// error-pattern:quux
12-
fn my_err(s: String) -> ! { println!("{}", s); panic!("quux"); }
13-
fn main() { 3_usize == my_err("bye".to_string()); }
12+
fn my_err(s: String) -> ! {
13+
println!("{}", s);
14+
panic!("quux");
15+
}
16+
fn main() {
17+
3_usize == my_err("bye".to_string());
18+
}

src/test/run-fail/bug-2470-bounds-check-overflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ fn main() {
2020
// address of the 0th cell in the array (even though the index is
2121
// huge).
2222

23-
let x = vec!(1_usize,2_usize,3_usize);
23+
let x = vec![1_usize, 2_usize, 3_usize];
2424

2525
let base = x.as_ptr() as usize;
2626
let idx = base / mem::size_of::<usize>();
2727
println!("ov1 base = 0x{:x}", base);
2828
println!("ov1 idx = 0x{:x}", idx);
2929
println!("ov1 sizeof::<usize>() = 0x{:x}", mem::size_of::<usize>());
3030
println!("ov1 idx * sizeof::<usize>() = 0x{:x}",
31-
idx * mem::size_of::<usize>());
31+
idx * mem::size_of::<usize>());
3232

3333
// This should panic.
3434
println!("ov1 0x{:x}", x[idx]);

src/test/run-fail/bug-811.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313
use std::marker::PhantomData;
1414

15-
fn test00_start(ch: chan_t<isize>, message: isize) { send(ch, message); }
15+
fn test00_start(ch: chan_t<isize>, message: isize) {
16+
send(ch, message);
17+
}
1618

1719
type task_id = isize;
1820
type port_id = isize;
@@ -23,6 +25,10 @@ struct chan_t<T> {
2325
marker: PhantomData<*mut T>,
2426
}
2527

26-
fn send<T:Send>(_ch: chan_t<T>, _data: T) { panic!(); }
28+
fn send<T: Send>(_ch: chan_t<T>, _data: T) {
29+
panic!();
30+
}
2731

28-
fn main() { panic!("quux"); }
32+
fn main() {
33+
panic!("quux");
34+
}

src/test/run-fail/doublepanic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#![allow(unreachable_code)]
1212

13-
//error-pattern:One
13+
// error-pattern:One
1414
fn main() {
1515
panic!("One");
1616
panic!("Two");

src/test/run-fail/explicit-panic-msg.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
// error-pattern:wooooo
1515
fn main() {
1616
let mut a = 1;
17-
if 1 == 1 { a = 2; }
17+
if 1 == 1 {
18+
a = 2;
19+
}
1820
panic!(format!("woooo{}", "o"));
1921
}

src/test/run-fail/explicit-panic.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@
1212

1313

1414
// error-pattern:explicit
15-
fn main() { panic!(); }
15+
fn main() {
16+
panic!();
17+
}

src/test/run-fail/expr-fn-panic.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
// error-pattern:explicit panic
1212

13-
fn f() -> ! { panic!() }
13+
fn f() -> ! {
14+
panic!()
15+
}
1416

15-
fn main() { f(); }
17+
fn main() {
18+
f();
19+
}

src/test/run-fail/expr-if-panic-fn.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,19 @@
1010

1111
// error-pattern:explicit panic
1212

13-
fn f() -> ! { panic!() }
13+
fn f() -> ! {
14+
panic!()
15+
}
1416

15-
fn g() -> isize { let x = if true { f() } else { 10 }; return x; }
17+
fn g() -> isize {
18+
let x = if true {
19+
f()
20+
} else {
21+
10
22+
};
23+
return x;
24+
}
1625

17-
fn main() { g(); }
26+
fn main() {
27+
g();
28+
}

src/test/run-fail/expr-if-panic.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,12 @@
1010

1111
// error-pattern:explicit panic
1212

13-
fn main() { let _x = if false { 0 } else if true { panic!() } else { 10 }; }
13+
fn main() {
14+
let _x = if false {
15+
0
16+
} else if true {
17+
panic!()
18+
} else {
19+
10
20+
};
21+
}

src/test/run-fail/expr-match-panic-fn.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,18 @@
1010

1111
// error-pattern:explicit panic
1212

13-
fn f() -> ! { panic!() }
13+
fn f() -> ! {
14+
panic!()
15+
}
1416

15-
fn g() -> isize { let x = match true { true => { f() } false => { 10 } }; return x; }
17+
fn g() -> isize {
18+
let x = match true {
19+
true => f(),
20+
false => 10,
21+
};
22+
return x;
23+
}
1624

17-
fn main() { g(); }
25+
fn main() {
26+
g();
27+
}

src/test/run-fail/expr-match-panic.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,9 @@
1010

1111
// error-pattern:explicit panic
1212

13-
fn main() { let _x = match true { false => { 0 } true => { panic!() } }; }
13+
fn main() {
14+
let _x = match true {
15+
false => 0,
16+
true => panic!(),
17+
};
18+
}

src/test/run-fail/for-each-loop-panic.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@
1010

1111
// error-pattern:moop
1212

13-
fn main() { for _ in 0_usize..10_usize { panic!("moop"); } }
13+
fn main() {
14+
for _ in 0_usize..10_usize {
15+
panic!("moop");
16+
}
17+
}

src/test/run-fail/if-check-panic.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
fn even(x: usize) -> bool {
1313
if x < 2 {
1414
return false;
15-
} else if x == 2 { return true; } else { return even(x - 2); }
15+
} else if x == 2 {
16+
return true;
17+
} else {
18+
return even(x - 2);
19+
}
1620
}
1721

1822
fn foo(x: usize) {
@@ -23,4 +27,6 @@ fn foo(x: usize) {
2327
}
2428
}
2529

26-
fn main() { foo(3); }
30+
fn main() {
31+
foo(3);
32+
}

src/test/run-fail/if-cond-bot.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,11 @@
99
// except according to those terms.
1010

1111
// error-pattern:quux
12-
fn my_err(s: String) -> ! { println!("{}", s); panic!("quux"); }
13-
fn main() { if my_err("bye".to_string()) { } }
12+
fn my_err(s: String) -> ! {
13+
println!("{}", s);
14+
panic!("quux");
15+
}
16+
fn main() {
17+
if my_err("bye".to_string()) {
18+
}
19+
}

src/test/run-fail/issue-12920.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
// error-pattern:explicit panic
1212

1313
pub fn main() {
14-
panic!(); println!("{}", 1);
14+
panic!();
15+
println!("{}", 1);
1516
}

src/test/run-fail/issue-18576.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ fn main() {
2020
let pointer = other;
2121
pointer();
2222
}
23-
extern fn other() {}
23+
extern "C" fn other() {}

src/test/run-fail/issue-20971.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,13 @@ pub trait Parser {
1919

2020
impl Parser for () {
2121
type Input = ();
22-
fn parse(&mut self, input: ()) {
23-
24-
}
22+
fn parse(&mut self, input: ()) {}
2523
}
2624

27-
pub fn many() -> Box<Parser<Input=<() as Parser>::Input> + 'static> {
25+
pub fn many() -> Box<Parser<Input = <() as Parser>::Input> + 'static> {
2826
panic!("Hello, world!")
2927
}
3028

3129
fn main() {
32-
many()
33-
.parse(());
30+
many().parse(());
3431
}

src/test/run-fail/issue-2444.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@
1212

1313
use std::sync::Arc;
1414

15-
enum e<T> { ee(Arc<T>) }
15+
enum e<T> {
16+
ee(Arc<T>),
17+
}
1618

17-
fn foo() -> e<isize> {panic!();}
19+
fn foo() -> e<isize> {
20+
panic!();
21+
}
1822

1923
fn main() {
20-
let _f = foo();
24+
let _f = foo();
2125
}

src/test/run-fail/issue-28934.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ struct Parser<'i: 't, 't>(&'i u8, &'t u8);
1717

1818
impl<'i, 't> Parser<'i, 't> {
1919
fn parse_nested_block<F, T>(&mut self, parse: F) -> Result<T, ()>
20-
where for<'tt> F: FnOnce(&mut Parser<'i, 'tt>) -> T { panic!() }
20+
where for<'tt> F: FnOnce(&mut Parser<'i, 'tt>) -> T
21+
{
22+
panic!()
23+
}
2124

22-
fn expect_exhausted(&mut self) -> Result<(), ()> { Ok(()) }
25+
fn expect_exhausted(&mut self) -> Result<(), ()> {
26+
Ok(())
27+
}
2328
}
2429

2530
fn main() {

src/test/run-fail/issue-3029.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// error-pattern:so long
1717
fn main() {
1818
let mut x = Vec::new();
19-
let y = vec!(3);
19+
let y = vec![3];
2020
panic!("so long");
2121
x.extend(y.into_iter());
2222
}

src/test/run-fail/issue-6458-1.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@
1111
// error-pattern:explicit panic
1212

1313
fn foo<T>(t: T) {}
14-
fn main() { foo(panic!()) }
14+
fn main() {
15+
foo(panic!())
16+
}

src/test/run-fail/issue-948.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@
1212

1313
#![allow(unused_variables)]
1414

15-
struct Point { x: isize, y: isize }
15+
struct Point {
16+
x: isize,
17+
y: isize,
18+
}
1619

1720
fn main() {
18-
let origin = Point {x: 0, y: 0};
19-
let f: Point = Point {x: (panic!("beep boop")),.. origin};
21+
let origin = Point { x: 0, y: 0 };
22+
let f: Point = Point { x: (panic!("beep boop")), ..origin };
2023
}

src/test/run-fail/match-bot-panic.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
#![allow(unreachable_code)]
1414
#![allow(unused_variables)]
1515

16-
fn foo(s: String) { }
16+
fn foo(s: String) {}
1717

1818
fn main() {
19-
let i =
20-
match Some::<isize>(3) { None::<isize> => { panic!() } Some::<isize>(_) => { panic!() } };
19+
let i = match Some::<isize>(3) {
20+
None::<isize> => panic!(),
21+
Some::<isize>(_) => panic!(),
22+
};
2123
foo(i);
2224
}

src/test/run-fail/match-disc-bot.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
// except according to those terms.
1010

1111
// error-pattern:quux
12-
fn f() -> ! { panic!("quux") }
13-
fn g() -> isize { match f() { true => { 1 } false => { 0 } } }
14-
fn main() { g(); }
12+
fn f() -> ! {
13+
panic!("quux")
14+
}
15+
fn g() -> isize {
16+
match f() {
17+
true => 1,
18+
false => 0,
19+
}
20+
}
21+
fn main() {
22+
g();
23+
}

0 commit comments

Comments
 (0)