diff --git a/.bazelrc b/.bazelrc index ced67a845..9314dcfe4 100644 --- a/.bazelrc +++ b/.bazelrc @@ -43,7 +43,7 @@ build --aspects=@rules_rust//rust:defs.bzl%rustfmt_aspect build --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect # TODO(aaronmondal): Extend these flags until we can run with clippy::pedantic. -build --@rules_rust//:clippy_flags=-Dwarnings,-Dclippy::uninlined_format_args,-Dclippy::manual_string_new,-Dclippy::manual_let_else,-Dclippy::single_match_else,-Dclippy::redundant_closure_for_method_calls,-Dclippy::semicolon_if_nothing_returned,-Dclippy::unreadable_literal,-Dclippy::range_plus_one,-Dclippy::inconsistent_struct_constructor,-Dclippy::match_wildcard_for_single_variants,-Dclippy::implicit_clone,-Dclippy::needless_pass_by_value,-Dclippy::explicit_deref_methods,-Dclippy::trivially_copy_pass_by_ref,-Dclippy::unnecessary_wraps,-Dclippy::cast_lossless,-Dclippy::map_unwrap_or,-Dclippy::ref_as_ptr,-Dclippy::inline_always,-Dclippy::redundant_else,-Dclippy::return_self_not_must_use,-Dclippy::match_same_arms,-Dclippy::explicit_iter_loop,-Dclippy::items_after_statements,-Dclippy::explicit_into_iter_loop,-Dclippy::stable_sort_primitive,-Dclippy::ptr_as_ptr,-Dclippy::needless_raw_string_hashes +build --@rules_rust//:clippy_flags=-Dwarnings,-Dclippy::uninlined_format_args,-Dclippy::manual_string_new,-Dclippy::manual_let_else,-Dclippy::single_match_else,-Dclippy::redundant_closure_for_method_calls,-Dclippy::semicolon_if_nothing_returned,-Dclippy::unreadable_literal,-Dclippy::range_plus_one,-Dclippy::inconsistent_struct_constructor,-Dclippy::match_wildcard_for_single_variants,-Dclippy::implicit_clone,-Dclippy::needless_pass_by_value,-Dclippy::explicit_deref_methods,-Dclippy::trivially_copy_pass_by_ref,-Dclippy::unnecessary_wraps,-Dclippy::cast_lossless,-Dclippy::map_unwrap_or,-Dclippy::ref_as_ptr,-Dclippy::inline_always,-Dclippy::redundant_else,-Dclippy::return_self_not_must_use,-Dclippy::match_same_arms,-Dclippy::explicit_iter_loop,-Dclippy::items_after_statements,-Dclippy::explicit_into_iter_loop,-Dclippy::stable_sort_primitive,-Dclippy::ptr_as_ptr,-Dclippy::needless_raw_string_hashes,-Dclippy::default_trait_access build --@rules_rust//:clippy.toml=//:clippy.toml test --@rules_rust//:rustfmt.toml=//:.rustfmt.toml diff --git a/nativelink-proto/gen_lib_rs_tool.py b/nativelink-proto/gen_lib_rs_tool.py index 4f04830ea..6e873aa20 100644 --- a/nativelink-proto/gen_lib_rs_tool.py +++ b/nativelink-proto/gen_lib_rs_tool.py @@ -36,6 +36,8 @@ // *** DO NOT MODIFY *** // This file is auto-generated. To update it, run: // `bazel run nativelink-proto:update_protos` + +#![allow(clippy::default_trait_access)] """ diff --git a/nativelink-proto/genproto/lib.rs b/nativelink-proto/genproto/lib.rs index ea03ec505..aec52340e 100644 --- a/nativelink-proto/genproto/lib.rs +++ b/nativelink-proto/genproto/lib.rs @@ -16,6 +16,8 @@ // This file is auto-generated. To update it, run: // `bazel run nativelink-proto:update_protos` +#![allow(clippy::default_trait_access)] + pub mod build { pub mod bazel { pub mod remote { diff --git a/nativelink-scheduler/src/cache_lookup_scheduler.rs b/nativelink-scheduler/src/cache_lookup_scheduler.rs index a2cd22ffd..64854bfb6 100644 --- a/nativelink-scheduler/src/cache_lookup_scheduler.rs +++ b/nativelink-scheduler/src/cache_lookup_scheduler.rs @@ -147,7 +147,7 @@ impl CacheLookupScheduler { Ok(Self { ac_store, action_scheduler, - inflight_cache_checks: Default::default(), + inflight_cache_checks: Arc::default(), }) } diff --git a/nativelink-service/tests/worker_api_server_test.rs b/nativelink-service/tests/worker_api_server_test.rs index 2a441d293..7c94d4924 100644 --- a/nativelink-service/tests/worker_api_server_test.rs +++ b/nativelink-service/tests/worker_api_server_test.rs @@ -18,6 +18,7 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH}; use async_lock::Mutex as AsyncMutex; use async_trait::async_trait; +use bytes::Bytes; use nativelink_config::cas_server::WorkerApiConfig; use nativelink_config::schedulers::WorkerAllocationStrategy; use nativelink_error::{Error, ResultExt}; @@ -428,7 +429,7 @@ pub async fn execution_response_success_test() -> Result<(), Box Result<(), Box Result<(), Box Result<(), Error> { const VALUE: &str = "123"; let spec = ExistenceCacheSpec { backend: StoreSpec::noop(NoopSpec::default()), // Note: Not used. - eviction_policy: Default::default(), + eviction_policy: Option::default(), }; let inner_store = Store::new(MemoryStore::new(&MemorySpec::default())); let store = ExistenceCacheStore::new(&spec, inner_store.clone()); @@ -72,7 +72,7 @@ async fn update_flags_existance_cache_test() -> Result<(), Error> { const VALUE: &str = "123"; let spec = ExistenceCacheSpec { backend: StoreSpec::noop(NoopSpec::default()), - eviction_policy: Default::default(), + eviction_policy: Option::default(), }; let inner_store = Store::new(MemoryStore::new(&MemorySpec::default())); let store = ExistenceCacheStore::new(&spec, inner_store.clone()); @@ -95,7 +95,7 @@ async fn get_part_caches_if_exact_size_set() -> Result<(), Error> { const VALUE: &str = "123"; let spec = ExistenceCacheSpec { backend: StoreSpec::noop(NoopSpec::default()), - eviction_policy: Default::default(), + eviction_policy: Option::default(), }; let inner_store = Store::new(MemoryStore::new(&MemorySpec::default())); let digest = DigestInfo::try_new(VALID_HASH1, 3).unwrap(); diff --git a/nativelink-util/src/action_messages.rs b/nativelink-util/src/action_messages.rs index 75c99e700..78e6a9a01 100644 --- a/nativelink-util/src/action_messages.rs +++ b/nativelink-util/src/action_messages.rs @@ -707,10 +707,10 @@ pub struct ActionResult { impl Default for ActionResult { fn default() -> Self { ActionResult { - output_files: Default::default(), - output_folders: Default::default(), - output_directory_symlinks: Default::default(), - output_file_symlinks: Default::default(), + output_files: Vec::default(), + output_folders: Vec::default(), + output_directory_symlinks: Vec::default(), + output_file_symlinks: Vec::default(), exit_code: INTERNAL_ERROR_EXIT_CODE, stdout_digest: DigestInfo::new([0u8; 32], 0), stderr_digest: DigestInfo::new([0u8; 32], 0), @@ -726,7 +726,7 @@ impl Default for ActionResult { output_upload_start_timestamp: SystemTime::UNIX_EPOCH, output_upload_completed_timestamp: SystemTime::UNIX_EPOCH, }, - server_logs: Default::default(), + server_logs: HashMap::default(), error: None, message: String::new(), } @@ -974,7 +974,7 @@ impl TryFrom for ActionResult { .execution_metadata .err_tip(|| "Expected execution_metadata to be set on ExecuteResponse msg")? .try_into()?, - server_logs: Default::default(), + server_logs: HashMap::default(), error: None, message: String::new(), }) diff --git a/nativelink-worker/tests/running_actions_manager_test.rs b/nativelink-worker/tests/running_actions_manager_test.rs index 60cfe9b69..b0b6c0062 100644 --- a/nativelink-worker/tests/running_actions_manager_test.rs +++ b/nativelink-worker/tests/running_actions_manager_test.rs @@ -40,6 +40,7 @@ use nativelink_proto::build::bazel::remote::execution::v2::{ use nativelink_proto::com::github::trace_machina::nativelink::remote_execution::{ HistoricalExecuteResponse, StartExecute, }; +use nativelink_proto::google::rpc::Status; use nativelink_store::ac_utils::{get_and_decode_digest, serialize_and_upload_message}; use nativelink_store::fast_slow_store::FastSlowStore; use nativelink_store::filesystem_store::FilesystemStore; @@ -2119,7 +2120,7 @@ async fn success_does_cache_in_historical_results() -> Result<(), Box Result<(), Box