Skip to content

Commit 2a7400b

Browse files
cargo clippy
1 parent 0337635 commit 2a7400b

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
@@ -108,9 +108,8 @@ impl<Location: AsUrl> ParsedLogPath<Location> {
108108
#[internal_api]
109109
pub(crate) fn try_from(location: Location) -> Option<ParsedLogPath<Location>> {
110110
let url = location.as_url();
111-
let Some(mut path_segments) = url.path_segments() else {
112-
return None;
113-
};
111+
let mut path_segments = url.path_segments()?;
112+
114113
#[allow(clippy::unwrap_used)]
115114
let filename = path_segments
116115
.next_back()
@@ -176,24 +175,16 @@ impl<Location: AsUrl> ParsedLogPath<Location> {
176175
["crc"] if in_delta_log_dir => LogPathFileType::Crc,
177176
["checkpoint", "parquet"] if in_delta_log_dir => LogPathFileType::SinglePartCheckpoint,
178177
["checkpoint", uuid, "json" | "parquet"] if in_delta_log_dir => {
179-
let Some(_) = parse_path_part::<String>(uuid, UUID_PART_LEN) else {
180-
return None;
181-
};
178+
let _ = parse_path_part::<String>(uuid, UUID_PART_LEN)?;
182179
LogPathFileType::UuidCheckpoint
183180
}
184181
[hi, "compacted", "json"] if in_delta_log_dir => {
185-
let Some(hi) = parse_path_part(hi, VERSION_LEN) else {
186-
return None;
187-
};
182+
let hi = parse_path_part(hi, VERSION_LEN)?;
188183
LogPathFileType::CompactedCommit { hi }
189184
}
190185
["checkpoint", part_num, num_parts, "parquet"] if in_delta_log_dir => {
191-
let Some(part_num) = parse_path_part(part_num, MULTIPART_PART_LEN) else {
192-
return None;
193-
};
194-
let Some(num_parts) = parse_path_part(num_parts, MULTIPART_PART_LEN) else {
195-
return None;
196-
};
186+
let part_num = parse_path_part(part_num, MULTIPART_PART_LEN)?;
187+
let num_parts = parse_path_part(num_parts, MULTIPART_PART_LEN)?;
197188

198189
// A valid part_num must be in the range [1, num_parts]
199190
if !(0 < part_num && part_num <= num_parts) {
@@ -473,10 +464,7 @@ mod tests {
473464
// ignored - no extension
474465
let log_path = table_log_dir.join("00000000000000000010").unwrap();
475466
let result = ParsedLogPath::try_from(log_path);
476-
assert!(
477-
matches!(result, None),
478-
"Expected Ok(None) for missing file extension"
479-
);
467+
assert!(result.is_none());
480468

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

0 commit comments

Comments
 (0)