From 288179be49eee00e15ed19bd7147ba721c670e85 Mon Sep 17 00:00:00 2001 From: Keunwoo Lee Date: Tue, 27 Jan 2015 19:31:11 -0800 Subject: [PATCH] address Arcterus comments on uutils/coreutils PR 515 Mostly style things. --- README.md | 1 + src/od/od.rs | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index eaba3f293..c0cfb6a63 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,7 @@ To do - mktemp - mv (almost done, one more option) - numfmt +- od (in progress, needs lots of work) - pathchk - pinky - pr diff --git a/src/od/od.rs b/src/od/od.rs index 5a290ecea..fca7f2962 100644 --- a/src/od/od.rs +++ b/src/od/od.rs @@ -39,7 +39,7 @@ pub fn uumain(args: Vec) -> isize { "BYTES"), getopts::optflag("h", "help", "display this help and exit."), getopts::optflag("v", "version", "output version information and exit."), - ]; + ]; let matches = match getopts::getopts(args.tail(), &opts) { Ok(m) => m, @@ -78,16 +78,15 @@ fn main(radix: Radix, fname: String) { Ok(n) => { print!("{:07o}", addr); match radix { - Radix::Decimal => { - }, + Radix::Decimal => {}, Radix::Octal => { - for b in range(0, n/std::u16::BYTES) { - let bs = &bytes[2*b .. 2*b+2]; + for b in range(0, n / std::u16::BYTES) { + let bs = &bytes[(2 * b) .. (2 * b + 2)]; let p: u16 = (bs[1] as u16) << 8 | bs[0] as u16; print!(" {:06o}", p); } if n % std::u16::BYTES == 1 { - print!(" {:06o}", bytes[n-1]); + print!(" {:06o}", bytes[n - 1]); } } _ => { } @@ -109,7 +108,7 @@ fn parse_radix(radix_str: Option) -> Radix { } let radix: char = *(st.get(0) - .expect("byte string of length 1 lacks a 0th elem")) as char; + .expect("byte string of length 1 lacks a 0th elem")) as char; if radix == 'd' { Radix::Decimal } else if radix == 'x' {