Skip to content

Commit 2582617

Browse files
committed
language changes: std::util is gone.
1 parent bb5b372 commit 2582617

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

angolmois.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3288,7 +3288,7 @@ pub mod gfx {
32883288
* Angolmois is not well refactored. (In fact, the game logic is usually hard to refactor, right?)
32893289
*/
32903290
pub mod player {
3291-
use std::{vec, cmp, num, iter, util};
3291+
use std::{vec, cmp, num, iter};
32923292
use std::rc::Rc;
32933293
use sdl::*;
32943294
use sdl::video::*;
@@ -4091,6 +4091,8 @@ pub mod player {
40914091
40924092
/// Applies the blit command to given list of image resources. (C: a part of `load_resource`)
40934093
fn apply_blitcmd(imgres: &mut [ImageResource], bc: &BlitCmd) {
4094+
use std::mem;
4095+
40944096
let src = bc.src.to_uint();
40954097
let dst = bc.dst.to_uint();
40964098
if src == dst { return; }
@@ -4111,7 +4113,7 @@ pub mod player {
41114113
}
41124114
41134115
// temporarily swap imgres[src], otherwise it will cause an error
4114-
let savedorigin = util::replace(&mut imgres[src], NoImage);
4116+
let savedorigin = mem::replace(&mut imgres[src], NoImage);
41154117
{
41164118
let origin = savedorigin.surface().unwrap();
41174119
let target = imgres[dst].surface().unwrap();
@@ -4302,12 +4304,11 @@ Artist: {artist}
43024304
/// (C: `resource_loaded`)
43034305
pub fn graphic_update_status(path: Option<~str>, screen: &Surface, saved_screen: &Surface,
43044306
font: &Font, ticker: &mut Ticker, atexit: ||) {
4305-
// Rust: `on_tick` calls the closure at most once so `path` won't be referenced twice,
4306-
// but the analysis can't reason that. (#4654) an "option dance" via
4307-
// `Option<T>::swap_unwrap` is not helpful here since `path` can be `None`.
4308-
let mut path = path; // XXX #4654
4307+
use std::mem;
4308+
4309+
let mut path = path;
43094310
ticker.on_tick(get_ticks(), || {
4310-
let path = ::std::util::replace(&mut path, None); // XXX #4654
4311+
let path = mem::replace(&mut path, None);
43114312
let msg = path.unwrap_or(~"loading...");
43124313
screen.blit_at(saved_screen, 0, (SCREENH-20) as i16);
43134314
screen.with_pixels(|pixels| {
@@ -4322,9 +4323,11 @@ Artist: {artist}
43224323
/// A callback template for `load_resource` with the textual loading screen.
43234324
/// (C: `resource_loaded`)
43244325
pub fn text_update_status(path: Option<~str>, ticker: &mut Ticker, atexit: ||) {
4325-
let mut path = path; // XXX #4654
4326+
use std::mem;
4327+
4328+
let mut path = path;
43264329
ticker.on_tick(get_ticks(), || {
4327-
match ::std::util::replace(&mut path, None) { // XXX #4654
4330+
match mem::replace(&mut path, None) {
43284331
Some(path) => {
43294332
use util::str::StrUtil;
43304333
let path = if path.len() < 63 {path} else {path.slice_upto(0, 63).to_owned()};

0 commit comments

Comments
 (0)