Skip to content

Commit

Permalink
nightly clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyagr committed Nov 19, 2024
1 parent 7323c2e commit 0c6c471
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cli/src/commit_templater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ impl RefName {
fn is_tracking_present(&self) -> bool {
self.tracking_ref
.as_ref()
.map_or(false, |tracking| tracking.target.is_present())
.is_some_and(|tracking| tracking.target.is_present())
}

/// Number of commits ahead of the tracking local ref.
Expand Down
2 changes: 1 addition & 1 deletion cli/src/git_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ pub fn git_fetch(
GitFetchError::InvalidBranchPattern => {
if branch
.iter()
.any(|pattern| pattern.as_exact().map_or(false, |s| s.contains('*')))
.any(|pattern| pattern.as_exact().is_some_and(|s| s.contains('*')))
{
user_error_with_hint(
err,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/default_index/revset_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ impl PositionsAccumulatorInner<'_> {
desired_position: IndexPosition,
) -> Result<(), RevsetEvaluationError> {
let last_position = self.consumed_positions.last();
if last_position.map_or(false, |&pos| pos <= desired_position) {
if last_position.is_some_and(|&pos| pos <= desired_position) {
return Ok(());
}
while let Some(position) = self.walk.next(index).transpose()? {
Expand Down Expand Up @@ -1324,7 +1324,7 @@ fn match_lines<'a: 'b, 'b>(
text.split_inclusive(|b| *b == b'\n').filter(|line| {
let line = line.strip_suffix(b"\n").unwrap_or(line);
// TODO: add .matches_bytes() or .to_bytes_matcher()
str::from_utf8(line).map_or(false, |line| pattern.matches(line))
str::from_utf8(line).is_ok_and(|line| pattern.matches(line))
})
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/default_index/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl DefaultIndexStore {
let parent_file_has_id = |id: &CommitId| {
maybe_parent_file
.as_ref()
.map_or(false, |segment| segment.as_composite().has_id(id))
.is_some_and(|segment| segment.as_composite().has_id(id))
};
let get_commit_with_op = |commit_id: &CommitId, op_id: &OperationId| {
let op_id = op_id.clone();
Expand Down
2 changes: 1 addition & 1 deletion lib/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ fn resolve_git_ref_to_commit_id(
let peeled_id = peeling_ref.into_owned().into_fully_peeled_id().ok()?;
let is_commit = peeled_id
.object()
.map_or(false, |object| object.kind.is_commit());
.is_ok_and(|object| object.kind.is_commit());
is_commit.then(|| CommitId::from_bytes(peeled_id.as_bytes()))
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/matchers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl Matcher for FilesMatcher {
fn matches(&self, file: &RepoPath) -> bool {
self.tree
.get(file)
.map_or(false, |sub| sub.value == FilesNodeKind::File)
.is_some_and(|sub| sub.value == FilesNodeKind::File)
}

fn visit(&self, dir: &RepoPath) -> Visit {
Expand Down

0 comments on commit 0c6c471

Please sign in to comment.