This is an automated email from the ASF dual-hosted git repository. kingsword09 pushed a commit to branch chore-clippy-1 in repository https://gitbox.apache.org/repos/asf/opendal.git
commit 233ca540cbbb5f5bc6f889006bd9b11d60c4e409 Author: Kingsword <[email protected]> AuthorDate: Tue Nov 4 17:40:25 2025 +0800 chore: apply suggestions from clippy 1.91.0 --- core/src/types/mode.rs | 9 ++------- core/src/types/scheme.rs | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/core/src/types/mode.rs b/core/src/types/mode.rs index aa8b8d350..bbb464c75 100644 --- a/core/src/types/mode.rs +++ b/core/src/types/mode.rs @@ -19,13 +19,14 @@ use std::fmt::Display; use std::fmt::Formatter; /// EntryMode represents the mode. -#[derive(Copy, Clone, Debug, Eq, PartialEq)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Default)] pub enum EntryMode { /// FILE means the path has data to read. FILE, /// DIR means the path can be listed. DIR, /// Unknown means we don't know what we can do on this path. + #[default] Unknown, } @@ -51,12 +52,6 @@ impl EntryMode { } } -impl Default for EntryMode { - fn default() -> Self { - Self::Unknown - } -} - impl Display for EntryMode { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { diff --git a/core/src/types/scheme.rs b/core/src/types/scheme.rs index c08622506..ba56fddf8 100644 --- a/core/src/types/scheme.rs +++ b/core/src/types/scheme.rs @@ -29,7 +29,7 @@ use crate::Error; /// - Scheme is `non_exhaustive`, new variant COULD be added at any time. /// - New variant SHOULD be added in alphabet orders, /// - Users MUST NOT relay on its order. -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Default)] #[non_exhaustive] pub enum Scheme { /// [aliyun-drive][crate::services::AliyunDrive]: Aliyun Drive services. @@ -98,6 +98,7 @@ pub enum Scheme { /// [memcached][crate::services::Memcached]: Memcached service support. Memcached, /// [memory][crate::services::Memory]: In memory backend support. + #[default] Memory, /// [mini-moka][crate::services::MiniMoka]: Mini Moka backend support. MiniMoka, @@ -309,12 +310,6 @@ impl Scheme { } } -impl Default for Scheme { - fn default() -> Self { - Self::Memory - } -} - impl Display for Scheme { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.into_static())
