Skip to content

Commit

Permalink
Replace map_or with is_some_and.
Browse files Browse the repository at this point in the history
This change replaces more noisy Boolean calls to `map_or` with
`is_some_and`. To use `is_some_and`, the MSRV has been bumped to
`1.70.0`.
  • Loading branch information
olson-sean-k committed Nov 22, 2024
1 parent 576b003 commit 263f63b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
toolchain:
- 1.65.0 # Minimum.
- 1.70.0 # Minimum.
- stable
- beta
steps:
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "decorum"
version = "0.3.1"
edition = "2021"
rust-version = "1.70.0"
license = "MIT"
readme = "README.md"
authors = ["Sean Olson <olson.sean.k@gmail.com>"]
Expand Down
11 changes: 5 additions & 6 deletions src/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,12 +532,11 @@ where
const NEG_INFINITY: Self = Defined(InfinityEncoding::NEG_INFINITY);

fn is_infinite(self) -> bool {
self.defined()
.map_or(false, |defined| defined.is_infinite())
self.defined().is_some_and(InfinityEncoding::is_infinite)
}

fn is_finite(self) -> bool {
self.defined().map_or(false, |defined| defined.is_finite())
self.defined().is_some_and(InfinityEncoding::is_finite)
}
}

Expand Down Expand Up @@ -587,7 +586,7 @@ where
self.as_ref()
.defined()
.zip(other.as_ref().defined())
.map_or(false, |(left, right)| left.eq(right))
.is_some_and(|(left, right)| left.eq(right))
}
}

Expand Down Expand Up @@ -647,11 +646,11 @@ where
const LOG10_E: Self = Defined(UnaryRealFunction::LOG10_E);

fn is_zero(self) -> bool {
self.defined().map_or(false, |defined| defined.is_zero())
self.defined().is_some_and(UnaryRealFunction::is_zero)
}

fn is_one(self) -> bool {
self.defined().map_or(false, |defined| defined.is_one())
self.defined().is_some_and(UnaryRealFunction::is_one)
}

fn sign(self) -> Sign {
Expand Down

0 comments on commit 263f63b

Please sign in to comment.