]> git.lizzy.rs Git - rust.git/commitdiff
Remove unnecessary `clone()` on `writable`
authorSamrat Man Singh <samratmansingh@gmail.com>
Mon, 3 Aug 2020 15:09:09 +0000 (20:39 +0530)
committerSamrat Man Singh <samratmansingh@gmail.com>
Mon, 3 Aug 2020 15:09:09 +0000 (20:39 +0530)
src/shims/posix/fs.rs

index 6f46401ece657026a9c212af2dbdea038834db4c..1bba30a1ea0ff86c70b8f908bcfc61951e5ba8b6 100644 (file)
@@ -411,13 +411,13 @@ fn fcntl(
             let fh = &mut this.machine.file_handler;
             let (file_result, writable) = match fh.handles.get(&fd) {
                 Some(file_descriptor) => match file_descriptor.as_file_handle() {
-                    Ok(FileHandle { file, writable }) => (file.try_clone(), writable.clone()),
+                    Ok(FileHandle { file, writable }) => (file.try_clone(), *writable),
                     Err(_) => return this.handle_not_found(),
                 },
                 None => return this.handle_not_found(),
             };
             let fd_result = file_result.map(|duplicated| {
-                fh.insert_fd_with_min_fd(FileHandle { file: duplicated, writable: writable }, start)
+                fh.insert_fd_with_min_fd(FileHandle { file: duplicated, writable }, start)
             });
             this.try_unwrap_io_result(fd_result)
         } else if this.tcx.sess.target.target.target_os == "macos"