From dac87373a4193d17d288edd38224e73fbc2c517e Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Thu, 26 Sep 2019 08:55:24 -0400 Subject: Rename some variables to make their associations more clear. --- src/lib.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 397d526..43e3f12 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -190,7 +190,7 @@ impl Device { DeviceState::GetConfig => { let mut conf_desc: MaybeUninit = MaybeUninit::uninit(); - let buf = unsafe { to_slice_mut(&mut conf_desc) }; + let desc_buf = unsafe { to_slice_mut(&mut conf_desc) }; let len = host.control_transfer( &mut self.ep0, RequestType::from(( @@ -201,7 +201,7 @@ impl Device { RequestCode::GetDescriptor, WValue::from((0, DescriptorType::Configuration as u8)), 0, - Some(buf), + Some(desc_buf), )?; assert!(len == mem::size_of::()); let conf_desc = unsafe { conf_desc.assume_init() }; @@ -214,8 +214,9 @@ impl Device { // TODO: do a real allocation later. For now, keep a // large-ish static buffer and take an appropriately // sized slice into it for the transfer. - let mut buf: [u8; CONFIG_BUFFER_LEN] = [0; CONFIG_BUFFER_LEN]; - let mut tmp = &mut buf[..conf_desc.w_total_length as usize]; + let mut config = + unsafe { MaybeUninit::<[u8; CONFIG_BUFFER_LEN]>::uninit().assume_init() }; + let config_buf = &mut config[..conf_desc.w_total_length as usize]; let len = host.control_transfer( &mut self.ep0, RequestType::from(( @@ -226,7 +227,7 @@ impl Device { RequestCode::GetDescriptor, WValue::from((0, DescriptorType::Configuration as u8)), 0, - Some(&mut tmp), + Some(config_buf), )?; assert!(len == conf_desc.w_total_length as usize); let (interface_num, ep) = -- cgit v1.2.3