mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +00:00
Convert all try!() to ?
This commit is contained in:
parent
c851e00dbd
commit
c7d115b1ad
13 changed files with 34 additions and 34 deletions
12
tests/common/util.rs
Executable file → Normal file
12
tests/common/util.rs
Executable file → Normal file
|
@ -162,16 +162,16 @@ pub fn log_info<T: AsRef<str>, U: AsRef<str>>(msg: T, par: U) {
|
|||
}
|
||||
|
||||
pub fn recursive_copy(src: &Path, dest: &Path) -> Result<()> {
|
||||
if try!(fs::metadata(src)).is_dir() {
|
||||
if fs::metadata(src)?.is_dir() {
|
||||
for entry in try!(fs::read_dir(src)) {
|
||||
let entry = try!(entry);
|
||||
let entry = entry?;
|
||||
let mut new_dest = PathBuf::from(dest);
|
||||
new_dest.push(entry.file_name());
|
||||
if try!(fs::metadata(entry.path())).is_dir() {
|
||||
try!(fs::create_dir(&new_dest));
|
||||
try!(recursive_copy(&entry.path(), &new_dest));
|
||||
if fs::metadata(entry.path())?.is_dir() {
|
||||
fs::create_dir(&new_dest)?;
|
||||
recursive_copy(&entry.path(), &new_dest)?;
|
||||
} else {
|
||||
try!(fs::copy(&entry.path(), new_dest));
|
||||
fs::copy(&entry.path(), new_dest)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue