Skip to content

Commit 3b271eb

Browse files
committed
Use FIXME instead of TODO; Move bytes_to_copy calculation inside if
branch
1 parent 3f392ab commit 3b271eb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/libstd/sys/unix/fs.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -821,13 +821,14 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
821821
let has_copy_file_range = HAS_COPY_FILE_RANGE.load(Ordering::Relaxed);
822822
let mut written = 0u64;
823823
while written < len {
824-
// TODO should ideally use TryFrom
825-
let bytes_to_copy = if len - written > usize::max_value() as u64 {
826-
usize::max_value()
827-
} else {
828-
(len - written) as usize
829-
};
830824
let copy_result = if has_copy_file_range {
825+
// FIXME: should ideally use TryFrom
826+
let bytes_to_copy = if len - written > usize::max_value() as u64 {
827+
usize::max_value()
828+
} else {
829+
(len - written) as usize
830+
};
831+
831832
let copy_result = unsafe {
832833
// We actually don't have to adjust the offsets,
833834
// because copy_file_range adjusts the file offset automatically

0 commit comments

Comments
 (0)