cli: Vanity review.rs update

Absorb a nested `if .. else` block into the match statement.
This commit is contained in:
Slack Coder 2023-07-13 10:21:59 -05:00 committed by Alexis Sellier
parent fe00ed7ca7
commit 2a0643cf1c
No known key found for this signature in database
1 changed files with 35 additions and 36 deletions

View File

@ -233,8 +233,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
by_hunk, by_hunk,
unified, unified,
hunk, hunk,
} => { } if by_hunk => {
if by_hunk {
let mut opts = git::raw::DiffOptions::new(); let mut opts = git::raw::DiffOptions::new();
opts.patience(true) opts.patience(true)
.minimal(true) .minimal(true)
@ -244,7 +243,8 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
.hunk(hunk) .hunk(hunk)
.verdict(verdict) .verdict(verdict)
.run(revision, &mut opts)?; .run(revision, &mut opts)?;
} else { }
Operation::Review { verdict, .. } => {
let message = options.message.get(REVIEW_HELP_MSG)?; let message = options.message.get(REVIEW_HELP_MSG)?;
let message = message.replace(REVIEW_HELP_MSG.trim(), ""); let message = message.replace(REVIEW_HELP_MSG.trim(), "");
let message = if message.is_empty() { let message = if message.is_empty() {
@ -274,7 +274,6 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
} }
} }
} }
}
Operation::Delete => { Operation::Delete => {
let name = git::refs::storage::draft::review(profile.id(), &patch_id); let name = git::refs::storage::draft::review(profile.id(), &patch_id);