Skip to content

Replace ~"string" with "string.to_owned()", except in fail!, where it wa... #88

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
May 5, 2014
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
4 changes: 2 additions & 2 deletions src/codegen/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/sdl2/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/sdl2/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down Expand Up @@ -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")
}
}
6 changes: 3 additions & 3 deletions src/sdl2/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}

Expand Down Expand Up @@ -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())
}
}
}
4 changes: 2 additions & 2 deletions src/sdl2/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}

Expand All @@ -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"); }
let rv = f(texw as f64, texh as f64);
ll::SDL_GL_UnbindTexture(self.raw);
rv
Expand Down
2 changes: 1 addition & 1 deletion src/sdl2/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl Surface {
/// Locks a surface so that the pixels can be directly accessed safely.
pub fn with_lock<R>(&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"); }
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);
Expand Down