Skip to content

Commit

Permalink
chore: bump rust-version to 1.70
Browse files Browse the repository at this point in the history
That way clippy will allow to use the fantastic `Option::is_some_and()`
and friends.
  • Loading branch information
Byron committed Jan 12, 2025
1 parent 9db2160 commit 87938bb
Show file tree
Hide file tree
Showing 126 changed files with 181 additions and 202 deletions.
2 changes: 1 addition & 1 deletion gix-actor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gix-archive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
description = "archive generation from of a worktree stream"
authors = ["Sebastian Thiel <[email protected]>"]
edition = "2021"
rust-version = "1.65"
rust-version = "1.70"
include = ["src/**/*", "LICENSE-*"]

[lib]
Expand Down
2 changes: 1 addition & 1 deletion gix-attributes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project dealing .gitattributes files"
authors = ["Sebastian Thiel <[email protected]>"]
edition = "2021"
include = ["src/**/*", "LICENSE-*"]
rust-version = "1.65"
rust-version = "1.70"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion gix-bitmap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
edition = "2021"
rust-version = "1.65"
rust-version = "1.70"
exclude = ["CHANGELOG.md"]

[lib]
Expand Down
2 changes: 1 addition & 1 deletion gix-blame/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>", "Sebastian Thiel <[email protected]>"]
edition = "2021"
rust-version = "1.65"
rust-version = "1.70"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion gix-chunk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gix-command/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
edition = "2021"
rust-version = "1.65"
rust-version = "1.70"
include = ["src/lib.rs", "LICENSE-*"]

[lib]
Expand Down
2 changes: 1 addition & 1 deletion gix-commitgraph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description = "Read-only access to the git commitgraph file format"
authors = ["Conor Davis <[email protected]>", "Sebastian Thiel <[email protected]>"]
edition = "2021"
include = ["src/**/*", "LICENSE-*"]
rust-version = "1.65"
rust-version = "1.70"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion gix-config-value/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
edition = "2021"
rust-version = "1.65"
rust-version = "1.70"
include = ["src/**/*", "LICENSE-*"]

[lib]
Expand Down
2 changes: 1 addition & 1 deletion gix-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions gix-config/src/file/mutable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 2 additions & 6 deletions gix-config/src/file/mutable/section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize>, 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
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion gix-config/src/parse/section/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fn validated_name(name: Cow<'_, BStr>) -> Result<Cow<'_, BStr>, 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"]`.
Expand Down
4 changes: 2 additions & 2 deletions gix-config/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl Source {
.transpose()
.ok()
.flatten()
.map_or(false, |b| b.0)
.is_some_and(|b| b.0)
{
None
} else {
Expand All @@ -84,7 +84,7 @@ impl Source {
.transpose()
.ok()
.flatten()
.map_or(false, |b| b.0)
.is_some_and(|b| b.0)
{
None
} else {
Expand Down
2 changes: 1 addition & 1 deletion gix-config/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description = "Tests for the gix-config crate"
license = "MIT OR Apache-2.0"
authors = ["Edward Shen <[email protected]>"]
edition = "2021"
rust-version = "1.65"
rust-version = "1.70"
publish = false


Expand Down
2 changes: 1 addition & 1 deletion gix-credentials/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
edition = "2021"
rust-version = "1.65"
rust-version = "1.70"
include = ["src/**/*", "LICENSE-*"]

[lib]
Expand Down
2 changes: 1 addition & 1 deletion gix-diff/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "Calculate differences between various git objects"
authors = ["Sebastian Thiel <[email protected]>"]
edition = "2021"
include = ["src/**/*", "LICENSE-*"]
rust-version = "1.65"
rust-version = "1.70"
autotests = false

[features]
Expand Down
2 changes: 1 addition & 1 deletion gix-diff/src/blob/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gix-diff/src/index/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) = (
Expand Down
2 changes: 1 addition & 1 deletion gix-diff/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
description = "Tests for the gix-diff crate"
authors = ["Sebastian Thiel <[email protected]>"]
edition = "2021"
rust-version = "1.65"
rust-version = "1.70"

[[test]]
doctest = false
Expand Down
6 changes: 3 additions & 3 deletions gix-diff/tests/diff/tree_with_rewrites.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>(), @r#"
[
Deletion {
Expand Down Expand Up @@ -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::<Vec<_>>(), @r#"
[
Rewrite {
Expand Down Expand Up @@ -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::<Vec<_>>(), @r#"
[
Rewrite {
Expand Down
2 changes: 1 addition & 1 deletion gix-dir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
description = "A crate of the gitoxide project dealing with directory walks"
authors = ["Sebastian Thiel <[email protected]>"]
edition = "2021"
rust-version = "1.65"
rust-version = "1.70"

[lib]
doctest = false
Expand Down
6 changes: 3 additions & 3 deletions gix-dir/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl Status {
for_deletion: Option<ForDeletionMode>,
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 {
Expand All @@ -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,
}
Expand Down
18 changes: 9 additions & 9 deletions gix-dir/src/walk/classify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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()
Expand All @@ -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;
Expand All @@ -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 {
Expand All @@ -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();
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions gix-dir/src/walk/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 3 additions & 5 deletions gix-dir/src/walk/readdir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()`")
Expand Down
2 changes: 1 addition & 1 deletion gix-discover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "Discover git repositories and check if a directory is a git repos
authors = ["Sebastian Thiel <[email protected]>"]
edition = "2021"
include = ["src/**/*", "LICENSE-*"]
rust-version = "1.65"
rust-version = "1.70"

[lib]
doctest = false
Expand Down
Loading

0 comments on commit 87938bb

Please sign in to comment.