Replace .map_or(false with Option::is_some_and (#33468)

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2024-09-16 12:03:52 +02:00 committed by GitHub
parent 236cae9ce5
commit 7df30f3788
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 165 additions and 171 deletions

View file

@ -598,7 +598,7 @@ pub unsafe fn cross_origin_has_own(
// TODO: Once we have the slot for the holder, it'd be more efficient to
// use `ensure_cross_origin_property_holder`. We'll need `_proxy` to
// do that.
*bp = jsid_to_string(*cx, Handle::from_raw(id)).map_or(false, |key| {
*bp = jsid_to_string(*cx, Handle::from_raw(id)).is_some_and(|key| {
cross_origin_properties.keys().any(|defined_key| {
let defined_key = CStr::from_ptr(defined_key);
defined_key.to_bytes() == key.as_bytes()
@ -674,7 +674,7 @@ const ALLOWLISTED_SYMBOL_CODES: &[SymbolCode] = &[
];
unsafe fn is_cross_origin_allowlisted_prop(cx: SafeJSContext, id: RawHandleId) -> bool {
if jsid_to_string(*cx, Handle::from_raw(id)).map_or(false, |st| st == "then") {
if jsid_to_string(*cx, Handle::from_raw(id)).is_some_and(|st| st == "then") {
return true;
}