Skip to content

Commit acf4661

Browse files
committed
fix nighty and raise msrv
1 parent e7bc408 commit acf4661

38 files changed

+68
-110
lines changed

.clippy.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
msrv = "1.65.0"
2-
cognitive-complexity-threshold = 18
1+
msrv = "1.70.0"
2+
cognitive-complexity-threshold = 18

.github/workflows/ci.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,11 @@ jobs:
220220
- name: Install Rust
221221
uses: dtolnay/rust-toolchain@nightly
222222

223-
- name: cargo-udeps
224-
run: |
225-
# cargo install --locked cargo-udeps
226-
cargo install --git https://github.com/est31/cargo-udeps --locked
227-
cargo +nightly udeps --all-targets
223+
- name: build cargo-udeps
224+
run: cargo install --git https://github.com/est31/cargo-udeps --locked
225+
226+
- name: run cargo-udeps
227+
run: cargo +nightly udeps --all-targets
228228

229229
log-test:
230230
name: Changelog Test

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.24.3"
44
authors = ["extrawurst <[email protected]>"]
55
description = "blazing fast terminal-ui for git"
66
edition = "2021"
7-
rust-version = "1.65"
7+
rust-version = "1.70"
88
exclude = [".github/*", ".vscode/*", "assets/*"]
99
homepage = "https://github.com/extrawurst/gitui"
1010
repository = "https://github.com/extrawurst/gitui"

Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ clippy-nightly:
8282

8383
check: fmt clippy test deny
8484

85+
check-nightly:
86+
cargo +nightly c
87+
cargo +nightly clippy --workspace --all-features
88+
cargo +nightly t
89+
8590
deny:
8691
cargo deny check
8792

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ All contain a single binary file
215215

216216
### Requirements
217217

218-
- Minimum supported `rust`/`cargo` version: `1.65`
218+
- Minimum supported `rust`/`cargo` version: `1.70`
219219
- See [Install Rust](https://www.rust-lang.org/tools/install)
220220

221221
- To build openssl dependency (see https://docs.rs/openssl/latest/openssl/)

asyncgit/src/revlog.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,9 @@ impl AsyncLog {
201201
) -> Result<()> {
202202
let start_time = Instant::now();
203203

204-
let mut entries = Vec::with_capacity(LIMIT_COUNT);
204+
let mut entries = vec![CommitId::default(); LIMIT_COUNT];
205+
entries.resize(0, CommitId::default());
206+
205207
let r = repo(repo_path)?;
206208
let mut walker =
207209
LogWalker::new(&r, LIMIT_COUNT)?.filter(filter);

asyncgit/src/sync/blame.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,8 @@ pub fn blame_file(
6969
utils::get_head_repo(&repo)?
7070
};
7171

72-
let spec = format!(
73-
"{}:{}",
74-
commit_id.to_string(),
75-
fixup_windows_path(file_path)
76-
);
72+
let spec =
73+
format!("{}:{}", commit_id, fixup_windows_path(file_path));
7774

7875
let object = repo.revparse_single(&spec)?;
7976
let blob = repo.find_blob(object.id())?;

asyncgit/src/sync/commit_files.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,7 @@ pub(crate) fn get_commit_diff<'a>(
162162
Some(&mut opts),
163163
)?;
164164

165-
if stashes
166-
.map(|stashes| stashes.contains(&id))
167-
.unwrap_or_default()
168-
{
165+
if stashes.is_some_and(|stashes| stashes.contains(&id)) {
169166
if let Ok(untracked_commit) = commit.parent_id(2) {
170167
let untracked_diff = get_commit_diff(
171168
repo,

asyncgit/src/sync/commit_filter.rs

+5-10
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ impl LogFilterSearch {
115115
.new_file()
116116
.path()
117117
.and_then(|file| file.as_os_str().to_str())
118-
.map(|file| self.match_text(file))
119-
.unwrap_or_default()
118+
.is_some_and(|file| self.match_text(file))
120119
{
121120
return true;
122121
}
@@ -125,8 +124,7 @@ impl LogFilterSearch {
125124
.old_file()
126125
.path()
127126
.and_then(|file| file.as_os_str().to_str())
128-
.map(|file| self.match_text(file))
129-
.unwrap_or_default()
127+
.is_some_and(|file| self.match_text(file))
130128
})
131129
}
132130

@@ -194,8 +192,7 @@ pub fn filter_commit_by_search(
194192
.ok()
195193
})
196194
.flatten()
197-
.map(|diff| filter.match_diff(&diff))
198-
.unwrap_or_default();
195+
.is_some_and(|diff| filter.match_diff(&diff));
199196

200197
let authors_match = filter
201198
.options
@@ -205,13 +202,11 @@ pub fn filter_commit_by_search(
205202
let name_match = commit
206203
.author()
207204
.name()
208-
.map(|name| filter.match_text(name))
209-
.unwrap_or_default();
205+
.is_some_and(|name| filter.match_text(name));
210206
let mail_match = commit
211207
.author()
212208
.email()
213-
.map(|name| filter.match_text(name))
214-
.unwrap_or_default();
209+
.is_some_and(|name| filter.match_text(name));
215210

216211
name_match || mail_match
217212
})

asyncgit/src/sync/commits_info.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::fmt::Display;
2+
13
use super::RepoPath;
24
use crate::{error::Result, sync::repository::repo};
35
use git2::{Commit, Error, Oid};
@@ -46,9 +48,12 @@ impl CommitId {
4648
}
4749
}
4850

49-
impl ToString for CommitId {
50-
fn to_string(&self) -> String {
51-
self.0.to_string()
51+
impl Display for CommitId {
52+
fn fmt(
53+
&self,
54+
f: &mut std::fmt::Formatter<'_>,
55+
) -> std::fmt::Result {
56+
write!(f, "{}", self.0)
5257
}
5358
}
5459

asyncgit/src/sync/remotes/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ pub(crate) fn get_default_remote_in_repo(
6060
let remotes = repo.remotes()?;
6161

6262
// if `origin` exists return that
63-
let found_origin = remotes.iter().any(|r| {
64-
r.map(|r| r == DEFAULT_REMOTE_NAME).unwrap_or_default()
65-
});
63+
let found_origin = remotes
64+
.iter()
65+
.any(|r| r.is_some_and(|r| r == DEFAULT_REMOTE_NAME));
6666
if found_origin {
6767
return Ok(DEFAULT_REMOTE_NAME.into());
6868
}

asyncgit/src/sync/staging/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ use super::{
99
};
1010
use crate::error::Result;
1111
use git2::{DiffLine, DiffLineType, Repository};
12-
use std::{
13-
collections::HashSet, convert::TryFrom, fs::File, io::Read,
14-
};
12+
use std::{collections::HashSet, fs::File, io::Read};
1513

1614
const NEWLINE: char = '\n';
1715

filetreelist/src/filetree.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl FileTree {
136136
};
137137

138138
let changed_index =
139-
new_index.map(|i| i != selection).unwrap_or_default();
139+
new_index.is_some_and(|i| i != selection);
140140

141141
if changed_index {
142142
self.selection = new_index;
@@ -335,8 +335,7 @@ impl FileTree {
335335
self.items
336336
.tree_items
337337
.get(index)
338-
.map(|item| item.info().is_visible())
339-
.unwrap_or_default()
338+
.is_some_and(|item| item.info().is_visible())
340339
}
341340
}
342341

filetreelist/src/filetreeitems.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,7 @@ impl FileTreeItems {
346346

347347
if items
348348
.get(i + 1)
349-
.map(|item| item.kind().is_path())
350-
.unwrap_or_default()
349+
.is_some_and(|item| item.kind().is_path())
351350
{
352351
let next_item = items.remove(i + 1);
353352
let item_mut = &mut items[i];

filetreelist/src/item.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
use crate::error::Result;
2-
use std::{
3-
convert::TryFrom,
4-
path::{Path, PathBuf},
5-
};
2+
use std::path::{Path, PathBuf};
63

74
/// holds the information shared among all `FileTreeItem` in a `FileTree`
85
#[derive(Debug, Clone)]

filetreelist/src/tree_iter.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@ impl<'a> Iterator for TreeIterator<'a> {
2222

2323
fn next(&mut self) -> Option<Self::Item> {
2424
self.item_iter.next().map(|(index, item)| {
25-
(
26-
item,
27-
self.selection
28-
.map(|i| i == index)
29-
.unwrap_or_default(),
30-
)
25+
(item, self.selection.is_some_and(|i| i == index))
3126
})
3227
}
3328
}

src/components/blame_file.rs

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use ratatui::{
2626
widgets::{Block, Borders, Cell, Clear, Row, Table, TableState},
2727
Frame,
2828
};
29-
use std::convert::TryInto;
3029

3130
static NO_COMMIT_ID: &str = "0000000";
3231
static NO_AUTHOR: &str = "<no author>";

src/components/branchlist.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use ratatui::{
3636
widgets::{Block, BorderType, Borders, Clear, Paragraph, Tabs},
3737
Frame,
3838
};
39-
use std::{cell::Cell, convert::TryInto};
39+
use std::cell::Cell;
4040
use ui::style::SharedTheme;
4141
use unicode_truncate::UnicodeTruncateStr;
4242

@@ -505,12 +505,10 @@ impl BranchListComponent {
505505
.iter()
506506
.enumerate()
507507
.filter(|(index, b)| {
508-
b.local_details()
509-
.map(|details| {
510-
details.is_head
511-
&& *index == self.selection as usize
512-
})
513-
.unwrap_or_default()
508+
b.local_details().is_some_and(|details| {
509+
details.is_head
510+
&& *index == self.selection as usize
511+
})
514512
})
515513
.count() > 0
516514
}
@@ -623,8 +621,7 @@ impl BranchListComponent {
623621

624622
let is_head = displaybranch
625623
.local_details()
626-
.map(|details| details.is_head)
627-
.unwrap_or_default();
624+
.is_some_and(|details| details.is_head);
628625
let is_head_str =
629626
if is_head { HEAD_SYMBOL } else { EMPTY_SYMBOL };
630627
let upstream_tracking_str = match displaybranch.details {

src/components/commit_details/details.rs

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use ratatui::{
2323
text::{Line, Span, Text},
2424
Frame,
2525
};
26-
use std::clone::Clone;
2726
use std::{borrow::Cow, cell::Cell};
2827
use sync::CommitTags;
2928

src/components/commit_details/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl CommitDetailsComponent {
135135
}
136136

137137
fn is_compare(&self) -> bool {
138-
self.commit.map(|p| p.other.is_some()).unwrap_or_default()
138+
self.commit.is_some_and(|p| p.other.is_some())
139139
}
140140
}
141141

src/components/commitlist.rs

+6-13
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ use ratatui::{
3030
Frame,
3131
};
3232
use std::{
33-
borrow::Cow, cell::Cell, cmp, collections::BTreeMap,
34-
convert::TryFrom, rc::Rc, time::Instant,
33+
borrow::Cow, cell::Cell, cmp, collections::BTreeMap, rc::Rc,
34+
time::Instant,
3535
};
3636

3737
const ELEMENTS_PER_LINE: usize = 9;
@@ -151,11 +151,7 @@ impl CommitList {
151151
marked.windows(2).all(|w| w[0].0 + 1 == w[1].0);
152152

153153
let yank = if marked_consecutive {
154-
format!(
155-
"{}^..{}",
156-
first.1.to_string(),
157-
last.1.to_string()
158-
)
154+
format!("{}^..{}", first.1, last.1)
159155
} else {
160156
marked
161157
.iter()
@@ -248,8 +244,7 @@ impl CommitList {
248244
//note: set highlights to none if there is no highlight
249245
self.highlights = if highlighting
250246
.as_ref()
251-
.map(|set| set.is_empty())
252-
.unwrap_or_default()
247+
.is_some_and(|set| set.is_empty())
253248
{
254249
None
255250
} else {
@@ -718,8 +713,7 @@ impl CommitList {
718713

719714
self.highlights
720715
.as_ref()
721-
.map(|highlights| highlights.contains(&commit))
722-
.unwrap_or_default()
716+
.is_some_and(|highlights| highlights.contains(&commit))
723717
}
724718

725719
fn needs_data(&self, idx: usize, idx_max: usize) -> bool {
@@ -749,8 +743,7 @@ impl CommitList {
749743
let index_in_sync = self
750744
.items
751745
.index_offset_raw()
752-
.map(|index| want_min == index)
753-
.unwrap_or_default();
746+
.is_some_and(|index| want_min == index);
754747

755748
if !index_in_sync || !self.is_list_in_sync() || force {
756749
let commits = sync::get_commits_info(

src/components/diff.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,7 @@ impl DiffComponent {
146146
}
147147
///
148148
fn can_scroll(&self) -> bool {
149-
self.diff
150-
.as_ref()
151-
.map(|diff| diff.lines > 1)
152-
.unwrap_or_default()
149+
self.diff.as_ref().is_some_and(|diff| diff.lines > 1)
153150
}
154151
///
155152
pub fn current(&self) -> (String, bool) {

src/components/help.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use ratatui::{
2020
widgets::{Block, BorderType, Borders, Clear, Paragraph},
2121
Frame,
2222
};
23-
use std::{borrow::Cow, cmp, convert::TryFrom};
23+
use std::{borrow::Cow, cmp};
2424
use ui::style::SharedTheme;
2525

2626
///

src/components/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ use ratatui::{
8181
widgets::{Block, BorderType, Borders, Paragraph, Wrap},
8282
Frame,
8383
};
84-
use std::convert::From;
8584

8685
/// creates accessors for a list of components
8786
///

src/components/msg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use ratatui::{
1515
widgets::{Block, BorderType, Borders, Clear, Paragraph, Wrap},
1616
Frame,
1717
};
18-
use std::convert::TryFrom;
1918
use ui::style::SharedTheme;
19+
2020
pub struct MsgComponent {
2121
title: String,
2222
msg: String,

0 commit comments

Comments
 (0)