Skip to content

Commit 63817c0

Browse files
committed
ci: fix clippy warn error to long issue
1 parent 1f69c4a commit 63817c0

File tree

7 files changed

+27
-32
lines changed

7 files changed

+27
-32
lines changed

crates/paimon/src/error.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ pub enum Error {
4040
)]
4141
IoUnexpected {
4242
message: String,
43-
source: opendal::Error,
43+
#[snafu(source(from(opendal::Error, Box::new)))]
44+
source: Box<opendal::Error>,
4445
},
4546
#[snafu(
4647
visibility(pub(crate)),
@@ -58,7 +59,7 @@ pub enum Error {
5859
)]
5960
DataUnexpected {
6061
message: String,
61-
source: apache_avro::Error,
62+
source: Box<apache_avro::Error>,
6263
},
6364
#[snafu(
6465
visibility(pub(crate)),
@@ -72,7 +73,7 @@ impl From<opendal::Error> for Error {
7273
// TODO: Simple use IoUnexpected for now
7374
Error::IoUnexpected {
7475
message: "IO operation failed on underlying storage".to_string(),
75-
source,
76+
source: Box::new(source),
7677
}
7778
}
7879
}
@@ -81,7 +82,7 @@ impl From<apache_avro::Error> for Error {
8182
fn from(source: apache_avro::Error) -> Self {
8283
Error::DataUnexpected {
8384
message: "".to_string(),
84-
source,
85+
source: Box::new(source),
8586
}
8687
}
8788
}

