Skip to content

Commit 59f464c

Browse files
committed
Replace is_some_and with map_or for MSRV
is_some_and is stable only in Rust 1.70.0 and greater. map_or(false, |s| s.eq_ignore_ascii_case(SCHEME)): - This method is used to handle the Option returned by get(). - If get() returns None (i.e., the string is too short), map_or() returns false. - If get() returns Some(s), it applies the closure |s| s.eq_ignore_ascii_case(SCHEME). - This closure checks if the substring s is equal to SCHEME, ignoring ASCII case differences. - If they are equal, it returns true; otherwise, it returns false.
1 parent 76244b1 commit 59f464c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/de.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl<'a, T: DeserializeParams<'a>> Uri<'a, bitcoin::address::NetworkUnchecked, T
2525
return Err(Error::Uri(UriError(UriErrorInner::TooShort)));
2626
}
2727

28-
if !string.get(..SCHEME.len()).is_some_and(|s| s.eq_ignore_ascii_case(SCHEME)) {
28+
if !string.get(..SCHEME.len()).map_or(false, |s| s.eq_ignore_ascii_case(SCHEME)) {
2929
return Err(Error::Uri(UriError(UriErrorInner::InvalidScheme)));
3030
}
3131

0 commit comments

Comments
 (0)