summaryrefslogtreecommitdiff
path: root/cli/media_type.rs
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2021-02-17 13:47:18 -0500
committerGitHub <noreply@github.com>2021-02-17 13:47:18 -0500
commitc7dabc99eed50fa20cdcafd7c0175ab615da3d50 (patch)
treeec2c611c627827bbdd61d3e27400ae1b9a50d459 /cli/media_type.rs
parentf6d6b24506410816833d802e1a8d9cd704f73289 (diff)
Make ModuleSpecifier a type alias, not wrapper struct (#9531)
Diffstat (limited to 'cli/media_type.rs')
-rw-r--r--cli/media_type.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/cli/media_type.rs b/cli/media_type.rs
index 8117147cd..db64b3922 100644
--- a/cli/media_type.rs
+++ b/cli/media_type.rs
@@ -63,15 +63,14 @@ impl<'a> From<&'a String> for MediaType {
impl<'a> From<&'a ModuleSpecifier> for MediaType {
fn from(specifier: &'a ModuleSpecifier) -> Self {
- let url = specifier.as_url();
- let path = if url.scheme() == "file" {
- if let Ok(path) = url.to_file_path() {
+ let path = if specifier.scheme() == "file" {
+ if let Ok(path) = specifier.to_file_path() {
path
} else {
- PathBuf::from(url.path())
+ PathBuf::from(specifier.path())
}
} else {
- PathBuf::from(url.path())
+ PathBuf::from(specifier.path())
};
MediaType::from_path(&path)
}
@@ -245,7 +244,7 @@ mod tests {
];
for (specifier, expected) in fixtures {
- let actual = ModuleSpecifier::resolve_url_or_path(specifier).unwrap();
+ let actual = deno_core::resolve_url_or_path(specifier).unwrap();
assert_eq!(MediaType::from(&actual), expected);
}
}