From 9186fa0eb4f2757b730fe43aa6dee38bd9f83c63 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 12 Jan 2025 11:21:02 +0100 Subject: [PATCH] chore: bump `rust-version` to 1.70 That way clippy will allow to use the fantastic `Option::is_some_and()` and friends. --- gix-actor/Cargo.toml | 2 +- gix-archive/Cargo.toml | 2 +- gix-attributes/Cargo.toml | 2 +- gix-bitmap/Cargo.toml | 2 +- gix-blame/Cargo.toml | 2 +- gix-chunk/Cargo.toml | 2 +- gix-command/Cargo.toml | 2 +- gix-commitgraph/Cargo.toml | 2 +- gix-config-value/Cargo.toml | 2 +- gix-config/Cargo.toml | 2 +- gix-config/src/file/mutable/mod.rs | 4 +-- gix-config/src/file/mutable/section.rs | 8 ++--- gix-config/src/parse/section/header.rs | 2 +- gix-config/src/source.rs | 4 +-- gix-config/tests/Cargo.toml | 2 +- gix-credentials/Cargo.toml | 2 +- gix-diff/Cargo.toml | 2 +- gix-diff/src/blob/pipeline.rs | 2 +- gix-diff/src/index/function.rs | 2 +- gix-diff/tests/Cargo.toml | 2 +- gix-diff/tests/diff/tree_with_rewrites.rs | 6 ++-- gix-dir/Cargo.toml | 2 +- gix-dir/src/entry.rs | 6 ++-- gix-dir/src/walk/classify.rs | 18 ++++++------ gix-dir/src/walk/function.rs | 4 +-- gix-dir/src/walk/readdir.rs | 8 ++--- gix-discover/Cargo.toml | 2 +- gix-discover/src/upwards/mod.rs | 4 +-- gix-features/Cargo.toml | 2 +- gix-fetchhead/Cargo.toml | 2 +- gix-filter/Cargo.toml | 2 +- gix-filter/examples/arrow.rs | 4 +-- gix-fs/Cargo.toml | 2 +- gix-fsck/Cargo.toml | 2 +- gix-glob/Cargo.toml | 2 +- gix-glob/src/pattern.rs | 4 +-- gix-glob/src/wildmatch.rs | 2 +- gix-hash/Cargo.toml | 2 +- gix-hashtable/Cargo.toml | 2 +- gix-ignore/Cargo.toml | 2 +- gix-index/Cargo.toml | 2 +- gix-index/src/access/mod.rs | 4 +-- gix-index/src/extension/untracked_cache.rs | 2 +- gix-index/tests/Cargo.toml | 2 +- gix-lfs/Cargo.toml | 2 +- gix-lock/Cargo.toml | 2 +- gix-macros/Cargo.toml | 2 +- gix-mailmap/Cargo.toml | 2 +- gix-merge/Cargo.toml | 2 +- gix-merge/src/tree/mod.rs | 9 ++---- gix-negotiate/Cargo.toml | 2 +- gix-negotiate/src/consecutive.rs | 2 +- gix-negotiate/src/skipping.rs | 6 ++-- gix-note/Cargo.toml | 2 +- gix-object/Cargo.toml | 2 +- gix-object/src/tree/editor.rs | 4 +-- gix-odb/Cargo.toml | 2 +- gix-odb/src/memory.rs | 2 +- gix-odb/tests/Cargo.toml | 2 +- gix-pack/Cargo.toml | 2 +- gix-pack/tests/Cargo.toml | 2 +- gix-packetline-blocking/Cargo.toml | 2 +- gix-packetline/Cargo.toml | 2 +- gix-path/Cargo.toml | 2 +- gix-pathspec/Cargo.toml | 2 +- gix-pathspec/tests/search/mod.rs | 2 +- gix-prompt/Cargo.toml | 2 +- gix-protocol/Cargo.toml | 2 +- gix-protocol/src/fetch/negotiate.rs | 6 ++-- gix-quote/Cargo.toml | 2 +- gix-rebase/Cargo.toml | 2 +- gix-ref/Cargo.toml | 2 +- gix-ref/src/store/file/find.rs | 2 +- gix-ref/src/store/file/loose/iter.rs | 2 +- gix-ref/src/store/file/overlay_iter.rs | 2 +- gix-ref/src/store/file/transaction/prepare.rs | 2 +- gix-ref/tests/Cargo.toml | 2 +- gix-refspec/Cargo.toml | 2 +- gix-revision/Cargo.toml | 2 +- gix-revision/src/merge_base/function.rs | 9 +++--- gix-revision/src/spec/parse/function.rs | 2 +- gix-revwalk/Cargo.toml | 2 +- gix-sec/Cargo.toml | 2 +- gix-sequencer/Cargo.toml | 2 +- gix-shallow/Cargo.toml | 2 +- gix-status/Cargo.toml | 2 +- gix-status/src/index_as_worktree/function.rs | 2 +- .../src/index_as_worktree_with_renames/mod.rs | 2 +- gix-status/tests/Cargo.toml | 2 +- gix-submodule/Cargo.toml | 2 +- gix-submodule/src/is_active_platform.rs | 2 +- gix-tempfile/Cargo.toml | 2 +- gix-tempfile/src/registry.rs | 7 ++--- gix-tix/Cargo.toml | 2 +- gix-trace/Cargo.toml | 2 +- gix-transport/Cargo.toml | 2 +- .../src/client/blocking_io/http/mod.rs | 2 +- .../src/client/blocking_io/ssh/mod.rs | 2 +- gix-traverse/Cargo.toml | 2 +- gix-traverse/tests/Cargo.toml | 2 +- gix-tui/Cargo.toml | 2 +- gix-url/Cargo.toml | 2 +- gix-utils/Cargo.toml | 2 +- gix-validate/Cargo.toml | 2 +- gix-validate/src/path.rs | 29 ++++++++----------- gix-worktree-state/Cargo.toml | 2 +- gix-worktree-state/tests/Cargo.toml | 2 +- gix-worktree-stream/Cargo.toml | 2 +- gix-worktree/Cargo.toml | 2 +- gix-worktree/src/stack/platform.rs | 2 +- gix-worktree/tests/Cargo.toml | 2 +- gix-worktree/tests/worktree/stack/ignore.rs | 2 +- gix/Cargo.toml | 2 +- gix/src/pathspec.rs | 8 ++--- .../connection/fetch/update_refs/mod.rs | 4 +-- gix/src/repository/dirwalk.rs | 2 +- gix/src/repository/shallow.rs | 4 +-- .../revision/spec/parse/delegate/navigate.rs | 4 +-- gix/src/status/index_worktree.rs | 4 +-- gix/src/status/iter/types.rs | 2 +- gix/src/status/tree_index.rs | 2 +- gix/src/submodule/mod.rs | 4 +-- gix/tests/gix/clone.rs | 2 +- gix/tests/gix/remote/fetch.rs | 12 ++++---- 124 files changed, 180 insertions(+), 200 deletions(-) diff --git a/gix-actor/Cargo.toml b/gix-actor/Cargo.toml index 3f1e1e6798d..c791d87f3e2 100644 --- a/gix-actor/Cargo.toml +++ b/gix-actor/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://github.com/GitoxideLabs/gitoxide" license = "MIT OR Apache-2.0" edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-archive/Cargo.toml b/gix-archive/Cargo.toml index 475b0ae7fef..342d5382d7d 100644 --- a/gix-archive/Cargo.toml +++ b/gix-archive/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "archive generation from of a worktree stream" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" include = ["src/**/*", "LICENSE-*"] [lib] diff --git a/gix-attributes/Cargo.toml b/gix-attributes/Cargo.toml index a51601c29fe..46f4ca811cb 100644 --- a/gix-attributes/Cargo.toml +++ b/gix-attributes/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project dealing .gitattributes files" authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-bitmap/Cargo.toml b/gix-bitmap/Cargo.toml index 52008ee0871..fe69d676e78 100644 --- a/gix-bitmap/Cargo.toml +++ b/gix-bitmap/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project dedicated implementing the standard git bitmap format" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" exclude = ["CHANGELOG.md"] [lib] diff --git a/gix-blame/Cargo.toml b/gix-blame/Cargo.toml index fc4baf3fe48..dee58fe403c 100644 --- a/gix-blame/Cargo.toml +++ b/gix-blame/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project dedicated to implementing a 'blame' algorithm" authors = ["Christoph Rüßler ", "Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-chunk/Cargo.toml b/gix-chunk/Cargo.toml index e04a7f9b551..ae668656a09 100644 --- a/gix-chunk/Cargo.toml +++ b/gix-chunk/Cargo.toml @@ -10,7 +10,7 @@ documentation = "https://github.com/git/git/blob/seen/Documentation/technical/ch license = "MIT OR Apache-2.0" edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-command/Cargo.toml b/gix-command/Cargo.toml index dd5e2917687..df11992ed6c 100644 --- a/gix-command/Cargo.toml +++ b/gix-command/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project handling internal git command execution" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" include = ["src/lib.rs", "LICENSE-*"] [lib] diff --git a/gix-commitgraph/Cargo.toml b/gix-commitgraph/Cargo.toml index eeb8700e92a..7df0efe5ce7 100644 --- a/gix-commitgraph/Cargo.toml +++ b/gix-commitgraph/Cargo.toml @@ -10,7 +10,7 @@ description = "Read-only access to the git commitgraph file format" authors = ["Conor Davis ", "Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-config-value/Cargo.toml b/gix-config-value/Cargo.toml index 81b3702a72c..b274900f3e4 100644 --- a/gix-config-value/Cargo.toml +++ b/gix-config-value/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project providing git-config value parsing" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" include = ["src/**/*", "LICENSE-*"] [lib] diff --git a/gix-config/Cargo.toml b/gix-config/Cargo.toml index 07a4b63500f..c576ee3405c 100644 --- a/gix-config/Cargo.toml +++ b/gix-config/Cargo.toml @@ -11,7 +11,7 @@ edition = "2021" keywords = ["git-config", "git", "config", "gitoxide"] categories = ["config", "parser-implementations"] include = ["src/**/*", "LICENSE-*", "README.md"] -rust-version = "1.65" +rust-version = "1.70" autotests = false [features] diff --git a/gix-config/src/file/mutable/mod.rs b/gix-config/src/file/mutable/mod.rs index 3a9470c39d0..42da328bdb3 100644 --- a/gix-config/src/file/mutable/mod.rs +++ b/gix-config/src/file/mutable/mod.rs @@ -9,10 +9,10 @@ pub(crate) mod section; pub(crate) mod value; fn escape_value(value: &BStr) -> BString { - let starts_with_whitespace = value.first().map_or(false, u8::is_ascii_whitespace); + let starts_with_whitespace = value.first().is_some_and(u8::is_ascii_whitespace); let ends_with_whitespace = value .get(value.len().saturating_sub(1)) - .map_or(false, u8::is_ascii_whitespace); + .is_some_and(u8::is_ascii_whitespace); let contains_comment_indicators = value.find_byteset(b";#").is_some(); let quote = starts_with_whitespace || ends_with_whitespace || contains_comment_indicators; diff --git a/gix-config/src/file/mutable/section.rs b/gix-config/src/file/mutable/section.rs index e81eb8569e9..447c8648d67 100644 --- a/gix-config/src/file/mutable/section.rs +++ b/gix-config/src/file/mutable/section.rs @@ -274,11 +274,7 @@ impl<'a, 'event> SectionMut<'a, 'event> { /// Performs the removal, assuming the range is valid. fn remove_internal(&mut self, range: Range, fix_whitespace: bool) -> Cow<'event, BStr> { let events = &mut self.section.body.0; - if fix_whitespace - && events - .get(range.end) - .map_or(false, |ev| matches!(ev, Event::Newline(_))) - { + if fix_whitespace && events.get(range.end).is_some_and(|ev| matches!(ev, Event::Newline(_))) { events.remove(range.end); } let value = events @@ -294,7 +290,7 @@ impl<'a, 'event> SectionMut<'a, 'event> { .start .checked_sub(1) .and_then(|pos| events.get(pos)) - .map_or(false, |ev| matches!(ev, Event::Whitespace(_))) + .is_some_and(|ev| matches!(ev, Event::Whitespace(_))) { events.remove(range.start - 1); } diff --git a/gix-config/src/parse/section/header.rs b/gix-config/src/parse/section/header.rs index 5f4e382c90a..c0f27f6766a 100644 --- a/gix-config/src/parse/section/header.rs +++ b/gix-config/src/parse/section/header.rs @@ -62,7 +62,7 @@ fn validated_name(name: Cow<'_, BStr>) -> Result, Error> { impl Header<'_> { ///Return true if this is a header like `[legacy.subsection]`, or false otherwise. pub fn is_legacy(&self) -> bool { - self.separator.as_deref().map_or(false, |n| n == ".") + self.separator.as_deref().is_some_and(|n| n == ".") } /// Return the subsection name, if present, i.e. "origin" in `[remote "origin"]`. diff --git a/gix-config/src/source.rs b/gix-config/src/source.rs index a88c14a26ee..d56c1a51b67 100644 --- a/gix-config/src/source.rs +++ b/gix-config/src/source.rs @@ -71,7 +71,7 @@ impl Source { .transpose() .ok() .flatten() - .map_or(false, |b| b.0) + .is_some_and(|b| b.0) { None } else { @@ -84,7 +84,7 @@ impl Source { .transpose() .ok() .flatten() - .map_or(false, |b| b.0) + .is_some_and(|b| b.0) { None } else { diff --git a/gix-config/tests/Cargo.toml b/gix-config/tests/Cargo.toml index 36895eb9373..59a59cb9e89 100644 --- a/gix-config/tests/Cargo.toml +++ b/gix-config/tests/Cargo.toml @@ -8,7 +8,7 @@ description = "Tests for the gix-config crate" license = "MIT OR Apache-2.0" authors = ["Edward Shen "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" publish = false diff --git a/gix-credentials/Cargo.toml b/gix-credentials/Cargo.toml index 97f16fc8622..84072e67b4d 100644 --- a/gix-credentials/Cargo.toml +++ b/gix-credentials/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project to interact with git credentials helpers" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" include = ["src/**/*", "LICENSE-*"] [lib] diff --git a/gix-diff/Cargo.toml b/gix-diff/Cargo.toml index e3de39938c3..1eb573dca8d 100644 --- a/gix-diff/Cargo.toml +++ b/gix-diff/Cargo.toml @@ -9,7 +9,7 @@ description = "Calculate differences between various git objects" authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" autotests = false [features] diff --git a/gix-diff/src/blob/pipeline.rs b/gix-diff/src/blob/pipeline.rs index b9c727e4ca8..9f7f342de11 100644 --- a/gix-diff/src/blob/pipeline.rs +++ b/gix-diff/src/blob/pipeline.rs @@ -406,7 +406,7 @@ impl Pipeline { if matches!(mode, EntryKind::Blob | EntryKind::BlobExecutable) && convert == Mode::ToWorktreeAndBinaryToText || (convert == Mode::ToGitUnlessBinaryToTextIsPresent - && driver.map_or(false, |d| d.binary_to_text_command.is_some())) + && driver.is_some_and(|d| d.binary_to_text_command.is_some())) { let res = self.worktree_filter diff --git a/gix-diff/src/index/function.rs b/gix-diff/src/index/function.rs index 6a4f63bc548..28f8101da51 100644 --- a/gix-diff/src/index/function.rs +++ b/gix-diff/src/index/function.rs @@ -59,7 +59,7 @@ where let pattern_matches = RefCell::new(|relative_path, entry: &gix_index::Entry| { pathspec .pattern_matching_relative_path(relative_path, Some(entry.mode.is_submodule()), pathspec_attributes) - .map_or(false, |m| !m.is_excluded()) + .is_some_and(|m| !m.is_excluded()) }); let (mut lhs_iter, mut rhs_iter) = ( diff --git a/gix-diff/tests/Cargo.toml b/gix-diff/tests/Cargo.toml index 35645e05d90..6b57b0d7a2a 100644 --- a/gix-diff/tests/Cargo.toml +++ b/gix-diff/tests/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" description = "Tests for the gix-diff crate" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" [[test]] doctest = false diff --git a/gix-diff/tests/diff/tree_with_rewrites.rs b/gix-diff/tests/diff/tree_with_rewrites.rs index fe51cabdcb1..b13e7f028e3 100644 --- a/gix-diff/tests/diff/tree_with_rewrites.rs +++ b/gix-diff/tests/diff/tree_with_rewrites.rs @@ -1004,7 +1004,7 @@ fn realistic_renames_disabled_2() -> crate::Result { // Directories are associated with their children, making a bundling possible. insta::assert_debug_snapshot!(changes.into_iter() .filter(|c| !c.entry_mode().is_tree() || - c.relation().map_or(false, |r| matches!(r, Relation::Parent(_))) + c.relation().is_some_and(|r| matches!(r, Relation::Parent(_))) ).collect::>(), @r#" [ Deletion { @@ -1427,7 +1427,7 @@ fn realistic_renames_2() -> crate::Result { // Look how nicely it captures and associates this directory rename. insta::assert_debug_snapshot!(changes.into_iter() .filter(|c| !c.entry_mode().is_tree() || - c.relation().map_or(false, |r| matches!(r, Relation::Parent(_))) + c.relation().is_some_and(|r| matches!(r, Relation::Parent(_))) ).collect::>(), @r#" [ Rewrite { @@ -1690,7 +1690,7 @@ fn realistic_renames_3_without_identity() -> crate::Result { // Look how nicely it captures and associates this directory rename. insta::assert_debug_snapshot!(changes.into_iter() .filter(|c| !c.entry_mode().is_tree() || - c.relation().map_or(false, |r| matches!(r, Relation::Parent(_))) + c.relation().is_some_and(|r| matches!(r, Relation::Parent(_))) ).collect::>(), @r#" [ Rewrite { diff --git a/gix-dir/Cargo.toml b/gix-dir/Cargo.toml index bcd40df7d7e..fffffa2a322 100644 --- a/gix-dir/Cargo.toml +++ b/gix-dir/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project dealing with directory walks" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-dir/src/entry.rs b/gix-dir/src/entry.rs index ff0ce460c27..690be589ff2 100644 --- a/gix-dir/src/entry.rs +++ b/gix-dir/src/entry.rs @@ -190,7 +190,7 @@ impl Status { for_deletion: Option, worktree_root_is_repository: bool, ) -> bool { - let is_dir_on_disk = file_type.map_or(false, |ft| { + let is_dir_on_disk = file_type.is_some_and(|ft| { if worktree_root_is_repository { ft.is_dir() } else { @@ -203,13 +203,13 @@ impl Status { match self { Status::Pruned => false, Status::Ignored(_) => { - for_deletion.map_or(false, |fd| { + for_deletion.is_some_and(|fd| { matches!( fd, ForDeletionMode::FindNonBareRepositoriesInIgnoredDirectories | ForDeletionMode::FindRepositoriesInIgnoredDirectories ) - }) || pathspec_match.map_or(false, |m| !m.should_ignore()) + }) || pathspec_match.is_some_and(|m| !m.should_ignore()) } Status::Untracked | Status::Tracked => true, } diff --git a/gix-dir/src/walk/classify.rs b/gix-dir/src/walk/classify.rs index d5fcbcafcd4..9ffa6522312 100644 --- a/gix-dir/src/walk/classify.rs +++ b/gix-dir/src/walk/classify.rs @@ -24,7 +24,7 @@ pub fn root( let mut out = path(&mut path_buf, buf, 0, file_kind, || None, options, ctx)?; let worktree_root_is_repository = out .disk_kind - .map_or(false, |kind| matches!(kind, entry::Kind::Repository)); + .is_some_and(|kind| matches!(kind, entry::Kind::Repository)); for component in worktree_relative_root.components() { if last_length.is_some() { @@ -200,7 +200,7 @@ pub fn path( .pattern_matching_relative_path(rela_path.as_bstr(), kind.map(|ft| ft.is_dir()), ctx.pathspec_attributes) .map(Into::into); - if worktree_relative_worktree_dirs.map_or(false, |worktrees| worktrees.contains(&*rela_path)) { + if worktree_relative_worktree_dirs.is_some_and(|worktrees| worktrees.contains(&*rela_path)) { return Ok(out .with_kind(Some(entry::Kind::Repository), None) .with_status(entry::Status::Tracked)); @@ -267,9 +267,9 @@ pub fn path( ), ); } - if kind.map_or(false, |d| d.is_recursable_dir()) + if kind.is_some_and(|d| d.is_recursable_dir()) && (out.pathspec_match.is_none() - || worktree_relative_worktree_dirs.map_or(false, |worktrees| { + || worktree_relative_worktree_dirs.is_some_and(|worktrees| { for_deletion.is_some() && worktrees .iter() @@ -289,7 +289,7 @@ pub fn path( debug_assert!(maybe_status.is_none()); let mut status = entry::Status::Untracked; - if kind.map_or(false, |ft| ft.is_dir()) { + if kind.is_some_and(|ft| ft.is_dir()) { kind = maybe_upgrade_to_repository(kind, classify_untracked_bare_repositories); } else if out.pathspec_match.is_none() { status = entry::Status::Pruned; @@ -313,7 +313,7 @@ pub fn maybe_upgrade_to_repository( if is_nested_repo { let git_dir_is_our_own = gix_path::realpath_opts(path, current_dir, gix_path::realpath::MAX_SYMLINKS) .ok() - .map_or(false, |realpath_candidate| realpath_candidate == git_dir_realpath); + .is_some_and(|realpath_candidate| realpath_candidate == git_dir_realpath); is_nested_repo = !git_dir_is_our_own; } if is_nested_repo { @@ -325,7 +325,7 @@ pub fn maybe_upgrade_to_repository( if is_nested_nonbare_repo { let git_dir_is_our_own = gix_path::realpath_opts(path, current_dir, gix_path::realpath::MAX_SYMLINKS) .ok() - .map_or(false, |realpath_candidate| realpath_candidate == git_dir_realpath); + .is_some_and(|realpath_candidate| realpath_candidate == git_dir_realpath); is_nested_nonbare_repo = !git_dir_is_our_own; } path.pop(); @@ -387,7 +387,7 @@ fn resolve_file_type_with_index( } Some(entry) => { let icase_dir = index.entry_closest_to_directory_icase(rela_path.as_bstr(), true, accelerate); - let directory_matches_exactly = icase_dir.map_or(false, |dir| { + let directory_matches_exactly = icase_dir.is_some_and(|dir| { let path = dir.path(index); let slash_idx = path.rfind_byte(b'/').expect("dir"); path[..slash_idx].as_bstr() == rela_path @@ -430,7 +430,7 @@ fn resolve_file_type_with_index( if all_excluded_from_worktree_non_cone || one_index_signalling_with_cone .filter(|_| kind.is_none()) - .map_or(false, |idx| index.entries()[idx].mode.is_sparse()) + .is_some_and(|idx| index.entries()[idx].mode.is_sparse()) { special_property = Some(entry::Property::TrackedExcluded); } diff --git a/gix-dir/src/walk/function.rs b/gix-dir/src/walk/function.rs index 21600f93251..65f8f8d1b73 100644 --- a/gix-dir/src/walk/function.rs +++ b/gix-dir/src/walk/function.rs @@ -83,7 +83,7 @@ pub fn walk( delegate, ); if !can_recurse { - if buf.is_empty() && !root_info.disk_kind.map_or(false, |kind| kind.is_dir()) { + if buf.is_empty() && !root_info.disk_kind.is_some_and(|kind| kind.is_dir()) { return Err(Error::WorktreeRootIsFile { root: root.to_owned() }); } if options.precompose_unicode { @@ -159,7 +159,7 @@ pub(super) fn can_recurse( worktree_root_is_repository: bool, delegate: &mut dyn Delegate, ) -> bool { - let is_dir = info.disk_kind.map_or(false, |k| k.is_dir()); + let is_dir = info.disk_kind.is_some_and(|k| k.is_dir()); if !is_dir { return false; } diff --git a/gix-dir/src/walk/readdir.rs b/gix-dir/src/walk/readdir.rs index ab1e9370344..9c6de3f97bf 100644 --- a/gix-dir/src/walk/readdir.rs +++ b/gix-dir/src/walk/readdir.rs @@ -26,7 +26,7 @@ pub(super) fn recursive( out: &mut Outcome, state: &mut State, ) -> Result<(Action, bool), Error> { - if ctx.should_interrupt.map_or(false, |flag| flag.load(Ordering::Relaxed)) { + if ctx.should_interrupt.is_some_and(|flag| flag.load(Ordering::Relaxed)) { return Err(Error::Interrupted); } out.read_dir_calls += 1; @@ -303,12 +303,10 @@ impl Mark { if kind == Some(entry::Kind::Repository) { return None; } - if pathspec_match.map_or(false, |m| { - matches!(m, PathspecMatch::Verbatim | PathspecMatch::Excluded) - }) { + if pathspec_match.is_some_and(|m| matches!(m, PathspecMatch::Verbatim | PathspecMatch::Excluded)) { return None; } - matching_entries += usize::from(pathspec_match.map_or(false, |m| !m.should_ignore())); + matching_entries += usize::from(pathspec_match.is_some_and(|m| !m.should_ignore())); match status { Status::Pruned => { unreachable!("BUG: pruned aren't ever held, check `should_hold()`") diff --git a/gix-discover/Cargo.toml b/gix-discover/Cargo.toml index d2398bf17da..234965d154b 100644 --- a/gix-discover/Cargo.toml +++ b/gix-discover/Cargo.toml @@ -9,7 +9,7 @@ description = "Discover git repositories and check if a directory is a git repos authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-discover/src/upwards/mod.rs b/gix-discover/src/upwards/mod.rs index 7419e0c7600..2ab7e9cdeee 100644 --- a/gix-discover/src/upwards/mod.rs +++ b/gix-discover/src/upwards/mod.rs @@ -89,7 +89,7 @@ pub(crate) mod function { let mut current_height = 0; let mut cursor_metadata = Some(dir_metadata); 'outer: loop { - if max_height.map_or(false, |x| current_height > x) { + if max_height.is_some_and(|x| current_height > x) { return Err(Error::NoGitRepositoryWithinCeiling { path: dir.into_owned(), ceiling_height: current_height, @@ -168,7 +168,7 @@ pub(crate) mod function { } } } - if cursor.parent().map_or(false, |p| p.as_os_str().is_empty()) { + if cursor.parent().is_some_and(|p| p.as_os_str().is_empty()) { cursor = cwd.to_path_buf(); dir_made_absolute = true; } diff --git a/gix-features/Cargo.toml b/gix-features/Cargo.toml index 055deb88688..81e46fba987 100644 --- a/gix-features/Cargo.toml +++ b/gix-features/Cargo.toml @@ -8,7 +8,7 @@ version = "0.39.1" authors = ["Sebastian Thiel "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.65" +rust-version = "1.70" include = ["src/**/*", "LICENSE-*"] [lib] diff --git a/gix-fetchhead/Cargo.toml b/gix-fetchhead/Cargo.toml index 091fd5ea312..93a574e2d38 100644 --- a/gix-fetchhead/Cargo.toml +++ b/gix-fetchhead/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project to read and write .git/FETCH_HEAD" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-filter/Cargo.toml b/gix-filter/Cargo.toml index c839818918d..6aa879a496c 100644 --- a/gix-filter/Cargo.toml +++ b/gix-filter/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project implementing git filters" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" include = ["src/**/*", "LICENSE-*"] [lib] diff --git a/gix-filter/examples/arrow.rs b/gix-filter/examples/arrow.rs index 616084deb09..23ee69d3de7 100644 --- a/gix-filter/examples/arrow.rs +++ b/gix-filter/examples/arrow.rs @@ -12,7 +12,7 @@ fn main() -> Result<(), Box> { let mut args = std::env::args(); let sub_command = args.nth(1).ok_or("Need sub-command")?; let next_arg = args.next(); // possibly %f - let needs_failure = next_arg.as_deref().map_or(false, |file| file.ends_with("fail")); + let needs_failure = next_arg.as_deref().is_some_and(|file| file.ends_with("fail")); if needs_failure { panic!("failure requested for {sub_command}"); } @@ -40,7 +40,7 @@ fn main() -> Result<(), Box> { .meta .iter() .find_map(|(key, value)| (key == "pathname").then_some(value)) - .map_or(false, |path| path.ends_with(b"fail")); + .is_some_and(|path| path.ends_with(b"fail")); let pathname = request .meta .iter() diff --git a/gix-fs/Cargo.toml b/gix-fs/Cargo.toml index 300183d6820..ae69db99e4d 100644 --- a/gix-fs/Cargo.toml +++ b/gix-fs/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate providing file system specific utilities to `gitoxide`" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" include = ["src/**/*", "LICENSE-*"] [lib] diff --git a/gix-fsck/Cargo.toml b/gix-fsck/Cargo.toml index b115dc31bee..340e4aba36c 100644 --- a/gix-fsck/Cargo.toml +++ b/gix-fsck/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" description = "Verifies the connectivity and validity of objects in the database" edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-glob/Cargo.toml b/gix-glob/Cargo.toml index ac9f1cc842c..9b269a4a460 100644 --- a/gix-glob/Cargo.toml +++ b/gix-glob/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project dealing with pattern matching" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" include = ["src/**/*", "LICENSE-*"] [lib] diff --git a/gix-glob/src/pattern.rs b/gix-glob/src/pattern.rs index 475b912b04a..3b0219169ab 100644 --- a/gix-glob/src/pattern.rs +++ b/gix-glob/src/pattern.rs @@ -135,7 +135,7 @@ impl Pattern { value .len() .checked_sub(text.len()) - .map_or(false, |start| text.eq_ignore_ascii_case(&value[start..])) + .is_some_and(|start| text.eq_ignore_ascii_case(&value[start..])) } else { value.ends_with(text.as_ref()) } @@ -144,7 +144,7 @@ impl Pattern { if mode.contains(wildmatch::Mode::IGNORE_CASE) { if !value .get(..pos) - .map_or(false, |value| value.eq_ignore_ascii_case(&self.text[..pos])) + .is_some_and(|value| value.eq_ignore_ascii_case(&self.text[..pos])) { return false; } diff --git a/gix-glob/src/wildmatch.rs b/gix-glob/src/wildmatch.rs index bd590dfd0de..964736f50b1 100644 --- a/gix-glob/src/wildmatch.rs +++ b/gix-glob/src/wildmatch.rs @@ -240,7 +240,7 @@ pub(crate) mod function { } BRACKET_OPEN if matches!(p.peek(), Some((_, COLON))) => { p.next(); - while p.peek().map_or(false, |t| t.1 != BRACKET_CLOSE) { + while p.peek().is_some_and(|t| t.1 != BRACKET_CLOSE) { p.next(); } let closing_bracket_idx = match p.next() { diff --git a/gix-hash/Cargo.toml b/gix-hash/Cargo.toml index 222504b4304..7594c7698e5 100644 --- a/gix-hash/Cargo.toml +++ b/gix-hash/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://github.com/GitoxideLabs/gitoxide" license = "MIT OR Apache-2.0" edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-hashtable/Cargo.toml b/gix-hashtable/Cargo.toml index e64a480fb57..dd459a7cd78 100644 --- a/gix-hashtable/Cargo.toml +++ b/gix-hashtable/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate that provides hashtable based data structures optimized t authors = ["Pascal Kuthe "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-ignore/Cargo.toml b/gix-ignore/Cargo.toml index d256d1ac9b5..b7094cb03da 100644 --- a/gix-ignore/Cargo.toml +++ b/gix-ignore/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project dealing .gitignore files" authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-index/Cargo.toml b/gix-index/Cargo.toml index 53dd8c0b4fb..74e62ed1b49 100644 --- a/gix-index/Cargo.toml +++ b/gix-index/Cargo.toml @@ -9,7 +9,7 @@ description = "A work-in-progress crate of the gitoxide project dedicated implem authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*", "README.md"] -rust-version = "1.65" +rust-version = "1.70" autotests = false diff --git a/gix-index/src/access/mod.rs b/gix-index/src/access/mod.rs index 855a7e97dc7..9a66fa2b08d 100644 --- a/gix-index/src/access/mod.rs +++ b/gix-index/src/access/mod.rs @@ -331,8 +331,8 @@ impl State { .get(..prefix_len) .map_or_else(|| e.path(self) <= &prefix[..e.path.len()], |p| p < prefix) }); - let mut high = low - + self.entries[low..].partition_point(|e| e.path(self).get(..prefix_len).map_or(false, |p| p <= prefix)); + let mut high = + low + self.entries[low..].partition_point(|e| e.path(self).get(..prefix_len).is_some_and(|p| p <= prefix)); let low_entry = &self.entries.get(low)?; if low_entry.stage_raw() != 0 { diff --git a/gix-index/src/extension/untracked_cache.rs b/gix-index/src/extension/untracked_cache.rs index c47d6883745..8f7e88124e5 100644 --- a/gix-index/src/extension/untracked_cache.rs +++ b/gix-index/src/extension/untracked_cache.rs @@ -40,7 +40,7 @@ pub const SIGNATURE: Signature = *b"UNTR"; // #[allow(unused)] /// Decode an untracked cache extension from `data`, assuming object hashes are of type `object_hash`. pub fn decode(data: &[u8], object_hash: gix_hash::Kind) -> Option { - if !data.last().map_or(false, |b| *b == 0) { + if !data.last().is_some_and(|b| *b == 0) { return None; } let (identifier_len, data) = var_int(data)?; diff --git a/gix-index/tests/Cargo.toml b/gix-index/tests/Cargo.toml index 6e632abf031..8d707b1ed80 100644 --- a/gix-index/tests/Cargo.toml +++ b/gix-index/tests/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" description = "Integration tests for gix-index" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" [[test]] name = "integrate" diff --git a/gix-lfs/Cargo.toml b/gix-lfs/Cargo.toml index 225991403ae..5708dd95f51 100644 --- a/gix-lfs/Cargo.toml +++ b/gix-lfs/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project dealing with handling git large file support" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-lock/Cargo.toml b/gix-lock/Cargo.toml index d0d5f9045c6..fd4f2bc41ec 100644 --- a/gix-lock/Cargo.toml +++ b/gix-lock/Cargo.toml @@ -9,7 +9,7 @@ description = "A git-style lock-file implementation" authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*", "README.md"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-macros/Cargo.toml b/gix-macros/Cargo.toml index 3b0c3ad54bd..4522da72623 100644 --- a/gix-macros/Cargo.toml +++ b/gix-macros/Cargo.toml @@ -13,7 +13,7 @@ authors = [ repository = "https://github.com/GitoxideLabs/gitoxide" license = "MIT OR Apache-2.0" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] proc-macro = true diff --git a/gix-mailmap/Cargo.toml b/gix-mailmap/Cargo.toml index 047b7f9ad47..d06a00ff31d 100644 --- a/gix-mailmap/Cargo.toml +++ b/gix-mailmap/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project for parsing mailmap files" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" include = ["src/**/*", "LICENSE-*"] [lib] diff --git a/gix-merge/Cargo.toml b/gix-merge/Cargo.toml index a3dc7b93a68..422fbf436da 100644 --- a/gix-merge/Cargo.toml +++ b/gix-merge/Cargo.toml @@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project implementing merge algorithms" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" [lints] workspace = true diff --git a/gix-merge/src/tree/mod.rs b/gix-merge/src/tree/mod.rs index 9a09138e01e..b01a14eb378 100644 --- a/gix-merge/src/tree/mod.rs +++ b/gix-merge/src/tree/mod.rs @@ -233,10 +233,7 @@ impl Conflict { }; match how.tree_merge { treat_as_unresolved::TreeMerge::Undecidable => { - self.resolution.is_err() - || self - .content_merge() - .map_or(false, |info| content_merge_unresolved(&info)) + self.resolution.is_err() || self.content_merge().is_some_and(|info| content_merge_unresolved(&info)) } treat_as_unresolved::TreeMerge::EvasiveRenames | treat_as_unresolved::TreeMerge::ForcedResolution => { match &self.resolution { @@ -246,13 +243,13 @@ impl Conflict { how.tree_merge == treat_as_unresolved::TreeMerge::ForcedResolution || self .content_merge() - .map_or(false, |merged_blob| content_merge_unresolved(&merged_blob)) + .is_some_and(|merged_blob| content_merge_unresolved(&merged_blob)) } Resolution::OursModifiedTheirsRenamedAndChangedThenRename { merged_blob, final_location, .. - } => final_location.is_some() || merged_blob.as_ref().map_or(false, content_merge_unresolved), + } => final_location.is_some() || merged_blob.as_ref().is_some_and(content_merge_unresolved), Resolution::OursModifiedTheirsModifiedThenBlobContentMerge { merged_blob } => { content_merge_unresolved(merged_blob) } diff --git a/gix-negotiate/Cargo.toml b/gix-negotiate/Cargo.toml index d1cdca8f85f..01fba253db0 100644 --- a/gix-negotiate/Cargo.toml +++ b/gix-negotiate/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project implementing negotiation algorithms" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" include = ["src/**/*", "LICENSE-*"] [lib] diff --git a/gix-negotiate/src/consecutive.rs b/gix-negotiate/src/consecutive.rs index f74eac65661..cc924f0a46d 100644 --- a/gix-negotiate/src/consecutive.rs +++ b/gix-negotiate/src/consecutive.rs @@ -148,7 +148,7 @@ impl Negotiator for Algorithm { fn in_common_with_remote(&mut self, id: ObjectId, graph: &mut crate::Graph<'_, '_>) -> Result { let known_to_be_common = graph .get(&id) - .map_or(false, |commit| commit.data.flags.contains(Flags::COMMON)); + .is_some_and(|commit| commit.data.flags.contains(Flags::COMMON)); self.mark_common(id, Mark::ThisCommitAndAncestors, Ancestors::DirectUnseen, graph)?; Ok(known_to_be_common) } diff --git a/gix-negotiate/src/skipping.rs b/gix-negotiate/src/skipping.rs index ea404043339..9db90db6cfa 100644 --- a/gix-negotiate/src/skipping.rs +++ b/gix-negotiate/src/skipping.rs @@ -116,7 +116,7 @@ impl Negotiator for Algorithm { fn known_common(&mut self, id: ObjectId, graph: &mut crate::Graph<'_, '_>) -> Result<(), Error> { if graph .get(&id) - .map_or(false, |commit| commit.data.flags.contains(Flags::SEEN)) + .is_some_and(|commit| commit.data.flags.contains(Flags::SEEN)) { return Ok(()); } @@ -126,7 +126,7 @@ impl Negotiator for Algorithm { fn add_tip(&mut self, id: ObjectId, graph: &mut crate::Graph<'_, '_>) -> Result<(), Error> { if graph .get(&id) - .map_or(false, |commit| commit.data.flags.contains(Flags::SEEN)) + .is_some_and(|commit| commit.data.flags.contains(Flags::SEEN)) { return Ok(()); } @@ -168,7 +168,7 @@ impl Negotiator for Algorithm { fn in_common_with_remote(&mut self, id: ObjectId, graph: &mut crate::Graph<'_, '_>) -> Result { let mut was_seen = false; - let known_to_be_common = graph.get(&id).map_or(false, |commit| { + let known_to_be_common = graph.get(&id).is_some_and(|commit| { was_seen = commit.data.flags.contains(Flags::SEEN); commit.data.flags.contains(Flags::COMMON) }); diff --git a/gix-note/Cargo.toml b/gix-note/Cargo.toml index 92b78312a57..c19a809fb58 100644 --- a/gix-note/Cargo.toml +++ b/gix-note/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project dealing with git notes" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-object/Cargo.toml b/gix-object/Cargo.toml index d555ed32b5e..342c3e0e7a5 100644 --- a/gix-object/Cargo.toml +++ b/gix-object/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://github.com/GitoxideLabs/gitoxide" license = "MIT OR Apache-2.0" edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-object/src/tree/editor.rs b/gix-object/src/tree/editor.rs index 0b86fa090a1..b4371b541b5 100644 --- a/gix-object/src/tree/editor.rs +++ b/gix-object/src/tree/editor.rs @@ -257,7 +257,7 @@ impl Editor<'_> { let mut path_buf = self.path_buf.borrow_mut(); let mut cursor = self.trees.get_mut(path_buf.as_bstr()).expect("root is always present"); let mut rela_path = rela_path.into_iter().peekable(); - let new_kind_is_tree = kind_and_id.map_or(false, |(kind, _, _)| kind == EntryKind::Tree); + let new_kind_is_tree = kind_and_id.is_some_and(|(kind, _, _)| kind == EntryKind::Tree); while let Some(name) = rela_path.next() { let name = name.as_ref(); if name.is_empty() { @@ -336,7 +336,7 @@ impl Editor<'_> { if needs_sorting { cursor.entries.sort(); } - if is_last && kind_and_id.map_or(false, |(_, _, mode)| mode == UpsertMode::Normal) { + if is_last && kind_and_id.is_some_and(|(_, _, mode)| mode == UpsertMode::Normal) { break; } push_path_component(&mut path_buf, name); diff --git a/gix-odb/Cargo.toml b/gix-odb/Cargo.toml index 22551bd8d42..389858205cd 100644 --- a/gix-odb/Cargo.toml +++ b/gix-odb/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" description = "Implements various git object databases" edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" autotests = false [lib] diff --git a/gix-odb/src/memory.rs b/gix-odb/src/memory.rs index cd8e9fbdc3d..6d5f405e7cb 100644 --- a/gix-odb/src/memory.rs +++ b/gix-odb/src/memory.rs @@ -162,7 +162,7 @@ where T: gix_object::Exists, { fn exists(&self, id: &gix_hash::oid) -> bool { - self.memory.as_ref().map_or(false, |map| map.borrow().contains_key(id)) || self.inner.exists(id) + self.memory.as_ref().is_some_and(|map| map.borrow().contains_key(id)) || self.inner.exists(id) } } diff --git a/gix-odb/tests/Cargo.toml b/gix-odb/tests/Cargo.toml index 42bf809c7f9..7c8b8e560ad 100644 --- a/gix-odb/tests/Cargo.toml +++ b/gix-odb/tests/Cargo.toml @@ -8,7 +8,7 @@ authors = ["Sebastian Thiel "] license = "MIT OR Apache-2.0" description = "Tests for gix-odb with feature-toggle support" edition = "2021" -rust-version = "1.65" +rust-version = "1.70" publish = false [features] diff --git a/gix-pack/Cargo.toml b/gix-pack/Cargo.toml index 7b8dd586004..ae102ba6680 100644 --- a/gix-pack/Cargo.toml +++ b/gix-pack/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" description = "Implements git packs and related data structures" edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" autotests = false [lib] diff --git a/gix-pack/tests/Cargo.toml b/gix-pack/tests/Cargo.toml index a21ffa06c97..ef9920cdfcd 100644 --- a/gix-pack/tests/Cargo.toml +++ b/gix-pack/tests/Cargo.toml @@ -8,7 +8,7 @@ authors = ["Sebastian Thiel "] license = "MIT OR Apache-2.0" description = "Please use `gix-` instead ('git' -> 'gix')" edition = "2021" -rust-version = "1.65" +rust-version = "1.70" [features] gix-features-parallel = ["gix-features/parallel"] diff --git a/gix-packetline-blocking/Cargo.toml b/gix-packetline-blocking/Cargo.toml index 6a2dae7613c..61e6cd23dd6 100644 --- a/gix-packetline-blocking/Cargo.toml +++ b/gix-packetline-blocking/Cargo.toml @@ -9,7 +9,7 @@ description = "A duplicate of `gix-packetline` with the `blocking-io` feature pr authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-packetline/Cargo.toml b/gix-packetline/Cargo.toml index 189e07e6375..db899221839 100644 --- a/gix-packetline/Cargo.toml +++ b/gix-packetline/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project implementing the pkt-line seriali authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-path/Cargo.toml b/gix-path/Cargo.toml index 808fb750c8d..04b87ae6c0d 100644 --- a/gix-path/Cargo.toml +++ b/gix-path/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project dealing paths and their conversio authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-pathspec/Cargo.toml b/gix-pathspec/Cargo.toml index 06c406031c9..6e61f172561 100644 --- a/gix-pathspec/Cargo.toml +++ b/gix-pathspec/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project dealing magical pathspecs" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" include = ["src/**/*", "LICENSE-*", "README.md"] [lib] diff --git a/gix-pathspec/tests/search/mod.rs b/gix-pathspec/tests/search/mod.rs index 07cd328e994..c1c0bac88ad 100644 --- a/gix-pathspec/tests/search/mod.rs +++ b/gix-pathspec/tests/search/mod.rs @@ -644,7 +644,7 @@ mod baseline { attrs.pattern_matching_relative_path(rela_path, case, Some(is_dir), out) }, ) - .map_or(false, |m| !m.is_excluded()) + .is_some_and(|m| !m.is_excluded()) }) .cloned() .collect(); diff --git a/gix-prompt/Cargo.toml b/gix-prompt/Cargo.toml index e331a68407b..1edff0cf275 100644 --- a/gix-prompt/Cargo.toml +++ b/gix-prompt/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project for handling prompts in the termi authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*", "README.md"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-protocol/Cargo.toml b/gix-protocol/Cargo.toml index 541d31ab0e9..e55a168313f 100644 --- a/gix-protocol/Cargo.toml +++ b/gix-protocol/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project for implementing git protocols" authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*", "!**/tests/**/*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-protocol/src/fetch/negotiate.rs b/gix-protocol/src/fetch/negotiate.rs index d28feef86a2..54c8514d2cf 100644 --- a/gix-protocol/src/fetch/negotiate.rs +++ b/gix-protocol/src/fetch/negotiate.rs @@ -181,7 +181,7 @@ where { remote_ref_target_known[mapping_idx] = true; cutoff_date = cutoff_date.unwrap_or_default().max(commit.commit_time).into(); - } else if want_id.map_or(false, |maybe_annotated_tag| objects.exists(maybe_annotated_tag)) { + } else if want_id.is_some_and(|maybe_annotated_tag| objects.exists(maybe_annotated_tag)) { remote_ref_target_known[mapping_idx] = true; } } @@ -263,12 +263,12 @@ pub fn make_refmapping_ignore_predicate(fetch_tags: Tags, ref_map: &RefMap) -> i .then(|| fetch_tags.to_refspec()) .flatten(); move |mapping| { - tag_refspec_to_ignore.map_or(false, |tag_spec| { + tag_refspec_to_ignore.is_some_and(|tag_spec| { mapping .spec_index .implicit_index() .and_then(|idx| ref_map.extra_refspecs.get(idx)) - .map_or(false, |spec| spec.to_ref() == tag_spec) + .is_some_and(|spec| spec.to_ref() == tag_spec) }) } } diff --git a/gix-quote/Cargo.toml b/gix-quote/Cargo.toml index cd4ec1299f6..486f21d3936 100644 --- a/gix-quote/Cargo.toml +++ b/gix-quote/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project dealing with various quotations used by git" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" include = ["src/**/*", "LICENSE-*"] [lib] diff --git a/gix-rebase/Cargo.toml b/gix-rebase/Cargo.toml index ca04de78fb7..14b5e1a8556 100644 --- a/gix-rebase/Cargo.toml +++ b/gix-rebase/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project dealing rebases" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-ref/Cargo.toml b/gix-ref/Cargo.toml index 51713a2d48d..a93e51e1482 100644 --- a/gix-ref/Cargo.toml +++ b/gix-ref/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate to handle git references" authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" autotests = false [lib] diff --git a/gix-ref/src/store/file/find.rs b/gix-ref/src/store/file/find.rs index 439c356b465..9d543b2b678 100644 --- a/gix-ref/src/store/file/find.rs +++ b/gix-ref/src/store/file/find.rs @@ -232,7 +232,7 @@ impl file::Store { MainRef | MainPseudoRef => (commondir.into(), sn), LinkedRef { name: worktree_name } => sn .category() - .map_or(false, |cat| cat.is_worktree_private()) + .is_some_and(|cat| cat.is_worktree_private()) .then(|| { if is_reflog { (linked_git_dir(worktree_name).into(), sn) diff --git a/gix-ref/src/store/file/loose/iter.rs b/gix-ref/src/store/file/loose/iter.rs index 57f20142c55..0bfbbd91587 100644 --- a/gix-ref/src/store/file/loose/iter.rs +++ b/gix-ref/src/store/file/loose/iter.rs @@ -37,7 +37,7 @@ impl Iterator for SortedLoosePaths { for entry in self.file_walk.as_mut()?.by_ref() { match entry { Ok(entry) => { - if !entry.file_type().map_or(false, |ft| ft.is_file()) { + if !entry.file_type().is_ok_and(|ft| ft.is_file()) { continue; } let full_path = entry.path().into_owned(); diff --git a/gix-ref/src/store/file/overlay_iter.rs b/gix-ref/src/store/file/overlay_iter.rs index 7bda0ae9c72..0e39e5af05f 100644 --- a/gix-ref/src/store/file/overlay_iter.rs +++ b/gix-ref/src/store/file/overlay_iter.rs @@ -118,7 +118,7 @@ impl Iterator for LooseThenPacked<'_, '_> { fn next(&mut self) -> Option { fn advance_to_non_private(iter: &mut Peekable) { while let Some(Ok((_path, name))) = iter.peek() { - if name.category().map_or(false, |cat| cat.is_worktree_private()) { + if name.category().is_some_and(|cat| cat.is_worktree_private()) { iter.next(); } else { break; diff --git a/gix-ref/src/store/file/transaction/prepare.rs b/gix-ref/src/store/file/transaction/prepare.rs index 988f8a3446e..caa7fcfa360 100644 --- a/gix-ref/src/store/file/transaction/prepare.rs +++ b/gix-ref/src/store/file/transaction/prepare.rs @@ -430,7 +430,7 @@ fn possibly_adjust_name_for_prefixes(name: &FullNameRef) -> Option { Tag | LocalBranch | RemoteBranch | Note => name.into(), MainRef | LinkedRef { .. } => sn .category() - .map_or(false, |cat| !cat.is_worktree_private()) + .is_some_and(|cat| !cat.is_worktree_private()) .then_some(sn), } .map(ToOwned::to_owned) diff --git a/gix-ref/tests/Cargo.toml b/gix-ref/tests/Cargo.toml index 1f6ec8940e7..0b0345bd0eb 100644 --- a/gix-ref/tests/Cargo.toml +++ b/gix-ref/tests/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" description = "Test the gix-ref crate with feature toggles" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" [features] gix-features-parallel = ["gix-features/parallel"] # test sorted parallel loose file traversal diff --git a/gix-refspec/Cargo.toml b/gix-refspec/Cargo.toml index 39e9491ddba..834b00d14cb 100644 --- a/gix-refspec/Cargo.toml +++ b/gix-refspec/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project for parsing and representing refs authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*", "README.md"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-revision/Cargo.toml b/gix-revision/Cargo.toml index f448b33a94a..a867abd7aea 100644 --- a/gix-revision/Cargo.toml +++ b/gix-revision/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project dealing with finding names for re authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*", "README.md"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-revision/src/merge_base/function.rs b/gix-revision/src/merge_base/function.rs index 95903efad46..7d59606c492 100644 --- a/gix-revision/src/merge_base/function.rs +++ b/gix-revision/src/merge_base/function.rs @@ -162,11 +162,10 @@ fn paint_down_to_common( } let mut out = Vec::new(); - while queue.iter_unordered().any(|id| { - graph - .get(id) - .map_or(false, |commit| !commit.data.contains(Flags::STALE)) - }) { + while queue + .iter_unordered() + .any(|id| graph.get(id).is_some_and(|commit| !commit.data.contains(Flags::STALE))) + { let (info, commit_id) = queue.pop().expect("we have non-stale"); let commit = graph.get_mut(&commit_id).expect("everything queued is in graph"); let mut flags_without_result = commit.data & (Flags::COMMIT1 | Flags::COMMIT2 | Flags::STALE); diff --git a/gix-revision/src/spec/parse/function.rs b/gix-revision/src/spec/parse/function.rs index 37035697287..3297510b90a 100644 --- a/gix-revision/src/spec/parse/function.rs +++ b/gix-revision/src/spec/parse/function.rs @@ -355,7 +355,7 @@ where if *pos != 0 && (next, next_next) == (Some(&b'.'), Some(&b'.')) { return false; } - next == Some(&b'{') || next.map_or(false, |b| SEPARATORS.contains(b)) + next == Some(&b'{') || next.is_some_and(|b| SEPARATORS.contains(b)) } else if SEPARATORS.contains(b) { true } else { diff --git a/gix-revwalk/Cargo.toml b/gix-revwalk/Cargo.toml index 12e74bcd7d9..77fe8d64b7c 100644 --- a/gix-revwalk/Cargo.toml +++ b/gix-revwalk/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate providing utilities for walking the revision graph" authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-sec/Cargo.toml b/gix-sec/Cargo.toml index e0bd9070019..269570d37e0 100644 --- a/gix-sec/Cargo.toml +++ b/gix-sec/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project providing a shared trust model" authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-sequencer/Cargo.toml b/gix-sequencer/Cargo.toml index 1851d4cb01e..aaf9515dfa9 100644 --- a/gix-sequencer/Cargo.toml +++ b/gix-sequencer/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project handling sequences of human-aided operations" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-shallow/Cargo.toml b/gix-shallow/Cargo.toml index 61438be635e..f1977d82f38 100644 --- a/gix-shallow/Cargo.toml +++ b/gix-shallow/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" description = "Handle files specifying the shallow boundary" edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-status/Cargo.toml b/gix-status/Cargo.toml index 6aef2db2c9b..e6dc95c0d21 100644 --- a/gix-status/Cargo.toml +++ b/gix-status/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project dealing with 'git status'-like fu authors = ["Sebastian Thiel ", "Pascal Kuthe "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" autotests = false [lib] diff --git a/gix-status/src/index_as_worktree/function.rs b/gix-status/src/index_as_worktree/function.rs index 8fb300abdb5..1affadb1c22 100644 --- a/gix-status/src/index_as_worktree/function.rs +++ b/gix-status/src/index_as_worktree/function.rs @@ -277,7 +277,7 @@ impl<'index> State<'_, 'index> { self.attr_stack .set_case(case) .at_entry(relative_path, Some(is_dir_to_mode(is_dir)), objects) - .map_or(false, |platform| platform.matching_attributes(out)) + .is_ok_and(|platform| platform.matching_attributes(out)) }, ) .map_or(true, |m| m.is_excluded()); diff --git a/gix-status/src/index_as_worktree_with_renames/mod.rs b/gix-status/src/index_as_worktree_with_renames/mod.rs index ea62d825ee6..6ce99b1a7bf 100644 --- a/gix-status/src/index_as_worktree_with_renames/mod.rs +++ b/gix-status/src/index_as_worktree_with_renames/mod.rs @@ -101,7 +101,7 @@ pub(super) mod function { stack .set_case(case) .at_entry(relative_path, Some(is_dir_to_mode(is_dir)), &objects) - .map_or(false, |platform| platform.matching_attributes(out)) + .is_ok_and(|platform| platform.matching_attributes(out)) }, excludes: excludes.as_mut(), objects: &objects, diff --git a/gix-status/tests/Cargo.toml b/gix-status/tests/Cargo.toml index 76ddc7d61a3..86142741025 100644 --- a/gix-status/tests/Cargo.toml +++ b/gix-status/tests/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate to drive gix-status tests with different features" authors = ["Sebastian Thiel ", "Pascal Kuthe "] edition = "2021" publish = false -rust-version = "1.65" +rust-version = "1.70" [[test]] name = "status" diff --git a/gix-submodule/Cargo.toml b/gix-submodule/Cargo.toml index 84b493099c2..7a774d7f74e 100644 --- a/gix-submodule/Cargo.toml +++ b/gix-submodule/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project dealing git submodules" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" include = ["src/**/*", "LICENSE-*"] [lib] diff --git a/gix-submodule/src/is_active_platform.rs b/gix-submodule/src/is_active_platform.rs index 85f4b9353b7..b5b597acc45 100644 --- a/gix-submodule/src/is_active_platform.rs +++ b/gix-submodule/src/is_active_platform.rs @@ -40,7 +40,7 @@ impl IsActivePlatform { if let Some(val) = self.search.as_mut().map(|search| { search .pattern_matching_relative_path(name, Some(true), attributes) - .map_or(false, |m| !m.is_excluded()) + .is_some_and(|m| !m.is_excluded()) }) { return Ok(val); } diff --git a/gix-tempfile/Cargo.toml b/gix-tempfile/Cargo.toml index 151bdcc8c8f..7a649c2287a 100644 --- a/gix-tempfile/Cargo.toml +++ b/gix-tempfile/Cargo.toml @@ -9,7 +9,7 @@ description = "A tempfile implementation with a global registry to assure cleanu authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*", "README.md"] -rust-version = "1.65" +rust-version = "1.70" [[example]] name = "delete-tempfiles-on-sigterm" diff --git a/gix-tempfile/src/registry.rs b/gix-tempfile/src/registry.rs index 0e41178214c..654ec471092 100644 --- a/gix-tempfile/src/registry.rs +++ b/gix-tempfile/src/registry.rs @@ -21,10 +21,7 @@ pub fn cleanup_tempfiles_signal_safe() { for idx in 0..one_past_last_index { if let Some(entry) = REGISTRY.try_entry(idx) { entry.and_modify(|tempfile| { - if tempfile - .as_ref() - .map_or(false, |tf| tf.owning_process_id == current_pid) - { + if tempfile.as_ref().is_some_and(|tf| tf.owning_process_id == current_pid) { if let Some(tempfile) = tempfile.take() { tempfile.drop_without_deallocation(); } @@ -55,7 +52,7 @@ pub fn cleanup_tempfiles() { let current_pid = std::process::id(); #[cfg(feature = "hp-hashmap")] REGISTRY.iter_mut().for_each(|mut tf| { - if tf.as_ref().map_or(false, |tf| tf.owning_process_id == current_pid) { + if tf.as_ref().is_some_and(|tf| tf.owning_process_id == current_pid) { tf.take(); } }); diff --git a/gix-tix/Cargo.toml b/gix-tix/Cargo.toml index 282db24bbc0..6bd8b114141 100644 --- a/gix-tix/Cargo.toml +++ b/gix-tix/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A tool like `tig`, but minimal, fast and efficient" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-trace/Cargo.toml b/gix-trace/Cargo.toml index 66e95d1caf3..b579a284db8 100644 --- a/gix-trace/Cargo.toml +++ b/gix-trace/Cargo.toml @@ -8,7 +8,7 @@ version = "0.1.11" authors = ["Sebastian Thiel "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.65" +rust-version = "1.70" include = ["src/**/*", "LICENSE-*"] [lib] diff --git a/gix-transport/Cargo.toml b/gix-transport/Cargo.toml index 6499eab5eef..136a62ac3a4 100644 --- a/gix-transport/Cargo.toml +++ b/gix-transport/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project dedicated to implementing the git authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-transport/src/client/blocking_io/http/mod.rs b/gix-transport/src/client/blocking_io/http/mod.rs index 503924e9690..b7fc5081f7a 100644 --- a/gix-transport/src/client/blocking_io/http/mod.rs +++ b/gix-transport/src/client/blocking_io/http/mod.rs @@ -281,7 +281,7 @@ impl Transport { let wanted_content_type = format!("application/x-{}-{}", service.as_str(), kind); if !headers.lines().collect::, _>>()?.iter().any(|l| { let mut tokens = l.split(':'); - tokens.next().zip(tokens.next()).map_or(false, |(name, value)| { + tokens.next().zip(tokens.next()).is_some_and(|(name, value)| { name.eq_ignore_ascii_case("content-type") && value.trim() == wanted_content_type }) }) { diff --git a/gix-transport/src/client/blocking_io/ssh/mod.rs b/gix-transport/src/client/blocking_io/ssh/mod.rs index b60301e4c3a..737543b87ab 100644 --- a/gix-transport/src/client/blocking_io/ssh/mod.rs +++ b/gix-transport/src/client/blocking_io/ssh/mod.rs @@ -125,7 +125,7 @@ pub fn connect( }), ); gix_features::trace::debug!(cmd = ?cmd, "invoking `ssh` for feature check"); - kind = if cmd.status().ok().map_or(false, |status| status.success()) { + kind = if cmd.status().ok().is_some_and(|status| status.success()) { ProgramKind::Ssh } else { ProgramKind::Simple diff --git a/gix-traverse/Cargo.toml b/gix-traverse/Cargo.toml index 28b0aff2306..4b93a5a24e8 100644 --- a/gix-traverse/Cargo.toml +++ b/gix-traverse/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project" authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" autotests = false [lib] diff --git a/gix-traverse/tests/Cargo.toml b/gix-traverse/tests/Cargo.toml index 83c3860b992..12227e0b393 100644 --- a/gix-traverse/tests/Cargo.toml +++ b/gix-traverse/tests/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "Integration tests for the gix-traverse crate" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" [[test]] name = "traverse" diff --git a/gix-tui/Cargo.toml b/gix-tui/Cargo.toml index eaa1fab576f..b0bcabbe694 100644 --- a/gix-tui/Cargo.toml +++ b/gix-tui/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate of the gitoxide project dedicated to a terminal user interface to interact with git repositories" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" [[bin]] name = "gixi" diff --git a/gix-url/Cargo.toml b/gix-url/Cargo.toml index e9f6c4e641f..794978bff76 100644 --- a/gix-url/Cargo.toml +++ b/gix-url/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project implementing parsing and serializ authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*", "tests/baseline/**/*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-utils/Cargo.toml b/gix-utils/Cargo.toml index 9108c3736d9..849c17e7828 100644 --- a/gix-utils/Cargo.toml +++ b/gix-utils/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate with `gitoxide` utilities that don't need feature toggles" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" include = ["src/**/*", "LICENSE-*"] [lib] diff --git a/gix-validate/Cargo.toml b/gix-validate/Cargo.toml index daef6de3f46..db3c5c98e11 100644 --- a/gix-validate/Cargo.toml +++ b/gix-validate/Cargo.toml @@ -9,7 +9,7 @@ description = "Validation functions for various kinds of names in git" authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix-validate/src/path.rs b/gix-validate/src/path.rs index 6cf4bb615c8..6321e403b18 100644 --- a/gix-validate/src/path.rs +++ b/gix-validate/src/path.rs @@ -150,21 +150,21 @@ fn is_win_device(input: &BStr) -> bool { // Hence, justification for this asymmetry is merely to do exactly the same as Git does, // and to have exactly the same behaviour during validation (for worktree-writes). if in3.eq_ignore_ascii_case(b"COM") - && input.get(3).map_or(false, |n| *n >= b'1' && *n <= b'9') + && input.get(3).is_some_and(|n| *n >= b'1' && *n <= b'9') && is_done_windows(input.get(4..)) { return true; } if in3.eq_ignore_ascii_case(b"LPT") - && input.get(3).map_or(false, u8::is_ascii_digit) + && input.get(3).is_some_and(u8::is_ascii_digit) && is_done_windows(input.get(4..)) { return true; } if in3.eq_ignore_ascii_case(b"CON") && (is_done_windows(input.get(3..)) - || (input.get(3..6).map_or(false, |n| n.eq_ignore_ascii_case(b"IN$")) && is_done_windows(input.get(6..))) - || (input.get(3..7).map_or(false, |n| n.eq_ignore_ascii_case(b"OUT$")) && is_done_windows(input.get(7..)))) + || (input.get(3..6).is_some_and(|n| n.eq_ignore_ascii_case(b"IN$")) && is_done_windows(input.get(6..))) + || (input.get(3..7).is_some_and(|n| n.eq_ignore_ascii_case(b"OUT$")) && is_done_windows(input.get(7..)))) { return true; } @@ -231,16 +231,10 @@ fn is_dot_hfs(input: &BStr, search_case_insensitive: &str) -> bool { } fn is_dot_git_ntfs(input: &BStr) -> bool { - if input - .get(..4) - .map_or(false, |input| input.eq_ignore_ascii_case(b".git")) - { + if input.get(..4).is_some_and(|input| input.eq_ignore_ascii_case(b".git")) { return is_done_ntfs(input.get(4..)); } - if input - .get(..5) - .map_or(false, |input| input.eq_ignore_ascii_case(b"git~1")) - { + if input.get(..5).is_some_and(|input| input.eq_ignore_ascii_case(b"git~1")) { return is_done_ntfs(input.get(5..)); } false @@ -253,9 +247,10 @@ fn is_dot_git_ntfs(input: &BStr) -> bool { fn is_dot_ntfs(input: &BStr, search_case_insensitive: &str, ntfs_shortname_prefix: &str) -> bool { if input.first() == Some(&b'.') { let end_pos = 1 + search_case_insensitive.len(); - if input.get(1..end_pos).map_or(false, |input| { - input.eq_ignore_ascii_case(search_case_insensitive.as_bytes()) - }) { + if input + .get(1..end_pos) + .is_some_and(|input| input.eq_ignore_ascii_case(search_case_insensitive.as_bytes())) + { is_done_ntfs(input.get(end_pos..)) } else { false @@ -265,12 +260,12 @@ fn is_dot_ntfs(input: &BStr, search_case_insensitive: &str, ntfs_shortname_prefi if search_case_insensitive .get(..6) .zip(input.get(..6)) - .map_or(false, |(ntfs_prefix, first_6_of_input)| { + .is_some_and(|(ntfs_prefix, first_6_of_input)| { first_6_of_input.eq_ignore_ascii_case(ntfs_prefix) && input.get(6) == Some(&b'~') // It's notable that only `~1` to `~4` are possible before the disambiguation algorithm // switches to using the `ntfs_shortname_prefix`, which is checked hereafter. - && input.get(7).map_or(false, |num| (b'1'..=b'4').contains(num)) + && input.get(7).is_some_and(|num| (b'1'..=b'4').contains(num)) }) { return is_done_ntfs(input.get(8..)); diff --git a/gix-worktree-state/Cargo.toml b/gix-worktree-state/Cargo.toml index 8b0b17f09d4..b5c5b8e2a8e 100644 --- a/gix-worktree-state/Cargo.toml +++ b/gix-worktree-state/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project implementing setting the worktree authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" autotests = false [lib] diff --git a/gix-worktree-state/tests/Cargo.toml b/gix-worktree-state/tests/Cargo.toml index 1b44b7e1837..cbf979e2b20 100644 --- a/gix-worktree-state/tests/Cargo.toml +++ b/gix-worktree-state/tests/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate for running tests with feature toggles on gix-worktree-st authors = ["Sebastian Thiel "] edition = "2021" publish = false -rust-version = "1.65" +rust-version = "1.70" [[test]] name = "worktree" diff --git a/gix-worktree-stream/Cargo.toml b/gix-worktree-stream/Cargo.toml index 44f9187f7fb..44690416413 100644 --- a/gix-worktree-stream/Cargo.toml +++ b/gix-worktree-stream/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "generate a byte-stream from a git-tree" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" include = ["src/**/*", "LICENSE-*"] [lib] diff --git a/gix-worktree/Cargo.toml b/gix-worktree/Cargo.toml index a9e5724a856..eeabbbb0fb8 100644 --- a/gix-worktree/Cargo.toml +++ b/gix-worktree/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project for shared worktree related types authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" autotests = false [lib] diff --git a/gix-worktree/src/stack/platform.rs b/gix-worktree/src/stack/platform.rs index 5f8f5431b25..2e3e62ccfe6 100644 --- a/gix-worktree/src/stack/platform.rs +++ b/gix-worktree/src/stack/platform.rs @@ -23,7 +23,7 @@ impl<'a> Platform<'a> { #[doc(alias = "is_path_ignored", alias = "git2")] pub fn is_excluded(&self) -> bool { self.matching_exclude_pattern() - .map_or(false, |m| !m.pattern.is_negative()) + .is_some_and(|m| !m.pattern.is_negative()) } /// See if a non-negative ignore-pattern matches and obtain the kind of exclude, or return `None` diff --git a/gix-worktree/tests/Cargo.toml b/gix-worktree/tests/Cargo.toml index 7d2a65dc85f..7ff00c91c49 100644 --- a/gix-worktree/tests/Cargo.toml +++ b/gix-worktree/tests/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" description = "A crate for testing the gix-worktree crate with feature toggles" authors = ["Sebastian Thiel "] edition = "2021" -rust-version = "1.65" +rust-version = "1.70" publish = false [[test]] diff --git a/gix-worktree/tests/worktree/stack/ignore.rs b/gix-worktree/tests/worktree/stack/ignore.rs index 7ea4fbcebe5..7b618560e43 100644 --- a/gix-worktree/tests/worktree/stack/ignore.rs +++ b/gix-worktree/tests/worktree/stack/ignore.rs @@ -159,7 +159,7 @@ fn check_against_baseline() -> crate::Result { ); } // Paths read from the index are relative to the repo, and they don't exist locally due tot skip-worktree - if m.source.map_or(false, std::path::Path::exists) { + if m.source.is_some_and(std::path::Path::exists) { assert_eq!( m.source.map(|p| p.canonicalize().unwrap()), Some(worktree_dir.join(source_file.to_str_lossy().as_ref()).canonicalize()?) diff --git a/gix/Cargo.toml b/gix/Cargo.toml index 61280a84054..32b220265e7 100644 --- a/gix/Cargo.toml +++ b/gix/Cargo.toml @@ -9,7 +9,7 @@ version = "0.69.1" authors = ["Sebastian Thiel "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.65" +rust-version = "1.70" [lib] doctest = false diff --git a/gix/src/pathspec.rs b/gix/src/pathspec.rs index 78316c1037b..9b95d1e57e0 100644 --- a/gix/src/pathspec.rs +++ b/gix/src/pathspec.rs @@ -135,7 +135,7 @@ impl<'repo> Pathspec<'repo> { stack .set_case(case) .at_entry(relative_path, Some(is_dir_to_mode(is_dir)), &self.repo.objects) - .map_or(false, |platform| platform.matching_attributes(out)) + .is_ok_and(|platform| platform.matching_attributes(out)) }, ) } @@ -144,7 +144,7 @@ impl<'repo> Pathspec<'repo> { /// `true` if `relative_path` is included in the set of positive pathspecs, while not being excluded. pub fn is_included<'a>(&mut self, relative_path: impl Into<&'a BStr>, is_dir: Option) -> bool { self.pattern_matching_relative_path(relative_path, is_dir) - .map_or(false, |m| !m.is_excluded()) + .is_some_and(|m| !m.is_excluded()) } /// Return an iterator over all entries along with their path if the path matches the pathspec, or `None` if the pathspec is @@ -189,7 +189,7 @@ impl PathspecDetached { stack .set_case(case) .at_entry(relative_path, Some(is_dir_to_mode(is_dir)), &self.odb) - .map_or(false, |platform| platform.matching_attributes(out)) + .is_ok_and(|platform| platform.matching_attributes(out)) }, ) } @@ -198,7 +198,7 @@ impl PathspecDetached { /// `true` if `relative_path` is included in the set of positive pathspecs, while not being excluded. pub fn is_included<'a>(&mut self, relative_path: impl Into<&'a BStr>, is_dir: Option) -> bool { self.pattern_matching_relative_path(relative_path, is_dir) - .map_or(false, |m| !m.is_excluded()) + .is_some_and(|m| !m.is_excluded()) } } diff --git a/gix/src/remote/connection/fetch/update_refs/mod.rs b/gix/src/remote/connection/fetch/update_refs/mod.rs index 608b1c1c1ba..bb3c4f5e379 100644 --- a/gix/src/remote/connection/fetch/update_refs/mod.rs +++ b/gix/src/remote/connection/fetch/update_refs/mod.rs @@ -90,7 +90,7 @@ pub(crate) fn update( remote, local, spec, - implicit_tag_refspec.map_or(false, |tag_spec| spec.to_ref() == tag_spec), + implicit_tag_refspec.is_some_and(|tag_spec| spec.to_ref() == tag_spec), ) }) }, @@ -170,7 +170,7 @@ pub(crate) fn update( }); match ancestors { Ok(mut ancestors) => { - ancestors.any(|cid| cid.map_or(false, |c| c.id == local_id)) + ancestors.any(|cid| cid.is_ok_and(|c| c.id == local_id)) } Err(_) => { force = true; diff --git a/gix/src/repository/dirwalk.rs b/gix/src/repository/dirwalk.rs index 8bc2656ec48..cf7e036e7e8 100644 --- a/gix/src/repository/dirwalk.rs +++ b/gix/src/repository/dirwalk.rs @@ -92,7 +92,7 @@ impl Repository { stack .set_case(case) .at_entry(relative_path, Some(is_dir_to_mode(is_dir)), &self.objects) - .map_or(false, |platform| platform.matching_attributes(out)) + .is_ok_and(|platform| platform.matching_attributes(out)) }, excludes: Some(&mut excludes.inner), objects: &self.objects, diff --git a/gix/src/repository/shallow.rs b/gix/src/repository/shallow.rs index 90947a25d9c..c18c625e3a8 100644 --- a/gix/src/repository/shallow.rs +++ b/gix/src/repository/shallow.rs @@ -5,9 +5,7 @@ use crate::{config::tree::gitoxide, Repository}; impl Repository { /// Return `true` if the repository is a shallow clone, i.e. contains history only up to a certain depth. pub fn is_shallow(&self) -> bool { - self.shallow_file() - .metadata() - .map_or(false, |m| m.is_file() && m.len() > 0) + self.shallow_file().metadata().is_ok_and(|m| m.is_file() && m.len() > 0) } /// Return a shared list of shallow commits which is updated automatically if the in-memory snapshot has become stale diff --git a/gix/src/revision/spec/parse/delegate/navigate.rs b/gix/src/revision/spec/parse/delegate/navigate.rs index ec463a72500..d6d70a7e1ee 100644 --- a/gix/src/revision/spec/parse/delegate/navigate.rs +++ b/gix/src/revision/spec/parse/delegate/navigate.rs @@ -242,7 +242,7 @@ impl delegate::Navigate for Delegate<'_> { .peeled() .ok()? .filter_map(Result::ok) - .filter(|r| r.id().header().ok().map_or(false, |obj| obj.kind().is_commit())) + .filter(|r| r.id().header().ok().is_some_and(|obj| obj.kind().is_commit())) .filter_map(|r| r.detach().peeled), ) .sorting(crate::revision::walk::Sorting::ByCommitTime(Default::default())) @@ -335,7 +335,7 @@ impl delegate::Navigate for Delegate<'_> { let exists = self .repo .work_dir() - .map_or(false, |root| root.join(gix_path::from_bstr(path)).exists()); + .is_some_and(|root| root.join(gix_path::from_bstr(path)).exists()); self.err.push(Error::IndexLookup { desired_path: path.into(), desired_stage: stage, diff --git a/gix/src/status/index_worktree.rs b/gix/src/status/index_worktree.rs index 3dccb18ec28..71ae3b0c1ce 100644 --- a/gix/src/status/index_worktree.rs +++ b/gix/src/status/index_worktree.rs @@ -169,7 +169,7 @@ impl Repository { where E: From + From, { - let empty_patterns_match_prefix = options.map_or(false, |opts| opts.empty_patterns_match_prefix); + let empty_patterns_match_prefix = options.is_some_and(|opts| opts.empty_patterns_match_prefix); let attrs_and_excludes = self.attributes( index, crate::worktree::stack::state::attributes::Source::WorktreeThenIdMapping, @@ -264,7 +264,7 @@ mod submodule_status { let Ok(Some(mut submodules)) = repo.submodules() else { return Ok(None); }; - let Some(sm) = submodules.find(|sm| sm.path().map_or(false, |path| path == rela_path)) else { + let Some(sm) = submodules.find(|sm| sm.path().is_ok_and(|path| path == rela_path)) else { return Ok(None); }; let (ignore, check_dirty) = match self.mode { diff --git a/gix/src/status/iter/types.rs b/gix/src/status/iter/types.rs index 6087ca25110..c5986559cda 100644 --- a/gix/src/status/iter/types.rs +++ b/gix/src/status/iter/types.rs @@ -77,7 +77,7 @@ impl Outcome { /// If they are not written back, subsequent `status` operations will take longer to complete, whereas the /// additional work can be prevented by writing the changes back to the index. pub fn has_changes(&self) -> bool { - self.changes.as_ref().map_or(false, |changes| !changes.is_empty()) + self.changes.as_ref().is_some_and(|changes| !changes.is_empty()) } /// Write the changes if there are any back to the index file. diff --git a/gix/src/status/tree_index.rs b/gix/src/status/tree_index.rs index 06828dfa777..57850d8b149 100644 --- a/gix/src/status/tree_index.rs +++ b/gix/src/status/tree_index.rs @@ -131,7 +131,7 @@ impl Repository { Some(crate::pathspec::is_dir_to_mode(is_dir)), &pathspec.repo.objects, ) - .map_or(false, |platform| platform.matching_attributes(out)) + .is_ok_and(|platform| platform.matching_attributes(out)) }, )?; diff --git a/gix/src/submodule/mod.rs b/gix/src/submodule/mod.rs index dc80da3531d..64921d6deac 100644 --- a/gix/src/submodule/mod.rs +++ b/gix/src/submodule/mod.rs @@ -155,7 +155,7 @@ impl Submodule<'_> { attributes .set_case(case) .at_entry(relative_path, Some(is_dir_to_mode(is_dir)), &self.state.repo.objects) - .map_or(false, |platform| platform.matching_attributes(out)) + .is_ok_and(|platform| platform.matching_attributes(out)) } })?; Ok(is_active) @@ -417,7 +417,7 @@ pub mod status { return None; } let is_dirty = - self.checked_out_head_id != self.index_id || self.changes.as_ref().map_or(false, |c| !c.is_empty()); + self.checked_out_head_id != self.index_id || self.changes.as_ref().is_some_and(|c| !c.is_empty()); Some(is_dirty) } } diff --git a/gix/tests/gix/clone.rs b/gix/tests/gix/clone.rs index 1a22716f46b..11d6ad3fe65 100644 --- a/gix/tests/gix/clone.rs +++ b/gix/tests/gix/clone.rs @@ -677,7 +677,7 @@ mod blocking_io { .handshake .capabilities .capability("ls-refs") - .map_or(false, |cap| cap.supports("unborn").unwrap_or(false)); + .is_some_and(|cap| cap.supports("unborn").unwrap_or(false)); if supports_unborn { assert_eq!( head.referent_name().expect("present").as_bstr(), diff --git a/gix/tests/gix/remote/fetch.rs b/gix/tests/gix/remote/fetch.rs index 11202982024..aa4d75f6241 100644 --- a/gix/tests/gix/remote/fetch.rs +++ b/gix/tests/gix/remote/fetch.rs @@ -457,10 +457,10 @@ mod blocking_and_async_io { assert_eq!(negotiate.rounds.len(), 1); assert_eq!(write_pack_bundle.index.data_hash, hex_to_id(expected_data_hash), ); assert_eq!(write_pack_bundle.index.num_objects, 3 + num_objects_offset, "{fetch_tags:?}"); - assert!(write_pack_bundle.data_path.as_deref().map_or(false, std::path::Path::is_file)); - assert!(write_pack_bundle.index_path.as_deref().map_or(false, std::path::Path::is_file)); + assert!(write_pack_bundle.data_path.as_deref().is_some_and(std::path::Path::is_file)); + assert!(write_pack_bundle.index_path.as_deref().is_some_and(std::path::Path::is_file)); assert_eq!(update_refs.edits.len(), expected_ref_edits, "{fetch_tags:?}"); - assert_eq!(write_pack_bundle.keep_path.as_deref().map_or(false, std::path::Path::is_file), update_refs.edits.is_empty(),".keep are kept if there was no edit to prevent `git gc` from clearing out the pack as it's not referred to necessarily"); + assert_eq!(write_pack_bundle.keep_path.as_deref().is_some_and(std::path::Path::is_file), update_refs.edits.is_empty(),".keep are kept if there was no edit to prevent `git gc` from clearing out the pack as it's not referred to necessarily"); }, _ => unreachable!("Naive negotiation sends the same have and wants, resulting in an empty pack (technically no change, but we don't detect it) - empty packs are fine") } @@ -547,8 +547,8 @@ mod blocking_and_async_io { write_pack_bundle.index.index_hash, hex_to_id("d07c527cf14e524a8494ce6d5d08e28079f5c6ea") ); - assert!(write_pack_bundle.data_path.map_or(false, |f| f.is_file())); - assert!(write_pack_bundle.index_path.map_or(false, |f| f.is_file())); + assert!(write_pack_bundle.data_path.is_some_and(|f| f.is_file())); + assert!(write_pack_bundle.index_path.is_some_and(|f| f.is_file())); assert_eq!(update_refs.edits.len(), 2); let edit = &update_refs.edits[0]; @@ -578,7 +578,7 @@ mod blocking_and_async_io { } assert!( - !write_pack_bundle.keep_path.map_or(false, |f| f.is_file()), + !write_pack_bundle.keep_path.is_some_and(|f| f.is_file()), ".keep files are deleted if there is one edit" );