Skip to content

Commit

Permalink
Use FIXME instead of TODO; Move bytes_to_copy calculation inside if
Browse files Browse the repository at this point in the history
branch
  • Loading branch information
nicokoch committed May 28, 2018
1 parent 3f392ab commit 3b271eb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/libstd/sys/unix/fs.rs
Expand Up @@ -821,13 +821,14 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
let has_copy_file_range = HAS_COPY_FILE_RANGE.load(Ordering::Relaxed);
let mut written = 0u64;
while written < len {
// TODO should ideally use TryFrom
let bytes_to_copy = if len - written > usize::max_value() as u64 {
usize::max_value()
} else {
(len - written) as usize
};
let copy_result = if has_copy_file_range {
// FIXME: should ideally use TryFrom
let bytes_to_copy = if len - written > usize::max_value() as u64 {
usize::max_value()
} else {
(len - written) as usize
};

let copy_result = unsafe {
// We actually don't have to adjust the offsets,
// because copy_file_range adjusts the file offset automatically
Expand Down

0 comments on commit 3b271eb

Please sign in to comment.