mirror of
https://github.com/uutils/coreutils
synced 2024-10-08 00:49:31 +00:00
refactor/cat ~ fix cargo clippy
complaint (clippy::needless_borrow)
This commit is contained in:
parent
777e3906f8
commit
c115ad4274
|
@ -295,7 +295,7 @@ fn cat_handle<R: Read>(
|
||||||
if options.can_write_fast() {
|
if options.can_write_fast() {
|
||||||
write_fast(handle)
|
write_fast(handle)
|
||||||
} else {
|
} else {
|
||||||
write_lines(handle, &options, state)
|
write_lines(handle, options, state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ fn cat_path(path: &str, options: &OutputOptions, state: &mut OutputState) -> Cat
|
||||||
reader: stdin,
|
reader: stdin,
|
||||||
is_interactive: is_stdin_interactive(),
|
is_interactive: is_stdin_interactive(),
|
||||||
};
|
};
|
||||||
return cat_handle(&mut handle, &options, state);
|
return cat_handle(&mut handle, options, state);
|
||||||
}
|
}
|
||||||
match get_input_type(path)? {
|
match get_input_type(path)? {
|
||||||
InputType::Directory => Err(CatError::IsDirectory),
|
InputType::Directory => Err(CatError::IsDirectory),
|
||||||
|
@ -322,7 +322,7 @@ fn cat_path(path: &str, options: &OutputOptions, state: &mut OutputState) -> Cat
|
||||||
reader: socket,
|
reader: socket,
|
||||||
is_interactive: false,
|
is_interactive: false,
|
||||||
};
|
};
|
||||||
cat_handle(&mut handle, &options, state)
|
cat_handle(&mut handle, options, state)
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
let file = File::open(path)?;
|
let file = File::open(path)?;
|
||||||
|
@ -332,7 +332,7 @@ fn cat_path(path: &str, options: &OutputOptions, state: &mut OutputState) -> Cat
|
||||||
reader: file,
|
reader: file,
|
||||||
is_interactive: false,
|
is_interactive: false,
|
||||||
};
|
};
|
||||||
cat_handle(&mut handle, &options, state)
|
cat_handle(&mut handle, options, state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,7 @@ fn cat_files(files: Vec<String>, options: &OutputOptions) -> Result<(), u32> {
|
||||||
};
|
};
|
||||||
|
|
||||||
for path in &files {
|
for path in &files {
|
||||||
if let Err(err) = cat_path(path, &options, &mut state) {
|
if let Err(err) = cat_path(path, options, &mut state) {
|
||||||
show_error!("{}: {}", path, err);
|
show_error!("{}: {}", path, err);
|
||||||
error_count += 1;
|
error_count += 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue