mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 12:37:49 +00:00
Update for latest Rust
This commit is contained in:
parent
c470efc5b4
commit
b8d67ea672
5 changed files with 5 additions and 5 deletions
|
@ -104,7 +104,7 @@ fn decode(input: &mut Reader, ignore_garbage: bool) {
|
||||||
let slice =
|
let slice =
|
||||||
if ignore_garbage {
|
if ignore_garbage {
|
||||||
to_decode.as_slice()
|
to_decode.as_slice()
|
||||||
.trim_chars(|c: char| {
|
.trim_chars(|&: c: char| {
|
||||||
let num = match c.to_ascii_opt() {
|
let num = match c.to_ascii_opt() {
|
||||||
Some(ascii) => ascii.as_byte(),
|
Some(ascii) => ascii.as_byte(),
|
||||||
None => return false
|
None => return false
|
||||||
|
|
|
@ -62,7 +62,7 @@ fn du(path: &Path, mut my_stat: Stat,
|
||||||
let this_stat = Stat{path: f.clone(), fstat: safe_unwrap!(fs::lstat(&f))};
|
let this_stat = Stat{path: f.clone(), fstat: safe_unwrap!(fs::lstat(&f))};
|
||||||
if this_stat.fstat.kind == FileType::Directory {
|
if this_stat.fstat.kind == FileType::Directory {
|
||||||
let oa_clone = options.clone();
|
let oa_clone = options.clone();
|
||||||
futures.push(Future::spawn(proc() { du(&f, this_stat, oa_clone, depth + 1) }))
|
futures.push(Future::spawn(move || { du(&f, this_stat, oa_clone, depth + 1) }))
|
||||||
} else {
|
} else {
|
||||||
my_stat.fstat.size += this_stat.fstat.size;
|
my_stat.fstat.size += this_stat.fstat.size;
|
||||||
my_stat.fstat.unstable.blocks += this_stat.fstat.unstable.blocks;
|
my_stat.fstat.unstable.blocks += this_stat.fstat.unstable.blocks;
|
||||||
|
|
|
@ -528,7 +528,7 @@ impl<'a> Iterator<WordInfo<'a>> for WordSplit<'a> {
|
||||||
let mut word_nchars = 0;
|
let mut word_nchars = 0;
|
||||||
self.position =
|
self.position =
|
||||||
match self.string.slice_from(word_start)
|
match self.string.slice_from(word_start)
|
||||||
.find(|x: char| if !x.is_whitespace() { word_nchars += char_width(x); false } else { true }) {
|
.find(|&mut: x: char| if !x.is_whitespace() { word_nchars += char_width(x); false } else { true }) {
|
||||||
None => self.length,
|
None => self.length,
|
||||||
Some(s) => s + word_start
|
Some(s) => s + word_start
|
||||||
};
|
};
|
||||||
|
|
|
@ -124,7 +124,7 @@ fn fold_file<T: io::Reader>(file: BufferedReader<T>, bytes: bool, spaces: bool,
|
||||||
let slice = {
|
let slice = {
|
||||||
let slice = line.slice(i, i + width);
|
let slice = line.slice(i, i + width);
|
||||||
if spaces && i + width < len {
|
if spaces && i + width < len {
|
||||||
match slice.rfind(|ch: char| ch.is_whitespace()) {
|
match slice.rfind(|&: ch: char| ch.is_whitespace()) {
|
||||||
Some(m) => slice.slice_to(m + 1),
|
Some(m) => slice.slice_to(m + 1),
|
||||||
None => slice
|
None => slice
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
verbose: matches.opt_present("v"),
|
verbose: matches.opt_present("v"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let string_to_path = |s: &String| { Path::new(s.as_slice()) };
|
let string_to_path = |&: s: &String| { Path::new(s.as_slice()) };
|
||||||
let paths: Vec<Path> = matches.free.iter().map(string_to_path).collect();
|
let paths: Vec<Path> = matches.free.iter().map(string_to_path).collect();
|
||||||
|
|
||||||
if matches.opt_present("version") {
|
if matches.opt_present("version") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue