diff options
author | Brian Cully <bjc@kublai.com> | 2019-09-26 08:55:24 -0400 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2019-09-26 08:55:24 -0400 |
commit | dac87373a4193d17d288edd38224e73fbc2c517e (patch) | |
tree | 016b7d9864aba3bbc774f924c7deac0d75e212d9 /src/lib.rs | |
parent | a546201a869c7103eab3b6870b3340ea73389740 (diff) | |
download | bootkbd-dac87373a4193d17d288edd38224e73fbc2c517e.tar.gz bootkbd-dac87373a4193d17d288edd38224e73fbc2c517e.zip |
Rename some variables to make their associations more clear.
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -190,7 +190,7 @@ impl Device { DeviceState::GetConfig => { let mut conf_desc: MaybeUninit<ConfigurationDescriptor> = 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::<ConfigurationDescriptor>()); 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) = |