diff --git a/src/codegen/main.rs b/src/codegen/main.rs index 6b567a5cc99..167b3da4d17 100644 --- a/src/codegen/main.rs +++ b/src/codegen/main.rs @@ -28,12 +28,12 @@ fn main() { Ok(_) => {}, }; - if *args.get(1) == ~"keycode.rs" { + if *args.get(1) == "keycode.rs".to_owned() { match keycode::generate(&output_dir) { Ok(_) => {}, Err(e) => fail!("Could not automatically generate sources for keycodes: {:s}", e.desc), }; - } else if *args.get(1) == ~"scancode.rs" { + } else if *args.get(1) == "scancode.rs".to_owned() { match scancode::generate(&output_dir) { Ok(_) => {}, Err(e) => fail!("Could not automatically generate sources for scancodes: {:s}", e.desc), diff --git a/src/sdl2/audio.rs b/src/sdl2/audio.rs index 1ff2e00f626..e573e7fe473 100644 --- a/src/sdl2/audio.rs +++ b/src/sdl2/audio.rs @@ -347,7 +347,7 @@ impl AudioCVT { unsafe { if (*self.raw).needed != 1 { - return Err(~"no convertion needed!") + return Err("no convertion needed!".to_owned()) } // set len (*self.raw).len = src.len() as c_int; diff --git a/src/sdl2/controller.rs b/src/sdl2/controller.rs index b9e1c80346b..aa40a3f7db7 100644 --- a/src/sdl2/controller.rs +++ b/src/sdl2/controller.rs @@ -141,7 +141,7 @@ pub fn wrap_controller_axis(bitflags: u8) -> ControllerAxis { ll::SDL_CONTROLLER_AXIS_RIGHTY => RightYAxis, ll::SDL_CONTROLLER_AXIS_TRIGGERLEFT => TriggerLeftAxis, ll::SDL_CONTROLLER_AXIS_TRIGGERRIGHT => TriggerRightAxis, - _ => fail!(~"unhandled controller axis") + _ => fail!("unhandled controller axis".to_owned()) } } @@ -182,6 +182,6 @@ pub fn wrap_controller_button(bitflags: u8) -> ControllerButton { ll::SDL_CONTROLLER_BUTTON_DPAD_DOWN => DPadDownButton, ll::SDL_CONTROLLER_BUTTON_DPAD_LEFT => DPadLeftButton, ll::SDL_CONTROLLER_BUTTON_DPAD_RIGHT => DPadRightButton, - _ => fail!(~"unhandled controller button") + _ => fail!("unhandled controller button".to_owned()) } } diff --git a/src/sdl2/event.rs b/src/sdl2/event.rs index 099a39cd9b9..2ae05ce8410 100644 --- a/src/sdl2/event.rs +++ b/src/sdl2/event.rs @@ -738,7 +738,7 @@ impl Event { Ok(window) => window, }; - let text = str::from_utf8_owned(event.text.iter().take_while(|&b| (*b) != 0i8).map(|&b| b as u8).collect::<~[u8]>()).unwrap_or(~""); + let text = str::from_utf8_owned(event.text.iter().take_while(|&b| (*b) != 0i8).map(|&b| b as u8).collect::<~[u8]>()).unwrap_or("".to_owned()); TextEditingEvent(event.timestamp as uint, window, text, event.start as int, event.length as int) } @@ -751,7 +751,7 @@ impl Event { Ok(window) => window, }; - let text = str::from_utf8_owned(event.text.iter().take_while(|&b| (*b) != 0i8).map(|&b| b as u8).collect::<~[u8]>()).unwrap_or(~""); + let text = str::from_utf8_owned(event.text.iter().take_while(|&b| (*b) != 0i8).map(|&b| b as u8).collect::<~[u8]>()).unwrap_or("".to_owned()); TextInputEvent(event.timestamp as uint, window, text) } @@ -1094,7 +1094,7 @@ pub fn push_event(event: Event) -> Result<(), ~str> { else { Err(get_error()) } }, None => { - Err(~"Unsupport event type to push back to queue.") + Err("Unsupport event type to push back to queue.".to_owned()) } } } diff --git a/src/sdl2/render.rs b/src/sdl2/render.rs index dcf627ac9f7..c5ce32bccec 100644 --- a/src/sdl2/render.rs +++ b/src/sdl2/render.rs @@ -719,7 +719,7 @@ impl Texture { if result { Ok((texw as f64, texh as f64)) } else { - Err(~"Operation not supported") + Err("Operation not supported".to_owned()) } } @@ -731,7 +731,7 @@ impl Texture { unsafe { let texw: c_float = 0.0; let texh: c_float = 0.0; - if ll::SDL_GL_BindTexture(self.raw, &texw, &texh) != 0 { fail!(~"could not bind texture"); } + if ll::SDL_GL_BindTexture(self.raw, &texw, &texh) != 0 { fail!("could not bind texture".to_owned()); } let rv = f(texw as f64, texh as f64); ll::SDL_GL_UnbindTexture(self.raw); rv diff --git a/src/sdl2/surface.rs b/src/sdl2/surface.rs index 2b126348d72..c10889f4169 100644 --- a/src/sdl2/surface.rs +++ b/src/sdl2/surface.rs @@ -148,7 +148,7 @@ impl Surface { /// Locks a surface so that the pixels can be directly accessed safely. pub fn with_lock(&self, f: |pixels: &mut [u8]| -> R) -> R { unsafe { - if ll::SDL_LockSurface(self.raw) != 0 { fail!(~"could not lock surface"); } + if ll::SDL_LockSurface(self.raw) != 0 { fail!("could not lock surface".to_owned()); } let len = (*self.raw).pitch as uint * ((*self.raw).h as uint); let pixels: &mut [u8] = cast::transmute(((*self.raw).pixels, len)); let rv = f(pixels);