Skip to content

Commit 7f86cf8

Browse files
cargo clippy
1 parent bcc8ff5 commit 7f86cf8

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

kernel/src/path.rs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,8 @@ impl<Location: AsUrl> ParsedLogPath<Location> {
110110
#[internal_api]
111111
pub(crate) fn try_from(location: Location) -> Option<ParsedLogPath<Location>> {
112112
let url = location.as_url();
113-
let Some(mut path_segments) = url.path_segments() else {
114-
return None;
115-
};
113+
let mut path_segments = url.path_segments()?;
114+
116115
#[allow(clippy::unwrap_used)]
117116
let filename = path_segments
118117
.next_back()
@@ -178,24 +177,16 @@ impl<Location: AsUrl> ParsedLogPath<Location> {
178177
["crc"] if in_delta_log_dir => LogPathFileType::Crc,
179178
["checkpoint", "parquet"] if in_delta_log_dir => LogPathFileType::SinglePartCheckpoint,
180179
["checkpoint", uuid, "json" | "parquet"] if in_delta_log_dir => {
181-
let Some(_) = parse_path_part::<String>(uuid, UUID_PART_LEN) else {
182-
return None;
183-
};
180+
let _ = parse_path_part::<String>(uuid, UUID_PART_LEN)?;
184181
LogPathFileType::UuidCheckpoint
185182
}
186183
[hi, "compacted", "json"] if in_delta_log_dir => {
187-
let Some(hi) = parse_path_part(hi, VERSION_LEN) else {
188-
return None;
189-
};
184+
let hi = parse_path_part(hi, VERSION_LEN)?;
190185
LogPathFileType::CompactedCommit { hi }
191186
}
192187
["checkpoint", part_num, num_parts, "parquet"] if in_delta_log_dir => {
193-
let Some(part_num) = parse_path_part(part_num, MULTIPART_PART_LEN) else {
194-
return None;
195-
};
196-
let Some(num_parts) = parse_path_part(num_parts, MULTIPART_PART_LEN) else {
197-
return None;
198-
};
188+
let part_num = parse_path_part(part_num, MULTIPART_PART_LEN)?;
189+
let num_parts = parse_path_part(num_parts, MULTIPART_PART_LEN)?;
199190

200191
// A valid part_num must be in the range [1, num_parts]
201192
if !(0 < part_num && part_num <= num_parts) {
@@ -492,10 +483,7 @@ mod tests {
492483
// ignored - no extension
493484
let log_path = table_log_dir.join("00000000000000000010").unwrap();
494485
let result = ParsedLogPath::try_from(log_path);
495-
assert!(
496-
matches!(result, None),
497-
"Expected Ok(None) for missing file extension"
498-
);
486+
assert!(result.is_none());
499487

500488
// empty extension - should be treated as unknown file type
501489
let log_path = table_log_dir.join("00000000000000000011.").unwrap();

0 commit comments

Comments
 (0)