about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-01-20 12:37:56 +0800
committerGitHub <noreply@github.com>2025-01-20 12:37:56 +0800
commitf3f21ae6a4e9e4b88192f0016eac9ceaa5513389 (patch)
tree40d1bcaf6634d24cb62fb9f8533536adb6d7a2fd /compiler/rustc_parse/src/parser/expr.rs
parent64768c56305cf0c139c0de280f1191cd8258193b (diff)
parent1951d86a35c2b7d5c5434493f1897425cbfd8e96 (diff)
downloadrust-f3f21ae6a4e9e4b88192f0016eac9ceaa5513389.tar.gz
rust-f3f21ae6a4e9e4b88192f0016eac9ceaa5513389.zip
Rollup merge of #135738 - yotamofek:map_or_true-compiler, r=compiler-errors
Replace usages of `map_or(bool, ...)` with `is_{some_and|none_or|ok_and}`

Split out from #135732 according to https://github.com/rust-lang/rust/pull/135732?pullrequestreview-2561072330 ,
same thing but just for the compiler:

> The usage of `map_or(bool, ...)` is really hard to understand IMHO.
> This PR simply uses clippy (with `--fix`) to replace that with `is_{some_and|none_or|ok_and}`.
> (no manual modifications were made, just machine applicable clippy fixes and then fmt)

r? ``@compiler-errors``
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 7533e75ffe2..5cd02128287 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -2095,7 +2095,7 @@ impl<'a> Parser<'a> {
                     // point literal here, since there's no use of the exponent
                     // syntax that also constitutes a valid integer, so we need
                     // not check for that.
-                    if suffix.map_or(true, |s| s == sym::f32 || s == sym::f64)
+                    if suffix.is_none_or(|s| s == sym::f32 || s == sym::f64)
                         && symbol.as_str().chars().all(|c| c.is_numeric() || c == '_')
                         && self.token.span.hi() == next_token.span.lo()
                     {