Skip to content

Commit 219730e

Browse files
crumblingstatuecaryhaynie
authored andcommitted
Replace fail! with panic!
1 parent 07c105e commit 219730e

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

examples/demo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ pub fn main() {
66

77
let window = match sdl2::video::Window::new("rust-sdl2 demo: Video", sdl2::video::PosCentered, sdl2::video::PosCentered, 800, 600, sdl2::video::OPENGL) {
88
Ok(window) => window,
9-
Err(err) => fail!(format!("failed to create window: {}", err))
9+
Err(err) => panic!(format!("failed to create window: {}", err))
1010
};
1111

1212
let renderer = match sdl2::render::Renderer::from_window(window, sdl2::render::DriverAuto, sdl2::render::ACCELERATED) {
1313
Ok(renderer) => renderer,
14-
Err(err) => fail!(format!("failed to create renderer: {}", err))
14+
Err(err) => panic!(format!("failed to create renderer: {}", err))
1515
};
1616

1717
let _ = renderer.set_draw_color(sdl2::pixels::RGB(255, 0, 0));

src/sdl2/controller.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ pub fn wrap_controller_axis(bitflags: u8) -> ControllerAxis {
146146
ll::SDL_CONTROLLER_AXIS_RIGHTY => RightYAxis,
147147
ll::SDL_CONTROLLER_AXIS_TRIGGERLEFT => TriggerLeftAxis,
148148
ll::SDL_CONTROLLER_AXIS_TRIGGERRIGHT => TriggerRightAxis,
149-
_ => fail!("unhandled controller axis")
149+
_ => panic!("unhandled controller axis")
150150
}
151151
}
152152

@@ -188,6 +188,6 @@ pub fn wrap_controller_button(bitflags: u8) -> ControllerButton {
188188
ll::SDL_CONTROLLER_BUTTON_DPAD_DOWN => DPadDownButton,
189189
ll::SDL_CONTROLLER_BUTTON_DPAD_LEFT => DPadLeftButton,
190190
ll::SDL_CONTROLLER_BUTTON_DPAD_RIGHT => DPadRightButton,
191-
_ => fail!("unhandled controller button")
191+
_ => panic!("unhandled controller button")
192192
}
193193
}

src/sdl2/pixels.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl PixelFormatFlag {
214214
Index8
215215
=> num_of_pixels * 1,
216216
Unknown | Index1LSB | Index1MSB | Index4LSB | Index4MSB
217-
=> fail!("not supported format: {}", *self),
217+
=> panic!("not supported format: {}", *self),
218218
}
219219
}
220220

@@ -240,7 +240,7 @@ impl PixelFormatFlag {
240240
Index8
241241
=> 1,
242242
Unknown | Index1LSB | Index1MSB | Index4LSB | Index4MSB
243-
=> fail!("not supported format: {}", *self),
243+
=> panic!("not supported format: {}", *self),
244244
}
245245
}
246246
}

src/sdl2/render.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ impl Texture {
764764
unsafe {
765765
let texw: c_float = 0.0;
766766
let texh: c_float = 0.0;
767-
if ll::SDL_GL_BindTexture(self.raw, &texw, &texh) != 0 { fail!("could not bind texture"); }
767+
if ll::SDL_GL_BindTexture(self.raw, &texw, &texh) != 0 { panic!("could not bind texture"); }
768768
let rv = f(texw as f64, texh as f64);
769769
ll::SDL_GL_UnbindTexture(self.raw);
770770
rv

src/sdl2/surface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl Surface {
179179
/// Locks a surface so that the pixels can be directly accessed safely.
180180
pub fn with_lock<R>(&mut self, f: |pixels: &mut [u8]| -> R) -> R {
181181
unsafe {
182-
if ll::SDL_LockSurface(self.raw) != 0 { fail!("could not lock surface"); }
182+
if ll::SDL_LockSurface(self.raw) != 0 { panic!("could not lock surface"); }
183183
let len = (*self.raw).pitch as uint * ((*self.raw).h as uint);
184184
let rv = ::std::slice::raw::mut_buf_as_slice((*self.raw).pixels as *mut _, len, f);
185185
ll::SDL_UnlockSurface(self.raw);

0 commit comments

Comments
 (0)