Bug 1413639: u2f-hid-rs: Remove unnecessary mut annotation. r?jcj
Fix a warning when building for windows targets.
Data here doesn't need to be mutable. The contents of the struct
are modified inside the unsafe block, and that's allowed because
libc::malloc() returns a *mut. But the value of the binding itself,
that is, the location in memory that data references, never changes.
MozReview-Commit-ID: 3l2IL5xXvjF
--- a/dom/webauthn/u2f-hid-rs/src/windows/winapi.rs
+++ b/dom/webauthn/u2f-hid-rs/src/windows/winapi.rs
@@ -190,17 +190,17 @@ impl DeviceInterfaceDetailData {
cb_size = 4 + 2; // 4-byte uint + default TCHAR size. size_of is inaccurate.
}
if size < cb_size {
warn!("DeviceInterfaceDetailData is too small. {}", size);
return None;
}
- let mut data = unsafe { libc::malloc(size) as PSP_DEVICE_INTERFACE_DETAIL_DATA_W };
+ let data = unsafe { libc::malloc(size) as PSP_DEVICE_INTERFACE_DETAIL_DATA_W };
if data.is_null() {
return None;
}
// Set total size of the structure.
unsafe { (*data).cbSize = cb_size as UINT };
// Compute offset of `SP_DEVICE_INTERFACE_DETAIL_DATA_W.DevicePath`.