diff options
author | Matthew Maurer <mmaurer@google.com> | 2022-02-01 21:55:13 +0000 |
---|---|---|
committer | Matthew Maurer <mmaurer@google.com> | 2022-02-02 00:07:08 +0000 |
commit | 8d391ba93895414f1f5d54f7e43db11aa7eb2445 (patch) | |
tree | 0786bd6ff655f3377eefa44ff6802b3a86f3e378 /src | |
parent | 0b4b3a11bb9377b6e639356a1910bcc7d0d69dbb (diff) | |
download | uwb-8d391ba93895414f1f5d54f7e43db11aa7eb2445.tar.gz |
[lints] Remove or tag unused variables
Also caught issue where `env` was being recomputed rather than used from
parameters.
Bug: 217415765
Test: build
Change-Id: I6d2d53b0d6f3b426bbc0c42246639e58eb08e1a7
Diffstat (limited to 'src')
-rw-r--r-- | src/rust/adaptation/mod.rs | 4 | ||||
-rw-r--r-- | src/rust/event_manager/mod.rs | 3 | ||||
-rw-r--r-- | src/rust/uci/mod.rs | 34 | ||||
-rw-r--r-- | src/rust/uci/uci_hmsgs.rs | 3 |
4 files changed, 15 insertions, 29 deletions
diff --git a/src/rust/adaptation/mod.rs b/src/rust/adaptation/mod.rs index a329e96..1d1bde8 100644 --- a/src/rust/adaptation/mod.rs +++ b/src/rust/adaptation/mod.rs @@ -105,7 +105,7 @@ impl UwbAdaptationImpl { #[async_trait] impl UwbAdaptation for UwbAdaptationImpl { - async fn finalize(&mut self, exit_status: bool) {} + async fn finalize(&mut self, _exit_status: bool) {} async fn hal_open(&self) { let m_cback = BnUwbClientCallback::new_async_binder( @@ -150,7 +150,7 @@ impl MockUwbAdaptation { #[cfg(test)] #[async_trait] impl UwbAdaptation for MockUwbAdaptation { - async fn finalize(&mut self, exit_status: bool) {} + async fn finalize(&mut self, _exit_status: bool) {} async fn hal_open(&self) {} async fn hal_close(&self) {} async fn core_initialization(&self) -> Result<(), UwbErr> { diff --git a/src/rust/event_manager/mod.rs b/src/rust/event_manager/mod.rs index bad9136..e0120f9 100644 --- a/src/rust/event_manager/mod.rs +++ b/src/rust/event_manager/mod.rs @@ -580,7 +580,6 @@ impl EventManagerImpl { env: &JNIEnv, data: SessionUpdateControllerMulticastListNtfPacket, ) -> Result<()> { - let env = self.jvm.attach_current_thread()?; let uwb_multicast_update_class = self.find_class(&env, &MULTICAST_LIST_UPDATE_STATUS_CLASS)?; @@ -639,8 +638,6 @@ impl EventManagerImpl { oid: u32, payload: Vec<u8>, ) -> Result<()> { - let env = self.jvm.attach_current_thread()?; - let gid: i32 = gid.try_into().expect("Failed to convert gid"); let oid: i32 = oid.try_into().expect("Failed to convert gid"); let payload_jbytearray = env.byte_array_from_slice(payload.as_ref())?; diff --git a/src/rust/uci/mod.rs b/src/rust/uci/mod.rs index 55b466f..57abc81 100644 --- a/src/rust/uci/mod.rs +++ b/src/rust/uci/mod.rs @@ -68,6 +68,7 @@ pub enum JNICommand { UciSetAppConfig { session_id: u32, no_of_params: u32, + // TODO this field should be removed, in tandem with a change to the Uwb APEX app_config_param_len: u32, app_configs: Vec<u8>, }, @@ -267,27 +268,16 @@ impl<T: EventManager> Driver<T> { JNICommand::UciSetCountryCode { ref code } => { uci_hmsgs::build_set_country_code_cmd(code).build().to_vec() } - JNICommand::UciSetAppConfig { - session_id, - no_of_params, - app_config_param_len, - ref app_configs, - } => uci_hmsgs::build_set_app_config_cmd( - session_id, - no_of_params, - app_config_param_len, - app_configs, - )? - .build() - .to_vec(), - JNICommand::UciGetAppConfig { - session_id, - no_of_params, - app_config_param_len, - ref app_configs, - } => SessionGetAppConfigCmdBuilder { session_id, app_cfg: app_configs.to_vec() } - .build() - .to_vec(), + JNICommand::UciSetAppConfig { session_id, no_of_params, ref app_configs, .. } => { + uci_hmsgs::build_set_app_config_cmd(session_id, no_of_params, app_configs)? + .build() + .to_vec() + } + JNICommand::UciGetAppConfig { session_id, ref app_configs, .. } => { + SessionGetAppConfigCmdBuilder { session_id, app_cfg: app_configs.to_vec() } + .build() + .to_vec() + } JNICommand::UciRawVendorCmd { gid, oid, payload } => { uci_hmsgs::build_uci_vendor_cmd_packet(gid, oid, payload)?.to_vec() } @@ -315,7 +305,7 @@ impl<T: EventManager> Driver<T> { .unwrap_or_else(|e| error!("Error invoking core init HAL API : {:?}", e)); self.set_state(UwbState::W4HalOpen); } - JNICommand::Disable(graceful) => { + JNICommand::Disable(_graceful) => { self.adaptation.hal_close().await; self.set_state(UwbState::W4HalClose); } diff --git a/src/rust/uci/uci_hmsgs.rs b/src/rust/uci/uci_hmsgs.rs index 0bbd56a..218ce2e 100644 --- a/src/rust/uci/uci_hmsgs.rs +++ b/src/rust/uci/uci_hmsgs.rs @@ -56,11 +56,10 @@ pub fn build_multicast_list_update_cmd( pub fn build_set_app_config_cmd( session_id: u32, no_of_params: u32, - app_config_param_len: u32, mut app_configs: &[u8], ) -> Result<SessionSetAppConfigCmdBuilder, UwbErr> { let mut tlvs = Vec::new(); - for i in 0..no_of_params { + for _ in 0..no_of_params { let tlv = AppConfigTlv::parse(app_configs)?; app_configs = &app_configs[tlv.v.len() + 2..]; tlvs.push(tlv); |