summaryrefslogtreecommitdiff
path: root/cli/file_fetcher.rs
diff options
context:
space:
mode:
authorYiyu Lin <linyiyu1992@gmail.com>2023-01-04 20:20:36 +0800
committerGitHub <noreply@github.com>2023-01-04 13:20:36 +0100
commit319f6074761421b797db71bf10f6171516e3d92a (patch)
tree86d67cc767861e826fff6f2d41c243dbbcd25f60 /cli/file_fetcher.rs
parent2da882137eecc96e73a8c4f8e9b7d59ccdbfca66 (diff)
chore(cli,ext,rt): remove some unnecessary `clone` or `malloc` (#17261)
Diffstat (limited to 'cli/file_fetcher.rs')
-rw-r--r--cli/file_fetcher.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/cli/file_fetcher.rs b/cli/file_fetcher.rs
index b8ee82a80..cc83e6f5f 100644
--- a/cli/file_fetcher.rs
+++ b/cli/file_fetcher.rs
@@ -90,7 +90,7 @@ fn fetch_local(specifier: &ModuleSpecifier) -> Result<File, AnyError> {
let local = specifier.to_file_path().map_err(|_| {
uri_error(format!("Invalid file path.\n Specifier: {}", specifier))
})?;
- let bytes = fs::read(local.clone())?;
+ let bytes = fs::read(&local)?;
let charset = text_encoding::detect_charset(&bytes).to_string();
let source = get_source_from_bytes(bytes, Some(charset))?;
let media_type = MediaType::from(specifier);
@@ -359,7 +359,7 @@ impl FileFetcher {
let blob = {
let blob_store = self.blob_store.borrow();
blob_store
- .get_object_url(specifier.clone())?
+ .get_object_url(specifier.clone())
.ok_or_else(|| {
custom_error(
"NotFound",
@@ -525,7 +525,7 @@ impl FileFetcher {
CacheSetting::ReloadSome(list) => {
let mut url = specifier.clone();
url.set_fragment(None);
- if list.contains(&url.as_str().to_string()) {
+ if list.iter().any(|x| x == url.as_str()) {
return false;
}
url.set_query(None);