Skip to content

Commit caaf1c0

Browse files
committed
fix: 修复 clippy 错误
1 parent defac01 commit caaf1c0

5 files changed

Lines changed: 5 additions & 9 deletions

File tree

src/hooks/autoplay.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ static mut STATE_PTR: usize = 0;
1414
static mut DEMO_OFF: u32 = 0;
1515
static mut PRESET_OFF: u32 = 0;
1616
static mut OSD_HWND: usize = 0;
17-
static mut OSD_HIDE_TICK: u32 = 0;
1817
static mut JUDGE_ADDR: usize = 0;
1918
static mut ORIG_JUDGE: usize = 0;
2019

@@ -29,7 +28,6 @@ extern "system" {
2928
id: *mut u32,
3029
) -> usize;
3130
fn Sleep(ms: u32);
32-
fn GetTickCount() -> u32;
3331
fn GetModuleHandleA(module_name: *const u8) -> usize;
3432
}
3533

@@ -70,7 +68,6 @@ extern "system" {
7068
#[link(name = "gdi32")]
7169
extern "system" {
7270
fn SetBkMode(hdc: usize, mode: i32) -> i32;
73-
fn SetBkColor(hdc: usize, color: u32) -> u32;
7471
fn SetTextColor(hdc: usize, color: u32) -> u32;
7572
fn CreateFontA(
7673
h: i32,

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(non_snake_case, clippy::manual_c_str_literals)]
2+
13
mod config;
24
mod d3d9;
35
mod hooks;

src/util/api.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ impl Api {
109109
.is_some_and(|func| unsafe { func(addr, buf.as_mut_ptr().cast(), size) == 0 })
110110
}
111111

112+
#[allow(dead_code)]
112113
pub fn mem_fill(&self, addr: usize, value: u8, size: u32) -> bool {
113114
self.raw()
114115
.and_then(|api| api.mem_fill)

src/util/memory.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ pub fn patch_bytes(api: &Api, addr: usize, expected: &[u8], patch: &[u8]) -> Pat
115115
}
116116
}
117117

118+
#[allow(dead_code)]
118119
pub fn nop_bytes(api: &Api, addr: usize, expected: &[u8], count: usize) -> PatchResult {
119120
patch_bytes(api, addr, expected, &vec![0x90; count])
120121
}

src/ux/exit_confirm.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
55
use crate::config::Config;
66
use crate::util::api::Api;
77

8-
type WndProc = unsafe extern "system" fn(usize, u32, usize, isize) -> isize;
98
type TaskDialogIndirectFn = unsafe extern "system" fn(*const TaskDialogConfig, *mut i32, *mut i32, *mut i32) -> i32;
109

1110
static ORIGINAL_WNDPROC: AtomicUsize = AtomicUsize::new(0);
@@ -21,7 +20,6 @@ const MB_OKCANCEL: u32 = 0x0000_0001;
2120
const MB_DEFBUTTON2: u32 = 0x0000_0100;
2221
const IDOK: i32 = 1;
2322
const TDF_ALLOW_DIALOG_CANCELLATION: u32 = 0x0008;
24-
const TDCBF_CANCEL_BUTTON: u32 = 0x0008;
2523
const TASKDIALOG_BUTTON_EXIT: i32 = 1001;
2624
const GWL_WNDPROC: i32 = -4;
2725

@@ -35,7 +33,6 @@ extern "system" {
3533
flags: u32,
3634
id: *mut u32,
3735
) -> usize;
38-
fn GetModuleHandleA(module_name: *const u8) -> usize;
3936
fn GetProcAddress(module: usize, proc_name: *const u8) -> *const c_void;
4037
fn Sleep(ms: u32);
4138
fn CreateActCtxA(ctx: *const ActCtxA) -> usize;
@@ -58,12 +55,10 @@ struct ActCtxA {
5855
h_module: usize,
5956
}
6057

61-
const ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID: u32 = 0x004;
6258
const INVALID_HANDLE_VALUE: usize = usize::MAX;
6359

6460
#[link(name = "user32")]
6561
extern "system" {
66-
fn FindWindowA(class_name: *const u8, window_name: *const u8) -> usize;
6762
fn CallWindowProcA(prev_wnd_func: usize, hwnd: usize, msg: u32, wp: usize, lp: isize) -> isize;
6863
fn MessageBoxW(hwnd: usize, text: *const u16, caption: *const u16, flags: u32) -> i32;
6964
fn PostMessageA(hwnd: usize, msg: u32, wp: usize, lp: isize) -> i32;
@@ -151,7 +146,7 @@ unsafe extern "system" fn wndproc_hook_thread(_param: *mut c_void) -> u32 {
151146
return 0;
152147
}
153148

154-
let old = SetWindowLongA(hwnd, GWL_WNDPROC, confirming_wndproc as i32);
149+
let old = SetWindowLongA(hwnd, GWL_WNDPROC, confirming_wndproc as *const () as i32);
155150
if old != 0 {
156151
ORIGINAL_WNDPROC.store(old as usize, Ordering::SeqCst);
157152
}

0 commit comments

Comments
 (0)