diff --git a/.bazelrc b/.bazelrc index 31a536423..d843dc43b 100644 --- a/.bazelrc +++ b/.bazelrc @@ -45,7 +45,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 +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 build --@rules_rust//:clippy.toml=//:clippy.toml test --@rules_rust//:rustfmt.toml=//:.rustfmt.toml diff --git a/nativelink-error/src/lib.rs b/nativelink-error/src/lib.rs index 4e36d82c3..b87782c32 100644 --- a/nativelink-error/src/lib.rs +++ b/nativelink-error/src/lib.rs @@ -76,8 +76,8 @@ impl Error { #[inline] #[must_use] - pub fn append(mut self, msg: S) -> Self { - self.messages.push(msg.to_string()); + pub fn append>(mut self, msg: S) -> Self { + self.messages.push(msg.into()); self } diff --git a/nativelink-scheduler/src/default_scheduler_factory.rs b/nativelink-scheduler/src/default_scheduler_factory.rs index acb182938..daa110469 100644 --- a/nativelink-scheduler/src/default_scheduler_factory.rs +++ b/nativelink-scheduler/src/default_scheduler_factory.rs @@ -99,7 +99,7 @@ fn simple_scheduler_factory( let task_change_notify = Arc::new(Notify::new()); let awaited_action_db = memory_awaited_action_db_factory( config.retain_completed_for_s, - task_change_notify.clone(), + &task_change_notify.clone(), SystemTime::now, ); let (action_scheduler, worker_scheduler) = @@ -141,7 +141,7 @@ fn simple_scheduler_factory( pub fn memory_awaited_action_db_factory( mut retain_completed_for_s: u32, - task_change_notify: Arc, + task_change_notify: &Arc, now_fn: NowFn, ) -> MemoryAwaitedActionDb where diff --git a/nativelink-scheduler/src/memory_awaited_action_db.rs b/nativelink-scheduler/src/memory_awaited_action_db.rs index 32f017baf..8d44b47a3 100644 --- a/nativelink-scheduler/src/memory_awaited_action_db.rs +++ b/nativelink-scheduler/src/memory_awaited_action_db.rs @@ -251,7 +251,7 @@ impl SortedAwaitedActions { fn insert_sort_map_for_stage( &mut self, stage: &ActionStage, - sorted_awaited_action: SortedAwaitedAction, + sorted_awaited_action: &SortedAwaitedAction, ) -> Result<(), Error> { let newly_inserted = match stage { ActionStage::Unknown => self.unknown.insert(sorted_awaited_action.clone()), @@ -294,7 +294,7 @@ impl SortedAwaitedActions { )); }; - self.insert_sort_map_for_stage(&new_awaited_action.state().stage, sorted_awaited_action) + self.insert_sort_map_for_stage(&new_awaited_action.state().stage, &sorted_awaited_action) .err_tip(|| "In AwaitedActionDb::update_awaited_action")?; Ok(()) } @@ -655,7 +655,7 @@ impl I + Clone + Send + Sync> AwaitedActionDbI /// cleanup of the other maps on drop. fn make_client_awaited_action( &mut self, - operation_id: OperationId, + operation_id: &OperationId, awaited_action: AwaitedAction, ) -> (Arc, watch::Receiver) { let (tx, rx) = watch::channel(awaited_action); @@ -704,7 +704,7 @@ impl I + Clone + Send + Sync> AwaitedActionDbI let sort_key = awaited_action.sort_key(); let (client_awaited_action, rx) = - self.make_client_awaited_action(operation_id.clone(), awaited_action); + self.make_client_awaited_action(&operation_id.clone(), awaited_action); event!( Level::DEBUG, @@ -736,7 +736,7 @@ impl I + Clone + Send + Sync> AwaitedActionDbI self.sorted_action_info_hash_keys .insert_sort_map_for_stage( &ActionStage::Queued, - SortedAwaitedAction { + &SortedAwaitedAction { sort_key, operation_id, }, diff --git a/nativelink-scheduler/src/store_awaited_action_db.rs b/nativelink-scheduler/src/store_awaited_action_db.rs index 95591f867..2c7b53883 100644 --- a/nativelink-scheduler/src/store_awaited_action_db.rs +++ b/nativelink-scheduler/src/store_awaited_action_db.rs @@ -133,8 +133,8 @@ impl AwaitedActionSubscriber for OperationSubscriber { } } -fn awaited_action_decode(version: u64, data: Bytes) -> Result { - let mut awaited_action: AwaitedAction = serde_json::from_slice(&data) +fn awaited_action_decode(version: u64, data: &Bytes) -> Result { + let mut awaited_action: AwaitedAction = serde_json::from_slice(data) .map_err(|e| make_input_err!("In AwaitedAction::decode - {e:?}"))?; awaited_action.set_version(version); Ok(awaited_action) @@ -165,7 +165,7 @@ impl SchedulerStoreKeyProvider for OperationIdToAwaitedAction<'_> { impl SchedulerStoreDecodeTo for OperationIdToAwaitedAction<'_> { type DecodeOutput = AwaitedAction; fn decode(version: u64, data: Bytes) -> Result { - awaited_action_decode(version, data) + awaited_action_decode(version, &data) } } @@ -200,7 +200,7 @@ impl SchedulerIndexProvider for SearchUniqueQualifierToAwaitedAction<'_> { impl SchedulerStoreDecodeTo for SearchUniqueQualifierToAwaitedAction<'_> { type DecodeOutput = AwaitedAction; fn decode(version: u64, data: Bytes) -> Result { - awaited_action_decode(version, data) + awaited_action_decode(version, &data) } } @@ -216,7 +216,7 @@ impl SchedulerIndexProvider for SearchSortKeyPrefixToAwaitedAction { impl SchedulerStoreDecodeTo for SearchSortKeyPrefixToAwaitedAction { type DecodeOutput = AwaitedAction; fn decode(version: u64, data: Bytes) -> Result { - awaited_action_decode(version, data) + awaited_action_decode(version, &data) } } diff --git a/nativelink-scheduler/tests/simple_scheduler_test.rs b/nativelink-scheduler/tests/simple_scheduler_test.rs index acac8a50f..fc7c75912 100644 --- a/nativelink-scheduler/tests/simple_scheduler_test.rs +++ b/nativelink-scheduler/tests/simple_scheduler_test.rs @@ -163,7 +163,7 @@ async fn basic_add_action_with_one_worker_test() -> Result<(), Error> { &nativelink_config::schedulers::SimpleScheduler::default(), memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -225,7 +225,7 @@ async fn client_does_not_receive_update_timeout() -> Result<(), Error> { }, memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -294,7 +294,7 @@ async fn find_executing_action() -> Result<(), Error> { &nativelink_config::schedulers::SimpleScheduler::default(), memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -374,7 +374,7 @@ async fn remove_worker_reschedules_multiple_running_job_test() -> Result<(), Err }, memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -549,7 +549,7 @@ async fn set_drain_worker_pauses_and_resumes_worker_test() -> Result<(), Error> &nativelink_config::schedulers::SimpleScheduler::default(), memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -636,7 +636,7 @@ async fn worker_should_not_queue_if_properties_dont_match_test() -> Result<(), E }, memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -727,7 +727,7 @@ async fn cacheable_items_join_same_action_queued_test() -> Result<(), Error> { &nativelink_config::schedulers::SimpleScheduler::default(), memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -828,7 +828,7 @@ async fn worker_disconnects_does_not_schedule_for_execution_test() -> Result<(), &nativelink_config::schedulers::SimpleScheduler::default(), memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -1087,7 +1087,7 @@ async fn worker_timesout_reschedules_running_job_test() -> Result<(), Error> { }, memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -1209,7 +1209,7 @@ async fn update_action_sends_completed_result_to_client_test() -> Result<(), Err &nativelink_config::schedulers::SimpleScheduler::default(), memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -1310,7 +1310,7 @@ async fn update_action_sends_completed_result_after_disconnect() -> Result<(), E &nativelink_config::schedulers::SimpleScheduler::default(), memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -1428,7 +1428,7 @@ async fn update_action_with_wrong_worker_id_errors_test() -> Result<(), Error> { &nativelink_config::schedulers::SimpleScheduler::default(), memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -1526,7 +1526,7 @@ async fn does_not_crash_if_operation_joined_then_relaunched() -> Result<(), Erro &nativelink_config::schedulers::SimpleScheduler::default(), memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -1669,7 +1669,7 @@ async fn run_two_jobs_on_same_worker_with_platform_properties_restrictions() -> }, memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -1831,7 +1831,7 @@ async fn run_jobs_in_the_order_they_were_queued() -> Result<(), Error> { }, memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -1898,7 +1898,7 @@ async fn worker_retries_on_internal_error_and_fails_test() -> Result<(), Error> }, memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -2047,7 +2047,7 @@ async fn ensure_scheduler_drops_inner_spawn() -> Result<(), Error> { &nativelink_config::schedulers::SimpleScheduler::default(), memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), move || { @@ -2080,7 +2080,7 @@ async fn ensure_task_or_worker_change_notification_received_test() -> Result<(), &nativelink_config::schedulers::SimpleScheduler::default(), memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, @@ -2155,7 +2155,7 @@ async fn client_reconnect_keeps_action_alive() -> Result<(), Error> { }, memory_awaited_action_db_factory( 0, - task_change_notify.clone(), + &task_change_notify.clone(), MockInstantWrapped::default, ), || async move {}, diff --git a/nativelink-service/src/execution_server.rs b/nativelink-service/src/execution_server.rs index 677d68c4c..96ca5457c 100644 --- a/nativelink-service/src/execution_server.rs +++ b/nativelink-service/src/execution_server.rs @@ -197,7 +197,7 @@ impl ExecutionServer { } fn to_execute_stream( - nl_client_operation_id: NativelinkOperationId, + nl_client_operation_id: &NativelinkOperationId, action_listener: Box, ) -> Response { let client_operation_id = OperationId::from(nl_client_operation_id.to_string()); @@ -277,7 +277,7 @@ impl ExecutionServer { .err_tip(|| "Failed to schedule task")?; Ok(Self::to_execute_stream( - NativelinkOperationId::new( + &NativelinkOperationId::new( instance_name, action_listener .as_state() @@ -315,7 +315,7 @@ impl ExecutionServer { else { return Err(Status::not_found("Failed to find existing task")); }; - Ok(Self::to_execute_stream(nl_operation_id, rx)) + Ok(Self::to_execute_stream(&nl_operation_id, rx)) } } diff --git a/nativelink-store/src/compression_store.rs b/nativelink-store/src/compression_store.rs index 7f7c259fb..753fdf99c 100644 --- a/nativelink-store/src/compression_store.rs +++ b/nativelink-store/src/compression_store.rs @@ -220,7 +220,7 @@ pub struct CompressionStore { impl CompressionStore { pub fn new( - compression_config: nativelink_config::stores::CompressionStore, + compression_config: &nativelink_config::stores::CompressionStore, inner_store: Store, ) -> Result, Error> { let lz4_config = match compression_config.compression_algorithm { diff --git a/nativelink-store/src/default_store_factory.rs b/nativelink-store/src/default_store_factory.rs index 4d89a675f..60a5b1c31 100644 --- a/nativelink-store/src/default_store_factory.rs +++ b/nativelink-store/src/default_store_factory.rs @@ -59,7 +59,7 @@ pub fn store_factory<'a>( store_factory(&config.backend, store_manager, None).await?, ), StoreConfig::compression(config) => CompressionStore::new( - *config.clone(), + &config.clone(), store_factory(&config.backend, store_manager, None).await?, )?, StoreConfig::dedup(config) => DedupStore::new( diff --git a/nativelink-store/src/s3_store.rs b/nativelink-store/src/s3_store.rs index f40a1a4df..8622d1b0e 100644 --- a/nativelink-store/src/s3_store.rs +++ b/nativelink-store/src/s3_store.rs @@ -324,7 +324,7 @@ where })) } - fn make_s3_path(&self, key: StoreKey<'_>) -> String { + fn make_s3_path(&self, key: &StoreKey<'_>) -> String { format!("{}{}", self.key_prefix, key.as_str(),) } @@ -335,7 +335,7 @@ where .s3_client .head_object() .bucket(&self.bucket) - .key(self.make_s3_path(digest.borrow())) + .key(self.make_s3_path(&digest.borrow())) .send() .await; @@ -412,7 +412,7 @@ where mut reader: DropCloserReadHalf, upload_size: UploadSizeInfo, ) -> Result<(), Error> { - let s3_path = &self.make_s3_path(digest.borrow()); + let s3_path = &self.make_s3_path(&digest.borrow()); let max_size = match upload_size { UploadSizeInfo::ExactSize(sz) | UploadSizeInfo::MaxSize(sz) => sz, @@ -687,7 +687,7 @@ where return Ok(()); } - let s3_path = &self.make_s3_path(key); + let s3_path = &self.make_s3_path(&key); let end_read_byte = length .map_or(Some(None), |length| Some(offset.checked_add(length))) .err_tip(|| "Integer overflow protection triggered")?; diff --git a/nativelink-store/tests/compression_store_test.rs b/nativelink-store/tests/compression_store_test.rs index 8742195c9..229d18a9a 100644 --- a/nativelink-store/tests/compression_store_test.rs +++ b/nativelink-store/tests/compression_store_test.rs @@ -71,7 +71,7 @@ const MEGABYTE_SZ: usize = 1024 * 1024; #[nativelink_test] async fn simple_smoke_test() -> Result<(), Error> { let store = CompressionStore::new( - nativelink_config::stores::CompressionStore { + &nativelink_config::stores::CompressionStore { backend: nativelink_config::stores::StoreConfig::memory( nativelink_config::stores::MemoryStore::default(), ), @@ -107,7 +107,7 @@ async fn simple_smoke_test() -> Result<(), Error> { #[nativelink_test] async fn partial_reads_test() -> Result<(), Error> { let store_owned = CompressionStore::new( - nativelink_config::stores::CompressionStore { + &nativelink_config::stores::CompressionStore { backend: nativelink_config::stores::StoreConfig::memory( nativelink_config::stores::MemoryStore::default(), ), @@ -166,7 +166,7 @@ async fn partial_reads_test() -> Result<(), Error> { #[nativelink_test] async fn rand_5mb_smoke_test() -> Result<(), Error> { let store_owned = CompressionStore::new( - nativelink_config::stores::CompressionStore { + &nativelink_config::stores::CompressionStore { backend: nativelink_config::stores::StoreConfig::memory( nativelink_config::stores::MemoryStore::default(), ), @@ -203,7 +203,7 @@ async fn rand_5mb_smoke_test() -> Result<(), Error> { async fn sanity_check_zero_bytes_test() -> Result<(), Error> { let inner_store = MemoryStore::new(&nativelink_config::stores::MemoryStore::default()); let store_owned = CompressionStore::new( - nativelink_config::stores::CompressionStore { + &nativelink_config::stores::CompressionStore { backend: nativelink_config::stores::StoreConfig::memory( nativelink_config::stores::MemoryStore::default(), ), @@ -258,7 +258,7 @@ async fn check_header_test() -> Result<(), Error> { const MAX_SIZE_INPUT: u64 = 1024 * 1024; // 1MB. let inner_store = MemoryStore::new(&nativelink_config::stores::MemoryStore::default()); let store_owned = CompressionStore::new( - nativelink_config::stores::CompressionStore { + &nativelink_config::stores::CompressionStore { backend: nativelink_config::stores::StoreConfig::memory( nativelink_config::stores::MemoryStore::default(), ), @@ -345,7 +345,7 @@ async fn check_footer_test() -> Result<(), Error> { const BLOCK_SIZE: u32 = 32 * 1024; let inner_store = MemoryStore::new(&nativelink_config::stores::MemoryStore::default()); let store_owned = CompressionStore::new( - nativelink_config::stores::CompressionStore { + &nativelink_config::stores::CompressionStore { backend: nativelink_config::stores::StoreConfig::memory( nativelink_config::stores::MemoryStore::default(), ), @@ -492,7 +492,7 @@ async fn get_part_is_zero_digest() -> Result<(), Error> { const BLOCK_SIZE: u32 = 32 * 1024; let inner_store = MemoryStore::new(&nativelink_config::stores::MemoryStore::default()); let store_owned = CompressionStore::new( - nativelink_config::stores::CompressionStore { + &nativelink_config::stores::CompressionStore { backend: nativelink_config::stores::StoreConfig::memory( nativelink_config::stores::MemoryStore::default(), ), diff --git a/nativelink-util/src/health_utils.rs b/nativelink-util/src/health_utils.rs index 1f117bcda..80b29bea0 100644 --- a/nativelink-util/src/health_utils.rs +++ b/nativelink-util/src/health_utils.rs @@ -127,7 +127,7 @@ pub struct HealthRegistryBuilder { /// sub building scoped health registries and building the health registry. /// `build()` should be called once for finalizing the production of a health registry. impl HealthRegistryBuilder { - pub fn new(namespace: Cow<'static, str>) -> Self { + pub fn new(namespace: &str) -> Self { Self { namespace: format!("/{namespace}").into(), state: Arc::new(Mutex::new(HashMap::new())), @@ -141,7 +141,7 @@ impl HealthRegistryBuilder { } /// Create a sub builder for a namespace. - pub fn sub_builder(&mut self, namespace: Cow<'static, str>) -> HealthRegistryBuilder { + pub fn sub_builder(&mut self, namespace: &str) -> HealthRegistryBuilder { HealthRegistryBuilder { namespace: format!("{}/{}", self.namespace, namespace).into(), state: self.state.clone(), diff --git a/nativelink-util/tests/health_utils_test.rs b/nativelink-util/tests/health_utils_test.rs index 51da1bb75..4e3a0bfae 100644 --- a/nativelink-util/tests/health_utils_test.rs +++ b/nativelink-util/tests/health_utils_test.rs @@ -27,7 +27,7 @@ use pretty_assertions::assert_eq; #[nativelink_test] async fn create_empty_indicator() -> Result<(), Error> { - let mut health_registry_builder = HealthRegistryBuilder::new("nativelink".into()); + let mut health_registry_builder = HealthRegistryBuilder::new("nativelink"); let health_registry = health_registry_builder.build(); let health_status: Vec = health_registry.health_status_report().collect().await; @@ -39,7 +39,7 @@ async fn create_empty_indicator() -> Result<(), Error> { async fn create_register_indicator() -> Result<(), Error> { generate_health_status_indicator!(MockComponentImpl, Ok, "ok"); - let mut health_registry_builder = HealthRegistryBuilder::new("nativelink".into()); + let mut health_registry_builder = HealthRegistryBuilder::new("nativelink"); health_registry_builder.register_indicator(Arc::new(MockComponentImpl {})); @@ -66,11 +66,11 @@ async fn create_register_indicator() -> Result<(), Error> { async fn create_sub_registry() -> Result<(), Error> { generate_health_status_indicator!(MockComponentImpl, Ok, "ok"); - let mut health_registry_builder = HealthRegistryBuilder::new("nativelink".into()); + let mut health_registry_builder = HealthRegistryBuilder::new("nativelink"); health_registry_builder.register_indicator(Arc::new(MockComponentImpl {})); - let mut namespace1_registry = health_registry_builder.sub_builder("namespace1".into()); + let mut namespace1_registry = health_registry_builder.sub_builder("namespace1"); namespace1_registry.register_indicator(Arc::new(MockComponentImpl {})); @@ -107,7 +107,7 @@ async fn create_multiple_indicators_same_registry() -> Result<(), Error> { generate_health_status_indicator!(MockComponentImpl2, Ok, "ok"); generate_health_status_indicator!(MockComponentImpl3, Ok, "ok"); - let mut health_registry_builder = HealthRegistryBuilder::new("nativelink".into()); + let mut health_registry_builder = HealthRegistryBuilder::new("nativelink"); health_registry_builder.register_indicator(Arc::new(MockComponentImpl1 {})); health_registry_builder.register_indicator(Arc::new(MockComponentImpl2 {})); @@ -153,15 +153,15 @@ async fn create_multiple_indicators_with_sub_registry() -> Result<(), Error> { generate_health_status_indicator!(MockComponentImpl2, Ok, "ok"); generate_health_status_indicator!(MockComponentImpl3, Ok, "ok"); - let mut health_registry_builder = HealthRegistryBuilder::new("nativelink".into()); + let mut health_registry_builder = HealthRegistryBuilder::new("nativelink"); - let mut sub_builder = health_registry_builder.sub_builder("namespace1".into()); + let mut sub_builder = health_registry_builder.sub_builder("namespace1"); sub_builder.register_indicator(Arc::new(MockComponentImpl1 {})); - let mut sub_builder = health_registry_builder.sub_builder("namespace2".into()); + let mut sub_builder = health_registry_builder.sub_builder("namespace2"); sub_builder.register_indicator(Arc::new(MockComponentImpl2 {})); health_registry_builder - .sub_builder("namespace3".into()) + .sub_builder("namespace3") .register_indicator(Arc::new(MockComponentImpl3 {})); let health_registry = health_registry_builder.build(); diff --git a/src/bin/nativelink.rs b/src/bin/nativelink.rs index 12d84ccd1..f33225f2d 100644 --- a/src/bin/nativelink.rs +++ b/src/bin/nativelink.rs @@ -161,9 +161,8 @@ async fn inner_main( cfg: CasConfig, server_start_timestamp: u64, ) -> Result<(), Box> { - let health_registry_builder = Arc::new(AsyncMutex::new(HealthRegistryBuilder::new( - "nativelink".into(), - ))); + let health_registry_builder = + Arc::new(AsyncMutex::new(HealthRegistryBuilder::new("nativelink"))); let store_manager = Arc::new(StoreManager::new()); { @@ -172,7 +171,7 @@ async fn inner_main( for (name, store_cfg) in cfg.stores { let health_component_name = format!("stores/{name}"); let mut health_register_store = - health_registry_lock.sub_builder(health_component_name.into()); + health_registry_lock.sub_builder(&health_component_name); let store = store_factory(&store_cfg, &store_manager, Some(&mut health_register_store)) .await .err_tip(|| format!("Failed to create store '{name}'"))?;