summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/fetch/lib.rs9
-rw-r--r--ext/ffi/dlfcn.rs6
-rw-r--r--ext/ffi/lib.rs3
-rw-r--r--ext/flash/lib.rs7
-rw-r--r--ext/http/lib.rs4
-rw-r--r--ext/net/lib.rs3
-rw-r--r--ext/net/ops.rs2
-rw-r--r--ext/net/ops_unix.rs2
-rw-r--r--ext/node/errors.rs47
-rw-r--r--ext/node/lib.rs6
-rw-r--r--ext/node/resolution.rs8
-rw-r--r--ext/web/blob.rs2
-rw-r--r--ext/web/lib.rs9
-rw-r--r--ext/webgpu/src/lib.rs3
-rw-r--r--ext/websocket/lib.rs5
15 files changed, 48 insertions, 68 deletions
diff --git a/ext/fetch/lib.rs b/ext/fetch/lib.rs
index 4a19650cb..7f0a5e37e 100644
--- a/ext/fetch/lib.rs
+++ b/ext/fetch/lib.rs
@@ -231,8 +231,7 @@ where
if method != Method::GET {
return Err(type_error(format!(
- "Fetching files only supports the GET method. Received {}.",
- method
+ "Fetching files only supports the GET method. Received {method}."
)));
}
@@ -347,11 +346,11 @@ where
}
"data" => {
let data_url = DataUrl::process(url.as_str())
- .map_err(|e| type_error(format!("{:?}", e)))?;
+ .map_err(|e| type_error(format!("{e:?}")))?;
let (body, _) = data_url
.decode_to_vec()
- .map_err(|e| type_error(format!("{:?}", e)))?;
+ .map_err(|e| type_error(format!("{e:?}")))?;
let response = http::Response::builder()
.status(http::StatusCode::OK)
@@ -371,7 +370,7 @@ where
// because the URL isn't an object URL.
return Err(type_error("Blob for the given URL not found."));
}
- _ => return Err(type_error(format!("scheme '{}' not supported", scheme))),
+ _ => return Err(type_error(format!("scheme '{scheme}' not supported"))),
};
Ok(FetchReturn {
diff --git a/ext/ffi/dlfcn.rs b/ext/ffi/dlfcn.rs
index a6b870c30..570af09fc 100644
--- a/ext/ffi/dlfcn.rs
+++ b/ext/ffi/dlfcn.rs
@@ -46,8 +46,7 @@ impl DynamicLibraryResource {
match unsafe { self.lib.symbol::<*const c_void>(&symbol) } {
Ok(value) => Ok(Ok(value)),
Err(err) => Err(generic_error(format!(
- "Failed to register symbol {}: {}",
- symbol, err
+ "Failed to register symbol {symbol}: {err}"
))),
}?
}
@@ -156,8 +155,7 @@ where
match unsafe { resource.lib.symbol::<*const c_void>(symbol) } {
Ok(value) => Ok(value),
Err(err) => Err(generic_error(format!(
- "Failed to register symbol {}: {}",
- symbol, err
+ "Failed to register symbol {symbol}: {err}"
))),
}?;
let ptr = libffi::middle::CodePtr::from_ptr(fn_ptr as _);
diff --git a/ext/ffi/lib.rs b/ext/ffi/lib.rs
index 64d731491..d97bb16b4 100644
--- a/ext/ffi/lib.rs
+++ b/ext/ffi/lib.rs
@@ -60,8 +60,7 @@ fn check_unstable(state: &OpState, api_name: &str) {
if !unstable.0 {
eprintln!(
- "Unstable API '{}'. The --unstable flag must be provided.",
- api_name
+ "Unstable API '{api_name}'. The --unstable flag must be provided."
);
std::process::exit(70);
}
diff --git a/ext/flash/lib.rs b/ext/flash/lib.rs
index 7a7849be1..92490e0b8 100644
--- a/ext/flash/lib.rs
+++ b/ext/flash/lib.rs
@@ -723,7 +723,7 @@ fn op_flash_first_packet(
return Ok(Some(buf.into()));
}
Err(e) => {
- return Err(type_error(format!("{}", e)));
+ return Err(type_error(format!("{e}")));
}
}
}
@@ -773,7 +773,7 @@ async fn op_flash_read_body(
return n;
}
Err(e) if e.kind() == std::io::ErrorKind::InvalidInput => {
- panic!("chunked read error: {}", e);
+ panic!("chunked read error: {e}");
}
Err(_) => {
drop(_lock);
@@ -1493,8 +1493,7 @@ fn check_unstable(state: &OpState, api_name: &str) {
if !unstable.0 {
eprintln!(
- "Unstable API '{}'. The --unstable flag must be provided.",
- api_name
+ "Unstable API '{api_name}'. The --unstable flag must be provided."
);
std::process::exit(70);
}
diff --git a/ext/http/lib.rs b/ext/http/lib.rs
index f1371ffec..d6450bb69 100644
--- a/ext/http/lib.rs
+++ b/ext/http/lib.rs
@@ -746,7 +746,7 @@ fn ensure_vary_accept_encoding(hmap: &mut hyper::HeaderMap) {
if let Some(v) = hmap.get_mut(hyper::header::VARY) {
if let Ok(s) = v.to_str() {
if !s.to_lowercase().contains("accept-encoding") {
- *v = format!("Accept-Encoding, {}", s).try_into().unwrap()
+ *v = format!("Accept-Encoding, {s}").try_into().unwrap()
}
return;
}
@@ -935,7 +935,7 @@ async fn op_http_shutdown(
fn op_http_websocket_accept_header(key: String) -> Result<String, AnyError> {
let digest = ring::digest::digest(
&ring::digest::SHA1_FOR_LEGACY_USE_ONLY,
- format!("{}258EAFA5-E914-47DA-95CA-C5AB0DC85B11", key).as_bytes(),
+ format!("{key}258EAFA5-E914-47DA-95CA-C5AB0DC85B11").as_bytes(),
);
Ok(base64::encode(digest))
}
diff --git a/ext/net/lib.rs b/ext/net/lib.rs
index 64e28fd00..ad5b97a7a 100644
--- a/ext/net/lib.rs
+++ b/ext/net/lib.rs
@@ -45,8 +45,7 @@ impl UnstableChecker {
pub fn check_unstable(&self, api_name: &str) {
if !self.unstable {
eprintln!(
- "Unstable API '{}'. The --unstable flag must be provided.",
- api_name
+ "Unstable API '{api_name}'. The --unstable flag must be provided."
);
std::process::exit(70);
}
diff --git a/ext/net/ops.rs b/ext/net/ops.rs
index 259703d17..1d84a1067 100644
--- a/ext/net/ops.rs
+++ b/ext/net/ops.rs
@@ -488,7 +488,7 @@ where
.lookup(query, record_type)
.await
.map_err(|e| {
- let message = format!("{}", e);
+ let message = format!("{e}");
match e.kind() {
ResolveErrorKind::NoRecordsFound { .. } => {
custom_error("NotFound", message)
diff --git a/ext/net/ops_unix.rs b/ext/net/ops_unix.rs
index d2933a573..1161d2759 100644
--- a/ext/net/ops_unix.rs
+++ b/ext/net/ops_unix.rs
@@ -27,7 +27,7 @@ pub use tokio::net::UnixStream;
/// A utility function to map OsStrings to Strings
pub fn into_string(s: std::ffi::OsString) -> Result<String, AnyError> {
s.into_string().map_err(|s| {
- let message = format!("File name or path {:?} is not valid UTF-8", s);
+ let message = format!("File name or path {s:?} is not valid UTF-8");
custom_error("InvalidData", message)
})
}
diff --git a/ext/node/errors.rs b/ext/node/errors.rs
index 9158ab0c5..bad6696ba 100644
--- a/ext/node/errors.rs
+++ b/ext/node/errors.rs
@@ -13,12 +13,11 @@ pub fn err_invalid_module_specifier(
maybe_base: Option<String>,
) -> AnyError {
let mut msg = format!(
- "[ERR_INVALID_MODULE_SPECIFIER] Invalid module \"{}\" {}",
- request, reason
+ "[ERR_INVALID_MODULE_SPECIFIER] Invalid module \"{request}\" {reason}"
);
if let Some(base) = maybe_base {
- msg = format!("{} imported from {}", msg, base);
+ msg = format!("{msg} imported from {base}");
}
type_error(msg)
@@ -30,17 +29,15 @@ pub fn err_invalid_package_config(
maybe_base: Option<String>,
maybe_message: Option<String>,
) -> AnyError {
- let mut msg = format!(
- "[ERR_INVALID_PACKAGE_CONFIG] Invalid package config {}",
- path
- );
+ let mut msg =
+ format!("[ERR_INVALID_PACKAGE_CONFIG] Invalid package config {path}");
if let Some(base) = maybe_base {
- msg = format!("{} while importing {}", msg, base);
+ msg = format!("{msg} while importing {base}");
}
if let Some(message) = maybe_message {
- msg = format!("{}. {}", msg, message);
+ msg = format!("{msg}. {message}");
}
generic_error(msg)
@@ -49,8 +46,7 @@ pub fn err_invalid_package_config(
#[allow(unused)]
pub fn err_module_not_found(path: &str, base: &str, typ: &str) -> AnyError {
generic_error(format!(
- "[ERR_MODULE_NOT_FOUND] Cannot find {} \"{}\" imported from \"{}\"",
- typ, path, base
+ "[ERR_MODULE_NOT_FOUND] Cannot find {typ} \"{path}\" imported from \"{base}\""
))
}
@@ -86,10 +82,10 @@ pub fn err_invalid_package_target(
};
if let Some(base) = maybe_referrer {
- msg = format!("{} imported from {}", msg, base);
+ msg = format!("{msg} imported from {base}");
};
if rel_error {
- msg = format!("{}; target must start with \"./\"", msg);
+ msg = format!("{msg}; target must start with \"./\"");
}
generic_error(msg)
@@ -116,16 +112,14 @@ pub fn err_package_path_not_exported(
}
if subpath == "." {
- msg = format!(
- "{} No \"exports\" main defined in '{}package.json'",
- msg, pkg_path
- );
+ msg =
+ format!("{msg} No \"exports\" main defined in '{pkg_path}package.json'");
} else {
- msg = format!("{} Package subpath '{}' is not defined by \"exports\" in '{}package.json'", msg, subpath, pkg_path);
+ msg = format!("{msg} Package subpath '{subpath}' is not defined by \"exports\" in '{pkg_path}package.json'");
};
if let Some(referrer) = maybe_referrer {
- msg = format!("{} imported from '{}'", msg, referrer);
+ msg = format!("{msg} imported from '{referrer}'");
}
generic_error(msg)
@@ -137,21 +131,20 @@ pub fn err_package_import_not_defined(
base: &str,
) -> AnyError {
let mut msg = format!(
- "[ERR_PACKAGE_IMPORT_NOT_DEFINED] Package import specifier \"{}\" is not defined in",
- specifier
+ "[ERR_PACKAGE_IMPORT_NOT_DEFINED] Package import specifier \"{specifier}\" is not defined in"
);
if let Some(package_path) = package_path {
- msg = format!("{} in package {}package.json", msg, package_path);
+ msg = format!("{msg} in package {package_path}package.json");
}
- msg = format!("{} imported from {}", msg, base);
+ msg = format!("{msg} imported from {base}");
type_error(msg)
}
pub fn err_unsupported_dir_import(path: &str, base: &str) -> AnyError {
- generic_error(format!("[ERR_UNSUPPORTED_DIR_IMPORT] Directory import '{}' is not supported resolving ES modules imported from {}", path, base))
+ generic_error(format!("[ERR_UNSUPPORTED_DIR_IMPORT] Directory import '{path}' is not supported resolving ES modules imported from {base}"))
}
pub fn err_unsupported_esm_url_scheme(url: &Url) -> AnyError {
@@ -160,10 +153,8 @@ pub fn err_unsupported_esm_url_scheme(url: &Url) -> AnyError {
.to_string();
if cfg!(window) && url.scheme().len() == 2 {
- msg = format!(
- "{}. On Windows, absolute path must be valid file:// URLs",
- msg
- );
+ msg =
+ format!("{msg}. On Windows, absolute path must be valid file:// URLs");
}
msg = format!("{}. Received protocol '{}'", msg, url.scheme());
diff --git a/ext/node/lib.rs b/ext/node/lib.rs
index 3eda18958..3c0e32308 100644
--- a/ext/node/lib.rs
+++ b/ext/node/lib.rs
@@ -69,7 +69,7 @@ pub static NODE_GLOBAL_THIS_NAME: Lazy<String> = Lazy::new(|| {
.unwrap()
.as_secs();
// use a changing variable name to make it hard to depend on this
- format!("__DENO_NODE_GLOBAL_THIS_{}__", seconds)
+ format!("__DENO_NODE_GLOBAL_THIS_{seconds}__")
});
pub static NODE_ENV_VAR_ALLOWLIST: Lazy<HashSet<String>> = Lazy::new(|| {
@@ -497,7 +497,7 @@ where
if request == pkg_name {
// pass
- } else if request.starts_with(&format!("{}/", pkg_name)) {
+ } else if request.starts_with(&format!("{pkg_name}/")) {
expansion += &request[pkg_name.len()..];
} else {
return Ok(None);
@@ -579,7 +579,7 @@ where
let referrer = Url::from_file_path(parent_path).unwrap();
resolution::package_exports_resolve(
&pkg.path,
- format!(".{}", expansion),
+ format!(".{expansion}"),
exports,
&referrer,
NodeModuleKind::Cjs,
diff --git a/ext/node/resolution.rs b/ext/node/resolution.rs
index 81a2521b5..ccd272741 100644
--- a/ext/node/resolution.rs
+++ b/ext/node/resolution.rs
@@ -117,7 +117,7 @@ pub fn with_known_extension(path: &Path, ext: &str) -> PathBuf {
Some(period_index) => &file_name[..period_index],
None => &file_name,
};
- path.with_file_name(format!("{}.{}", file_name, ext))
+ path.with_file_name(format!("{file_name}.{ext}"))
}
fn to_specifier_display_string(url: &ModuleSpecifier) -> String {
@@ -350,7 +350,7 @@ fn resolve_package_target_string(
.replace(&target, |_caps: &regex::Captures| subpath.clone())
.to_string()
} else {
- format!("{}{}", target, subpath)
+ format!("{target}{subpath}")
};
let package_json_url =
ModuleSpecifier::from_file_path(package_json_path).unwrap();
@@ -404,7 +404,7 @@ fn resolve_package_target_string(
let request = if pattern {
match_.replace('*', &subpath)
} else {
- format!("{}{}", match_, subpath)
+ format!("{match_}{subpath}")
};
return Err(throw_invalid_subpath(
request,
@@ -915,7 +915,7 @@ pub fn legacy_main_resolve(
.path
.parent()
.unwrap()
- .join(format!("{}{}", main, ending))
+ .join(format!("{main}{ending}"))
.clean();
if file_exists(&guess) {
// TODO(bartlomieju): emitLegacyIndexDeprecation()
diff --git a/ext/web/blob.rs b/ext/web/blob.rs
index b43b3d17b..1a7992792 100644
--- a/ext/web/blob.rs
+++ b/ext/web/blob.rs
@@ -66,7 +66,7 @@ impl BlobStore {
"null".to_string()
};
let id = Uuid::new_v4();
- let url = Url::parse(&format!("blob:{}/{}", origin, id)).unwrap();
+ let url = Url::parse(&format!("blob:{origin}/{id}")).unwrap();
let mut blob_store = self.object_urls.lock();
blob_store.insert(url.clone(), Arc::new(blob));
diff --git a/ext/web/lib.rs b/ext/web/lib.rs
index 92cfcceeb..ac3fe59fe 100644
--- a/ext/web/lib.rs
+++ b/ext/web/lib.rs
@@ -175,8 +175,7 @@ fn op_encoding_normalize_label(label: String) -> Result<String, AnyError> {
let encoding = Encoding::for_label_no_replacement(label.as_bytes())
.ok_or_else(|| {
range_error(format!(
- "The encoding label provided ('{}') is invalid.",
- label
+ "The encoding label provided ('{label}') is invalid."
))
})?;
Ok(encoding.name().to_lowercase())
@@ -224,8 +223,7 @@ fn op_encoding_decode_single(
) -> Result<U16String, AnyError> {
let encoding = Encoding::for_label(label.as_bytes()).ok_or_else(|| {
range_error(format!(
- "The encoding label provided ('{}') is invalid.",
- label
+ "The encoding label provided ('{label}') is invalid."
))
})?;
@@ -278,8 +276,7 @@ fn op_encoding_new_decoder(
) -> Result<ResourceId, AnyError> {
let encoding = Encoding::for_label(label.as_bytes()).ok_or_else(|| {
range_error(format!(
- "The encoding label provided ('{}') is invalid.",
- label
+ "The encoding label provided ('{label}') is invalid."
))
})?;
diff --git a/ext/webgpu/src/lib.rs b/ext/webgpu/src/lib.rs
index 9ee220dd0..d1fb55dbf 100644
--- a/ext/webgpu/src/lib.rs
+++ b/ext/webgpu/src/lib.rs
@@ -73,8 +73,7 @@ fn check_unstable(state: &OpState, api_name: &str) {
let unstable = state.borrow::<Unstable>();
if !unstable.0 {
eprintln!(
- "Unstable API '{}'. The --unstable flag must be provided.",
- api_name
+ "Unstable API '{api_name}'. The --unstable flag must be provided."
);
std::process::exit(70);
}
diff --git a/ext/websocket/lib.rs b/ext/websocket/lib.rs
index 8123f84fc..baf5c396c 100644
--- a/ext/websocket/lib.rs
+++ b/ext/websocket/lib.rs
@@ -321,7 +321,7 @@ where
Some("ws") => 80,
_ => unreachable!(),
});
- let addr = format!("{}:{}", domain, port);
+ let addr = format!("{domain}:{port}");
let tcp_socket = TcpStream::connect(addr).await?;
let socket: MaybeTlsStream<TcpStream> = match uri.scheme_str() {
@@ -359,8 +359,7 @@ where
}
.map_err(|err| {
DomExceptionNetworkError::new(&format!(
- "failed to connect to WebSocket: {}",
- err
+ "failed to connect to WebSocket: {err}"
))
})?;