Skip to content

Commit

Permalink
chore: fix cargo clippy (#5379)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorgan authored Dec 2, 2024
1 parent 5834e28 commit 0b077ec
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
4 changes: 3 additions & 1 deletion integrations/cloud_filter/tests/behavior/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Box<dyn Future<Output = ()>>>;

#[tokio::main]
async fn main() -> ExitCode {
let args = Arguments::from_args();
Expand Down Expand Up @@ -80,7 +82,7 @@ fn init(
op: Operator,
) -> (
SyncRootId,
Connection<AsyncBridge<CloudFilter, impl Fn(Pin<Box<dyn Future<Output = ()>>>)>>,
Connection<AsyncBridge<CloudFilter, impl Fn(Callback)>>,
) {
let sync_root_id = SyncRootIdBuilder::new(PROVIDER_NAME)
.user_security_id(SecurityId::current_user().unwrap())
Expand Down
16 changes: 8 additions & 8 deletions integrations/dav-server/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl DavFileSystem for OpendalFs {
&'a self,
path: &'a DavPath,
options: dav_server::fs::OpenOptions,
) -> FsFuture<Box<dyn DavFile>> {
) -> FsFuture<'a, Box<dyn DavFile>> {
async move {
let file = OpendalFile::open(self.op.clone(), path.clone(), options).await?;
Ok(Box::new(file) as Box<dyn DavFile>)
Expand All @@ -85,7 +85,7 @@ impl DavFileSystem for OpendalFs {
&'a self,
path: &'a DavPath,
_meta: ReadDirMeta,
) -> FsFuture<FsStream<Box<dyn DavDirEntry>>> {
) -> FsFuture<'a, FsStream<Box<dyn DavDirEntry>>> {
async move {
let path = path.as_url_string();
self.op
Expand All @@ -97,7 +97,7 @@ impl DavFileSystem for OpendalFs {
.boxed()
}

fn metadata<'a>(&'a self, path: &'a DavPath) -> FsFuture<Box<dyn DavMetaData>> {
fn metadata<'a>(&'a self, path: &'a DavPath) -> FsFuture<'a, Box<dyn DavMetaData>> {
async move {
let opendal_metadata = self.op.stat(path.as_url_string().as_str()).await;
match opendal_metadata {
Expand All @@ -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();

Expand Down Expand Up @@ -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())
Expand All @@ -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()
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion integrations/virtiofs/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub trait ReadWriteAtVolatile<B: BitmapSlice> {
fn write_vectored_at_volatile(&self, bufs: &[&VolatileSlice<B>]) -> Result<usize>;
}

impl<'a, B: BitmapSlice, T: ReadWriteAtVolatile<B> + ?Sized> ReadWriteAtVolatile<B> for &'a T {
impl<B: BitmapSlice, T: ReadWriteAtVolatile<B> + ?Sized> ReadWriteAtVolatile<B> for &T {
fn read_vectored_at_volatile(&self, bufs: &[&VolatileSlice<B>]) -> Result<usize> {
(**self).read_vectored_at_volatile(bufs)
}
Expand Down
4 changes: 2 additions & 2 deletions integrations/virtiofs/src/virtiofs_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl<'a, B: Bitmap + BitmapSlice + 'static> Reader<'a, B> {
}
}

impl<'a, B: BitmapSlice> io::Read for Reader<'a, B> {
impl<B: BitmapSlice> io::Read for Reader<'_, B> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.buffer
.consume(buf.len(), |bufs| {
Expand Down Expand Up @@ -308,7 +308,7 @@ impl<'a, B: Bitmap + BitmapSlice + 'static> Writer<'a, B> {
}
}

impl<'a, B: BitmapSlice> Write for Writer<'a, B> {
impl<B: BitmapSlice> Write for Writer<'_, B> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.buffer
.consume(buf.len(), |bufs| {
Expand Down

0 comments on commit 0b077ec

Please sign in to comment.