[go: nahoru, domu]

Skip to content

Commit

Permalink
cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
nicokoch committed Apr 3, 2019
1 parent d50b820 commit 724b498
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ pub fn reflink<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()>
/// }
/// ```
pub fn reflink_or_copy<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<Option<u64>> {
match reflink(&from, &to) {
Ok(()) => return Ok(None),
Err(_) => {}
if let Ok(()) = reflink(&from, &to) {
Ok(None)
} else {
fs::copy(from, to).map(Some)
}
fs::copy(from, to).map(|written| Some(written))
}
4 changes: 2 additions & 2 deletions src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ pub fn reflink(from: &Path, to: &Path) -> io::Result<()> {
) -> libc::c_int;
}

let src = cstr(from.as_ref())?;
let dest = cstr(to.as_ref())?;
let src = cstr(from)?;
let dest = cstr(to)?;

let ret = unsafe { clonefile(src.as_ptr(), dest.as_ptr(), CLONE_NOOWNERCOPY) };

Expand Down

0 comments on commit 724b498

Please sign in to comment.