Skip to content

Commit b9bce51

Browse files
committed
controllers/krate/publish: Simplify validate_url() fn by using let-else
1 parent 75f4a21 commit b9bce51

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/controllers/krate/publish.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,8 @@ fn is_reserved_name(name: &str, conn: &mut PgConnection) -> QueryResult<bool> {
352352
}
353353

354354
fn validate_url(url: Option<&str>, field: &str) -> AppResult<()> {
355-
let url = match url {
356-
Some(s) => s,
357-
None => return Ok(()),
355+
let Some(url) = url else {
356+
return Ok(());
358357
};
359358

360359
// Manually check the string, as `Url::parse` may normalize relative URLs

0 commit comments

Comments
 (0)