mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 09:28:21 +00:00
fix latest clippy (#2597)
This commit is contained in:
parent
7f75307f6e
commit
cc907996f4
21 changed files with 44 additions and 24 deletions
|
|
@ -271,7 +271,7 @@ pub fn config_is_pull_rebase(repo_path: &RepoPath) -> Result<bool> {
|
||||||
let value =
|
let value =
|
||||||
rebase.value().map(String::from).unwrap_or_default();
|
rebase.value().map(String::from).unwrap_or_default();
|
||||||
return Ok(value == "true");
|
return Ok(value == "true");
|
||||||
};
|
}
|
||||||
|
|
||||||
Ok(false)
|
Ok(false)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,6 @@ pub fn amend(
|
||||||
/// Wrap `Repository::signature` to allow unknown user.name.
|
/// Wrap `Repository::signature` to allow unknown user.name.
|
||||||
///
|
///
|
||||||
/// See <https://github.com/gitui-org/gitui/issues/79>.
|
/// See <https://github.com/gitui-org/gitui/issues/79>.
|
||||||
#[allow(clippy::redundant_pub_crate)]
|
|
||||||
pub(crate) fn signature_allow_undefined_name(
|
pub(crate) fn signature_allow_undefined_name(
|
||||||
repo: &Repository,
|
repo: &Repository,
|
||||||
) -> std::result::Result<Signature<'_>, git2::Error> {
|
) -> std::result::Result<Signature<'_>, git2::Error> {
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ use crate::{
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use git2::{PackBuilderStage, PushOptions};
|
use git2::{PackBuilderStage, PushOptions};
|
||||||
use scopetime::scope_time;
|
use scopetime::scope_time;
|
||||||
|
use std::fmt::Write as _;
|
||||||
|
|
||||||
///
|
///
|
||||||
pub trait AsyncProgress: Clone + Send + Sync {
|
pub trait AsyncProgress: Clone + Send + Sync {
|
||||||
|
|
@ -182,7 +183,7 @@ pub fn push_raw(
|
||||||
if let Ok(Some(branch_upstream_merge)) =
|
if let Ok(Some(branch_upstream_merge)) =
|
||||||
get_branch_upstream_merge(repo_path, branch)
|
get_branch_upstream_merge(repo_path, branch)
|
||||||
{
|
{
|
||||||
push_ref.push_str(&format!(":{branch_upstream_merge}"));
|
let _ = write!(push_ref, ":{branch_upstream_merge}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ impl TreeItemInfo {
|
||||||
Path::new(
|
Path::new(
|
||||||
self.full_path
|
self.full_path
|
||||||
.components()
|
.components()
|
||||||
.last()
|
.next_back()
|
||||||
.and_then(|c| c.as_os_str().to_str())
|
.and_then(|c| c.as_os_str().to_str())
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ impl<'a> Iterator for TreeItemsIterator<'a> {
|
||||||
*i += 1;
|
*i += 1;
|
||||||
} else {
|
} else {
|
||||||
self.increments = Some(0);
|
self.increments = Some(0);
|
||||||
};
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if !init {
|
if !init {
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,7 @@ impl App {
|
||||||
3 => self.stashing_tab.draw(f, chunks_main[1])?,
|
3 => self.stashing_tab.draw(f, chunks_main[1])?,
|
||||||
4 => self.stashlist_tab.draw(f, chunks_main[1])?,
|
4 => self.stashlist_tab.draw(f, chunks_main[1])?,
|
||||||
_ => bail!("unknown tab"),
|
_ => bail!("unknown tab"),
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.draw_popups(f)?;
|
self.draw_popups(f)?;
|
||||||
|
|
@ -905,7 +905,7 @@ impl App {
|
||||||
InternalEvent::CommitSearch(options) => {
|
InternalEvent::CommitSearch(options) => {
|
||||||
self.revlog.search(options);
|
self.revlog.search(options);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
Ok(flags)
|
Ok(flags)
|
||||||
}
|
}
|
||||||
|
|
@ -997,7 +997,7 @@ impl App {
|
||||||
undo_last_commit(&self.repo.borrow())
|
undo_last_commit(&self.repo.borrow())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
flags.insert(NeedsUpdate::ALL);
|
flags.insert(NeedsUpdate::ALL);
|
||||||
|
|
||||||
|
|
@ -1019,7 +1019,7 @@ impl App {
|
||||||
));
|
));
|
||||||
|
|
||||||
self.tags_popup.update_tags()?;
|
self.tags_popup.update_tags()?;
|
||||||
};
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ impl ChangesComponent {
|
||||||
&self.repo.borrow(),
|
&self.repo.borrow(),
|
||||||
path,
|
path,
|
||||||
)?,
|
)?,
|
||||||
};
|
}
|
||||||
} else {
|
} else {
|
||||||
let config =
|
let config =
|
||||||
self.options.borrow().status_show_untracked();
|
self.options.borrow().status_show_untracked();
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,10 @@ impl CommitList {
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
#[expect(
|
||||||
|
clippy::missing_const_for_fn,
|
||||||
|
reason = "as of 1.86.0 clippy wants this to be const even though that breaks"
|
||||||
|
)]
|
||||||
pub fn marked(&self) -> &[(usize, CommitId)] {
|
pub fn marked(&self) -> &[(usize, CommitId)] {
|
||||||
&self.marked
|
&self.marked
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ impl TextInputComponent {
|
||||||
)
|
)
|
||||||
.title(self.title.clone()),
|
.title(self.title.clone()),
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
text_area
|
text_area
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ impl FileTreeItem {
|
||||||
|
|
||||||
match path
|
match path
|
||||||
.components()
|
.components()
|
||||||
.last()
|
.next_back()
|
||||||
.map(std::path::Component::as_os_str)
|
.map(std::path::Component::as_os_str)
|
||||||
.map(OsStr::to_string_lossy)
|
.map(OsStr::to_string_lossy)
|
||||||
.map(String::from)
|
.map(String::from)
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,10 @@ impl KeyConfig {
|
||||||
Ok(Self { keys, symbols })
|
Ok(Self { keys, symbols })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[expect(
|
||||||
|
clippy::missing_const_for_fn,
|
||||||
|
reason = "as of 1.86.0 clippy wants this to be const even though that breaks"
|
||||||
|
)]
|
||||||
fn get_key_symbol(&self, k: KeyCode) -> &str {
|
fn get_key_symbol(&self, k: KeyCode) -> &str {
|
||||||
match k {
|
match k {
|
||||||
KeyCode::Enter => &self.symbols.enter,
|
KeyCode::Enter => &self.symbols.enter,
|
||||||
|
|
@ -106,6 +110,10 @@ impl KeyConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[expect(
|
||||||
|
clippy::missing_const_for_fn,
|
||||||
|
reason = "as of 1.86.0 clippy wants this to be const even though that breaks"
|
||||||
|
)]
|
||||||
fn get_modifier_hint(&self, modifier: KeyModifiers) -> &str {
|
fn get_modifier_hint(&self, modifier: KeyModifiers) -> &str {
|
||||||
match modifier {
|
match modifier {
|
||||||
KeyModifiers::CONTROL => &self.symbols.control,
|
KeyModifiers::CONTROL => &self.symbols.control,
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,10 @@ struct SyntaxFileBlame {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SyntaxFileBlame {
|
impl SyntaxFileBlame {
|
||||||
|
#[expect(
|
||||||
|
clippy::missing_const_for_fn,
|
||||||
|
reason = "as of 1.86.0 clippy wants this to be const even though that breaks"
|
||||||
|
)]
|
||||||
fn path(&self) -> &str {
|
fn path(&self) -> &str {
|
||||||
&self.file_blame.path
|
&self.file_blame.path
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,9 @@ use ratatui::{
|
||||||
widgets::Paragraph,
|
widgets::Paragraph,
|
||||||
Frame,
|
Frame,
|
||||||
};
|
};
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
|
fmt::Write as _,
|
||||||
fs::{read_to_string, File},
|
fs::{read_to_string, File},
|
||||||
io::{Read, Write},
|
io::{Read, Write},
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
|
|
@ -470,9 +472,7 @@ impl CommitPopup {
|
||||||
|
|
||||||
let mut msg = msg.to_owned();
|
let mut msg = msg.to_owned();
|
||||||
if let (Some(user), Some(mail)) = (user, mail) {
|
if let (Some(user), Some(mail)) = (user, mail) {
|
||||||
msg.push_str(&format!(
|
let _ = write!(msg, "\n\nSigned-off-by: {user} <{mail}>");
|
||||||
"\n\nSigned-off-by: {user} <{mail}>"
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(msg)
|
Ok(msg)
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,6 @@ impl CreateRemotePopup {
|
||||||
|
|
||||||
self.hide();
|
self.hide();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -521,7 +521,7 @@ impl Component for FileRevlogPopup {
|
||||||
InspectCommitOpen::new(commit_id),
|
InspectCommitOpen::new(commit_id),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
};
|
}
|
||||||
} else if key_match(key, self.key_config.keys.blame) {
|
} else if key_match(key, self.key_config.keys.blame) {
|
||||||
if let Some(open_request) =
|
if let Some(open_request) =
|
||||||
self.open_request.clone()
|
self.open_request.clone()
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ impl OptionsPopup {
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.diff_hunk_lines_change(true);
|
.diff_hunk_lines_change(true);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
} else {
|
} else {
|
||||||
match self.selection {
|
match self.selection {
|
||||||
AppOption::StatusShowUntracked => {
|
AppOption::StatusShowUntracked => {
|
||||||
|
|
@ -246,7 +246,7 @@ impl OptionsPopup {
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.diff_hunk_lines_change(false);
|
.diff_hunk_lines_change(false);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.queue
|
self.queue
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ impl Component for Stashing {
|
||||||
} else {
|
} else {
|
||||||
Ok(EventState::NotConsumed)
|
Ok(EventState::NotConsumed)
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(EventState::NotConsumed)
|
Ok(EventState::NotConsumed)
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ impl StashList {
|
||||||
Action::StashDrop(ids) => self.drop(repo, ids)?,
|
Action::StashDrop(ids) => self.drop(repo, ids)?,
|
||||||
Action::StashPop(id) => self.pop(repo, *id)?,
|
Action::StashPop(id) => self.pop(repo, *id)?,
|
||||||
_ => (),
|
_ => (),
|
||||||
};
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -348,7 +348,7 @@ impl Status {
|
||||||
|
|
||||||
self.diff.focus(true);
|
self.diff.focus(true);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
self.update_diff()?;
|
self.update_diff()?;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ impl Scrollbar {
|
||||||
let right = area.right().saturating_sub(1);
|
let right = area.right().saturating_sub(1);
|
||||||
if right <= area.left() {
|
if right <= area.left() {
|
||||||
return;
|
return;
|
||||||
};
|
}
|
||||||
|
|
||||||
let (bar_top, bar_height) = {
|
let (bar_top, bar_height) = {
|
||||||
let scrollbar_area = area.inner(Margin {
|
let scrollbar_area = area.inner(Margin {
|
||||||
|
|
@ -86,7 +86,7 @@ impl Scrollbar {
|
||||||
let bottom = area.bottom().saturating_sub(1);
|
let bottom = area.bottom().saturating_sub(1);
|
||||||
if bottom <= area.top() {
|
if bottom <= area.top() {
|
||||||
return;
|
return;
|
||||||
};
|
}
|
||||||
|
|
||||||
let (bar_left, bar_width) = {
|
let (bar_left, bar_width) = {
|
||||||
let scrollbar_area = area.inner(Margin {
|
let scrollbar_area = area.inner(Margin {
|
||||||
|
|
|
||||||
|
|
@ -168,6 +168,10 @@ impl SyntaxText {
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
#[expect(
|
||||||
|
clippy::missing_const_for_fn,
|
||||||
|
reason = "as of 1.86.0 clippy wants this to be const even though that breaks"
|
||||||
|
)]
|
||||||
pub fn path(&self) -> &Path {
|
pub fn path(&self) -> &Path {
|
||||||
&self.path
|
&self.path
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue