Skip to content

Commit 17835bc

Browse files
committed
chore: bump rust-version to 1.70
That way clippy will allow to use the fantastic `Option::is_some_and()` and friends.
1 parent 9db2160 commit 17835bc

File tree

126 files changed

+185
-204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+185
-204
lines changed

gix-actor/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repository = "https://github.com/GitoxideLabs/gitoxide"
99
license = "MIT OR Apache-2.0"
1010
edition = "2021"
1111
include = ["src/**/*", "LICENSE-*"]
12-
rust-version = "1.65"
12+
rust-version = "1.70"
1313

1414
[lib]
1515
doctest = false

gix-archive/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
88
description = "archive generation from of a worktree stream"
99
authors = ["Sebastian Thiel <[email protected]>"]
1010
edition = "2021"
11-
rust-version = "1.65"
11+
rust-version = "1.70"
1212
include = ["src/**/*", "LICENSE-*"]
1313

1414
[lib]

gix-attributes/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description = "A crate of the gitoxide project dealing .gitattributes files"
99
authors = ["Sebastian Thiel <[email protected]>"]
1010
edition = "2021"
1111
include = ["src/**/*", "LICENSE-*"]
12-
rust-version = "1.65"
12+
rust-version = "1.70"
1313

1414
[lib]
1515
doctest = false

gix-bitmap/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
88
description = "A crate of the gitoxide project dedicated implementing the standard git bitmap format"
99
authors = ["Sebastian Thiel <[email protected]>"]
1010
edition = "2021"
11-
rust-version = "1.65"
11+
rust-version = "1.70"
1212
exclude = ["CHANGELOG.md"]
1313

1414
[lib]

gix-blame/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
88
description = "A crate of the gitoxide project dedicated to implementing a 'blame' algorithm"
99
authors = ["Christoph Rüßler <[email protected]>", "Sebastian Thiel <[email protected]>"]
1010
edition = "2021"
11-
rust-version = "1.65"
11+
rust-version = "1.70"
1212

1313
[lib]
1414
doctest = false

gix-chunk/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ documentation = "https://github.com/git/git/blob/seen/Documentation/technical/ch
1010
license = "MIT OR Apache-2.0"
1111
edition = "2021"
1212
include = ["src/**/*", "LICENSE-*"]
13-
rust-version = "1.65"
13+
rust-version = "1.70"
1414

1515
[lib]
1616
doctest = false

gix-command/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
88
description = "A crate of the gitoxide project handling internal git command execution"
99
authors = ["Sebastian Thiel <[email protected]>"]
1010
edition = "2021"
11-
rust-version = "1.65"
11+
rust-version = "1.70"
1212
include = ["src/lib.rs", "LICENSE-*"]
1313

1414
[lib]

gix-commitgraph/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ description = "Read-only access to the git commitgraph file format"
1010
authors = ["Conor Davis <[email protected]>", "Sebastian Thiel <[email protected]>"]
1111
edition = "2021"
1212
include = ["src/**/*", "LICENSE-*"]
13-
rust-version = "1.65"
13+
rust-version = "1.70"
1414

1515
[lib]
1616
doctest = false

gix-config-value/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
88
description = "A crate of the gitoxide project providing git-config value parsing"
99
authors = ["Sebastian Thiel <[email protected]>"]
1010
edition = "2021"
11-
rust-version = "1.65"
11+
rust-version = "1.70"
1212
include = ["src/**/*", "LICENSE-*"]
1313

1414
[lib]

gix-config/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ edition = "2021"
1111
keywords = ["git-config", "git", "config", "gitoxide"]
1212
categories = ["config", "parser-implementations"]
1313
include = ["src/**/*", "LICENSE-*", "README.md"]
14-
rust-version = "1.65"
14+
rust-version = "1.70"
1515
autotests = false
1616

1717
[features]

gix-config/src/file/mutable/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ pub(crate) mod section;
99
pub(crate) mod value;
1010

