From e1ee58ea7eb6ea76d4a7a57ab40d4ade255cc90d Mon Sep 17 00:00:00 2001 From: meteorgan Date: Mon, 2 Dec 2024 16:50:56 +0800 Subject: [PATCH] chore: fix cargo clippy --- integrations/cloud_filter/tests/behavior/main.rs | 4 +++- integrations/dav-server/src/fs.rs | 16 ++++++++-------- integrations/virtiofs/src/buffer.rs | 2 +- integrations/virtiofs/src/virtiofs_util.rs | 4 ++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/integrations/cloud_filter/tests/behavior/main.rs b/integrations/cloud_filter/tests/behavior/main.rs index 0b2cd371731e..8f73d9b2678d 100644 --- a/integrations/cloud_filter/tests/behavior/main.rs +++ b/integrations/cloud_filter/tests/behavior/main.rs @@ -43,6 +43,8 @@ const PROVIDER_NAME: &str = "ro-cloud_filter"; const DISPLAY_NAME: &str = "Test Cloud Filter"; const ROOT_PATH: &str = "C:\\sync_root"; +type Callback = Pin>>; + #[tokio::main] async fn main() -> ExitCode { let args = Arguments::from_args(); @@ -80,7 +82,7 @@ fn init( op: Operator, ) -> ( SyncRootId, - Connection>>)>>, + Connection>, ) { let sync_root_id = SyncRootIdBuilder::new(PROVIDER_NAME) .user_security_id(SecurityId::current_user().unwrap()) diff --git a/integrations/dav-server/src/fs.rs b/integrations/dav-server/src/fs.rs index 80444d8c676f..449b562c1186 100644 --- a/integrations/dav-server/src/fs.rs +++ b/integrations/dav-server/src/fs.rs @@ -73,7 +73,7 @@ impl DavFileSystem for OpendalFs { &'a self, path: &'a DavPath, options: dav_server::fs::OpenOptions, - ) -> FsFuture> { + ) -> FsFuture<'a, Box> { async move { let file = OpendalFile::open(self.op.clone(), path.clone(), options).await?; Ok(Box::new(file) as Box) @@ -85,7 +85,7 @@ impl DavFileSystem for OpendalFs { &'a self, path: &'a DavPath, _meta: ReadDirMeta, - ) -> FsFuture>> { + ) -> FsFuture<'a, FsStream>> { async move { let path = path.as_url_string(); self.op @@ -97,7 +97,7 @@ impl DavFileSystem for OpendalFs { .boxed() } - fn metadata<'a>(&'a self, path: &'a DavPath) -> FsFuture> { + fn metadata<'a>(&'a self, path: &'a DavPath) -> FsFuture<'a, Box> { async move { let opendal_metadata = self.op.stat(path.as_url_string().as_str()).await; match opendal_metadata { @@ -111,7 +111,7 @@ impl DavFileSystem for OpendalFs { .boxed() } - fn create_dir<'a>(&'a self, path: &'a DavPath) -> FsFuture<()> { + fn create_dir<'a>(&'a self, path: &'a DavPath) -> FsFuture<'a, ()> { async move { let path = path.as_url_string(); @@ -150,11 +150,11 @@ impl DavFileSystem for OpendalFs { .boxed() } - fn remove_dir<'a>(&'a self, path: &'a DavPath) -> FsFuture<()> { + fn remove_dir<'a>(&'a self, path: &'a DavPath) -> FsFuture<'a, ()> { self.remove_file(path) } - fn remove_file<'a>(&'a self, path: &'a DavPath) -> FsFuture<()> { + fn remove_file<'a>(&'a self, path: &'a DavPath) -> FsFuture<'a, ()> { async move { self.op .delete(path.as_url_string().as_str()) @@ -164,7 +164,7 @@ impl DavFileSystem for OpendalFs { .boxed() } - fn rename<'a>(&'a self, from: &'a DavPath, to: &'a DavPath) -> FsFuture<()> { + fn rename<'a>(&'a self, from: &'a DavPath, to: &'a DavPath) -> FsFuture<'a, ()> { async move { let from_path = from .as_rel_ospath() @@ -182,7 +182,7 @@ impl DavFileSystem for OpendalFs { .boxed() } - fn copy<'a>(&'a self, from: &'a DavPath, to: &'a DavPath) -> FsFuture<()> { + fn copy<'a>(&'a self, from: &'a DavPath, to: &'a DavPath) -> FsFuture<'a, ()> { async move { let from_path = from .as_rel_ospath() diff --git a/integrations/virtiofs/src/buffer.rs b/integrations/virtiofs/src/buffer.rs index 0cd8d1bb0e65..09e42498dd5c 100644 --- a/integrations/virtiofs/src/buffer.rs +++ b/integrations/virtiofs/src/buffer.rs @@ -30,7 +30,7 @@ pub trait ReadWriteAtVolatile { fn write_vectored_at_volatile(&self, bufs: &[&VolatileSlice]) -> Result; } -impl<'a, B: BitmapSlice, T: ReadWriteAtVolatile + ?Sized> ReadWriteAtVolatile for &'a T { +impl + ?Sized> ReadWriteAtVolatile for &T { fn read_vectored_at_volatile(&self, bufs: &[&VolatileSlice]) -> Result { (**self).read_vectored_at_volatile(bufs) } diff --git a/integrations/virtiofs/src/virtiofs_util.rs b/integrations/virtiofs/src/virtiofs_util.rs index cf0ab041a5eb..9d390da97532 100644 --- a/integrations/virtiofs/src/virtiofs_util.rs +++ b/integrations/virtiofs/src/virtiofs_util.rs @@ -216,7 +216,7 @@ impl<'a, B: Bitmap + BitmapSlice + 'static> Reader<'a, B> { } } -impl<'a, B: BitmapSlice> io::Read for Reader<'a, B> { +impl io::Read for Reader<'_, B> { fn read(&mut self, buf: &mut [u8]) -> io::Result { self.buffer .consume(buf.len(), |bufs| { @@ -308,7 +308,7 @@ impl<'a, B: Bitmap + BitmapSlice + 'static> Writer<'a, B> { } } -impl<'a, B: BitmapSlice> Write for Writer<'a, B> { +impl Write for Writer<'_, B> { fn write(&mut self, buf: &[u8]) -> io::Result { self.buffer .consume(buf.len(), |bufs| {