From 476bdcd9d25af7a15421f0dae8777005c84a0f61 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Sun, 2 Nov 2014 16:56:00 +0100 Subject: [PATCH 1/2] head, tail, uutils: fix build --- src/head/head.rs | 2 +- src/tail/tail.rs | 3 +-- src/uutils/uutils.rs | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/head/head.rs b/src/head/head.rs index 8f7f0d26f..4e1d758be 100644 --- a/src/head/head.rs +++ b/src/head/head.rs @@ -16,7 +16,7 @@ extern crate getopts; use std::char; use std::io::{stdin}; -use std::io::BufferedReader; +use std::io::{BufferedReader, BytesReader}; use std::io::fs::File; use std::path::Path; use std::str::from_utf8; diff --git a/src/tail/tail.rs b/src/tail/tail.rs index 99533d515..5836d80f3 100644 --- a/src/tail/tail.rs +++ b/src/tail/tail.rs @@ -15,12 +15,11 @@ extern crate getopts; use std::char; use std::io::{stdin}; -use std::io::BufferedReader; +use std::io::{BufferedReader, BytesReader}; use std::io::fs::File; use std::path::Path; use std::str::from_utf8; use getopts::{optopt, optflag, getopts, usage}; -use std::collections::Deque; use std::collections::ringbuf::RingBuf; use std::io::timer::sleep; use std::time::duration::Duration; diff --git a/src/uutils/uutils.rs b/src/uutils/uutils.rs index da3d59346..26b4796da 100644 --- a/src/uutils/uutils.rs +++ b/src/uutils/uutils.rs @@ -46,7 +46,7 @@ fn main() { let binary = Path::new(args[0].as_slice()); let binary_as_util = binary.filename_str().unwrap(); - match umap.find_equiv(&binary_as_util) { + match umap.find_equiv(binary_as_util) { Some(&uumain) => { os::set_exit_status(uumain(args)); return @@ -70,7 +70,7 @@ fn main() { args.remove(0); let util = args[0].as_slice(); - match umap.find_equiv(&util) { + match umap.find_equiv(util) { Some(&uumain) => { os::set_exit_status(uumain(args.clone())); return @@ -80,7 +80,7 @@ fn main() { // see if they want help on a specific util if args.len() >= 2 { let util = args[1].as_slice(); - match umap.find_equiv(&util) { + match umap.find_equiv(util) { Some(&uumain) => { os::set_exit_status(uumain(vec![util.to_string(), "--help".to_string()])); return From 71c9797bd76c09af0734647bef9ab96cf2231e00 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Sun, 2 Nov 2014 17:10:21 +0100 Subject: [PATCH 2/2] Fix get_mut deprecation warnings --- src/cut/ranges.rs | 2 +- src/fmt/linebreak.rs | 2 +- src/paste/paste.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cut/ranges.rs b/src/cut/ranges.rs index aae12cc4e..43f4c8373 100644 --- a/src/cut/ranges.rs +++ b/src/cut/ranges.rs @@ -68,7 +68,7 @@ impl Range { while j < ranges.len() && ranges[j].low <= ranges[i].high { let j_high = ranges.remove(j).unwrap().high; - ranges.get_mut(i).high = max(ranges[i].high, j_high); + ranges[i].high = max(ranges[i].high, j_high); } } diff --git a/src/fmt/linebreak.rs b/src/fmt/linebreak.rs index a7753290f..993cb9db4 100644 --- a/src/fmt/linebreak.rs +++ b/src/fmt/linebreak.rs @@ -229,7 +229,7 @@ fn find_kp_breakpoints<'a, T: Iterator<&'a WordInfo<'a>>>(iter: T, args: &BreakA // go through each active break, extending it and possibly adding a new active // break if we are above the minimum required length for &i in active_breaks.iter() { - let active = linebreaks.get_mut(i); + let active = &mut linebreaks[i]; // normalize demerits to avoid overflow, and record if this is the least active.demerits -= least_demerits; if active.demerits < ld_next { diff --git a/src/paste/paste.rs b/src/paste/paste.rs index e489024e4..fe17917e5 100644 --- a/src/paste/paste.rs +++ b/src/paste/paste.rs @@ -99,7 +99,7 @@ fn paste(filenames: Vec, serial: bool, delimiters: &str) { match file.read_line() { Ok(line) => output.push_str(line.as_slice().slice_to(line.len() - 1)), Err(f) => if f.kind == io::EndOfFile { - *eof.get_mut(i) = true; + eof[i] = true; eof_count += 1; } else { crash!(1, "{}", f.to_string());