1111
fn escape_value(value: &BStr) -> BString {
12-
let starts_with_whitespace = value.first().map_or(false, u8::is_ascii_whitespace);
12+
let starts_with_whitespace = value.first().is_some_and(u8::is_ascii_whitespace);
1313
let ends_with_whitespace = value
1414
.get(value.len().saturating_sub(1))
15-
.map_or(false, u8::is_ascii_whitespace);
15+
.is_some_and(u8::is_ascii_whitespace);
1616
let contains_comment_indicators = value.find_byteset(b";#").is_some();
1717
let quote = starts_with_whitespace || ends_with_whitespace || contains_comment_indicators;
1818

gix-config/src/file/mutable/section.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,7 @@ impl<'a, 'event> SectionMut<'a, 'event> {
274274
/// Performs the removal, assuming the range is valid.
275275
fn remove_internal(&mut self, range: Range<usize>, fix_whitespace: bool) -> Cow<'event, BStr> {
276276
let events = &mut self.section.body.0;
277-
if fix_whitespace
278-
&& events
279-
.get(range.end)
280-
.map_or(false, |ev| matches!(ev, Event::Newline(_)))
281-
{
277+
if fix_whitespace && events.get(range.end).is_some_and(|ev| matches!(ev, Event::Newline(_))) {
282278
events.remove(range.end);
283279
}
284280
let value = events
@@ -294,7 +290,7 @@ impl<'a, 'event> SectionMut<'a, 'event> {
294290
.start
295291
.checked_sub(1)
296292
.and_then(|pos| events.get(pos))
297-
.map_or(false, |ev| matches!(ev, Event::Whitespace(_)))
293+
.is_some_and(|ev| matches!(ev, Event::Whitespace(_)))
298294
{
299295
events.remove(range.start - 1);
300296
}

gix-config/src/parse/section/header.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn validated_name(name: Cow<'_, BStr>) -> Result<Cow<'_, BStr>, Error> {
6262
impl Header<'_> {
6363
///Return true if this is a header like `[legacy.subsection]`, or false otherwise.
6464
pub fn is_legacy(&self) -> bool {
65-
self.separator.as_deref().map_or(false, |n| n == ".")
65+
self.separator.as_deref().is_some_and(|n| n == ".")
6666
}
6767

6868
/// Return the subsection name, if present, i.e. "origin" in `[remote "origin"]`.

gix-config/src/source.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl Source {
7171
.transpose()
7272
.ok()
7373
.flatten()
74-
.map_or(false, |b| b.0)
74+
.is_some_and(|b| b.0)
7575
{
7676
None
7777
} else {
@@ -84,7 +84,7 @@ impl Source {
8484
.transpose()
8585
.ok()
8686
.flatten()
87-
.map_or(false, |b| b.0)
87+
.is_some_and(|b| b.0)
8888
{
8989
None
9090
} else {

gix-config/tests/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description = "Tests for the gix-config crate"
88
license = "MIT OR Apache-2.0"
99
authors = ["Edward Shen <[email protected]>"]
1010
edition = "2021"
11-
rust-version = "1.65"
11+
rust-version = "1.70"
1212
publish = false
1313

1414

gix-credentials/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
88
description = "A crate of the gitoxide project to interact with git credentials helpers"
99
authors = ["Sebastian Thiel <[email protected]>"]
1010
edition = "2021"
11-
rust-version = "1.65"
11+
rust-version = "1.70"
1212
include = ["src/**/*", "LICENSE-*"]
1313

1414
[lib]

gix-diff/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description = "Calculate differences between various git objects"
99
authors = ["Sebastian Thiel <[email protected]>"]
1010
edition = "2021"
1111
include = ["src/**/*", "LICENSE-*"]
12-
rust-version = "1.65"
12+
rust-version = "1.70"
1313
autotests = false
1414

1515
[features]

gix-diff/src/blob/pipeline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ impl Pipeline {
406406
if matches!(mode, EntryKind::Blob | EntryKind::BlobExecutable)
407407
&& convert == Mode::ToWorktreeAndBinaryToText
408408
|| (convert == Mode::ToGitUnlessBinaryToTextIsPresent
409-
&& driver.map_or(false, |d| d.binary_to_text_command.is_some()))
409+
&& driver.is_some_and(|d| d.binary_to_text_command.is_some()))
410410
{
411411
let res =
412412
self.worktree_filter

gix-diff/src/index/function.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ where
5959
let pattern_matches = RefCell::new(|relative_path, entry: &gix_index::Entry| {
6060
pathspec
6161
.pattern_matching_relative_path(relative_path, Some(entry.mode.is_submodule()), pathspec_attributes)
62-
.map_or(false, |m| !m.is_excluded())
62+
.is_some_and(|m| !m.is_excluded())
6363
});
6464

6565
let (mut lhs_iter, mut rhs_iter) = (

gix-diff/tests/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
99
description = "Tests for the gix-diff crate"
1010
authors = ["Sebastian Thiel <[email protected]>"]
1111
edition = "2021"
12-
rust-version = "1.65"
12+
rust-version = "1.70"
1313

1414
[[test]]
1515
doctest = false

gix-diff/tests/diff/tree_with_rewrites.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ fn realistic_renames_disabled_2() -> crate::Result {
10041004
// Directories are associated with their children, making a bundling possible.
10051005
insta::assert_debug_snapshot!(changes.into_iter()
10061006
.filter(|c| !c.entry_mode().is_tree() ||
1007-
c.relation().map_or(false, |r| matches!(r, Relation::Parent(_)))
1007+
c.relation().is_some_and(|r| matches!(r, Relation::Parent(_)))
10081008
).collect::<Vec<_>>(), @r#"
10091009
[
10101010
Deletion {
@@ -1427,7 +1427,7 @@ fn realistic_renames_2() -> crate::Result {
14271427
// Look how nicely it captures and associates this directory rename.
14281428
insta::assert_debug_snapshot!(changes.into_iter()
14291429
.filter(|c| !c.entry_mode().is_tree() ||
1430-
c.relation().map_or(false, |r| matches!(r, Relation::Parent(_)))
1430+
c.relation().is_some_and(|r| matches!(r, Relation::Parent(_)))
14311431
).collect::<Vec<_>>(), @r#"
14321432
[
14331433
Rewrite {
@@ -1690,7 +1690,7 @@ fn realistic_renames_3_without_identity() -> crate::Result {
16901690
// Look how nicely it captures and associates this directory rename.
16911691
insta::assert_debug_snapshot!(changes.into_iter()
16921692
.filter(|c| !c.entry_mode().is_tree() ||
1693-
c.relation().map_or(false, |r| matches!(r, Relation::Parent(_)))
1693+
c.relation().is_some_and(|r| matches!(r, Relation::Parent(_)))
16941694
).collect::<Vec<_>>(), @r#"
16951695
[
16961696
Rewrite {

gix-dir/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
88
description = "A crate of the gitoxide project dealing with directory walks"
99
authors = ["Sebastian Thiel <[email protected]>"]
1010
edition = "2021"
11-
rust-version = "1.65"
11+
rust-version = "1.70"
1212

1313
[lib]
1414
doctest = false

gix-dir/src/entry.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl Status {
190190
for_deletion: Option<ForDeletionMode>,
191191
worktree_root_is_repository: bool,
192192
) -> bool {
193-
let is_dir_on_disk = file_type.map_or(false, |ft| {
193+
let is_dir_on_disk = file_type.is_some_and(|ft| {
194194
if worktree_root_is_repository {
195195
ft.is_dir()
196196
} else {
@@ -203,13 +203,13 @@ impl Status {
203203
match self {
204204
Status::Pruned => false,
205205
Status::Ignored(_) => {
206-
for_deletion.map_or(false, |fd| {
206+
for_deletion.is_some_and(|fd| {
207207
matches!(
208208
fd,
209209
ForDeletionMode::FindNonBareRepositoriesInIgnoredDirectories
210210
| ForDeletionMode::FindRepositoriesInIgnoredDirectories
211211
)
212-
}) || pathspec_match.map_or(false, |m| !m.should_ignore())
212+
}) || pathspec_match.is_some_and(|m| !m.should_ignore())
213213
}
214214
Status::Untracked | Status::Tracked => true,
215215
}

gix-dir/src/walk/classify.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn root(
2424
let mut out = path(&mut path_buf, buf, 0, file_kind, || None, options, ctx)?;
2525
let worktree_root_is_repository = out
2626
.disk_kind
27-
.map_or(false, |kind| matches!(kind, entry::Kind::Repository));
27+
.is_some_and(|kind| matches!(kind, entry::Kind::Repository));
2828

2929
for component in worktree_relative_root.components() {
3030
if last_length.is_some() {
@@ -200,7 +200,7 @@ pub fn path(
200200
.pattern_matching_relative_path(rela_path.as_bstr(), kind.map(|ft| ft.is_dir()), ctx.pathspec_attributes)
201201
.map(Into::into);
202202

203-
if worktree_relative_worktree_dirs.map_or(false, |worktrees| worktrees.contains(&*rela_path)) {
203+
if worktree_relative_worktree_dirs.is_some_and(|worktrees| worktrees.contains(&*rela_path)) {
204204
return Ok(out
205205
.with_kind(Some(entry::Kind::Repository), None)
206206
.with_status(entry::Status::Tracked));
@@ -267,9 +267,9 @@ pub fn path(
267267
),
268268
);
269269
}
270-
if kind.map_or(false, |d| d.is_recursable_dir())
270+
if kind.is_some_and(|d| d.is_recursable_dir())
271271
&& (out.pathspec_match.is_none()
272-
|| worktree_relative_worktree_dirs.map_or(false, |worktrees| {
272+
|| worktree_relative_worktree_dirs.is_some_and(|worktrees| {
273273
for_deletion.is_some()
274274
&& worktrees
275275
.iter()
@@ -289,7 +289,7 @@ pub fn path(
289289
debug_assert!(maybe_status.is_none());
290290
let mut status = entry::Status::Untracked;
291291

292-
if kind.map_or(false, |ft| ft.is_dir()) {
292+
if kind.is_some_and(|ft| ft.is_dir()) {
293293
kind = maybe_upgrade_to_repository(kind, classify_untracked_bare_repositories);
294294
} else if out.pathspec_match.is_none() {
295295
status = entry::Status::Pruned;
@@ -313,7 +313,7 @@ pub fn maybe_upgrade_to_repository(
313313
if is_nested_repo {
314314
let git_dir_is_our_own = gix_path::realpath_opts(path, current_dir, gix_path::realpath::MAX_SYMLINKS)
315315
.ok()
316-
.map_or(false, |realpath_candidate| realpath_candidate == git_dir_realpath);
316+
.is_some_and(|realpath_candidate| realpath_candidate == git_dir_realpath);
317317
is_nested_repo = !git_dir_is_our_own;
318318
}
319319
if is_nested_repo {
@@ -325,7 +325,7 @@ pub fn maybe_upgrade_to_repository(
325325
if is_nested_nonbare_repo {
326326
let git_dir_is_our_own = gix_path::realpath_opts(path, current_dir, gix_path::realpath::MAX_SYMLINKS)
327327
.ok()
328-
.map_or(false, |realpath_candidate| realpath_candidate == git_dir_realpath);
328+
.is_some_and(|realpath_candidate| realpath_candidate == git_dir_realpath);
329329
is_nested_nonbare_repo = !git_dir_is_our_own;
330330
}
331331
path.pop();
@@ -387,7 +387,7 @@ fn resolve_file_type_with_index(
387387
}
388388
Some(entry) => {
389389
let icase_dir = index.entry_closest_to_directory_icase(rela_path.as_bstr(), true, accelerate);
390-
let directory_matches_exactly = icase_dir.map_or(false, |dir| {
390+
let directory_matches_exactly = icase_dir.is_some_and(|dir| {
391391
let path = dir.path(index);
392392
let slash_idx = path.rfind_byte(b'/').expect("dir");
393393
path[..slash_idx].as_bstr() == rela_path
@@ -430,7 +430,7 @@ fn resolve_file_type_with_index(
430430
if all_excluded_from_worktree_non_cone
431431
|| one_index_signalling_with_cone
432432
.filter(|_| kind.is_none())
433-
.map_or(false, |idx| index.entries()[idx].mode.is_sparse())
433+
.is_some_and(|idx| index.entries()[idx].mode.is_sparse())
434434
{
435435
special_property = Some(entry::Property::TrackedExcluded);
436436
}

gix-dir/src/walk/function.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub fn walk(
8383
delegate,
8484
);
8585
if !can_recurse {
86-
if buf.is_empty() && !root_info.disk_kind.map_or(false, |kind| kind.is_dir()) {
86+
if buf.is_empty() && !root_info.disk_kind.is_some_and(|kind| kind.is_dir()) {
8787
return Err(Error::WorktreeRootIsFile { root: root.to_owned() });
8888
}
8989
if options.precompose_unicode {
@@ -159,7 +159,7 @@ pub(super) fn can_recurse(
159159
worktree_root_is_repository: bool,
160160
delegate: &mut dyn Delegate,
161161
) -> bool {
162-
let is_dir = info.disk_kind.map_or(false, |k| k.is_dir());
162+
let is_dir = info.disk_kind.is_some_and(|k| k.is_dir());
163163
if !is_dir {
164164
return false;
165165
}

gix-dir/src/walk/readdir.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub(super) fn recursive(
2626
out: &mut Outcome,
2727
state: &mut State,
2828
) -> Result<(Action, bool), Error> {
29-
if ctx.should_interrupt.map_or(false, |flag| flag.load(Ordering::Relaxed)) {
29+
if ctx.should_interrupt.is_some_and(|flag| flag.load(Ordering::Relaxed)) {
3030
return Err(Error::Interrupted);
3131
}
3232
out.read_dir_calls += 1;
@@ -303,12 +303,10 @@ impl Mark {
303303
if kind == Some(entry::Kind::Repository) {
304304
return None;
305305
}
306-
if pathspec_match.map_or(false, |m| {
307-
matches!(m, PathspecMatch::Verbatim | PathspecMatch::Excluded)
308-
}) {
306+
if pathspec_match.is_some_and(|m| matches!(m, PathspecMatch::Verbatim | PathspecMatch::Excluded)) {
309307
return None;
310308
}
311-
matching_entries += usize::from(pathspec_match.map_or(false, |m| !m.should_ignore()));
309+
matching_entries += usize::from(pathspec_match.is_some_and(|m| !m.should_ignore()));
312310
match status {
313311
Status::Pruned => {
314312
unreachable!("BUG: pruned aren't ever held, check `should_hold()`")

gix-discover/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description = "Discover git repositories and check if a directory is a git repos
99
authors = ["Sebastian Thiel <[email protected]>"]
1010
edition = "2021"
1111
include = ["src/**/*", "LICENSE-*"]
12-
rust-version = "1.65"
12+
rust-version = "1.70"
1313

1414
[lib]
1515
doctest = false

0 commit comments

Comments
 (0)