This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/paimon-rust.git
The following commit(s) were added to refs/heads/main by this push:
new 3ef9234 ci: fix clippy warn error to long issue (#88)
3ef9234 is described below
commit 3ef92348f6daaf56e96fd9469cf64099808fb8c0
Author: yuxia Luo <[email protected]>
AuthorDate: Thu Feb 12 11:25:07 2026 +0800
ci: fix clippy warn error to long issue (#88)
---
crates/paimon/src/error.rs | 9 +++++----
crates/paimon/src/file_index/file_index_format.rs | 10 +++++-----
crates/paimon/src/io/file_io.rs | 16 ++++++++--------
crates/paimon/src/spec/index_manifest.rs | 1 +
crates/paimon/src/spec/manifest_common.rs | 1 +
crates/paimon/src/spec/manifest_entry.rs | 3 +--
crates/paimon/src/spec/types.rs | 19 ++++++-------------
7 files changed, 27 insertions(+), 32 deletions(-)
diff --git a/crates/paimon/src/error.rs b/crates/paimon/src/error.rs
index d7cfd18..1d7b50b 100644
--- a/crates/paimon/src/error.rs
+++ b/crates/paimon/src/error.rs
@@ -40,7 +40,8 @@ pub enum Error {
)]
IoUnexpected {
message: String,
- source: opendal::Error,
+ #[snafu(source(from(opendal::Error, Box::new)))]
+ source: Box<opendal::Error>,
},
#[snafu(
visibility(pub(crate)),
@@ -58,7 +59,7 @@ pub enum Error {
)]
DataUnexpected {
message: String,
- source: apache_avro::Error,
+ source: Box<apache_avro::Error>,
},
#[snafu(
visibility(pub(crate)),
@@ -72,7 +73,7 @@ impl From<opendal::Error> for Error {
// TODO: Simple use IoUnexpected for now
Error::IoUnexpected {
message: "IO operation failed on underlying storage".to_string(),
- source,
+ source: Box::new(source),
}
}
}
@@ -81,7 +82,7 @@ impl From<apache_avro::Error> for Error {
fn from(source: apache_avro::Error) -> Self {
Error::DataUnexpected {
message: "".to_string(),
- source,
+ source: Box::new(source),
}
}
}
diff --git a/crates/paimon/src/file_index/file_index_format.rs
b/crates/paimon/src/file_index/file_index_format.rs
index 696fea8..7a23871 100644
--- a/crates/paimon/src/file_index/file_index_format.rs
+++ b/crates/paimon/src/file_index/file_index_format.rs
@@ -230,7 +230,7 @@ impl FileIndex {
Ok(result)
} else {
Err(Error::FileIndexFormatInvalid {
- message: format!("Column '{}' not found in header",
column_name),
+ message: format!("Column '{column_name}' not found in header"),
})
}
}
@@ -292,7 +292,7 @@ impl FileIndexFormatReader {
let magic = buffer.get_u64_le();
if magic != MAGIC {
return Err(Error::FileIndexFormatInvalid {
- message: format!("Expected MAGIC: {}, but found: {}", MAGIC,
magic),
+ message: format!("Expected MAGIC: {MAGIC}, but found:
{magic}"),
});
}
@@ -339,7 +339,7 @@ impl FileIndexFormatReader {
// Column Name (variable-length UTF-8 string)
let column_name =
String::from_utf8(buffer.split_to(column_name_len as usize).to_vec())
.map_err(|e| Error::FileIndexFormatInvalid {
- message: format!("Invalid UTF-8 sequence in column name:
{}", e),
+ message: format!("Invalid UTF-8 sequence in column name:
{e}"),
})?;
current_offset += column_name_len as u64;
@@ -430,11 +430,11 @@ mod file_index_format_tests {
let mut indexes = HashMap::new();
for col_num in 1..5 {
- let column_name = format!("column{}", col_num);
+ let column_name = format!("column{col_num}");
let mut index_map = HashMap::new();
for idx_num in 1..5 {
index_map.insert(
- format!("index{}", idx_num),
+ format!("index{idx_num}"),
random_bytes(100 + col_num * idx_num),
);
}
diff --git a/crates/paimon/src/io/file_io.rs b/crates/paimon/src/io/file_io.rs
index 8b1d926..ee1b08f 100644
--- a/crates/paimon/src/io/file_io.rs
+++ b/crates/paimon/src/io/file_io.rs
@@ -39,7 +39,7 @@ impl FileIO {
/// The input HashMap is paimon-java's
[`Options`](https://github.com/apache/paimon/blob/release-0.8.2/paimon-common/src/main/java/org/apache/paimon/options/Options.java#L60)
pub fn from_url(path: &str) -> crate::Result<FileIOBuilder> {
let url = Url::parse(path).map_err(|_| Error::ConfigInvalid {
- message: format!("Invalid URL: {}", path),
+ message: format!("Invalid URL: {path}"),
})?;
Ok(FileIOBuilder::new(url.scheme()))
@@ -79,7 +79,7 @@ impl FileIO {
pub async fn get_status(&self, path: &str) -> Result<FileStatus> {
let (op, relative_path) = self.storage.create(path)?;
let meta = op.stat(relative_path).await.context(IoUnexpectedSnafu {
- message: format!("Failed to get file status for '{}'", path),
+ message: format!("Failed to get file status for '{path}'"),
})?;
Ok(FileStatus {
@@ -99,7 +99,7 @@ impl FileIO {
let (op, relative_path) = self.storage.create(path)?;
let entries = op.list(relative_path).await.context(IoUnexpectedSnafu {
- message: format!("Failed to list files in '{}'", path),
+ message: format!("Failed to list files in '{path}'"),
})?;
let mut statuses = Vec::new();
@@ -124,7 +124,7 @@ impl FileIO {
let (op, relative_path) = self.storage.create(path)?;
op.is_exist(relative_path).await.context(IoUnexpectedSnafu {
- message: format!("Failed to check existence of '{}'", path),
+ message: format!("Failed to check existence of '{path}'"),
})
}
@@ -135,7 +135,7 @@ impl FileIO {
let (op, relative_path) = self.storage.create(path)?;
op.delete(relative_path).await.context(IoUnexpectedSnafu {
- message: format!("Failed to delete file '{}'", path),
+ message: format!("Failed to delete file '{path}'"),
})?;
Ok(())
@@ -150,7 +150,7 @@ impl FileIO {
op.remove_all(relative_path)
.await
.context(IoUnexpectedSnafu {
- message: format!("Failed to delete directory '{}'", path),
+ message: format!("Failed to delete directory '{path}'"),
})?;
Ok(())
@@ -167,7 +167,7 @@ impl FileIO {
op.create_dir(relative_path)
.await
.context(IoUnexpectedSnafu {
- message: format!("Failed to create directory '{}'", path),
+ message: format!("Failed to create directory '{path}'"),
})?;
Ok(())
@@ -184,7 +184,7 @@ impl FileIO {
.rename(relative_path_src, relative_path_dst)
.await
.context(IoUnexpectedSnafu {
- message: format!("Failed to rename '{}' to '{}'", src, dst),
+ message: format!("Failed to rename '{src}' to '{dst}'"),
})?;
Ok(())
diff --git a/crates/paimon/src/spec/index_manifest.rs
b/crates/paimon/src/spec/index_manifest.rs
index 068edec..34ba10d 100644
--- a/crates/paimon/src/spec/index_manifest.rs
+++ b/crates/paimon/src/spec/index_manifest.rs
@@ -23,6 +23,7 @@ use std::fmt::{Display, Formatter};
/// Manifest entry for index file.
///
/// Impl Reference:
<https://github.com/apache/paimon/blob/release-0.8.2/paimon-core/src/main/java/org/apache/paimon/manifest/IndexManifestEntry.java>
+#[allow(dead_code)] // Part of spec; used when index manifest is implemented.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct IndexManifestEntry {
#[serde(rename = "_KIND")]
diff --git a/crates/paimon/src/spec/manifest_common.rs
b/crates/paimon/src/spec/manifest_common.rs
index 3f036d5..bfac29b 100644
--- a/crates/paimon/src/spec/manifest_common.rs
+++ b/crates/paimon/src/spec/manifest_common.rs
@@ -28,6 +28,7 @@ pub enum FileKind {
/// The Source of a file.
/// Impl References:
<https://github.com/apache/paimon/blob/release-0.8.2/paimon-core/src/main/java/org/apache/paimon/manifest/FileSource.java>
+#[allow(dead_code)] // Part of spec; used when file source is needed.
#[derive(PartialEq, Eq, Debug, Clone, Serialize_repr, Deserialize_repr)]
#[repr(u8)]
pub enum FileSource {
diff --git a/crates/paimon/src/spec/manifest_entry.rs
b/crates/paimon/src/spec/manifest_entry.rs
index 6e6cd58..df1dfab 100644
--- a/crates/paimon/src/spec/manifest_entry.rs
+++ b/crates/paimon/src/spec/manifest_entry.rs
@@ -17,8 +17,7 @@
use crate::spec::manifest_common::FileKind;
use crate::spec::DataFileMeta;
-use serde::Deserialize;
-use serde_with::serde_derive::Serialize;
+use serde::{Deserialize, Serialize};
/// The same {@link Identifier} indicates that the {@link ManifestEntry}
refers to the same data file.
///
diff --git a/crates/paimon/src/spec/types.rs b/crates/paimon/src/spec/types.rs
index e352d97..ed7f4e8 100644
--- a/crates/paimon/src/spec/types.rs
+++ b/crates/paimon/src/spec/types.rs
@@ -1506,29 +1506,22 @@ mod serde_utils {
) -> crate::Result<(usize, usize), Error> {
let Some(open_bracket) = s.find('(') else {
return Err(Error::DataTypeInvalid {
- message: format!(
- "Invalid {} specification. Missing opening bracket.",
- type_name
- )
- .to_string(),
+ message: format!("Invalid {type_name} specification. Missing
opening bracket.")
+ .to_string(),
});
};
let Some(close_bracket) = s.find(')') else {
return Err(Error::DataTypeInvalid {
- message: format!(
- "Invalid {} specification. Missing closing bracket.",
- type_name
- )
- .to_string(),
+ message: format!("Invalid {type_name} specification. Missing
closing bracket.")
+ .to_string(),
});
};
if open_bracket >= close_bracket {
return Err(Error::DataTypeInvalid {
message: format!(
- "Invalid {} specification. Opening bracket \
- appears after or at the same position as closing bracket.",
- type_name
+ "Invalid {type_name} specification. Opening bracket \
+ appears after or at the same position as closing bracket."
)
.to_string(),
});