Skip to content

run rustfmt on test/run-fail folder #33897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/test/run-fail/args-panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
#![allow(unknown_features)]
#![feature(box_syntax)]

fn f(_a: isize, _b: isize, _c: Box<isize>) { panic!("moop"); }
fn f(_a: isize, _b: isize, _c: Box<isize>) {
panic!("moop");
}

fn main() { f(1, panic!("meep"), box 42); }
fn main() {
f(1, panic!("meep"), box 42);
}
2 changes: 1 addition & 1 deletion src/test/run-fail/assert-eq-macro-panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
// error-pattern:assertion failed: `(left == right)` (left: `14`, right: `15`)

fn main() {
assert_eq!(14,15);
assert_eq!(14, 15);
}
4 changes: 3 additions & 1 deletion src/test/run-fail/binop-fail-3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
// except according to those terms.

// error-pattern:quux
fn foo() -> ! { panic!("quux"); }
fn foo() -> ! {
panic!("quux");
}
fn main() {
foo() == foo(); // these types wind up being defaulted to ()
}
9 changes: 7 additions & 2 deletions src/test/run-fail/binop-panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@
// except according to those terms.

// error-pattern:quux
fn my_err(s: String) -> ! { println!("{}", s); panic!("quux"); }
fn main() { 3_usize == my_err("bye".to_string()); }
fn my_err(s: String) -> ! {
println!("{}", s);
panic!("quux");
}
fn main() {
3_usize == my_err("bye".to_string());
}
4 changes: 2 additions & 2 deletions src/test/run-fail/bug-2470-bounds-check-overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ fn main() {
// address of the 0th cell in the array (even though the index is
// huge).

let x = vec!(1_usize,2_usize,3_usize);
let x = vec![1_usize, 2_usize, 3_usize];

let base = x.as_ptr() as usize;
let idx = base / mem::size_of::<usize>();
println!("ov1 base = 0x{:x}", base);
println!("ov1 idx = 0x{:x}", idx);
println!("ov1 sizeof::<usize>() = 0x{:x}", mem::size_of::<usize>());
println!("ov1 idx * sizeof::<usize>() = 0x{:x}",
idx * mem::size_of::<usize>());
idx * mem::size_of::<usize>());

// This should panic.
println!("ov1 0x{:x}", x[idx]);
Expand Down
12 changes: 9 additions & 3 deletions src/test/run-fail/bug-811.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

use std::marker::PhantomData;

fn test00_start(ch: chan_t<isize>, message: isize) { send(ch, message); }
fn test00_start(ch: chan_t<isize>, message: isize) {
send(ch, message);
}

type task_id = isize;
type port_id = isize;
Expand All @@ -23,6 +25,10 @@ struct chan_t<T> {
marker: PhantomData<*mut T>,
}

fn send<T:Send>(_ch: chan_t<T>, _data: T) { panic!(); }
fn send<T: Send>(_ch: chan_t<T>, _data: T) {
panic!();
}

fn main() { panic!("quux"); }
fn main() {
panic!("quux");
}
2 changes: 1 addition & 1 deletion src/test/run-fail/doublepanic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#![allow(unreachable_code)]

//error-pattern:One
// error-pattern:One
fn main() {
panic!("One");
panic!("Two");
Expand Down
4 changes: 3 additions & 1 deletion src/test/run-fail/explicit-panic-msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
// error-pattern:wooooo
fn main() {
let mut a = 1;
if 1 == 1 { a = 2; }
if 1 == 1 {
a = 2;
}
panic!(format!("woooo{}", "o"));
}
4 changes: 3 additions & 1 deletion src/test/run-fail/explicit-panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@


// error-pattern:explicit
fn main() { panic!(); }
fn main() {
panic!();
}
8 changes: 6 additions & 2 deletions src/test/run-fail/expr-fn-panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

// error-pattern:explicit panic

fn f() -> ! { panic!() }
fn f() -> ! {
panic!()
}

fn main() { f(); }
fn main() {
f();
}
17 changes: 14 additions & 3 deletions src/test/run-fail/expr-if-panic-fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,19 @@

// error-pattern:explicit panic

fn f() -> ! { panic!() }
fn f() -> ! {
panic!()
}

fn g() -> isize { let x = if true { f() } else { 10 }; return x; }
fn g() -> isize {
let x = if true {
f()
} else {
10
};
return x;
}

fn main() { g(); }
fn main() {
g();
}
10 changes: 9 additions & 1 deletion src/test/run-fail/expr-if-panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,12 @@

// error-pattern:explicit panic

fn main() { let _x = if false { 0 } else if true { panic!() } else { 10 }; }
fn main() {
let _x = if false {
0
} else if true {
panic!()
} else {
10
};
}
16 changes: 13 additions & 3 deletions src/test/run-fail/expr-match-panic-fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@

// error-pattern:explicit panic

fn f() -> ! { panic!() }
fn f() -> ! {
panic!()
}

fn g() -> isize { let x = match true { true => { f() } false => { 10 } }; return x; }
fn g() -> isize {
let x = match true {
true => f(),
false => 10,
};
return x;
}

fn main() { g(); }
fn main() {
g();
}
7 changes: 6 additions & 1 deletion src/test/run-fail/expr-match-panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@

// error-pattern:explicit panic

fn main() { let _x = match true { false => { 0 } true => { panic!() } }; }
fn main() {
let _x = match true {
false => 0,
true => panic!(),
};
}
6 changes: 5 additions & 1 deletion src/test/run-fail/for-each-loop-panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@

// error-pattern:moop

fn main() { for _ in 0_usize..10_usize { panic!("moop"); } }
fn main() {
for _ in 0_usize..10_usize {
panic!("moop");
}
}
10 changes: 8 additions & 2 deletions src/test/run-fail/if-check-panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
fn even(x: usize) -> bool {
if x < 2 {
return false;
} else if x == 2 { return true; } else { return even(x - 2); }
} else if x == 2 {
return true;
} else {
return even(x - 2);
}
}

