mirror of
https://github.com/uutils/coreutils
synced 2024-11-17 02:08:09 +00:00
refactor/cat ~ fix cargo clippy
complaint (clippy::needless_borrow)
This commit is contained in:
parent
777e3906f8
commit
c115ad4274
1 changed files with 5 additions and 5 deletions
|
@ -295,7 +295,7 @@ fn cat_handle<R: Read>(
|
|||
if options.can_write_fast() {
|
||||
write_fast(handle)
|
||||
} 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,
|
||||
is_interactive: is_stdin_interactive(),
|
||||
};
|
||||
return cat_handle(&mut handle, &options, state);
|
||||
return cat_handle(&mut handle, options, state);
|
||||
}
|
||||
match get_input_type(path)? {
|
||||
InputType::Directory => Err(CatError::IsDirectory),
|
||||
|
@ -322,7 +322,7 @@ fn cat_path(path: &str, options: &OutputOptions, state: &mut OutputState) -> Cat
|
|||
reader: socket,
|
||||
is_interactive: false,
|
||||
};
|
||||
cat_handle(&mut handle, &options, state)
|
||||
cat_handle(&mut handle, options, state)
|
||||
}
|
||||
_ => {
|
||||
let file = File::open(path)?;
|
||||
|
@ -332,7 +332,7 @@ fn cat_path(path: &str, options: &OutputOptions, state: &mut OutputState) -> Cat
|
|||
reader: file,
|
||||
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 {
|
||||
if let Err(err) = cat_path(path, &options, &mut state) {
|
||||
if let Err(err) = cat_path(path, options, &mut state) {
|
||||
show_error!("{}: {}", path, err);
|
||||
error_count += 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue