mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 08:58: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 =
|
||||
rebase.value().map(String::from).unwrap_or_default();
|
||||
return Ok(value == "true");
|
||||
};
|
||||
}
|
||||
|
||||
Ok(false)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ pub fn amend(
|
|||
/// Wrap `Repository::signature` to allow unknown user.name.
|
||||
///
|
||||
/// See <https://github.com/gitui-org/gitui/issues/79>.
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
pub(crate) fn signature_allow_undefined_name(
|
||||
repo: &Repository,
|
||||
) -> std::result::Result<Signature<'_>, git2::Error> {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use crate::{
|
|||
use crossbeam_channel::Sender;
|
||||
use git2::{PackBuilderStage, PushOptions};
|
||||
use scopetime::scope_time;
|
||||
use std::fmt::Write as _;
|
||||
|
||||
///
|
||||
pub trait AsyncProgress: Clone + Send + Sync {
|
||||
|
|
@ -182,7 +183,7 @@ pub fn push_raw(
|
|||
if let Ok(Some(branch_upstream_merge)) =
|
||||
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(
|
||||
self.full_path
|
||||
.components()
|
||||
.last()
|
||||
.next_back()
|
||||
.and_then(|c| c.as_os_str().to_str())
|
||||
.unwrap_or_default(),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ impl<'a> Iterator for TreeItemsIterator<'a> {
|
|||
*i += 1;
|
||||
} else {
|
||||
self.increments = Some(0);
|
||||
};
|
||||
}
|
||||
|
||||
loop {
|
||||
if !init {
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ impl App {
|
|||
3 => self.stashing_tab.draw(f, chunks_main[1])?,
|
||||
4 => self.stashlist_tab.draw(f, chunks_main[1])?,
|
||||
_ => bail!("unknown tab"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
self.draw_popups(f)?;
|
||||
|
|
@ -905,7 +905,7 @@ impl App {
|
|||
InternalEvent::CommitSearch(options) => {
|
||||
self.revlog.search(options);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Ok(flags)
|
||||
}
|
||||
|
|
@ -997,7 +997,7 @@ impl App {
|
|||
undo_last_commit(&self.repo.borrow())
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
flags.insert(NeedsUpdate::ALL);
|
||||
|
||||
|
|
@ -1019,7 +1019,7 @@ impl App {
|
|||
));
|
||||
|
||||
self.tags_popup.update_tags()?;
|
||||
};
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ impl ChangesComponent {
|
|||
&self.repo.borrow(),
|
||||
path,
|
||||
)?,
|
||||
};
|
||||
}
|
||||
} else {
|
||||
let config =
|
||||
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)] {
|
||||
&self.marked
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ impl TextInputComponent {
|
|||
)
|
||||
.title(self.title.clone()),
|
||||
);
|
||||
};
|
||||
}
|
||||
text_area
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ impl FileTreeItem {
|
|||
|
||||
match path
|
||||
.components()
|
||||
.last()
|
||||
.next_back()
|
||||
.map(std::path::Component::as_os_str)
|
||||
.map(OsStr::to_string_lossy)
|
||||
.map(String::from)
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ impl KeyConfig {
|
|||
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 {
|
||||
match k {
|
||||
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 {
|
||||
match modifier {
|
||||
KeyModifiers::CONTROL => &self.symbols.control,
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@ struct 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 {
|
||||
&self.file_blame.path
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@ use ratatui::{
|
|||
widgets::Paragraph,
|
||||
Frame,
|
||||
};
|
||||
|
||||
use std::{
|
||||
fmt::Write as _,
|
||||
fs::{read_to_string, File},
|
||||
io::{Read, Write},
|
||||
path::PathBuf,
|
||||
|
|
@ -470,9 +472,7 @@ impl CommitPopup {
|
|||
|
||||
let mut msg = msg.to_owned();
|
||||
if let (Some(user), Some(mail)) = (user, mail) {
|
||||
msg.push_str(&format!(
|
||||
"\n\nSigned-off-by: {user} <{mail}>"
|
||||
));
|
||||
let _ = write!(msg, "\n\nSigned-off-by: {user} <{mail}>");
|
||||
}
|
||||
|
||||
Ok(msg)
|
||||
|
|
|
|||
|
|
@ -209,6 +209,6 @@ impl CreateRemotePopup {
|
|||
|
||||
self.hide();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -521,7 +521,7 @@ impl Component for FileRevlogPopup {
|
|||
InspectCommitOpen::new(commit_id),
|
||||
),
|
||||
));
|
||||
};
|
||||
}
|
||||
} else if key_match(key, self.key_config.keys.blame) {
|
||||
if let Some(open_request) =
|
||||
self.open_request.clone()
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ impl OptionsPopup {
|
|||
.borrow_mut()
|
||||
.diff_hunk_lines_change(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
} else {
|
||||
match self.selection {
|
||||
AppOption::StatusShowUntracked => {
|
||||
|
|
@ -246,7 +246,7 @@ impl OptionsPopup {
|
|||
.borrow_mut()
|
||||
.diff_hunk_lines_change(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
self.queue
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ impl Component for Stashing {
|
|||
} else {
|
||||
Ok(EventState::NotConsumed)
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Ok(EventState::NotConsumed)
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ impl StashList {
|
|||
Action::StashDrop(ids) => self.drop(repo, ids)?,
|
||||
Action::StashPop(id) => self.pop(repo, *id)?,
|
||||
_ => (),
|
||||
};
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ impl Status {
|
|||
|
||||
self.diff.focus(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
self.update_diff()?;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ impl Scrollbar {
|
|||
let right = area.right().saturating_sub(1);
|
||||
if right <= area.left() {
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
let (bar_top, bar_height) = {
|
||||
let scrollbar_area = area.inner(Margin {
|
||||
|
|
@ -86,7 +86,7 @@ impl Scrollbar {
|
|||
let bottom = area.bottom().saturating_sub(1);
|
||||
if bottom <= area.top() {
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
let (bar_left, bar_width) = {
|
||||
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 {
|
||||
&self.path
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue