Skip to content

Commit 76dc9cf

Browse files
committed
refactor: repair clippy lints for is_some_and
1 parent 3179115 commit 76dc9cf

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

src/cmd/completion/bash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ fn get_flags(command: &clap::Command) -> (ShStream, ShStream) {
335335
for name in longs {
336336
if arg
337337
.get_num_args()
338-
.map_or(false, |value_range| value_range.takes_values())
338+
.is_some_and(|value_range| value_range.takes_values())
339339
{
340340
long_flags.word(&f!("--{name}="));
341341
} else {

src/cmd/import.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ impl Headers {
935935

936936
if line
937937
.strip_prefix(b"commit ")
938-
.map_or(false, |rest| rest.iter().all(u8::is_ascii_hexdigit))
938+
.is_some_and(|rest| rest.iter().all(u8::is_ascii_hexdigit))
939939
{
940940
// Looks like this patch came from `git show`. Remaining message lines
941941
// need to be stripped of indentation.

src/patch/edit/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,9 @@ impl<'a, 'repo> EditBuilder<'a, 'repo> {
550550
default_committer.to_owned()
551551
};
552552

553-
let new_commit_id = if patch_commit.and_then(|commit| commit.decode().ok()).map_or(
554-
false,
555-
|patch_commit_ref| {
553+
let new_commit_id = if patch_commit
554+
.and_then(|commit| commit.decode().ok())
555+
.is_some_and(|patch_commit_ref| {
556556
patch_commit_ref.committer().name == committer.name
557557
&& patch_commit_ref.committer().email == committer.email
558558
// N.B.: intentionally not comparing commiter.when()
@@ -562,8 +562,7 @@ impl<'a, 'repo> EditBuilder<'a, 'repo> {
562562
&& patch_commit_ref.message == message.raw_bytes()
563563
&& patch_commit_ref.tree() == tree_id
564564
&& patch_commit_ref.parents().next() == Some(parent_id)
565-
},
566-
) {
565+
}) {
567566
None
568567
} else {
569568
Some(repo.commit_ex(&author, &committer, &message, tree_id, [parent_id])?)

src/patch/name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl PatchName {
118118
candidate = default_name;
119119
}
120120

121-
if len_limit.map_or(false, |limit| limit > 0 && candidate.len() > limit) {
121+
if len_limit.is_some_and(|limit| limit > 0 && candidate.len() > limit) {
122122
let len_limit = len_limit.unwrap();
123123
let mut word_iter = candidate.split('-').filter_map(|w| {
124124
let w = w.trim_matches('.');

src/stack/transaction/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ impl<'repo> StackTransaction<'repo> {
984984
let is_last = i + 1 == patchnames.len();
985985
let already_merged = merged
986986
.as_ref()
987-
.map_or(false, |merged| merged.contains(&patchname));
987+
.is_some_and(|merged| merged.contains(&patchname));
988988
self.push_patch(
989989
patchname,
990990
already_merged,

0 commit comments

Comments
 (0)