Skip to content

Commit 5958709

Browse files
committed
Simplify input and baseURL validation
1 parent b8fb90b commit 5958709

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,8 @@ impl UrlPattern {
4242
None => (None, options),
4343
};
4444

45-
if let Some(UrlPatternInput::Init(_)) = input {
46-
if let Some(_) = base_url {
47-
return Err(PyTypeError::new_err("cannot use dict input with baseURL"));
48-
}
45+
if matches!(input, Some(UrlPatternInput::Init(_))) && base_url.is_some() {
46+
return Err(PyTypeError::new_err("cannot use dict input with baseURL"));
4947
}
5048

5149
let init: ::urlpattern::UrlPatternInit = match input {
@@ -162,7 +160,7 @@ impl UrlPattern {
162160
}
163161
},
164162
UrlPatternInput::Init(init) => {
165-
if let Some(_) = baseURL {
163+
if baseURL.is_some() {
166164
return Err(PyTypeError::new_err("cannot use dict input with baseURL"));
167165
}
168166

@@ -251,7 +249,7 @@ impl UrlPattern {
251249
}
252250
},
253251
UrlPatternInput::Init(init) => {
254-
if let Some(_) = baseURL {
252+
if baseURL.is_some() {
255253
return Err(PyTypeError::new_err("cannot use dict input with baseURL"));
256254
}
257255

0 commit comments

Comments
 (0)