crates/paimon/src/file_index/file_index_format.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ impl FileIndex {
230230
Ok(result)
231231
} else {
232232
Err(Error::FileIndexFormatInvalid {
233-
message: format!("Column '{}' not found in header", column_name),
233+
message: format!("Column '{column_name}' not found in header"),
234234
})
235235
}
236236
}
@@ -292,7 +292,7 @@ impl FileIndexFormatReader {
292292
let magic = buffer.get_u64_le();
293293
if magic != MAGIC {
294294
return Err(Error::FileIndexFormatInvalid {
295-
message: format!("Expected MAGIC: {}, but found: {}", MAGIC, magic),
295+
message: format!("Expected MAGIC: {MAGIC}, but found: {magic}"),
296296
});
297297
}
298298

@@ -339,7 +339,7 @@ impl FileIndexFormatReader {
339339
// Column Name (variable-length UTF-8 string)
340340
let column_name = String::from_utf8(buffer.split_to(column_name_len as usize).to_vec())
341341
.map_err(|e| Error::FileIndexFormatInvalid {
342-
message: format!("Invalid UTF-8 sequence in column name: {}", e),
342+
message: format!("Invalid UTF-8 sequence in column name: {e}"),
343343
})?;
344344
current_offset += column_name_len as u64;
345345

@@ -430,11 +430,11 @@ mod file_index_format_tests {
430430

431431
let mut indexes = HashMap::new();
432432
for col_num in 1..5 {
433-
let column_name = format!("column{}", col_num);
433+
let column_name = format!("column{col_num}");
434434
let mut index_map = HashMap::new();
435435
for idx_num in 1..5 {
436436
index_map.insert(
437-
format!("index{}", idx_num),
437+
format!("index{idx_num}"),
438438
random_bytes(100 + col_num * idx_num),
439439
);
440440
}

crates/paimon/src/io/file_io.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl FileIO {
3939
/// 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)
4040
pub fn from_url(path: &str) -> crate::Result<FileIOBuilder> {
4141
let url = Url::parse(path).map_err(|_| Error::ConfigInvalid {
42-
message: format!("Invalid URL: {}", path),
42+
message: format!("Invalid URL: {path}"),
4343
})?;
4444

4545
Ok(FileIOBuilder::new(url.scheme()))
@@ -79,7 +79,7 @@ impl FileIO {
7979
pub async fn get_status(&self, path: &str) -> Result<FileStatus> {
8080
let (op, relative_path) = self.storage.create(path)?;
8181
let meta = op.stat(relative_path).await.context(IoUnexpectedSnafu {
82-
message: format!("Failed to get file status for '{}'", path),
82+
message: format!("Failed to get file status for '{path}'"),
8383
})?;
8484

8585
Ok(FileStatus {
@@ -99,7 +99,7 @@ impl FileIO {
9999
let (op, relative_path) = self.storage.create(path)?;
100100

101101
let entries = op.list(relative_path).await.context(IoUnexpectedSnafu {
102-
message: format!("Failed to list files in '{}'", path),
102+
message: format!("Failed to list files in '{path}'"),
103103
})?;
104104

105105
let mut statuses = Vec::new();
@@ -124,7 +124,7 @@ impl FileIO {
124124
let (op, relative_path) = self.storage.create(path)?;
125125

126126
op.is_exist(relative_path).await.context(IoUnexpectedSnafu {
127-
message: format!("Failed to check existence of '{}'", path),
127+
message: format!("Failed to check existence of '{path}'"),
128128
})
129129
}
130130

@@ -135,7 +135,7 @@ impl FileIO {
135135
let (op, relative_path) = self.storage.create(path)?;
136136

137137
op.delete(relative_path).await.context(IoUnexpectedSnafu {
138-
message: format!("Failed to delete file '{}'", path),
138+
message: format!("Failed to delete file '{path}'"),
139139
})?;
140140

141141
Ok(())
@@ -150,7 +150,7 @@ impl FileIO {
150150
op.remove_all(relative_path)
151151
.await
152152
.context(IoUnexpectedSnafu {
153-
message: format!("Failed to delete directory '{}'", path),
153+
message: format!("Failed to delete directory '{path}'"),
154154
})?;
155155

156156
Ok(())
@@ -167,7 +167,7 @@ impl FileIO {
167167
op.create_dir(relative_path)
168168
.await
169169
.context(IoUnexpectedSnafu {
170-
message: format!("Failed to create directory '{}'", path),
170+
message: format!("Failed to create directory '{path}'"),
171171
})?;
172172

173173
Ok(())
@@ -184,7 +184,7 @@ impl FileIO {
184184
.rename(relative_path_src, relative_path_dst)
185185
.await
186186
.context(IoUnexpectedSnafu {
187-
message: format!("Failed to rename '{}' to '{}'", src, dst),
187+
message: format!("Failed to rename '{src}' to '{dst}'"),
188188
})?;
189189

190190
Ok(())

crates/paimon/src/spec/index_manifest.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use std::fmt::{Display, Formatter};
2323
/// Manifest entry for index file.
2424
///
2525
/// Impl Reference: <https://github.com/apache/paimon/blob/release-0.8.2/paimon-core/src/main/java/org/apache/paimon/manifest/IndexManifestEntry.java>
26+
#[allow(dead_code)] // Part of spec; used when index manifest is implemented.
2627
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
2728
pub struct IndexManifestEntry {
2829
#[serde(rename = "_KIND")]

crates/paimon/src/spec/manifest_common.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub enum FileKind {
2828

2929
/// The Source of a file.
3030
/// Impl References: <https://github.com/apache/paimon/blob/release-0.8.2/paimon-core/src/main/java/org/apache/paimon/manifest/FileSource.java>
31+
#[allow(dead_code)] // Part of spec; used when file source is needed.
3132
#[derive(PartialEq, Eq, Debug, Clone, Serialize_repr, Deserialize_repr)]
3233
#[repr(u8)]
3334
pub enum FileSource {

crates/paimon/src/spec/manifest_entry.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717

1818
use crate::spec::manifest_common::FileKind;
1919
use crate::spec::DataFileMeta;
20-
use serde::Deserialize;
21-
use serde_with::serde_derive::Serialize;
20+
use serde::{Deserialize, Serialize};
2221

2322
/// The same {@link Identifier} indicates that the {@link ManifestEntry} refers to the same data file.
2423
///

crates/paimon/src/spec/types.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,29 +1506,22 @@ mod serde_utils {
15061506
) -> crate::Result<(usize, usize), Error> {
15071507
let Some(open_bracket) = s.find('(') else {
15081508
return Err(Error::DataTypeInvalid {
1509-
message: format!(
1510-
"Invalid {} specification. Missing opening bracket.",
1511-
type_name
1512-
)
1513-
.to_string(),
1509+
message: format!("Invalid {type_name} specification. Missing opening bracket.")
1510+
.to_string(),
15141511
});
15151512
};
15161513
let Some(close_bracket) = s.find(')') else {
15171514
return Err(Error::DataTypeInvalid {
1518-
message: format!(
1519-
"Invalid {} specification. Missing closing bracket.",
1520-
type_name
1521-
)
1522-
.to_string(),
1515+
message: format!("Invalid {type_name} specification. Missing closing bracket.")
1516+
.to_string(),
15231517
});
15241518
};
15251519

15261520
if open_bracket >= close_bracket {
15271521
return Err(Error::DataTypeInvalid {
15281522
message: format!(
1529-
"Invalid {} specification. Opening bracket \
1530-
appears after or at the same position as closing bracket.",
1531-
type_name
1523+
"Invalid {type_name} specification. Opening bracket \
1524+
appears after or at the same position as closing bracket."
15321525
)
15331526
.to_string(),
15341527
});

0 commit comments

Comments
 (0)