Skip to content

Commit cc90799

Browse files
authored
fix latest clippy (#2597)
1 parent 7f75307 commit cc90799

21 files changed

+44
-24
lines changed

asyncgit/src/sync/branch/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ pub fn config_is_pull_rebase(repo_path: &RepoPath) -> Result<bool> {
271271
let value =
272272
rebase.value().map(String::from).unwrap_or_default();
273273
return Ok(value == "true");
274-
};
274+
}
275275

276276
Ok(false)
277277
}

asyncgit/src/sync/commit.rs

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ pub fn amend(
5555
/// Wrap `Repository::signature` to allow unknown user.name.
5656
///
5757
/// See <https://github.com/gitui-org/gitui/issues/79>.
58-
#[allow(clippy::redundant_pub_crate)]
5958
pub(crate) fn signature_allow_undefined_name(
6059
repo: &Repository,
6160
) -> std::result::Result<Signature<'_>, git2::Error> {

asyncgit/src/sync/remotes/push.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use crate::{
1717
use crossbeam_channel::Sender;
1818
use git2::{PackBuilderStage, PushOptions};
1919
use scopetime::scope_time;
20+
use std::fmt::Write as _;
2021

2122
///
2223
pub trait AsyncProgress: Clone + Send + Sync {
@@ -182,7 +183,7 @@ pub fn push_raw(
182183
if let Ok(Some(branch_upstream_merge)) =
183184
get_branch_upstream_merge(repo_path, branch)
184185
{
185-
push_ref.push_str(&format!(":{branch_upstream_merge}"));
186+
let _ = write!(push_ref, ":{branch_upstream_merge}");
186187
}
187188
}
188189

filetreelist/src/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl TreeItemInfo {
5555
Path::new(
5656
self.full_path
5757
.components()
58-
.last()
58+
.next_back()
5959
.and_then(|c| c.as_os_str().to_str())
6060
.unwrap_or_default(),
6161
)

filetreelist/src/treeitems_iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl<'a> Iterator for TreeItemsIterator<'a> {
3535
*i += 1;
3636
} else {
3737
self.increments = Some(0);
38-
};
38+
}
3939

4040
loop {
4141
if !init {

src/app.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ impl App {
275275
3 => self.stashing_tab.draw(f, chunks_main[1])?,
276276
4 => self.stashlist_tab.draw(f, chunks_main[1])?,
277277
_ => bail!("unknown tab"),
278-
};
278+
}
279279
}
280280

281281
self.draw_popups(f)?;
@@ -905,7 +905,7 @@ impl App {
905905
InternalEvent::CommitSearch(options) => {
906906
self.revlog.search(options);
907907
}
908-
};
908+
}
909909

910910
Ok(flags)
911911
}
@@ -997,7 +997,7 @@ impl App {
997997
undo_last_commit(&self.repo.borrow())
998998
);
999999
}
1000-
};
1000+
}
10011001

10021002
flags.insert(NeedsUpdate::ALL);
10031003

@@ -1019,7 +1019,7 @@ impl App {
10191019
));
10201020

10211021
self.tags_popup.update_tags()?;
1022-
};
1022+
}
10231023
Ok(())
10241024
}
10251025

src/components/changes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl ChangesComponent {
9292
&self.repo.borrow(),
9393
path,
9494
)?,
95-
};
95+
}
9696
} else {
9797
let config =
9898
self.options.borrow().status_show_untracked();

src/components/commitlist.rs

+4
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ impl CommitList {
115115
}
116116

117117
///
118+
#[expect(
119+
clippy::missing_const_for_fn,
120+
reason = "as of 1.86.0 clippy wants this to be const even though that breaks"
121+
)]
118122
pub fn marked(&self) -> &[(usize, CommitId)] {
119123
&self.marked
120124
}

src/components/textinput.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl TextInputComponent {
176176
)
177177
.title(self.title.clone()),
178178
);
179-
};
179+
}
180180
text_area
181181
});
182182
}

