mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-31 21:17:46 +00:00
od: clean up fname usage
+ rm superfluous clone + rm superfluous mut variable
This commit is contained in:
parent
71bc68a987
commit
55be34a2c4
1 changed files with 5 additions and 6 deletions
11
src/od/od.rs
11
src/od/od.rs
|
@ -51,18 +51,17 @@ pub fn uumain(args: Vec<String>) -> isize {
|
||||||
Err(f) => { panic!("Invalid -A/--address-radix\n{}", f) }
|
Err(f) => { panic!("Invalid -A/--address-radix\n{}", f) }
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut fname;
|
let fname = match args.last() {
|
||||||
match args.last() {
|
Some(n) => n,
|
||||||
Some(n) => fname = n,
|
None => { panic!("Need fname for now") ; }
|
||||||
None => { panic!("Need fname for now") ; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
main(input_offset_base, fname.clone());
|
main(input_offset_base, fname.as_slice());
|
||||||
|
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main(input_offset_base: Radix, fname: String) {
|
fn main(input_offset_base: Radix, fname: &str) {
|
||||||
let mut f = match File::open(&Path::new(fname)) {
|
let mut f = match File::open(&Path::new(fname)) {
|
||||||
Ok(f) => f,
|
Ok(f) => f,
|
||||||
Err(e) => panic!("file error: {}", e)
|
Err(e) => panic!("file error: {}", e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue