more clippy fixes

This commit is contained in:
Nikita Galaiko 2023-10-13 12:56:33 +02:00 committed by GitButler
parent 8accaa1fec
commit 45daddeaa3
2 changed files with 13 additions and 17 deletions

View File

@ -47,7 +47,7 @@ impl super::RunCommand for Commit {
None => return Ok(()), None => return Ok(()),
}; };
let commit_branch = ids[selection].clone(); let commit_branch = ids[selection];
println!( println!(
"Committing virtual branch {}", "Committing virtual branch {}",
commit_branch.to_string().red() commit_branch.to_string().red()

View File

@ -1533,14 +1533,13 @@ fn get_applied_status(
.unwrap_or(current_hunk.modified_at); .unwrap_or(current_hunk.modified_at);
// push hunk to the end of the list, preserving the order // push hunk to the end of the list, preserving the order
hunks_by_branch_id hunks_by_branch_id.entry(branch.id).or_default().push(
.entry(branch.id.clone()) VirtualBranchHunk {
.or_default()
.push(VirtualBranchHunk {
id: ch.with_timestamp(timestamp).to_string(), id: ch.with_timestamp(timestamp).to_string(),
modified_at: timestamp, modified_at: timestamp,
..current_hunk.clone() ..current_hunk.clone()
}); },
);
// remove the hunk from the current hunks because each hunk can // remove the hunk from the current hunks because each hunk can
// only be owned once // only be owned once
@ -1550,16 +1549,13 @@ fn get_applied_status(
} else if owned_hunk.intersects(&ch) { } else if owned_hunk.intersects(&ch) {
// if it's an intersection, push the hunk to the beginning, // if it's an intersection, push the hunk to the beginning,
// indicating the the hunk has been updated // indicating the the hunk has been updated
hunks_by_branch_id hunks_by_branch_id.entry(branch.id).or_default().insert(
.entry(branch.id.clone()) 0,
.or_default() VirtualBranchHunk {
.insert( id: ch.to_string(),
0, ..current_hunk.clone()
VirtualBranchHunk { },
id: ch.to_string(), );
..current_hunk.clone()
},
);
// track updated hunks to bubble them up later // track updated hunks to bubble them up later
updated.push(FileOwnership { updated.push(FileOwnership {
@ -1613,7 +1609,7 @@ fn get_applied_status(
.unwrap(), .unwrap(),
); );
hunks_by_branch_id hunks_by_branch_id
.entry(virtual_branches[0].id.clone()) .entry(virtual_branches[0].id)
.or_default() .or_default()
.push(hunk.clone()); .push(hunk.clone());
} }