compiler: Export to_url from pathutils

The LSP will need this to unify code paths between WASM and binary
builds.
This commit is contained in:
Tobias Hunger 2024-01-10 21:26:24 +01:00 committed by Tobias Hunger
parent ff2bf6849e
commit 77a97ed6b5

View file

@ -19,7 +19,7 @@ pub fn is_url(path: &Path) -> bool {
}
/// Convert a `Path` to an `url::Url` if possible
fn to_url(path: &str) -> Option<url::Url> {
pub fn to_url(path: &str) -> Option<url::Url> {
let Ok(url) = url::Url::parse(path) else {
return None;
};
@ -35,7 +35,7 @@ fn to_url(path: &str) -> Option<url::Url> {
fn test_to_url() {
#[track_caller]
fn th(input: &str, expected: bool) {
assert_eq!(to_url(&input).is_some(), expected);
assert_eq!(to_url(input).is_some(), expected);
}
th("https://foo.bar/", true);