From e00690bf9b29ca38182602e34f8ec2c93fef4e52 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Wed, 31 Jul 2024 19:52:59 +0300 Subject: [PATCH] core: Fix I/O build on Darwin --- core/io/darwin.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/core/io/darwin.rs b/core/io/darwin.rs index ed8acfc3d..06b057f65 100644 --- a/core/io/darwin.rs +++ b/core/io/darwin.rs @@ -2,7 +2,7 @@ use crate::error::LimboError; use crate::io::common; use crate::Result; -use super::{Completion, File, WriteCompletion, IO}; +use super::{Completion, File, IO}; use libc::{c_short, fcntl, flock, F_SETLK}; use log::trace; use polling::{Event, Events, Poller}; @@ -67,7 +67,8 @@ impl IO for DarwinIO { match cf { CompletionCallback::Read(ref file, ref c, pos) => { let mut file = file.borrow_mut(); - let r = match *c { + let c: &Completion = &c; + let r = match c { Completion::Read(r) => r, Completion::Write(_) => unreachable!(), }; @@ -85,7 +86,7 @@ impl IO for DarwinIO { }; match result { std::result::Result::Ok(n) => { - match cf { + match &cf { CompletionCallback::Read(_, ref c, _) => { c.complete(0); } @@ -109,7 +110,7 @@ enum CompletionCallback { Read(Rc>, Rc, usize), Write( Rc>, - Rc, + Rc, Rc>, usize, ), @@ -175,10 +176,10 @@ impl File for DarwinFile { Ok(()) } - fn pread(&self, pos: usize, c: Rc) -> Result<()> { - let file = self.file.borrow(); + fn pread(&self, pos: usize, c: Rc) -> Result<()> { + let file = self.file.borrow(); let result = { - let r = match *c { + let r = match &(*c) { Completion::Read(r) => r, Completion::Write(_) => unreachable!(), }; @@ -215,7 +216,7 @@ impl File for DarwinFile { &self, pos: usize, buffer: Rc>, - c: Rc, + c: Rc, ) -> Result<()> { let file = self.file.borrow(); let result = {