fn foo(x: usize) {
Expand All @@ -23,4 +27,6 @@ fn foo(x: usize) {
}
}

fn main() { foo(3); }
fn main() {
foo(3);
}
10 changes: 8 additions & 2 deletions src/test/run-fail/if-cond-bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,11 @@
// except according to those terms.

// error-pattern:quux
fn my_err(s: String) -> ! { println!("{}", s); panic!("quux"); }
fn main() { if my_err("bye".to_string()) { } }
fn my_err(s: String) -> ! {
println!("{}", s);
panic!("quux");
}
fn main() {
if my_err("bye".to_string()) {
}
}
3 changes: 2 additions & 1 deletion src/test/run-fail/issue-12920.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
// error-pattern:explicit panic

pub fn main() {
panic!(); println!("{}", 1);
panic!();
println!("{}", 1);
}
2 changes: 1 addition & 1 deletion src/test/run-fail/issue-18576.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ fn main() {
let pointer = other;
pointer();
}
extern fn other() {}
extern "C" fn other() {}
9 changes: 3 additions & 6 deletions src/test/run-fail/issue-20971.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@ pub trait Parser {

impl Parser for () {
type Input = ();
fn parse(&mut self, input: ()) {

}
fn parse(&mut self, input: ()) {}
}

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

fn main() {
many()
.parse(());
many().parse(());
}
10 changes: 7 additions & 3 deletions src/test/run-fail/issue-2444.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@

use std::sync::Arc;

enum e<T> { ee(Arc<T>) }
enum e<T> {
ee(Arc<T>),
}

fn foo() -> e<isize> {panic!();}
fn foo() -> e<isize> {
panic!();
}

fn main() {
let _f = foo();
let _f = foo();
}
9 changes: 7 additions & 2 deletions src/test/run-fail/issue-28934.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ struct Parser<'i: 't, 't>(&'i u8, &'t u8);

impl<'i, 't> Parser<'i, 't> {
fn parse_nested_block<F, T>(&mut self, parse: F) -> Result<T, ()>
where for<'tt> F: FnOnce(&mut Parser<'i, 'tt>) -> T { panic!() }
where for<'tt> F: FnOnce(&mut Parser<'i, 'tt>) -> T
{
panic!()
}

fn expect_exhausted(&mut self) -> Result<(), ()> { Ok(()) }
fn expect_exhausted(&mut self) -> Result<(), ()> {
Ok(())
}
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-fail/issue-3029.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// error-pattern:so long
fn main() {
let mut x = Vec::new();
let y = vec!(3);
let y = vec![3];
panic!("so long");
x.extend(y.into_iter());
}
4 changes: 3 additions & 1 deletion src/test/run-fail/issue-6458-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@
// error-pattern:explicit panic

fn foo<T>(t: T) {}
fn main() { foo(panic!()) }
fn main() {
foo(panic!())
}
9 changes: 6 additions & 3 deletions src/test/run-fail/issue-948.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@

#![allow(unused_variables)]

struct Point { x: isize, y: isize }
struct Point {
x: isize,
y: isize,
}

fn main() {
let origin = Point {x: 0, y: 0};
let f: Point = Point {x: (panic!("beep boop")),.. origin};
let origin = Point { x: 0, y: 0 };
let f: Point = Point { x: (panic!("beep boop")), ..origin };
}
8 changes: 5 additions & 3 deletions src/test/run-fail/match-bot-panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
#![allow(unreachable_code)]
#![allow(unused_variables)]

fn foo(s: String) { }
fn foo(s: String) {}

fn main() {
let i =
match Some::<isize>(3) { None::<isize> => { panic!() } Some::<isize>(_) => { panic!() } };
let i = match Some::<isize>(3) {
None::<isize> => panic!(),
Some::<isize>(_) => panic!(),
};
foo(i);
}
15 changes: 12 additions & 3 deletions src/test/run-fail/match-disc-bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
// except according to those terms.

// error-pattern:quux
fn f() -> ! { panic!("quux") }
fn g() -> isize { match f() { true => { 1 } false => { 0 } } }
fn main() { g(); }
fn f() -> ! {
panic!("quux")
}
fn g() -> isize {
match f() {
true => 1,
false => 0,
}
}
fn main() {
g();
}
Loading