Skip to content

Commit 027a48e

Browse files
committed
make the crate 1.87.0 compliant
1 parent 988fda2 commit 027a48e

1 file changed

Lines changed: 31 additions & 31 deletions

File tree

src/lib.rs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -207,16 +207,16 @@ impl UrlPatternInit {
207207
if let Some(pathname) = &self.pathname {
208208
result.pathname = Some(pathname.clone());
209209

210-
if let Some(base_url) = base_url
211-
&& !base_url.cannot_be_a_base()
212-
&& !is_absolute_pathname(pathname, &kind)
213-
{
214-
let baseurl_path = url::quirks::pathname(base_url);
215-
let slash_index = baseurl_path.rfind('/');
216-
if let Some(slash_index) = slash_index {
217-
let new_pathname = baseurl_path[..=slash_index].to_string();
218-
result.pathname =
219-
Some(format!("{}{}", new_pathname, result.pathname.unwrap()));
210+
if let Some(base_url) = base_url {
211+
if !base_url.cannot_be_a_base() &&
212+
!is_absolute_pathname(pathname, &kind) {
213+
let baseurl_path = url::quirks::pathname(base_url);
214+
let slash_index = baseurl_path.rfind('/');
215+
if let Some(slash_index) = slash_index {
216+
let new_pathname = baseurl_path[..=slash_index].to_string();
217+
result.pathname =
218+
Some(format!("{}{}", new_pathname, result.pathname.unwrap()));
219+
}
220220
}
221221
}
222222

@@ -331,12 +331,12 @@ impl<R: RegExp> UrlPattern<R> {
331331
)?;
332332

333333
// If processedInit["protocol"] is a special scheme and processedInit["port"] is its corresponding default port
334-
if let Some(protocol) = &processed_init.protocol
335-
&& is_special_scheme(protocol)
336-
{
337-
let default_port = special_scheme_default_port(protocol);
338-
if default_port == processed_init.port.as_deref() {
339-
processed_init.port = Some(String::new())
334+
if let Some(protocol) = &processed_init.protocol {
335+
if is_special_scheme(protocol) {
336+
let default_port = special_scheme_default_port(protocol);
337+
if default_port == processed_init.port.as_deref() {
338+
processed_init.port = Some(String::new())
339+
}
340340
}
341341
}
342342

@@ -924,13 +924,13 @@ mod tests {
924924

925925
let match_input = quirks::process_match_input(input, base_url.as_deref());
926926

927-
if let Some(ExpectedMatch::String(s)) = &case.expected_match
928-
&& s == "error"
929-
{
930-
assert!(match_input.is_err());
931-
println!("✅ Passed");
932-
return;
933-
};
927+
if let Some(ExpectedMatch::String(s)) = &case.expected_match {
928+
if s == "error" {
929+
assert!(match_input.is_err());
930+
println!("✅ Passed");
931+
return;
932+
}
933+
}
934934

935935
let input = match_input.expect("failed to parse match input");
936936

@@ -949,14 +949,14 @@ mod tests {
949949
} else {
950950
Ok(None)
951951
};
952-
if let Some(ExpectedMatch::String(s)) = &case.expected_match
953-
&& s == "error"
954-
{
955-
assert!(test_res.is_err());
956-
assert!(exec_res.is_err());
957-
println!("✅ Passed");
958-
return;
959-
};
952+
if let Some(ExpectedMatch::String(s)) = &case.expected_match {
953+
if s == "error" {
954+
assert!(test_res.is_err());
955+
assert!(exec_res.is_err());
956+
println!("✅ Passed");
957+
return;
958+
}
959+
}
960960

961961
let expected_match = case.expected_match.map(|x| match x {
962962
ExpectedMatch::String(_) => unreachable!(),

0 commit comments

Comments
 (0)