mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-10-02 22:06:50 +02:00
ci: run clippy on all platforms (#3650)
This commit is contained in:
5 files changed
+48
-21
No files matched your search
@@ -40,11 +40,11 @@ struct UserData<R: Runtime> {
|
||||
|
||||
impl<R: Runtime> UserData<R> {
|
||||
unsafe fn from_hwnd_raw(hwnd: HWND) -> *mut Self {
|
||||
GetWindowLongPtrW(hwnd, GWLP_USERDATA) as *mut Self
|
||||
unsafe { GetWindowLongPtrW(hwnd, GWLP_USERDATA) as *mut Self }
|
||||
}
|
||||
|
||||
unsafe fn from_hwnd<'a>(hwnd: HWND) -> &'a mut Self {
|
||||
&mut *Self::from_hwnd_raw(hwnd)
|
||||
unsafe { &mut *Self::from_hwnd_raw(hwnd) }
|
||||
}
|
||||
|
||||
fn run_callback(&mut self, args: Vec<String>, cwd: String) {
|
||||
@@ -147,18 +147,18 @@ unsafe extern "system" fn single_instance_window_proc<R: Runtime>(
|
||||
) -> LRESULT {
|
||||
match msg {
|
||||
WM_CREATE => {
|
||||
let create_struct = &*(lparam as *const CREATESTRUCTW);
|
||||
let create_struct = unsafe { &*(lparam as *const CREATESTRUCTW) };
|
||||
let userdata = create_struct.lpCreateParams as *const UserData<R>;
|
||||
SetWindowLongPtrW(hwnd, GWLP_USERDATA, userdata as _);
|
||||
unsafe { SetWindowLongPtrW(hwnd, GWLP_USERDATA, userdata as _) };
|
||||
0
|
||||
}
|
||||
|
||||
WM_COPYDATA => {
|
||||
let cds_ptr = lparam as *const COPYDATASTRUCT;
|
||||
if (*cds_ptr).dwData == WMCOPYDATA_SINGLE_INSTANCE_DATA {
|
||||
let userdata = UserData::<R>::from_hwnd(hwnd);
|
||||
if unsafe { (*cds_ptr).dwData == WMCOPYDATA_SINGLE_INSTANCE_DATA } {
|
||||
let userdata = unsafe { UserData::<R>::from_hwnd(hwnd) };
|
||||
|
||||
let data = CStr::from_ptr((*cds_ptr).lpData as _).to_string_lossy();
|
||||
let data = unsafe { CStr::from_ptr((*cds_ptr).lpData as _).to_string_lossy() };
|
||||
let mut s = data.split('|');
|
||||
let cwd = s.next().unwrap();
|
||||
let args = s.map(|s| s.to_string()).collect();
|
||||
@@ -169,11 +169,11 @@ unsafe extern "system" fn single_instance_window_proc<R: Runtime>(
|
||||
}
|
||||
|
||||
WM_DESTROY => {
|
||||
let userdata = UserData::<R>::from_hwnd_raw(hwnd);
|
||||
drop(Box::from_raw(userdata));
|
||||
let userdata = unsafe { UserData::<R>::from_hwnd_raw(hwnd) };
|
||||
drop(unsafe { Box::from_raw(userdata) });
|
||||
0
|
||||
}
|
||||
_ => DefWindowProcW(hwnd, msg, wparam, lparam),
|
||||
_ => unsafe { DefWindowProcW(hwnd, msg, wparam, lparam) },
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,23 +245,23 @@ pub fn encode_wide(string: impl AsRef<std::ffi::OsStr>) -> Vec<u16> {
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
#[allow(non_snake_case)]
|
||||
unsafe fn SetWindowLongPtrW(hwnd: HWND, index: WINDOW_LONG_PTR_INDEX, value: isize) -> isize {
|
||||
w32wm::SetWindowLongW(hwnd, index, value as _) as _
|
||||
unsafe { w32wm::SetWindowLongW(hwnd, index, value as _) as _ }
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
#[allow(non_snake_case)]
|
||||
unsafe fn SetWindowLongPtrW(hwnd: HWND, index: WINDOW_LONG_PTR_INDEX, value: isize) -> isize {
|
||||
w32wm::SetWindowLongPtrW(hwnd, index, value)
|
||||
unsafe { w32wm::SetWindowLongPtrW(hwnd, index, value) }
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
#[allow(non_snake_case)]
|
||||
unsafe fn GetWindowLongPtrW(hwnd: HWND, index: WINDOW_LONG_PTR_INDEX) -> isize {
|
||||
w32wm::GetWindowLongW(hwnd, index) as _
|
||||
unsafe { w32wm::GetWindowLongW(hwnd, index) as _ }
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
#[allow(non_snake_case)]
|
||||
unsafe fn GetWindowLongPtrW(hwnd: HWND, index: WINDOW_LONG_PTR_INDEX) -> isize {
|
||||
w32wm::GetWindowLongPtrW(hwnd, index)
|
||||
unsafe { w32wm::GetWindowLongPtrW(hwnd, index) }
|
||||
}
|
||||
@@ -1963,7 +1963,7 @@ mod tests {
|
||||
assert_eq!(cases.len(), cases_escaped.len());
|
||||
|
||||
for (orig, escaped) in cases.iter().zip(cases_escaped) {
|
||||
assert_eq!(escape_nsis_current_exe_arg(&OsStr::new(orig)), escaped);
|
||||
assert_eq!(escape_nsis_current_exe_arg(OsStr::new(orig)), escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user