Skip to content

Commit 6a31005

Browse files
committed
fix: switch nested if statements with let chains for better readability
1 parent a9cc88c commit 6a31005

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

src/ops/sources/google_drive.rs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -314,14 +314,12 @@ impl SourceExecutor for Executor {
314314
.list_files(&folder_id, &fields, &mut next_page_token)
315315
.await?;
316316
for file in files {
317-
if let Some(max_size) = self.max_file_size {
318-
if let Some(file_size) = file.size {
319-
if file_size > max_size {
317+
if let Some(max_size) = self.max_file_size
318+
&& let Some(file_size) = file.size
319+
&& file_size > max_size {
320320
// Skip files over the specified limit
321321
continue;
322322
}
323-
}
324-
}
325323
curr_rows.extend(self.visit_file(file, &mut new_folder_ids, &mut seen_ids)?);
326324
}
327325
if !curr_rows.is_empty() {
@@ -368,16 +366,15 @@ impl SourceExecutor for Executor {
368366
}
369367
};
370368
// Check file size limit
371-
if let Some(max_size) = self.max_file_size {
372-
if let Some(file_size) = file.size {
373-
if file_size > max_size {
374-
return Ok(PartialSourceRowData {
375-
value: Some(SourceValue::NonExistence),
376-
ordinal: Some(Ordinal::unavailable()),
377-
content_version_fp: None,
378-
});
379-
}
380-
}
369+
if let Some(max_size) = self.max_file_size
370+
&& let Some(file_size) = file.size
371+
&& file_size > max_size
372+
{
373+
return Ok(PartialSourceRowData {
374+
value: Some(SourceValue::NonExistence),
375+
ordinal: Some(Ordinal::unavailable()),
376+
content_version_fp: None,
377+
});
381378
}
382379
let ordinal = if options.include_ordinal {
383380
file.modified_time.map(|t| t.try_into()).transpose()?

0 commit comments

Comments
 (0)