mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-11 22:53:00 +00:00
chore(run-files): fix pre-existing clippy lints
- classify_section now returns FileDiffChangeKind directly (unnecessary_wraps) - collapse nested Some(...) or-pattern into single arm (unnested_or_patterns) - replace .unwrap() with .expect() in append_completed_run_with_final_patch test helper (unwrap_used) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7feef1c6b2
commit
a6a11cdd82
2 changed files with 13 additions and 13 deletions
|
|
@ -431,7 +431,7 @@ fn build_fallback_response(
|
|||
Vec::with_capacity(original_section_count.min(FILE_COUNT_CAP));
|
||||
|
||||
for section in sections.iter().take(FILE_COUNT_CAP) {
|
||||
let change_kind = classify_section(section).unwrap_or(FileDiffChangeKind::Modified);
|
||||
let change_kind = classify_section(section);
|
||||
let (old_name, new_name) = section_paths(section, Some(change_kind));
|
||||
let mut diff = degraded_file_diff(old_name, new_name, change_kind);
|
||||
|
||||
|
|
@ -549,34 +549,34 @@ fn split_patch_sections(patch: &str) -> Vec<PatchSection<'_>> {
|
|||
.collect()
|
||||
}
|
||||
|
||||
fn classify_section(section: &PatchSection<'_>) -> Option<FileDiffChangeKind> {
|
||||
fn classify_section(section: &PatchSection<'_>) -> FileDiffChangeKind {
|
||||
if section
|
||||
.body
|
||||
.lines()
|
||||
.any(|line| patch_mode_line_matches(line, "120000"))
|
||||
{
|
||||
return Some(FileDiffChangeKind::Symlink);
|
||||
return FileDiffChangeKind::Symlink;
|
||||
}
|
||||
if section
|
||||
.body
|
||||
.lines()
|
||||
.any(|line| patch_mode_line_matches(line, "160000"))
|
||||
{
|
||||
return Some(FileDiffChangeKind::Submodule);
|
||||
return FileDiffChangeKind::Submodule;
|
||||
}
|
||||
if section
|
||||
.body
|
||||
.lines()
|
||||
.any(|line| line.starts_with("new file mode "))
|
||||
{
|
||||
return Some(FileDiffChangeKind::Added);
|
||||
return FileDiffChangeKind::Added;
|
||||
}
|
||||
if section
|
||||
.body
|
||||
.lines()
|
||||
.any(|line| line.starts_with("deleted file mode "))
|
||||
{
|
||||
return Some(FileDiffChangeKind::Deleted);
|
||||
return FileDiffChangeKind::Deleted;
|
||||
}
|
||||
let mut has_rename_from = false;
|
||||
let mut has_rename_to = false;
|
||||
|
|
@ -585,9 +585,9 @@ fn classify_section(section: &PatchSection<'_>) -> Option<FileDiffChangeKind> {
|
|||
has_rename_to |= line.starts_with("rename to ");
|
||||
}
|
||||
if has_rename_from && has_rename_to {
|
||||
return Some(FileDiffChangeKind::Renamed);
|
||||
return FileDiffChangeKind::Renamed;
|
||||
}
|
||||
Some(FileDiffChangeKind::Modified)
|
||||
FileDiffChangeKind::Modified
|
||||
}
|
||||
|
||||
fn section_is_binary(section: &PatchSection<'_>) -> bool {
|
||||
|
|
@ -643,7 +643,7 @@ fn section_to_stats(section: &PatchSection<'_>, is_sensitive_fn: fn(&str) -> boo
|
|||
|| section_is_binary(section)
|
||||
|| matches!(
|
||||
classify_section(section),
|
||||
Some(FileDiffChangeKind::Symlink) | Some(FileDiffChangeKind::Submodule)
|
||||
FileDiffChangeKind::Symlink | FileDiffChangeKind::Submodule
|
||||
)
|
||||
{
|
||||
return DiffStats::default();
|
||||
|
|
@ -1595,7 +1595,7 @@ mod tests {
|
|||
|
||||
for (patch, expected) in cases {
|
||||
let section = split_patch_sections(patch).pop().expect("section");
|
||||
assert_eq!(classify_section(§ion), Some(expected));
|
||||
assert_eq!(classify_section(§ion), expected);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ async fn append_completed_run_with_final_patch(
|
|||
run_id: &RunId,
|
||||
final_patch: &str,
|
||||
) {
|
||||
let run_store = store.create_run(run_id).await.unwrap();
|
||||
let run_store = store.create_run(run_id).await.expect("create run store");
|
||||
workflow_event::append_event(
|
||||
&run_store,
|
||||
run_id,
|
||||
|
|
@ -62,7 +62,7 @@ async fn append_completed_run_with_final_patch(
|
|||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
.expect("append WorkflowRunStarted");
|
||||
workflow_event::append_event(
|
||||
&run_store,
|
||||
run_id,
|
||||
|
|
@ -78,7 +78,7 @@ async fn append_completed_run_with_final_patch(
|
|||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
.expect("append WorkflowRunCompleted");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue