Skip to content

Commit c3e9e09

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

1 file changed

Lines changed: 36 additions & 31 deletions

File tree

src/lib.rs

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -207,16 +207,18 @@ 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+
#[allow(clippy::collapsible_if)]
211+
if let Some(base_url) = base_url {
212+
if !base_url.cannot_be_a_base()
213+
&& !is_absolute_pathname(pathname, &kind)
214+
{
215+
let baseurl_path = url::quirks::pathname(base_url);
216+
let slash_index = baseurl_path.rfind('/');
217+
if let Some(slash_index) = slash_index {
218+
let new_pathname = baseurl_path[..=slash_index].to_string();
219+
result.pathname =
220+
Some(format!("{}{}", new_pathname, result.pathname.unwrap()));
221+
}
220222
}
221223
}
222224

@@ -331,12 +333,13 @@ impl<R: RegExp> UrlPattern<R> {
331333
)?;
332334

333335
// 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())
336+
if let Some(protocol) = &processed_init.protocol {
337+
#[allow(clippy::collapsible_if)]
338+
if is_special_scheme(protocol) {
339+
let default_port = special_scheme_default_port(protocol);
340+
if default_port == processed_init.port.as_deref() {
341+
processed_init.port = Some(String::new())
342+
}
340343
}
341344
}
342345

@@ -924,13 +927,14 @@ mod tests {
924927

925928
let match_input = quirks::process_match_input(input, base_url.as_deref());
926929

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-
};
930+
#[allow(clippy::collapsible_if)]
931+
if let Some(ExpectedMatch::String(s)) = &case.expected_match {
932+
if s == "error" {
933+
assert!(match_input.is_err());
934+
println!("✅ Passed");
935+
return;
936+
}
937+
}
934938

935939
let input = match_input.expect("failed to parse match input");
936940

@@ -949,14 +953,15 @@ mod tests {
949953
} else {
950954
Ok(None)
951955
};
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-
};
956+
#[allow(clippy::collapsible_if)]
957+
if let Some(ExpectedMatch::String(s)) = &case.expected_match {
958+
if s == "error" {
959+
assert!(test_res.is_err());
960+
assert!(exec_res.is_err());
961+
println!("✅ Passed");
962+
return;
963+
}
964+
}
960965

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

0 commit comments

Comments
 (0)