mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 08:58:21 +00:00
clippy fix
This commit is contained in:
parent
347e6e43e7
commit
809281f1ab
1 changed files with 53 additions and 50 deletions
103
src/app.rs
103
src/app.rs
|
|
@ -966,7 +966,6 @@ impl App {
|
|||
Ok(flags)
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
fn process_confirmed_action(
|
||||
&mut self,
|
||||
action: Action,
|
||||
|
|
@ -974,9 +973,7 @@ impl App {
|
|||
) -> Result<()> {
|
||||
match action {
|
||||
Action::Reset(r) => {
|
||||
if self.status_tab.reset(&r) {
|
||||
flags.insert(NeedsUpdate::ALL);
|
||||
}
|
||||
self.status_tab.reset(&r);
|
||||
}
|
||||
Action::StashDrop(_) | Action::StashPop(_) => {
|
||||
if let Err(e) = self
|
||||
|
|
@ -987,8 +984,6 @@ impl App {
|
|||
e.to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
flags.insert(NeedsUpdate::ALL);
|
||||
}
|
||||
Action::ResetHunk(path, hash) => {
|
||||
sync::reset_hunk(
|
||||
|
|
@ -997,7 +992,6 @@ impl App {
|
|||
hash,
|
||||
Some(self.options.borrow().diff_options()),
|
||||
)?;
|
||||
flags.insert(NeedsUpdate::ALL);
|
||||
}
|
||||
Action::ResetLines(path, lines) => {
|
||||
sync::discard_lines(
|
||||
|
|
@ -1005,7 +999,6 @@ impl App {
|
|||
&path,
|
||||
&lines,
|
||||
)?;
|
||||
flags.insert(NeedsUpdate::ALL);
|
||||
}
|
||||
Action::DeleteLocalBranch(branch_ref) => {
|
||||
if let Err(e) = sync::delete_branch(
|
||||
|
|
@ -1016,50 +1009,14 @@ impl App {
|
|||
e.to_string(),
|
||||
));
|
||||
}
|
||||
flags.insert(NeedsUpdate::ALL);
|
||||
|
||||
self.select_branch_popup.update_branches()?;
|
||||
}
|
||||
Action::DeleteRemoteBranch(branch_ref) => {
|
||||
self.queue.push(
|
||||
//TODO: check if this is correct based on the fix in `c6abbaf`
|
||||
branch_ref.rsplit('/').next().map_or_else(
|
||||
|| {
|
||||
InternalEvent::ShowErrorMsg(format!(
|
||||
"Failed to find the branch name in {branch_ref}"
|
||||
))
|
||||
},
|
||||
|name| {
|
||||
InternalEvent::Push(
|
||||
name.to_string(),
|
||||
PushType::Branch,
|
||||
false,
|
||||
true,
|
||||
)
|
||||
},
|
||||
),
|
||||
);
|
||||
flags.insert(NeedsUpdate::ALL);
|
||||
self.select_branch_popup.update_branches()?;
|
||||
self.delete_remote_branch(&branch_ref)?;
|
||||
}
|
||||
Action::DeleteTag(tag_name) => {
|
||||
if let Err(error) =
|
||||
sync::delete_tag(&self.repo.borrow(), &tag_name)
|
||||
{
|
||||
self.queue.push(InternalEvent::ShowErrorMsg(
|
||||
error.to_string(),
|
||||
));
|
||||
} else {
|
||||
let remote = sync::get_default_remote(
|
||||
&self.repo.borrow(),
|
||||
)?;
|
||||
|
||||
self.queue.push(InternalEvent::ConfirmAction(
|
||||
Action::DeleteRemoteTag(tag_name, remote),
|
||||
));
|
||||
|
||||
flags.insert(NeedsUpdate::ALL);
|
||||
self.tags_popup.update_tags()?;
|
||||
}
|
||||
self.delete_tag(tag_name)?;
|
||||
}
|
||||
Action::DeleteRemoteTag(tag_name, _remote) => {
|
||||
self.queue.push(InternalEvent::Push(
|
||||
|
|
@ -1079,18 +1036,64 @@ impl App {
|
|||
}
|
||||
Action::PullMerge { rebase, .. } => {
|
||||
self.pull_popup.try_conflict_free_merge(rebase);
|
||||
flags.insert(NeedsUpdate::ALL);
|
||||
}
|
||||
Action::AbortRevert | Action::AbortMerge => {
|
||||
self.status_tab.revert_pending_state();
|
||||
flags.insert(NeedsUpdate::ALL);
|
||||
}
|
||||
Action::AbortRebase => {
|
||||
self.status_tab.abort_rebase();
|
||||
flags.insert(NeedsUpdate::ALL);
|
||||
}
|
||||
};
|
||||
|
||||
flags.insert(NeedsUpdate::ALL);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn delete_tag(&mut self, tag_name: String) -> Result<()> {
|
||||
if let Err(error) =
|
||||
sync::delete_tag(&self.repo.borrow(), &tag_name)
|
||||
{
|
||||
self.queue
|
||||
.push(InternalEvent::ShowErrorMsg(error.to_string()));
|
||||
} else {
|
||||
let remote =
|
||||
sync::get_default_remote(&self.repo.borrow())?;
|
||||
|
||||
self.queue.push(InternalEvent::ConfirmAction(
|
||||
Action::DeleteRemoteTag(tag_name, remote),
|
||||
));
|
||||
|
||||
self.tags_popup.update_tags()?;
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn delete_remote_branch(
|
||||
&mut self,
|
||||
branch_ref: &str,
|
||||
) -> Result<()> {
|
||||
self.queue.push(
|
||||
//TODO: check if this is correct based on the fix in `c6abbaf`
|
||||
branch_ref.rsplit('/').next().map_or_else(
|
||||
|| {
|
||||
InternalEvent::ShowErrorMsg(format!(
|
||||
"Failed to find the branch name in {branch_ref}"
|
||||
))
|
||||
},
|
||||
|name| {
|
||||
InternalEvent::Push(
|
||||
name.to_string(),
|
||||
PushType::Branch,
|
||||
false,
|
||||
true,
|
||||
)
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
self.select_branch_popup.update_branches()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue