From c73442c25a0ad88ac7482b723997ae19dc72b3df Mon Sep 17 00:00:00 2001 From: Satya Rohith Date: Wed, 12 Aug 2026 14:25:02 +0530 Subject: [PATCH 1/3] build: upgrade Rust toolchain to 1.97.1 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- rust-toolchain.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3894a38cd..1030f86ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "Inflector" @@ -8905,7 +8905,7 @@ dependencies = [ [[package]] name = "v8" version = "130.0.7" -source = "git+https://github.com/supabase/rusty_v8?tag=v130.0.7#57d783ad71294f2677394e2aaf2db1ae162c16d0" +source = "git+https://github.com/supabase/rusty_v8?tag=v130.0.7-patch.1#1e075391ef6cf04414e5e0e229174426a1ce93a2" dependencies = [ "bindgen", "bitflags 2.6.0", diff --git a/Cargo.toml b/Cargo.toml index 8112a1666..ca24ff047 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -223,7 +223,7 @@ windows-sys = { version = "0.59.0", features = ["Win32_Foundation", "Win32_Media [patch.crates-io] deno_core = { git = "https://github.com/supabase/deno_core", branch = "324-supabase" } eszip = { git = "https://github.com/supabase/eszip", branch = "fix-pub-vis-0-80-1" } -v8 = { git = "https://github.com/supabase/rusty_v8", tag = "v130.0.7" } +v8 = { git = "https://github.com/supabase/rusty_v8", tag = "v130.0.7-patch.1" } deno_unsync = { path = "./vendor/deno_unsync" } deno_fetch = { path = "./vendor/deno_fetch" } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 3d572e0d6..8565ca6bc 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.82.0" +channel = "1.97.1" components = ["rustfmt", "clippy"] From 1f69da7688c7e5a7693215b355caf41bae094856 Mon Sep 17 00:00:00 2001 From: Satya Rohith Date: Wed, 12 Aug 2026 14:25:07 +0530 Subject: [PATCH 2/3] chore: resolve Rust 1.97 clippy warnings --- crates/base/src/inspector_server.rs | 4 ++-- crates/base/src/lib.rs | 2 ++ crates/base/src/runtime/mod.rs | 2 +- crates/base/src/runtime/unsync.rs | 1 + crates/base/src/utils/dirs.rs | 2 +- crates/base/src/worker/pool.rs | 15 ++++++--------- crates/base/tests/eszip_migration.rs | 2 +- crates/base/tests/integration_tests.rs | 3 +-- crates/cpu_timer/src/lib.rs | 3 +-- crates/fs/impl/prefix_fs.rs | 2 +- crates/fs/impl/virtual_fs.rs | 26 ++++++++------------------ crates/fs/tests/integration_tests.rs | 2 ++ deno/args/lockfile.rs | 2 +- deno/args/package_json.rs | 6 ++---- deno/cache/deno_dir.rs | 4 ++-- deno/cache/module_info.rs | 2 +- deno/cache/parsed_source.rs | 2 +- deno/graph_util.rs | 6 +++--- deno/lib.rs | 2 ++ deno/npm/byonm.rs | 4 ++-- deno/npm/managed/mod.rs | 2 +- deno/npm/managed/resolution.rs | 4 +++- deno/npm/mod.rs | 2 +- deno/resolver.rs | 2 +- deno/util/fs.rs | 1 - deno/util/sync/task_queue.rs | 2 +- ext/ai/lib.rs | 2 ++ ext/ai/onnxruntime/tensor.rs | 1 + ext/event_worker/events.rs | 1 + ext/node/clippy.toml | 10 ---------- ext/node/ops/crypto/cipher.rs | 24 ++++++++++++------------ ext/node/ops/crypto/keys.rs | 2 +- ext/node/ops/crypto/mod.rs | 6 ++---- ext/node/ops/http.rs | 19 ++++++++++--------- ext/node/ops/http2.rs | 12 ++++++------ ext/node/ops/os/cpus.rs | 7 ++++--- ext/node/ops/vm.rs | 10 ++++------ ext/node/ops/zlib/mod.rs | 2 +- ext/node/polyfill.rs | 4 +--- ext/runtime/conn_sync.rs | 2 +- ext/runtime/external_memory.rs | 4 ++-- ext/runtime/ops/http.rs | 4 ++-- ext/runtime/ops/net.rs | 2 +- ext/runtime/upgrade.rs | 2 +- ext/workers/context.rs | 11 ++++------- ext/workers/lib.rs | 11 +++++------ vendor/deno_fetch/lib.rs | 8 ++++---- vendor/deno_http/http_next.rs | 4 ++-- vendor/deno_http/lib.rs | 6 +++--- vendor/deno_http/request_body.rs | 2 +- vendor/deno_telemetry/lib.rs | 1 + 51 files changed, 120 insertions(+), 142 deletions(-) diff --git a/crates/base/src/inspector_server.rs b/crates/base/src/inspector_server.rs index a772be771..ee7ec4e75 100644 --- a/crates/base/src/inspector_server.rs +++ b/crates/base/src/inspector_server.rs @@ -536,13 +536,13 @@ impl InspectorInfo { } pub fn get_websocket_debugger_url(&self, host: &str) -> String { - format!("ws://{}/ws/{}", host, &self.uuid) + format!("ws://{}/ws/{}", host, self.uuid) } fn get_frontend_url(&self, host: &str) -> String { format!( "devtools://devtools/bundled/js_app.html?ws={}/ws/{}&experiments=true&v8only=true", - host, &self.uuid + host, self.uuid ) } diff --git a/crates/base/src/lib.rs b/crates/base/src/lib.rs index c83e5f197..286626a21 100644 --- a/crates/base/src/lib.rs +++ b/crates/base/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(unexpected_cfgs)] // ctor's implementation checks an internal feature in the caller. + extern crate core; mod inspector_server; diff --git a/crates/base/src/runtime/mod.rs b/crates/base/src/runtime/mod.rs index 3216531f9..03db8219f 100644 --- a/crates/base/src/runtime/mod.rs +++ b/crates/base/src/runtime/mod.rs @@ -700,7 +700,7 @@ where metadata .static_assets_lookup(static_root_path) .into_iter() - .chain(static_files.into_iter()) + .chain(static_files) .collect() } else { static_files diff --git a/crates/base/src/runtime/unsync.rs b/crates/base/src/runtime/unsync.rs index b3c937172..ab15120c6 100644 --- a/crates/base/src/runtime/unsync.rs +++ b/crates/base/src/runtime/unsync.rs @@ -16,6 +16,7 @@ impl MaskValueAsSend { } } +#[allow(dead_code)] // Used by optional runtime configurations. pub struct MaskFutureAsSend { pub fut: MaskValueAsSend, } diff --git a/crates/base/src/utils/dirs.rs b/crates/base/src/utils/dirs.rs index b711f69fd..6e1c4f785 100644 --- a/crates/base/src/utils/dirs.rs +++ b/crates/base/src/utils/dirs.rs @@ -15,7 +15,7 @@ mod internal { pub fn home_dir() -> Option { std::env::var_os("HOME") - .and_then(|h| if h.is_empty() { None } else { Some(h) }) + .filter(|h| !h.is_empty()) .or_else(|| { // TODO(bartlomieju): #[allow(clippy::undocumented_unsafe_blocks)] diff --git a/crates/base/src/worker/pool.rs b/crates/base/src/worker/pool.rs index ee9142b28..e47de2bdd 100644 --- a/crates/base/src/worker/pool.rs +++ b/crates/base/src/worker/pool.rs @@ -52,16 +52,13 @@ use crate::inspector_server::Inspector; use crate::server::ServerFlags; use crate::worker::WorkerSurfaceBuilder; -#[derive(Debug, Clone, Copy, EnumAsInner)] +#[derive(Debug, Clone, Copy, EnumAsInner, Default)] pub enum SupervisorPolicy { + #[default] PerWorker, - PerRequest { oneshot: bool }, -} - -impl Default for SupervisorPolicy { - fn default() -> Self { - Self::PerWorker - } + PerRequest { + oneshot: bool, + }, } impl FromStr for SupervisorPolicy { @@ -294,7 +291,7 @@ impl WorkerPool { let force_create = worker_options .conf .as_user_worker() - .map_or(false, |it| !is_oneshot_policy && it.force_create); + .is_some_and(|it| !is_oneshot_policy && it.force_create); if let Some(ref active_worker_uuid) = self.maybe_active_worker(&service_path, force_create) diff --git a/crates/base/tests/eszip_migration.rs b/crates/base/tests/eszip_migration.rs index b7e9a362e..8c83b70b0 100644 --- a/crates/base/tests/eszip_migration.rs +++ b/crates/base/tests/eszip_migration.rs @@ -96,7 +96,7 @@ where let buf = read(path.as_ref()).await?; let eszip = EszipPayloadKind::VecKind(buf.clone()); let metadata_path = - PathBuf::from(format!("{}.metadata", &path.as_ref().to_string_lossy())); + PathBuf::from(format!("{}.metadata", path.as_ref().to_string_lossy())); let metadata = if metadata_path.exists() { let buf = read(metadata_path).await?; Some(serde_json::from_slice::(&buf)?) diff --git a/crates/base/tests/integration_tests.rs b/crates/base/tests/integration_tests.rs index 1e76dfbab..9a98a0435 100644 --- a/crates/base/tests/integration_tests.rs +++ b/crates/base/tests/integration_tests.rs @@ -27,7 +27,6 @@ use base::server::ServerEvent; use base::server::ServerFlags; use base::server::ServerHealth; use base::server::Tls; -use base::utils::test_utils; use base::utils::test_utils::create_test_user_worker; use base::utils::test_utils::ensure_npm_package_installed; use base::utils::test_utils::test_user_runtime_opts; @@ -3388,7 +3387,7 @@ async fn test_commonjs_hono() { async fn test_commonjs_websocket(prefix: String) { ensure_npm_package_installed(format!( "./test_cases/commonjs-{}-websocket", - &prefix + prefix )) .await; let nonce = tungstenite::handshake::client::generate_key(); diff --git a/crates/cpu_timer/src/lib.rs b/crates/cpu_timer/src/lib.rs index 14190b226..8717acfd3 100644 --- a/crates/cpu_timer/src/lib.rs +++ b/crates/cpu_timer/src/lib.rs @@ -5,7 +5,6 @@ use std::sync::Arc; use anyhow::Error; use tokio::sync::mpsc; -use tokio::sync::Mutex; #[cfg(target_os = "linux")] mod linux { @@ -131,7 +130,7 @@ impl CPUTimer { } pub async fn set_channel(&self) -> mpsc::UnboundedReceiver<()> { - let (tx, rx) = mpsc::unbounded_channel(); + let (_tx, rx) = mpsc::unbounded_channel(); #[cfg(target_os = "linux")] { let mut val = self.cpu_alarm_val.cpu_alarms_tx.lock().await; diff --git a/crates/fs/impl/prefix_fs.rs b/crates/fs/impl/prefix_fs.rs index b1e5332c5..c71bc2af5 100644 --- a/crates/fs/impl/prefix_fs.rs +++ b/crates/fs/impl/prefix_fs.rs @@ -138,7 +138,7 @@ where .clone() .map(Ok) .or_else(|| self.base_fs.as_ref().map(|it| it.tmp_dir())) - .unwrap_or_else(|| Err(FsError::NotSupported)) + .unwrap_or(Err(FsError::NotSupported)) } fn chdir(&self, path: &Path) -> FsResult<()> { diff --git a/crates/fs/impl/virtual_fs.rs b/crates/fs/impl/virtual_fs.rs index 748341ae7..aaf43cdd9 100644 --- a/crates/fs/impl/virtual_fs.rs +++ b/crates/fs/impl/virtual_fs.rs @@ -408,7 +408,7 @@ impl VfsEntry { } } - fn as_ref(&self) -> VfsEntryRef { + fn as_ref(&self) -> VfsEntryRef<'_> { match self { VfsEntry::Dir(dir) => VfsEntryRef::Dir(dir), VfsEntry::File(file) => VfsEntryRef::File(file), @@ -513,10 +513,7 @@ impl VfsRoot { match entry { VfsEntryRef::Symlink(symlink) => { if !seen.insert(path.to_path_buf()) { - return Err(std::io::Error::new( - std::io::ErrorKind::Other, - "circular symlinks", - )); + return Err(std::io::Error::other("circular symlinks")); } path = Cow::Owned(symlink.resolve_dest_from_root(&self.root_path)); } @@ -530,7 +527,7 @@ impl VfsRoot { fn find_entry_no_follow( &self, path: &Path, - ) -> std::io::Result<(PathBuf, VfsEntryRef)> { + ) -> std::io::Result<(PathBuf, VfsEntryRef<'_>)> { self.find_entry_no_follow_inner(path, &mut HashSet::new()) } @@ -883,10 +880,9 @@ impl FileBackedVfs { VfsEntryRef::Symlink(symlink) => { Ok(symlink.resolve_dest_from_root(&self.fs_root.root_path)) } - VfsEntryRef::Dir(_) | VfsEntryRef::File(_) => Err(std::io::Error::new( - std::io::ErrorKind::Other, - "not a symlink", - )), + VfsEntryRef::Dir(_) | VfsEntryRef::File(_) => { + Err(std::io::Error::other("not a symlink")) + } } } @@ -928,20 +924,14 @@ impl FileBackedVfs { match entry { VfsEntryRef::Dir(dir) => Ok(dir), VfsEntryRef::Symlink(_) => unreachable!(), - VfsEntryRef::File(_) => Err(std::io::Error::new( - std::io::ErrorKind::Other, - "path is a file", - )), + VfsEntryRef::File(_) => Err(std::io::Error::other("path is a file")), } } pub fn file_entry(&self, path: &Path) -> std::io::Result<&VirtualFile> { let (_, entry) = self.fs_root.find_entry(path)?; match entry { - VfsEntryRef::Dir(_) => Err(std::io::Error::new( - std::io::ErrorKind::Other, - "path is a directory", - )), + VfsEntryRef::Dir(_) => Err(std::io::Error::other("path is a directory")), VfsEntryRef::Symlink(_) => unreachable!(), VfsEntryRef::File(file) => Ok(file), } diff --git a/crates/fs/tests/integration_tests.rs b/crates/fs/tests/integration_tests.rs index f8b18579c..282232570 100644 --- a/crates/fs/tests/integration_tests.rs +++ b/crates/fs/tests/integration_tests.rs @@ -1,3 +1,5 @@ +#![allow(unexpected_cfgs)] // ctor's implementation checks an internal feature in the caller. + use std::collections::HashMap; use std::path::Path; use std::time::Duration; diff --git a/deno/args/lockfile.rs b/deno/args/lockfile.rs index 8810a3482..0bd6e20f2 100644 --- a/deno/args/lockfile.rs +++ b/deno/args/lockfile.rs @@ -56,7 +56,7 @@ impl<'a, T> std::ops::DerefMut for Guard<'a, T> { impl CliLockfile { /// Get the inner deno_lockfile::Lockfile. - pub fn lock(&self) -> Guard { + pub fn lock(&self) -> Guard<'_, Lockfile> { Guard { guard: self.lockfile.lock(), } diff --git a/deno/args/package_json.rs b/deno/args/package_json.rs index b0f0a2f9b..2f0a722bd 100644 --- a/deno/args/package_json.rs +++ b/deno/args/package_json.rs @@ -100,10 +100,8 @@ impl NpmInstallDepsProvider { let mut pkg_pkgs = Vec::with_capacity( deps.dependencies.len() + deps.dev_dependencies.len(), ); - for (alias, dep) in deps - .dependencies - .into_iter() - .chain(deps.dev_dependencies.into_iter()) + for (alias, dep) in + deps.dependencies.into_iter().chain(deps.dev_dependencies) { let dep = match dep { Ok(dep) => dep, diff --git a/deno/cache/deno_dir.rs b/deno/cache/deno_dir.rs index b87cd5cdb..0656c9b65 100644 --- a/deno/cache/deno_dir.rs +++ b/deno/cache/deno_dir.rs @@ -75,7 +75,7 @@ impl DenoDir { } /// The root directory of the DENO_DIR for display purposes only. - pub fn root_path_for_display(&self) -> std::path::Display { + pub fn root_path_for_display(&self) -> std::path::Display<'_> { self.root.display() } @@ -184,7 +184,7 @@ pub mod dirs { pub fn home_dir() -> Option { std::env::var_os("HOME") - .and_then(|h| if h.is_empty() { None } else { Some(h) }) + .filter(|h| !h.is_empty()) .or_else(|| { // TODO(bartlomieju): #[allow(clippy::undocumented_unsafe_blocks)] diff --git a/deno/cache/module_info.rs b/deno/cache/module_info.rs index afca34bf4..bddbc2ccc 100644 --- a/deno/cache/module_info.rs +++ b/deno/cache/module_info.rs @@ -128,7 +128,7 @@ impl ModuleInfoCache { Ok(()) } - pub fn as_module_analyzer(&self) -> ModuleInfoCacheModuleAnalyzer { + pub fn as_module_analyzer(&self) -> ModuleInfoCacheModuleAnalyzer<'_> { ModuleInfoCacheModuleAnalyzer { module_info_cache: self, parsed_source_cache: &self.parsed_source_cache, diff --git a/deno/cache/parsed_source.rs b/deno/cache/parsed_source.rs index 168761331..922fd019b 100644 --- a/deno/cache/parsed_source.rs +++ b/deno/cache/parsed_source.rs @@ -64,7 +64,7 @@ impl ParsedSourceCache { /// Creates a parser that will reuse a ParsedSource from the store /// if it exists, or else parse. - pub fn as_capturing_parser(&self) -> CapturingEsParser { + pub fn as_capturing_parser(&self) -> CapturingEsParser<'_> { CapturingEsParser::new(None, self) } } diff --git a/deno/graph_util.rs b/deno/graph_util.rs index 7f31f935e..5683ee904 100644 --- a/deno/graph_util.rs +++ b/deno/graph_util.rs @@ -761,7 +761,7 @@ impl ModuleGraphBuilder { ) } - fn create_graph_resolver(&self) -> Result { + fn create_graph_resolver(&self) -> Result, AnyError> { let jsx_import_source_config = self .options .workspace() @@ -1118,8 +1118,8 @@ pub fn format_range_with_colors(referrer: &deno_graph::Range) -> String { format!( "{}:{}:{}", referrer.specifier.as_str(), - &(referrer.range.start.line + 1).to_string(), - &(referrer.range.start.character + 1).to_string() + (referrer.range.start.line + 1), + (referrer.range.start.character + 1) ) } diff --git a/deno/lib.rs b/deno/lib.rs index 061dbad01..c84424649 100644 --- a/deno/lib.rs +++ b/deno/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] // Public errors are defined by the pinned Deno crates. + use std::collections::HashMap; use std::env; use std::path::Path; diff --git a/deno/npm/byonm.rs b/deno/npm/byonm.rs index 45177b6fa..23fa78dcc 100644 --- a/deno/npm/byonm.rs +++ b/deno/npm/byonm.rs @@ -41,7 +41,7 @@ impl CliNpmResolver for CliByonmNpmResolver { Arc::new(self.clone()) } - fn as_inner(&self) -> InnerCliNpmResolverRef { + fn as_inner(&self) -> InnerCliNpmResolverRef<'_> { InnerCliNpmResolverRef::Byonm(self) } @@ -56,7 +56,7 @@ impl CliNpmResolver for CliByonmNpmResolver { ) -> Result, AnyError> { if !path .components() - .any(|c| c.as_os_str().to_ascii_lowercase() == "node_modules") + .any(|c| c.as_os_str().eq_ignore_ascii_case("node_modules")) { permissions.check_read_path(path).map_err(Into::into) } else { diff --git a/deno/npm/managed/mod.rs b/deno/npm/managed/mod.rs index 6e9477bec..7d0b17644 100644 --- a/deno/npm/managed/mod.rs +++ b/deno/npm/managed/mod.rs @@ -672,7 +672,7 @@ impl CliNpmResolver for ManagedCliNpmResolver { )) } - fn as_inner(&self) -> InnerCliNpmResolverRef { + fn as_inner(&self) -> InnerCliNpmResolverRef<'_> { InnerCliNpmResolverRef::Managed(self) } diff --git a/deno/npm/managed/resolution.rs b/deno/npm/managed/resolution.rs index 36d620b07..4f90b717b 100644 --- a/deno/npm/managed/resolution.rs +++ b/deno/npm/managed/resolution.rs @@ -316,7 +316,9 @@ async fn add_package_reqs_to_snapshot( result } -fn get_add_pkg_reqs_options(package_reqs: &[PackageReq]) -> AddPkgReqsOptions { +fn get_add_pkg_reqs_options( + package_reqs: &[PackageReq], +) -> AddPkgReqsOptions<'_> { AddPkgReqsOptions { package_reqs, // WARNING: When bumping this version, check if anything needs to be diff --git a/deno/npm/mod.rs b/deno/npm/mod.rs index 5dadcb254..5e4c01ff1 100644 --- a/deno/npm/mod.rs +++ b/deno/npm/mod.rs @@ -177,7 +177,7 @@ pub trait CliNpmResolver: NpmPackageFolderResolver + CliNpmReqResolver { fn clone_snapshotted(&self) -> Arc; - fn as_inner(&self) -> InnerCliNpmResolverRef; + fn as_inner(&self) -> InnerCliNpmResolverRef<'_>; fn as_managed(&self) -> Option<&ManagedCliNpmResolver> { match self.as_inner() { diff --git a/deno/resolver.rs b/deno/resolver.rs index 202d17eea..a677efd8a 100644 --- a/deno/resolver.rs +++ b/deno/resolver.rs @@ -239,7 +239,7 @@ impl CliResolver { pub fn create_graph_npm_resolver( &self, npm_caching: NpmCachingStrategy, - ) -> WorkerCliNpmGraphResolver { + ) -> WorkerCliNpmGraphResolver<'_> { WorkerCliNpmGraphResolver { npm_resolver: self.npm_resolver.as_ref(), found_package_json_dep_flag: &self.found_package_json_dep_flag, diff --git a/deno/util/fs.rs b/deno/util/fs.rs index 5381ddefb..a7107a8db 100644 --- a/deno/util/fs.rs +++ b/deno/util/fs.rs @@ -591,7 +591,6 @@ struct LaxSingleProcessFsFlagInner { impl Drop for LaxSingleProcessFsFlagInner { fn drop(&mut self) { - use fs3::FileExt; // kill the poll thread self.finished_token.cancel(); // release the file lock diff --git a/deno/util/sync/task_queue.rs b/deno/util/sync/task_queue.rs index 8db880203..28f499791 100644 --- a/deno/util/sync/task_queue.rs +++ b/deno/util/sync/task_queue.rs @@ -35,7 +35,7 @@ pub struct TaskQueue { impl TaskQueue { /// Acquires a permit where the tasks are executed one at a time /// and in the order that they were acquired. - pub fn acquire(&self) -> TaskQueuePermitAcquireFuture { + pub fn acquire(&self) -> TaskQueuePermitAcquireFuture<'_> { TaskQueuePermitAcquireFuture::new(self) } diff --git a/ext/ai/lib.rs b/ext/ai/lib.rs index 224b0450f..fbebb5bad 100644 --- a/ext/ai/lib.rs +++ b/ext/ai/lib.rs @@ -1,3 +1,5 @@ +#![allow(unexpected_cfgs)] // ctor's implementation checks an internal feature in the caller. + extern crate blas_src; mod consts; diff --git a/ext/ai/onnxruntime/tensor.rs b/ext/ai/onnxruntime/tensor.rs index 86b2e7ae8..a5869412a 100644 --- a/ext/ai/onnxruntime/tensor.rs +++ b/ext/ai/onnxruntime/tensor.rs @@ -116,6 +116,7 @@ pub enum JsTensorType { } #[derive(Serialize, Deserialize)] +#[allow(dead_code)] // Serde helper used through its remote derive implementation. struct JsTensorTypeSerdeHelper( #[serde(with = "JsTensorType")] TensorElementType, ); diff --git a/ext/event_worker/events.rs b/ext/event_worker/events.rs index 9706aef04..7b4257f4b 100644 --- a/ext/event_worker/events.rs +++ b/ext/event_worker/events.rs @@ -63,6 +63,7 @@ pub enum LogLevel { Error, } +#[allow(clippy::infallible_try_from)] // Keep the fallible API expected by event deserialization callers. impl TryFrom for LogLevel { type Error = Infallible; diff --git a/ext/node/clippy.toml b/ext/node/clippy.toml index 02fd259d0..49e76c4a5 100644 --- a/ext/node/clippy.toml +++ b/ext/node/clippy.toml @@ -10,16 +10,6 @@ disallowed-methods = [ { path = "std::path::Path::read_link", reason = "File system operations should be done using FileSystem trait" }, { path = "std::path::Path::symlink_metadata", reason = "File system operations should be done using FileSystem trait" }, { path = "std::path::Path::try_exists", reason = "File system operations should be done using FileSystem trait" }, - { path = "std::path::PathBuf::exists", reason = "File system operations should be done using FileSystem trait" }, - { path = "std::path::PathBuf::canonicalize", reason = "File system operations should be done using FileSystem trait" }, - { path = "std::path::PathBuf::is_dir", reason = "File system operations should be done using FileSystem trait" }, - { path = "std::path::PathBuf::is_file", reason = "File system operations should be done using FileSystem trait" }, - { path = "std::path::PathBuf::is_symlink", reason = "File system operations should be done using FileSystem trait" }, - { path = "std::path::PathBuf::metadata", reason = "File system operations should be done using FileSystem trait" }, - { path = "std::path::PathBuf::read_dir", reason = "File system operations should be done using FileSystem trait" }, - { path = "std::path::PathBuf::read_link", reason = "File system operations should be done using FileSystem trait" }, - { path = "std::path::PathBuf::symlink_metadata", reason = "File system operations should be done using FileSystem trait" }, - { path = "std::path::PathBuf::try_exists", reason = "File system operations should be done using FileSystem trait" }, { path = "std::fs::canonicalize", reason = "File system operations should be done using FileSystem trait" }, { path = "std::fs::copy", reason = "File system operations should be done using FileSystem trait" }, { path = "std::fs::create_dir", reason = "File system operations should be done using FileSystem trait" }, diff --git a/ext/node/ops/crypto/cipher.rs b/ext/node/ops/crypto/cipher.rs index 9fdb156ce..b12c15b81 100644 --- a/ext/node/ops/crypto/cipher.rs +++ b/ext/node/ops/crypto/cipher.rs @@ -140,13 +140,13 @@ impl DecipherContext { } impl Resource for CipherContext { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "cryptoCipher".into() } } impl Resource for DecipherContext { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "cryptoDecipher".into() } } @@ -231,25 +231,25 @@ impl Cipher { use Cipher::*; match self { Aes128Cbc(encryptor) => { - assert!(input.len() % 16 == 0); + assert!(input.len().is_multiple_of(16)); for (input, output) in input.chunks(16).zip(output.chunks_mut(16)) { encryptor.encrypt_block_b2b_mut(input.into(), output.into()); } } Aes128Ecb(encryptor) => { - assert!(input.len() % 16 == 0); + assert!(input.len().is_multiple_of(16)); for (input, output) in input.chunks(16).zip(output.chunks_mut(16)) { encryptor.encrypt_block_b2b_mut(input.into(), output.into()); } } Aes192Ecb(encryptor) => { - assert!(input.len() % 16 == 0); + assert!(input.len().is_multiple_of(16)); for (input, output) in input.chunks(16).zip(output.chunks_mut(16)) { encryptor.encrypt_block_b2b_mut(input.into(), output.into()); } } Aes256Ecb(encryptor) => { - assert!(input.len() % 16 == 0); + assert!(input.len().is_multiple_of(16)); for (input, output) in input.chunks(16).zip(output.chunks_mut(16)) { encryptor.encrypt_block_b2b_mut(input.into(), output.into()); } @@ -263,7 +263,7 @@ impl Cipher { cipher.encrypt(output); } Aes256Cbc(encryptor) => { - assert!(input.len() % 16 == 0); + assert!(input.len().is_multiple_of(16)); for (input, output) in input.chunks(16).zip(output.chunks_mut(16)) { encryptor.encrypt_block_b2b_mut(input.into(), output.into()); } @@ -449,25 +449,25 @@ impl Decipher { use Decipher::*; match self { Aes128Cbc(decryptor) => { - assert!(input.len() % 16 == 0); + assert!(input.len().is_multiple_of(16)); for (input, output) in input.chunks(16).zip(output.chunks_mut(16)) { decryptor.decrypt_block_b2b_mut(input.into(), output.into()); } } Aes128Ecb(decryptor) => { - assert!(input.len() % 16 == 0); + assert!(input.len().is_multiple_of(16)); for (input, output) in input.chunks(16).zip(output.chunks_mut(16)) { decryptor.decrypt_block_b2b_mut(input.into(), output.into()); } } Aes192Ecb(decryptor) => { - assert!(input.len() % 16 == 0); + assert!(input.len().is_multiple_of(16)); for (input, output) in input.chunks(16).zip(output.chunks_mut(16)) { decryptor.decrypt_block_b2b_mut(input.into(), output.into()); } } Aes256Ecb(decryptor) => { - assert!(input.len() % 16 == 0); + assert!(input.len().is_multiple_of(16)); for (input, output) in input.chunks(16).zip(output.chunks_mut(16)) { decryptor.decrypt_block_b2b_mut(input.into(), output.into()); } @@ -481,7 +481,7 @@ impl Decipher { decipher.decrypt(output); } Aes256Cbc(decryptor) => { - assert!(input.len() % 16 == 0); + assert!(input.len().is_multiple_of(16)); for (input, output) in input.chunks(16).zip(output.chunks_mut(16)) { decryptor.decrypt_block_b2b_mut(input.into(), output.into()); } diff --git a/ext/node/ops/crypto/keys.rs b/ext/node/ops/crypto/keys.rs index f164972d4..90a0e7f46 100644 --- a/ext/node/ops/crypto/keys.rs +++ b/ext/node/ops/crypto/keys.rs @@ -329,7 +329,7 @@ impl<'a> TryFrom> for RsaPssParameters<'a> { fn try_from( any: rsa::pkcs8::der::asn1::AnyRef<'a>, - ) -> rsa::pkcs8::der::Result { + ) -> rsa::pkcs8::der::Result> { any.sequence(|decoder| { let hash_algorithm = decoder .context_specific::( diff --git a/ext/node/ops/crypto/mod.rs b/ext/node/ops/crypto/mod.rs index 83afd88bb..44c9af5a9 100644 --- a/ext/node/ops/crypto/mod.rs +++ b/ext/node/ops/crypto/mod.rs @@ -275,7 +275,7 @@ pub fn op_node_cipheriv_final( .map_err(cipher::CipherContextError::Resource)?; let context = Rc::try_unwrap(context) .map_err(|_| cipher::CipherContextError::ContextInUse)?; - context.r#final(auto_pad, input, output).map_err(Into::into) + context.r#final(auto_pad, input, output) } #[op2] @@ -363,9 +363,7 @@ pub fn op_node_decipheriv_final( .map_err(cipher::DecipherContextError::Resource)?; let context = Rc::try_unwrap(context) .map_err(|_| cipher::DecipherContextError::ContextInUse)?; - context - .r#final(auto_pad, input, output, auth_tag) - .map_err(Into::into) + context.r#final(auto_pad, input, output, auth_tag) } #[op2] diff --git a/ext/node/ops/http.rs b/ext/node/ops/http.rs index f4adb9406..82a97b154 100644 --- a/ext/node/ops/http.rs +++ b/ext/node/ops/http.rs @@ -51,6 +51,7 @@ use tokio::io::AsyncWriteExt; #[op2(stack_trace)] #[serde] +#[allow(clippy::result_large_err)] // FetchError is owned by the vendored Deno fetch API. pub fn op_node_http_request

( state: &mut OpState, #[serde] method: ByteString, @@ -351,7 +352,7 @@ impl UpgradeStream { } impl Resource for UpgradeStream { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "fetchUpgradedStream".into() } @@ -408,7 +409,7 @@ impl NodeHttpFetchResponseResource { } impl Resource for NodeHttpFetchResponseResource { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "fetchResponse".into() } @@ -425,12 +426,12 @@ impl Resource for NodeHttpFetchResponseResource { match std::mem::take(&mut *reader) { NodeHttpFetchResponseReader::Start(resp) => { - let stream: BytesStream = - Box::pin(resp.into_body().into_data_stream().map(|r| { - r.map_err(|err| { - std::io::Error::new(std::io::ErrorKind::Other, err) - }) - })); + let stream: BytesStream = Box::pin( + resp + .into_body() + .into_data_stream() + .map(|r| r.map_err(std::io::Error::other)), + ); *reader = NodeHttpFetchResponseReader::BodyReader(stream.peekable()); } @@ -464,7 +465,7 @@ impl Resource for NodeHttpFetchResponseResource { }; let cancel_handle = RcRef::map(self, |r| &r.cancel); - fut.try_or_cancel(cancel_handle).await.map_err(Into::into) + fut.try_or_cancel(cancel_handle).await }) } diff --git a/ext/node/ops/http2.rs b/ext/node/ops/http2.rs index 53dada9f4..bbd0ecb51 100644 --- a/ext/node/ops/http2.rs +++ b/ext/node/ops/http2.rs @@ -40,7 +40,7 @@ pub struct Http2Client { } impl Resource for Http2Client { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "http2Client".into() } } @@ -52,7 +52,7 @@ pub struct Http2ClientConn { } impl Resource for Http2ClientConn { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "http2ClientConnection".into() } @@ -68,7 +68,7 @@ pub struct Http2ClientStream { } impl Resource for Http2ClientStream { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "http2ClientStream".into() } } @@ -83,7 +83,7 @@ pub struct Http2ClientResponseBody { } impl Resource for Http2ClientResponseBody { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "http2ClientResponseBody".into() } } @@ -94,7 +94,7 @@ pub struct Http2ServerConnection { } impl Resource for Http2ServerConnection { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "http2ServerConnection".into() } } @@ -104,7 +104,7 @@ pub struct Http2ServerSendResponse { } impl Resource for Http2ServerSendResponse { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "http2ServerSendResponse".into() } } diff --git a/ext/node/ops/os/cpus.rs b/ext/node/ops/os/cpus.rs index 3f5f430f6..452ebe8d3 100644 --- a/ext/node/ops/os/cpus.rs +++ b/ext/node/ops/os/cpus.rs @@ -26,6 +26,7 @@ impl CpuInfo { } #[cfg(target_os = "macos")] +#[allow(deprecated)] // libc remains the source of the Mach types used below. pub fn cpu_info() -> Option> { let mut model: [u8; 512] = [0; 512]; let mut size = std::mem::size_of_val(&model); @@ -36,14 +37,14 @@ pub fn cpu_info() -> Option> { let ticks = libc::sysconf(libc::_SC_CLK_TCK); let multiplier = 1000u64 / ticks as u64; if libc::sysctlbyname( - "machdep.cpu.brand_string\0".as_ptr() as *const libc::c_char, + c"machdep.cpu.brand_string".as_ptr(), model.as_mut_ptr() as _, &mut size, std::ptr::null_mut(), 0, ) != 0 && libc::sysctlbyname( - "hw.model\0".as_ptr() as *const libc::c_char, + c"hw.model".as_ptr(), model.as_mut_ptr() as _, &mut size, std::ptr::null_mut(), @@ -57,7 +58,7 @@ pub fn cpu_info() -> Option> { let mut cpu_speed_size = std::mem::size_of_val(&cpu_speed); libc::sysctlbyname( - "hw.cpufrequency\0".as_ptr() as *const libc::c_char, + c"hw.cpufrequency".as_ptr(), &mut cpu_speed as *mut _ as *mut libc::c_void, &mut cpu_speed_size, std::ptr::null_mut(), diff --git a/ext/node/ops/vm.rs b/ext/node/ops/vm.rs index f9dd4ab0c..d1ed61211 100644 --- a/ext/node/ops/vm.rs +++ b/ext/node/ops/vm.rs @@ -499,7 +499,10 @@ pub fn init_global_template<'a>( let maybe_object_template_slot = scope.get_slot::(); - if maybe_object_template_slot.is_none() { + if let Some(object_template_slot) = maybe_object_template_slot { + let object_template_slot = object_template_slot.clone(); + v8::Local::new(scope, object_template_slot.0) + } else { let global_object_template = init_global_template_inner(scope); if mode == ContextInitMode::UseSnapshot { @@ -509,11 +512,6 @@ pub fn init_global_template<'a>( scope.set_slot(contextify_global_template_slot); } global_object_template - } else { - let object_template_slot = maybe_object_template_slot - .expect("ContextifyGlobalTemplate slot should be already populated.") - .clone(); - v8::Local::new(scope, object_template_slot.0) } } diff --git a/ext/node/ops/zlib/mod.rs b/ext/node/ops/zlib/mod.rs index 991c0925d..ec2929a19 100644 --- a/ext/node/ops/zlib/mod.rs +++ b/ext/node/ops/zlib/mod.rs @@ -237,7 +237,7 @@ struct Zlib { impl deno_core::GarbageCollected for Zlib {} impl deno_core::Resource for Zlib { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "zlib".into() } } diff --git a/ext/node/polyfill.rs b/ext/node/polyfill.rs index 49eccc0a0..79d75f703 100644 --- a/ext/node/polyfill.rs +++ b/ext/node/polyfill.rs @@ -2,9 +2,7 @@ /// e.g. `is_builtin_node_module("assert")` pub fn is_builtin_node_module(module_name: &str) -> bool { - SUPPORTED_BUILTIN_NODE_MODULES - .iter() - .any(|m| *m == module_name) + SUPPORTED_BUILTIN_NODE_MODULES.contains(&module_name) } macro_rules! generate_builtin_node_module_lists { diff --git a/ext/runtime/conn_sync.rs b/ext/runtime/conn_sync.rs index 3d9bb7042..f4f5e9432 100644 --- a/ext/runtime/conn_sync.rs +++ b/ext/runtime/conn_sync.rs @@ -19,7 +19,7 @@ pub struct ConnWatcher(pub Option, pub Arc); // } impl Resource for ConnWatcher { - fn name(&self) -> std::borrow::Cow { + fn name(&self) -> std::borrow::Cow<'_, str> { "connWatcher".into() } } diff --git a/ext/runtime/external_memory.rs b/ext/runtime/external_memory.rs index 53fdb55b9..badaab1fb 100644 --- a/ext/runtime/external_memory.rs +++ b/ext/runtime/external_memory.rs @@ -99,7 +99,7 @@ unsafe extern "C" fn free( allocator.count.fetch_sub(n, Ordering::SeqCst); allocator.wake(); - let _ = Box::from_raw(std::slice::from_raw_parts_mut(data as *mut u8, n)); + let _ = Box::from_raw(std::ptr::slice_from_raw_parts_mut(data as *mut u8, n)); } #[allow(clippy::unnecessary_cast)] @@ -123,7 +123,7 @@ unsafe extern "C" fn reallocate( } let old_store = - Box::from_raw(std::slice::from_raw_parts_mut(prev as *mut u8, oldlen)); + Box::from_raw(std::ptr::slice_from_raw_parts_mut(prev as *mut u8, oldlen)); let mut new_store = Vec::with_capacity(newlen); let copy_len = oldlen.min(newlen); diff --git a/ext/runtime/ops/http.rs b/ext/runtime/ops/http.rs index 01617af58..bd3ecb12b 100644 --- a/ext/runtime/ops/http.rs +++ b/ext/runtime/ops/http.rs @@ -400,7 +400,7 @@ struct HttpUpgradeRawResponseResource { } impl Resource for HttpUpgradeRawResponseResource { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "httpUpgradeRawResponseResource".into() } } @@ -426,7 +426,7 @@ struct HttpUpgradeRawResponseFenceResource( ); impl Resource for HttpUpgradeRawResponseFenceResource { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "httpUpgradeRawResponseFenceResource".into() } } diff --git a/ext/runtime/ops/net.rs b/ext/runtime/ops/net.rs index 1e01d4d2b..3e4e1ee66 100644 --- a/ext/runtime/ops/net.rs +++ b/ext/runtime/ops/net.rs @@ -87,7 +87,7 @@ impl Resource for TokioDuplexResource { deno_core::impl_readable_byob!(); deno_core::impl_writable!(); - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "tokioDuplexStream".into() } diff --git a/ext/runtime/upgrade.rs b/ext/runtime/upgrade.rs index 06a69d6d8..ba2b96ca6 100644 --- a/ext/runtime/upgrade.rs +++ b/ext/runtime/upgrade.rs @@ -33,7 +33,7 @@ pub(crate) struct UpgradeStream { } impl Resource for UpgradeStream { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "httpRawUpgradeStream2".into() } diff --git a/ext/workers/context.rs b/ext/workers/context.rs index eb8aef83b..20d2b5c95 100644 --- a/ext/workers/context.rs +++ b/ext/workers/context.rs @@ -34,18 +34,13 @@ use tokio::sync::OwnedSemaphorePermit; use tokio_util::sync::CancellationToken; use uuid::Uuid; -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Default)] pub enum WorkerExitStatus { + #[default] Normal, WithUncaughtException(UncaughtExceptionEvent), } -impl Default for WorkerExitStatus { - fn default() -> Self { - Self::Normal - } -} - #[derive(Debug, Clone, Default)] pub struct WorkerExit(Arc>); @@ -175,6 +170,7 @@ pub struct EventWorkerRuntimeOpts { } #[derive(Debug, EnumAsInner)] +#[allow(clippy::large_enum_variant)] // Boxing would change the worker construction API. pub enum WorkerRuntimeOpts { UserWorker(UserWorkerRuntimeOpts), MainWorker(MainWorkerRuntimeOpts), @@ -278,6 +274,7 @@ pub struct WorkerContextInitOpts { } #[derive(Debug)] +#[allow(clippy::large_enum_variant)] // This is a low-frequency control channel; avoid API churn. pub enum UserWorkerMsgs { Create( WorkerContextInitOpts, diff --git a/ext/workers/lib.rs b/ext/workers/lib.rs index bf823ea84..f56a96061 100644 --- a/ext/workers/lib.rs +++ b/ext/workers/lib.rs @@ -346,7 +346,7 @@ pub struct UserWorkerResponse { struct UserWorkerRequestResource(Request); impl Resource for UserWorkerRequestResource { - fn name(&self) -> std::borrow::Cow { + fn name(&self) -> std::borrow::Cow<'_, str> { "userWorkerRequest".into() } } @@ -357,7 +357,7 @@ struct UserWorkerRequestBodyResource { } impl Resource for UserWorkerRequestBodyResource { - fn name(&self) -> std::borrow::Cow { + fn name(&self) -> std::borrow::Cow<'_, str> { "userWorkerRequestBody".into() } @@ -420,7 +420,7 @@ struct UserWorkerResponseBodyResource { } impl Resource for UserWorkerResponseBodyResource { - fn name(&self) -> std::borrow::Cow { + fn name(&self) -> std::borrow::Cow<'_, str> { "userWorkerResponseBody".into() } @@ -666,9 +666,8 @@ pub async fn op_user_worker_fetch_send( .to_string(); let size = HttpBody::size_hint(res.body()).exact(); - let stream: BytesStream = Box::pin(res.into_body().map(|r| { - r.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err)) - })); + let stream: BytesStream = + Box::pin(res.into_body().map(|r| r.map_err(std::io::Error::other))); let mut op_state = state.borrow_mut(); diff --git a/vendor/deno_fetch/lib.rs b/vendor/deno_fetch/lib.rs index 38e79cd2e..a7a14616b 100644 --- a/vendor/deno_fetch/lib.rs +++ b/vendor/deno_fetch/lib.rs @@ -722,7 +722,7 @@ pub struct FetchRequestResource { } impl Resource for FetchRequestResource { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "fetchRequest".into() } } @@ -730,7 +730,7 @@ impl Resource for FetchRequestResource { pub struct FetchCancelHandle(pub Rc); impl Resource for FetchCancelHandle { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "fetchCancelHandle".into() } @@ -779,7 +779,7 @@ impl FetchResponseResource { } impl Resource for FetchResponseResource { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "fetchResponse".into() } @@ -853,7 +853,7 @@ pub struct HttpClientResource { } impl Resource for HttpClientResource { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "httpClient".into() } } diff --git a/vendor/deno_http/http_next.rs b/vendor/deno_http/http_next.rs index 7dbac6021..270aff9f3 100644 --- a/vendor/deno_http/http_next.rs +++ b/vendor/deno_http/http_next.rs @@ -1034,7 +1034,7 @@ impl HttpJoinHandle { } impl Resource for HttpJoinHandle { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "http".into() } @@ -1362,7 +1362,7 @@ impl UpgradeStream { } impl Resource for UpgradeStream { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "httpRawUpgradeStream".into() } diff --git a/vendor/deno_http/lib.rs b/vendor/deno_http/lib.rs index 39b0bbc2a..8115730f0 100644 --- a/vendor/deno_http/lib.rs +++ b/vendor/deno_http/lib.rs @@ -327,7 +327,7 @@ impl HttpConnResource { } impl Resource for HttpConnResource { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "httpConn".into() } @@ -443,7 +443,7 @@ impl HttpStreamReadResource { } impl Resource for HttpStreamReadResource { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "httpReadStream".into() } @@ -522,7 +522,7 @@ impl HttpStreamWriteResource { } impl Resource for HttpStreamWriteResource { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "httpWriteStream".into() } } diff --git a/vendor/deno_http/request_body.rs b/vendor/deno_http/request_body.rs index f1c3f358e..6ca155fdb 100644 --- a/vendor/deno_http/request_body.rs +++ b/vendor/deno_http/request_body.rs @@ -77,7 +77,7 @@ impl HttpRequestBody { } impl Resource for HttpRequestBody { - fn name(&self) -> Cow { + fn name(&self) -> Cow<'_, str> { "requestBody".into() } diff --git a/vendor/deno_telemetry/lib.rs b/vendor/deno_telemetry/lib.rs index fce620bef..9040b5719 100644 --- a/vendor/deno_telemetry/lib.rs +++ b/vendor/deno_telemetry/lib.rs @@ -1,6 +1,7 @@ // Copyright 2018-2025 the Deno authors. MIT license. #![allow(clippy::too_many_arguments)] +#![allow(unexpected_cfgs)] // OpenTelemetry macros inspect private features from their defining crate. use std::borrow::Cow; use std::cell::RefCell; From feff12928ac0917864e55bd533c4d8c20da643e9 Mon Sep 17 00:00:00 2001 From: Satya Rohith Date: Wed, 12 Aug 2026 14:44:55 +0530 Subject: [PATCH 3/3] fix: restore Linux CPU timer compilation --- crates/cpu_timer/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/cpu_timer/src/lib.rs b/crates/cpu_timer/src/lib.rs index 8717acfd3..8d73b9443 100644 --- a/crates/cpu_timer/src/lib.rs +++ b/crates/cpu_timer/src/lib.rs @@ -1,7 +1,11 @@ +#![cfg_attr(target_os = "linux", allow(unexpected_cfgs))] + pub mod timerid; #[cfg(target_os = "linux")] use std::sync::Arc; +#[cfg(target_os = "linux")] +use tokio::sync::Mutex; use anyhow::Error; use tokio::sync::mpsc; @@ -130,7 +134,9 @@ impl CPUTimer { } pub async fn set_channel(&self) -> mpsc::UnboundedReceiver<()> { - let (_tx, rx) = mpsc::unbounded_channel(); + let (tx, rx) = mpsc::unbounded_channel(); + #[cfg(not(target_os = "linux"))] + let _ = tx; #[cfg(target_os = "linux")] { let mut val = self.cpu_alarm_val.cpu_alarms_tx.lock().await;