src/components/utils/filetree.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl FileTreeItem {
9090

9191
match path
9292
.components()
93-
.last()
93+
.next_back()
9494
.map(std::path::Component::as_os_str)
9595
.map(OsStr::to_string_lossy)
9696
.map(String::from)

src/keys/key_config.rs

+8
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ impl KeyConfig {
4040
Ok(Self { keys, symbols })
4141
}
4242

43+
#[expect(
44+
clippy::missing_const_for_fn,
45+
reason = "as of 1.86.0 clippy wants this to be const even though that breaks"
46+
)]
4347
fn get_key_symbol(&self, k: KeyCode) -> &str {
4448
match k {
4549
KeyCode::Enter => &self.symbols.enter,
@@ -106,6 +110,10 @@ impl KeyConfig {
106110
}
107111
}
108112

113+
#[expect(
114+
clippy::missing_const_for_fn,
115+
reason = "as of 1.86.0 clippy wants this to be const even though that breaks"
116+
)]
109117
fn get_modifier_hint(&self, modifier: KeyModifiers) -> &str {
110118
match modifier {
111119
KeyModifiers::CONTROL => &self.symbols.control,

src/popups/blame_file.rs

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ struct SyntaxFileBlame {
4141
}
4242

4343
impl SyntaxFileBlame {
44+
#[expect(
45+
clippy::missing_const_for_fn,
46+
reason = "as of 1.86.0 clippy wants this to be const even though that breaks"
47+
)]
4448
fn path(&self) -> &str {
4549
&self.file_blame.path
4650
}

src/popups/commit.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ use ratatui::{
2727
widgets::Paragraph,
2828
Frame,
2929
};
30+
3031
use std::{
32+
fmt::Write as _,
3133
fs::{read_to_string, File},
3234
io::{Read, Write},
3335
path::PathBuf,
@@ -470,9 +472,7 @@ impl CommitPopup {
470472

471473
let mut msg = msg.to_owned();
472474
if let (Some(user), Some(mail)) = (user, mail) {
473-
msg.push_str(&format!(
474-
"\n\nSigned-off-by: {user} <{mail}>"
475-
));
475+
let _ = write!(msg, "\n\nSigned-off-by: {user} <{mail}>");
476476
}
477477

478478
Ok(msg)

src/popups/create_remote.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,6 @@ impl CreateRemotePopup {
209209

210210
self.hide();
211211
}
212-
};
212+
}
213213
}
214214
}

src/popups/file_revlog.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ impl Component for FileRevlogPopup {
521521
InspectCommitOpen::new(commit_id),
522522
),
523523
));
524-
};
524+
}
525525
} else if key_match(key, self.key_config.keys.blame) {
526526
if let Some(open_request) =
527527
self.open_request.clone()

src/popups/options.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ impl OptionsPopup {
207207
.borrow_mut()
208208
.diff_hunk_lines_change(true);
209209
}
210-
};
210+
}
211211
} else {
212212
match self.selection {
213213
AppOption::StatusShowUntracked => {
@@ -246,7 +246,7 @@ impl OptionsPopup {
246246
.borrow_mut()
247247
.diff_hunk_lines_change(false);
248248
}
249-
};
249+
}
250250
}
251251

252252
self.queue

src/tabs/stashing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ impl Component for Stashing {
245245
} else {
246246
Ok(EventState::NotConsumed)
247247
};
248-
};
248+
}
249249
}
250250

251251
Ok(EventState::NotConsumed)

src/tabs/stashlist.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl StashList {
102102
Action::StashDrop(ids) => self.drop(repo, ids)?,
103103
Action::StashPop(id) => self.pop(repo, *id)?,
104104
_ => (),
105-
};
105+
}
106106

107107
Ok(())
108108
}

src/tabs/status.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ impl Status {
348348

349349
self.diff.focus(true);
350350
}
351-
};
351+
}
352352

353353
self.update_diff()?;
354354

src/ui/scrollbar.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl Scrollbar {
4949
let right = area.right().saturating_sub(1);
5050
if right <= area.left() {
5151
return;
52-
};
52+
}
5353

5454
let (bar_top, bar_height) = {
5555
let scrollbar_area = area.inner(Margin {
@@ -86,7 +86,7 @@ impl Scrollbar {
8686
let bottom = area.bottom().saturating_sub(1);
8787
if bottom <= area.top() {
8888
return;
89-
};
89+
}
9090

9191
let (bar_left, bar_width) = {
9292
let scrollbar_area = area.inner(Margin {

src/ui/syntax_text.rs

+4
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ impl SyntaxText {
168168
}
169169

170170
///
171+
#[expect(
172+
clippy::missing_const_for_fn,
173+
reason = "as of 1.86.0 clippy wants this to be const even though that breaks"
174+
)]
171175
pub fn path(&self) -> &Path {
172176
&self.path
173177
}

0 commit comments

Comments
 (0)