From 8f571e16cb0775d7b9b187a703c513541cfe528a Mon Sep 17 00:00:00 2001 From: Chris Wailes Date: Tue, 27 Jul 2021 16:04:09 -0700 Subject: [PATCH] Fix warnings in preparation for Rust 1.54.0 This CL fixes several new warnings generated by rustc 1.54.0. Bug: 194812675 Test: m rust Change-Id: I5877371b85ca3c447dc1fe53986827266b1b79c8 --- profcollectd/libprofcollectd/config.rs | 8 ++++---- profcollectd/libprofcollectd/lib.rs | 4 ++-- profcollectd/libprofcollectd/report.rs | 2 +- profcollectd/libprofcollectd/service.rs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/profcollectd/libprofcollectd/config.rs b/profcollectd/libprofcollectd/config.rs index bc41e99e2a..d53599568a 100644 --- a/profcollectd/libprofcollectd/config.rs +++ b/profcollectd/libprofcollectd/config.rs @@ -88,10 +88,10 @@ impl FromStr for Config { } fn get_or_initialise_node_id() -> Result { - let mut node_id = get_property(&PROFCOLLECT_NODE_ID_PROPERTY, MacAddr6::nil())?; + let mut node_id = get_property(PROFCOLLECT_NODE_ID_PROPERTY, MacAddr6::nil())?; if node_id.is_nil() { node_id = generate_random_node_id(); - set_property(&PROFCOLLECT_NODE_ID_PROPERTY, node_id)?; + set_property(PROFCOLLECT_NODE_ID_PROPERTY, node_id)?; } Ok(node_id) @@ -108,8 +108,8 @@ where { let default_value = default_value.to_string(); let config = profcollect_libflags_rust::GetServerConfigurableFlag( - &PROFCOLLECT_CONFIG_NAMESPACE, - &key, + PROFCOLLECT_CONFIG_NAMESPACE, + key, &default_value, ); Ok(T::from_str(&config)?) diff --git a/profcollectd/libprofcollectd/lib.rs b/profcollectd/libprofcollectd/lib.rs index f417bd8ccf..d5eec68c28 100644 --- a/profcollectd/libprofcollectd/lib.rs +++ b/profcollectd/libprofcollectd/lib.rs @@ -42,7 +42,7 @@ pub fn init_service(schedule_now: bool) -> Result<()> { let profcollect_binder_service = ProfcollectdBinderService::new()?; binder::add_service( - &PROFCOLLECTD_SERVICE_NAME, + PROFCOLLECTD_SERVICE_NAME, BnProfCollectd::new_binder(profcollect_binder_service, BinderFeatures::default()) .as_binder(), ) @@ -58,7 +58,7 @@ pub fn init_service(schedule_now: bool) -> Result<()> { } fn get_profcollectd_service() -> Result> { - binder::get_interface(&PROFCOLLECTD_SERVICE_NAME) + binder::get_interface(PROFCOLLECTD_SERVICE_NAME) .context("Failed to get profcollectd binder service, is profcollectd running?") } diff --git a/profcollectd/libprofcollectd/report.rs b/profcollectd/libprofcollectd/report.rs index a67d500b9f..69dff0c668 100644 --- a/profcollectd/libprofcollectd/report.rs +++ b/profcollectd/libprofcollectd/report.rs @@ -79,7 +79,7 @@ fn get_report_filename(node_id: &MacAddr6) -> Result { let since_epoch = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH)?; let ts = Timestamp::from_unix(&*UUID_CONTEXT, since_epoch.as_secs(), since_epoch.subsec_nanos()); - let uuid = Uuid::new_v1(ts, &node_id.as_bytes())?; + let uuid = Uuid::new_v1(ts, node_id.as_bytes())?; Ok(uuid.to_string()) } diff --git a/profcollectd/libprofcollectd/service.rs b/profcollectd/libprofcollectd/service.rs index 04f30f89cd..021271f373 100644 --- a/profcollectd/libprofcollectd/service.rs +++ b/profcollectd/libprofcollectd/service.rs @@ -89,7 +89,7 @@ impl IProfCollectd for ProfcollectdBinderService { .map_err(err_to_binder_status) } fn delete_report(&self, report_name: &str) -> BinderResult<()> { - verify_report_name(&report_name).map_err(err_to_binder_status)?; + verify_report_name(report_name).map_err(err_to_binder_status)?; let mut report = PathBuf::from(&*REPORT_OUTPUT_DIR); report.push(report_name); @@ -101,7 +101,7 @@ impl IProfCollectd for ProfcollectdBinderService { if bb_profile_id < 0 { return Err(err_to_binder_status(anyhow!("Invalid profile ID"))); } - verify_report_name(&report_name).map_err(err_to_binder_status)?; + verify_report_name(report_name).map_err(err_to_binder_status)?; let mut report = PathBuf::from(&*REPORT_OUTPUT_DIR); report.push(report_name);