mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 01:18: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)
|
Ok(flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn process_confirmed_action(
|
fn process_confirmed_action(
|
||||||
&mut self,
|
&mut self,
|
||||||
action: Action,
|
action: Action,
|
||||||
|
|
@ -974,9 +973,7 @@ impl App {
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
match action {
|
match action {
|
||||||
Action::Reset(r) => {
|
Action::Reset(r) => {
|
||||||
if self.status_tab.reset(&r) {
|
self.status_tab.reset(&r);
|
||||||
flags.insert(NeedsUpdate::ALL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Action::StashDrop(_) | Action::StashPop(_) => {
|
Action::StashDrop(_) | Action::StashPop(_) => {
|
||||||
if let Err(e) = self
|
if let Err(e) = self
|
||||||
|
|
@ -987,8 +984,6 @@ impl App {
|
||||||
e.to_string(),
|
e.to_string(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
flags.insert(NeedsUpdate::ALL);
|
|
||||||
}
|
}
|
||||||
Action::ResetHunk(path, hash) => {
|
Action::ResetHunk(path, hash) => {
|
||||||
sync::reset_hunk(
|
sync::reset_hunk(
|
||||||
|
|
@ -997,7 +992,6 @@ impl App {
|
||||||
hash,
|
hash,
|
||||||
Some(self.options.borrow().diff_options()),
|
Some(self.options.borrow().diff_options()),
|
||||||
)?;
|
)?;
|
||||||
flags.insert(NeedsUpdate::ALL);
|
|
||||||
}
|
}
|
||||||
Action::ResetLines(path, lines) => {
|
Action::ResetLines(path, lines) => {
|
||||||
sync::discard_lines(
|
sync::discard_lines(
|
||||||
|
|
@ -1005,7 +999,6 @@ impl App {
|
||||||
&path,
|
&path,
|
||||||
&lines,
|
&lines,
|
||||||
)?;
|
)?;
|
||||||
flags.insert(NeedsUpdate::ALL);
|
|
||||||
}
|
}
|
||||||
Action::DeleteLocalBranch(branch_ref) => {
|
Action::DeleteLocalBranch(branch_ref) => {
|
||||||
if let Err(e) = sync::delete_branch(
|
if let Err(e) = sync::delete_branch(
|
||||||
|
|
@ -1016,50 +1009,14 @@ impl App {
|
||||||
e.to_string(),
|
e.to_string(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
flags.insert(NeedsUpdate::ALL);
|
|
||||||
self.select_branch_popup.update_branches()?;
|
self.select_branch_popup.update_branches()?;
|
||||||
}
|
}
|
||||||
Action::DeleteRemoteBranch(branch_ref) => {
|
Action::DeleteRemoteBranch(branch_ref) => {
|
||||||
self.queue.push(
|
self.delete_remote_branch(&branch_ref)?;
|
||||||
//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()?;
|
|
||||||
}
|
}
|
||||||
Action::DeleteTag(tag_name) => {
|
Action::DeleteTag(tag_name) => {
|
||||||
if let Err(error) =
|
self.delete_tag(tag_name)?;
|
||||||
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()?;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Action::DeleteRemoteTag(tag_name, _remote) => {
|
Action::DeleteRemoteTag(tag_name, _remote) => {
|
||||||
self.queue.push(InternalEvent::Push(
|
self.queue.push(InternalEvent::Push(
|
||||||
|
|
@ -1079,18 +1036,64 @@ impl App {
|
||||||
}
|
}
|
||||||
Action::PullMerge { rebase, .. } => {
|
Action::PullMerge { rebase, .. } => {
|
||||||
self.pull_popup.try_conflict_free_merge(rebase);
|
self.pull_popup.try_conflict_free_merge(rebase);
|
||||||
flags.insert(NeedsUpdate::ALL);
|
|
||||||
}
|
}
|
||||||
Action::AbortRevert | Action::AbortMerge => {
|
Action::AbortRevert | Action::AbortMerge => {
|
||||||
self.status_tab.revert_pending_state();
|
self.status_tab.revert_pending_state();
|
||||||
flags.insert(NeedsUpdate::ALL);
|
|
||||||
}
|
}
|
||||||
Action::AbortRebase => {
|
Action::AbortRebase => {
|
||||||
self.status_tab.abort_rebase();
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue