Skip to content

Commit 76548e5

Browse files
committed
Fix rust CS
1 parent 968e897 commit 76548e5

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/api/redirection_loop.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,15 @@ impl RedirectionLoop {
9696
}
9797

9898
if i > 1 {
99-
match Url::parse(&current_url) {
100-
Ok(url) => {
101-
if !project_domains.is_empty() && !project_domains.contains(&url.host_str().unwrap().to_string()) {
102-
// The current url target a domain that is not registered in the project.
103-
// So we consider there is no redirection loop here.
104-
break;
105-
}
106-
},
107-
Err(_) => {}
108-
};
99+
// If the url cannot be parsed, let's treat it as a relative Url.
100+
// Otherwise, we check if the corresponding domain is registered in the project.
101+
if let Ok(url) = Url::parse(&current_url) {
102+
if !project_domains.is_empty() && !project_domains.contains(&url.host_str().unwrap().to_string()) {
103+
// The current url target a domain that is not registered in the project.
104+
// So we consider there is no redirection loop here.
105+
break;
106+
}
107+
}
109108

110109
error = Some(RedirectionError::AtLeastOneHop);
111110
}

src/api/test_examples.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ impl TestExamplesOutput {
7272
pub fn from_project(test_examples_input: TestExamplesProjectInput, existing_router: Arc<Router<Rule>>) -> TestExamplesOutput {
7373
let test_example_router = test_examples_input.change_set.update_existing_router(existing_router);
7474

75-
Self::create_result(&test_example_router, test_examples_input.max_hops, test_examples_input.project_domains)
75+
Self::create_result(
76+
&test_example_router,
77+
test_examples_input.max_hops,
78+
test_examples_input.project_domains,
79+
)
7680
}
7781

7882
pub fn create_result_without_project(test_examples_input: TestExamplesInput) -> TestExamplesOutput {

0 commit comments

Comments
 (0)