diff --git a/misc/musl-static/Dockerfile b/misc/musl-static/Dockerfile index 216730ff6da..7f6bd7e9520 100644 --- a/misc/musl-static/Dockerfile +++ b/misc/musl-static/Dockerfile @@ -1,4 +1,4 @@ -FROM clux/muslrust:1.66.1 +FROM clux/muslrust:1.68.2 ARG RUST_TARGET=x86_64-unknown-linux-musl diff --git a/misc/nydus-smoke/Dockerfile b/misc/nydus-smoke/Dockerfile index 8c231d17752..cfdf6ea0285 100644 --- a/misc/nydus-smoke/Dockerfile +++ b/misc/nydus-smoke/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.66.1 +FROM rust:1.68.2 ARG RUST_TARGET=x86_64-unknown-linux-musl RUN mkdir /root/.cargo/ diff --git a/rafs/src/lib.rs b/rafs/src/lib.rs index 923f8d2a095..062bc5f9877 100644 --- a/rafs/src/lib.rs +++ b/rafs/src/lib.rs @@ -114,7 +114,7 @@ pub trait RafsIoWrite: Write + Seek + 'static { fn validate_alignment(&mut self, size: usize, alignment: usize) -> Result { if alignment != 0 { - let cur = self.seek(SeekFrom::Current(0))?; + let cur = self.stream_position()?; if (size & (alignment - 1) != 0) || (cur & (alignment as u64 - 1) != 0) { return Err(einval!("unaligned data")); diff --git a/rafs/src/metadata/direct_v6.rs b/rafs/src/metadata/direct_v6.rs index 244a8f2a3cb..8509e52a4b7 100644 --- a/rafs/src/metadata/direct_v6.rs +++ b/rafs/src/metadata/direct_v6.rs @@ -479,9 +479,9 @@ impl OndiskInodeWrapper { // 3 - inode compression D: inode, [xattrs], map_header, extents ... | ... // 4 - inode chunk-based E: inode, [xattrs], chunk indexes ... | ... // 5~7 - reserved - fn data_block_offset<'a>( + fn data_block_offset( &self, - state: &'a Guard>, + state: &Guard>, inode: &dyn RafsV6OndiskInode, index: usize, ) -> RafsResult { @@ -713,9 +713,9 @@ impl OndiskInodeWrapper { Ok(()) } - fn get_entry_count<'a>( + fn get_entry_count( &self, - state: &'a Guard>, + state: &Guard>, inode: &dyn RafsV6OndiskInode, block_index: usize, ) -> Result { diff --git a/rafs/src/metadata/mod.rs b/rafs/src/metadata/mod.rs index a317f74197b..3c54fb49ebe 100644 --- a/rafs/src/metadata/mod.rs +++ b/rafs/src/metadata/mod.rs @@ -569,20 +569,15 @@ impl Default for RafsSuperMeta { } /// RAFS filesystem versions. -#[derive(Clone, Copy, Debug, PartialEq)] +#[derive(Clone, Copy, Debug, Default, PartialEq)] pub enum RafsVersion { /// RAFS v5 + #[default] V5, /// RAFS v6 V6, } -impl Default for RafsVersion { - fn default() -> Self { - RafsVersion::V5 - } -} - impl TryFrom for RafsVersion { type Error = Error; @@ -618,20 +613,15 @@ impl RafsVersion { } /// Rafs metadata working mode. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Default, Eq, PartialEq)] pub enum RafsMode { /// Directly mapping and accessing metadata into process by mmap(). + #[default] Direct, /// Read metadata into memory before using, for RAFS v5. Cached, } -impl Default for RafsMode { - fn default() -> Self { - RafsMode::Direct - } -} - impl FromStr for RafsMode { type Err = Error; diff --git a/rust-toolchain b/rust-toolchain index 0403bed10c3..5deab586f9a 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.66.1 +1.68.2 diff --git a/storage/src/factory.rs b/storage/src/factory.rs index 288e53bbb97..cc37a4e913c 100644 --- a/storage/src/factory.rs +++ b/storage/src/factory.rs @@ -58,7 +58,7 @@ struct BlobCacheMgrKey { config: Arc, } -#[allow(clippy::derive_hash_xor_eq)] +#[allow(clippy::derived_hash_with_manual_eq)] impl Hash for BlobCacheMgrKey { fn hash(&self, state: &mut H) { self.config.id.hash(state); diff --git a/storage/src/meta/toc.rs b/storage/src/meta/toc.rs index e759bd95f8c..b678dcc17f4 100644 --- a/storage/src/meta/toc.rs +++ b/storage/src/meta/toc.rs @@ -56,7 +56,7 @@ impl TryFrom for TocEntryFlags { compress::Algorithm::None => Ok(Self::COMPRESSION_NONE), compress::Algorithm::Zstd => Ok(Self::COMPRESSION_ZSTD), compress::Algorithm::Lz4Block => Ok(Self::COMPRESSION_LZ4_BLOCK), - _ => return Err(eother!(format!("unsupported compressor {}", c,))), + _ => Err(eother!(format!("unsupported compressor {}", c,))), } } } diff --git a/utils/src/compress/mod.rs b/utils/src/compress/mod.rs index 9ff00e375d8..fd19ca811f7 100644 --- a/utils/src/compress/mod.rs +++ b/utils/src/compress/mod.rs @@ -18,20 +18,15 @@ const COMPRESSION_MINIMUM_RATIO: usize = 100; /// Supported compression algorithms. #[repr(u32)] -#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] +#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)] pub enum Algorithm { + #[default] None = 0, Lz4Block = 1, GZip = 2, Zstd = 3, } -impl Default for Algorithm { - fn default() -> Self { - Self::None - } -} - impl fmt::Display for Algorithm { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self) diff --git a/utils/src/crypt.rs b/utils/src/crypt.rs index 9e1388bbf85..d387745cfdc 100644 --- a/utils/src/crypt.rs +++ b/utils/src/crypt.rs @@ -13,8 +13,9 @@ use openssl::symm; /// Supported cipher algorithms. #[repr(u32)] -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] pub enum Algorithm { + #[default] None = 0, Aes128Xts = 1, Aes256Xts = 2, @@ -67,12 +68,6 @@ impl Algorithm { } } -impl Default for Algorithm { - fn default() -> Self { - Algorithm::None - } -} - impl fmt::Display for Algorithm { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self) @@ -130,19 +125,15 @@ impl TryFrom for Algorithm { } /// Cipher object to encrypt/decrypt data. +#[derive(Default)] pub enum Cipher { + #[default] None, Aes128Xts(symm::Cipher), Aes256Xts(symm::Cipher), Aes256Gcm(symm::Cipher), } -impl Default for Cipher { - fn default() -> Self { - Cipher::None - } -} - impl Debug for Cipher { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match self { diff --git a/utils/src/digest.rs b/utils/src/digest.rs index f5a8ac75e6e..7e8ab74593a 100644 --- a/utils/src/digest.rs +++ b/utils/src/digest.rs @@ -20,18 +20,13 @@ pub const RAFS_DIGEST_LENGTH: usize = 32; pub type DigestData = [u8; RAFS_DIGEST_LENGTH]; #[repr(u32)] -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] pub enum Algorithm { + #[default] Blake3 = 0, Sha256 = 1, } -impl Default for Algorithm { - fn default() -> Self { - Self::Blake3 - } -} - impl fmt::Display for Algorithm { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self)