diff --git a/asyncgit/src/sync/branch/mod.rs b/asyncgit/src/sync/branch/mod.rs index 93185d6f45..66e47aa65b 100644 --- a/asyncgit/src/sync/branch/mod.rs +++ b/asyncgit/src/sync/branch/mod.rs @@ -271,7 +271,7 @@ pub fn config_is_pull_rebase(repo_path: &RepoPath) -> Result { let value = rebase.value().map(String::from).unwrap_or_default(); return Ok(value == "true"); - }; + } Ok(false) } diff --git a/asyncgit/src/sync/commit.rs b/asyncgit/src/sync/commit.rs index bb7e6384c5..f4e0b194ea 100644 --- a/asyncgit/src/sync/commit.rs +++ b/asyncgit/src/sync/commit.rs @@ -55,7 +55,6 @@ pub fn amend( /// Wrap `Repository::signature` to allow unknown user.name. /// /// See . -#[allow(clippy::redundant_pub_crate)] pub(crate) fn signature_allow_undefined_name( repo: &Repository, ) -> std::result::Result, git2::Error> { diff --git a/asyncgit/src/sync/remotes/push.rs b/asyncgit/src/sync/remotes/push.rs index b28b8a22d3..707f7572ad 100644 --- a/asyncgit/src/sync/remotes/push.rs +++ b/asyncgit/src/sync/remotes/push.rs @@ -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}"); } } diff --git a/filetreelist/src/item.rs b/filetreelist/src/item.rs index f664031b14..b06c275df2 100644 --- a/filetreelist/src/item.rs +++ b/filetreelist/src/item.rs @@ -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(), ) diff --git a/filetreelist/src/treeitems_iter.rs b/filetreelist/src/treeitems_iter.rs index 4feeb3e8ca..fddf35a1e9 100644 --- a/filetreelist/src/treeitems_iter.rs +++ b/filetreelist/src/treeitems_iter.rs @@ -35,7 +35,7 @@ impl<'a> Iterator for TreeItemsIterator<'a> { *i += 1; } else { self.increments = Some(0); - }; + } loop { if !init { diff --git a/src/app.rs b/src/app.rs index 45037f048f..68d2987c6f 100644 --- a/src/app.rs +++ b/src/app.rs @@ -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(()) } diff --git a/src/components/changes.rs b/src/components/changes.rs index 7b0bc4270b..48883d20e8 100644 --- a/src/components/changes.rs +++ b/src/components/changes.rs @@ -92,7 +92,7 @@ impl ChangesComponent { &self.repo.borrow(), path, )?, - }; + } } else { let config = self.options.borrow().status_show_untracked(); diff --git a/src/components/commitlist.rs b/src/components/commitlist.rs index f2c8a448a6..d45bec1739 100644 --- a/src/components/commitlist.rs +++ b/src/components/commitlist.rs @@ -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 } diff --git a/src/components/textinput.rs b/src/components/textinput.rs index e6586b8355..e67d19eac9 100644 --- a/src/components/textinput.rs +++ b/src/components/textinput.rs @@ -176,7 +176,7 @@ impl TextInputComponent { ) .title(self.title.clone()), ); - }; + } text_area }); } diff --git a/src/components/utils/filetree.rs b/src/components/utils/filetree.rs index 8b298dbb93..a0b507fa82 100644 --- a/src/components/utils/filetree.rs +++ b/src/components/utils/filetree.rs @@ -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) diff --git a/src/keys/key_config.rs b/src/keys/key_config.rs index 9cd4eb73f2..fe6a987765 100644 --- a/src/keys/key_config.rs +++ b/src/keys/key_config.rs @@ -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, diff --git a/src/popups/blame_file.rs b/src/popups/blame_file.rs index 273ca5ace3..9672965bcb 100644 --- a/src/popups/blame_file.rs +++ b/src/popups/blame_file.rs @@ -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 } diff --git a/src/popups/commit.rs b/src/popups/commit.rs index 4dcfc3241c..008fc6f8a7 100644 --- a/src/popups/commit.rs +++ b/src/popups/commit.rs @@ -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) diff --git a/src/popups/create_remote.rs b/src/popups/create_remote.rs index ac64934da5..8e464931e8 100644 --- a/src/popups/create_remote.rs +++ b/src/popups/create_remote.rs @@ -209,6 +209,6 @@ impl CreateRemotePopup { self.hide(); } - }; + } } } diff --git a/src/popups/file_revlog.rs b/src/popups/file_revlog.rs index c946323b5d..6bbbffbe8a 100644 --- a/src/popups/file_revlog.rs +++ b/src/popups/file_revlog.rs @@ -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() diff --git a/src/popups/options.rs b/src/popups/options.rs index 0b06131b48..e74e8bdc0b 100644 --- a/src/popups/options.rs +++ b/src/popups/options.rs @@ -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 diff --git a/src/tabs/stashing.rs b/src/tabs/stashing.rs index e5564563aa..5b2fe4b496 100644 --- a/src/tabs/stashing.rs +++ b/src/tabs/stashing.rs @@ -245,7 +245,7 @@ impl Component for Stashing { } else { Ok(EventState::NotConsumed) }; - }; + } } Ok(EventState::NotConsumed) diff --git a/src/tabs/stashlist.rs b/src/tabs/stashlist.rs index c8dceb2f63..1a97a0ac38 100644 --- a/src/tabs/stashlist.rs +++ b/src/tabs/stashlist.rs @@ -102,7 +102,7 @@ impl StashList { Action::StashDrop(ids) => self.drop(repo, ids)?, Action::StashPop(id) => self.pop(repo, *id)?, _ => (), - }; + } Ok(()) } diff --git a/src/tabs/status.rs b/src/tabs/status.rs index 034ffe39e6..40cf210786 100644 --- a/src/tabs/status.rs +++ b/src/tabs/status.rs @@ -348,7 +348,7 @@ impl Status { self.diff.focus(true); } - }; + } self.update_diff()?; diff --git a/src/ui/scrollbar.rs b/src/ui/scrollbar.rs index 6ae7ca3ee2..a0a9b3df80 100644 --- a/src/ui/scrollbar.rs +++ b/src/ui/scrollbar.rs @@ -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 { diff --git a/src/ui/syntax_text.rs b/src/ui/syntax_text.rs index 8d758f20cc..057f9e3588 100644 --- a/src/ui/syntax_text.rs +++ b/src/ui/syntax_text.rs @@ -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 }