mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-01 01:38:18 +00:00
fix clippy
This commit is contained in:
@@ -169,6 +169,7 @@ pub async fn new_bitrot_writer(
|
|||||||
|
|
||||||
pub type BitrotReader = Box<dyn ReadAt + Send>;
|
pub type BitrotReader = Box<dyn ReadAt + Send>;
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn new_bitrot_reader(
|
pub fn new_bitrot_reader(
|
||||||
disk: DiskStore,
|
disk: DiskStore,
|
||||||
data: &[u8],
|
data: &[u8],
|
||||||
@@ -691,16 +692,16 @@ mod test {
|
|||||||
let ep = Endpoint::try_from(temp_dir.as_str())?;
|
let ep = Endpoint::try_from(temp_dir.as_str())?;
|
||||||
let opt = DiskOption::default();
|
let opt = DiskOption::default();
|
||||||
let disk = new_disk(&ep, &opt).await?;
|
let disk = new_disk(&ep, &opt).await?;
|
||||||
let _ = disk.make_volume(volume).await?;
|
disk.make_volume(volume).await?;
|
||||||
let mut writer = new_bitrot_writer(disk.clone(), "", volume, file_path, 35, algo.clone(), 10).await?;
|
let mut writer = new_bitrot_writer(disk.clone(), "", volume, file_path, 35, algo.clone(), 10).await?;
|
||||||
|
|
||||||
let _ = writer.write(b"aaaaaaaaaa").await?;
|
writer.write(b"aaaaaaaaaa").await?;
|
||||||
let _ = writer.write(b"aaaaaaaaaa").await?;
|
writer.write(b"aaaaaaaaaa").await?;
|
||||||
let _ = writer.write(b"aaaaaaaaaa").await?;
|
writer.write(b"aaaaaaaaaa").await?;
|
||||||
let _ = writer.write(b"aaaaa").await?;
|
writer.write(b"aaaaa").await?;
|
||||||
|
|
||||||
let sum = bitrot_writer_sum(&writer);
|
let sum = bitrot_writer_sum(&writer);
|
||||||
let _ = writer.close().await?;
|
writer.close().await?;
|
||||||
|
|
||||||
let mut reader = new_bitrot_reader(disk, b"", volume, file_path, 35, algo, &sum, 10);
|
let mut reader = new_bitrot_reader(disk, b"", volume, file_path, 35, algo, &sum, 10);
|
||||||
let read_len = 10;
|
let read_len = 10;
|
||||||
|
|||||||
+17
-10
@@ -824,7 +824,7 @@ impl TryFrom<FileMetaShallowVersion> for FileMetaVersion {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Default, Clone, Eq, Ord, Hash)]
|
#[derive(Serialize, Deserialize, Debug, PartialEq, Default, Clone, Eq, Hash)]
|
||||||
pub struct FileMetaVersionHeader {
|
pub struct FileMetaVersionHeader {
|
||||||
pub version_id: Option<Uuid>,
|
pub version_id: Option<Uuid>,
|
||||||
pub mod_time: Option<OffsetDateTime>,
|
pub mod_time: Option<OffsetDateTime>,
|
||||||
@@ -974,26 +974,33 @@ impl FileMetaVersionHeader {
|
|||||||
|
|
||||||
impl PartialOrd for FileMetaVersionHeader {
|
impl PartialOrd for FileMetaVersionHeader {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||||
match self.mod_time.partial_cmp(&other.mod_time) {
|
Some(self.cmp(other))
|
||||||
Some(core::cmp::Ordering::Equal) => {}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Ord for FileMetaVersionHeader {
|
||||||
|
fn cmp(&self, other: &Self) -> Ordering {
|
||||||
|
match self.mod_time.cmp(&other.mod_time) {
|
||||||
|
core::cmp::Ordering::Equal => {}
|
||||||
ord => return ord,
|
ord => return ord,
|
||||||
}
|
}
|
||||||
|
|
||||||
match self.version_type.partial_cmp(&other.version_type) {
|
match self.version_type.cmp(&other.version_type) {
|
||||||
Some(core::cmp::Ordering::Equal) => {}
|
core::cmp::Ordering::Equal => {}
|
||||||
ord => return ord,
|
ord => return ord,
|
||||||
}
|
}
|
||||||
match self.signature.partial_cmp(&other.signature) {
|
match self.signature.cmp(&other.signature) {
|
||||||
Some(core::cmp::Ordering::Equal) => {}
|
core::cmp::Ordering::Equal => {}
|
||||||
ord => return ord,
|
ord => return ord,
|
||||||
}
|
}
|
||||||
match self.version_id.partial_cmp(&other.version_id) {
|
match self.version_id.cmp(&other.version_id) {
|
||||||
Some(core::cmp::Ordering::Equal) => {}
|
core::cmp::Ordering::Equal => {}
|
||||||
ord => return ord,
|
ord => return ord,
|
||||||
}
|
}
|
||||||
self.flags.partial_cmp(&other.flags)
|
self.flags.cmp(&other.flags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<FileMetaVersion> for FileMetaVersionHeader {
|
impl From<FileMetaVersion> for FileMetaVersionHeader {
|
||||||
fn from(value: FileMetaVersion) -> Self {
|
fn from(value: FileMetaVersion) -> Self {
|
||||||
let flags = {
|
let flags = {
|
||||||
|
|||||||
Reference in New Issue
Block a user