Skip to content

Commit fcffaad

Browse files
committed
Linting
1 parent 400aee6 commit fcffaad

File tree

3 files changed

+29
-24
lines changed

3 files changed

+29
-24
lines changed

memflow-win32/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
This crate contains memflow's win32 implementation.
33
It is used to interface with windows targets.
44
*/
5-
65
#![cfg_attr(not(feature = "std"), no_std)]
76
extern crate no_std_compat as std;
87

memflow-win32/src/win32/keyboard.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,11 @@ impl<T> Win32Keyboard<T> {
243243
{
244244
return Err(
245245
Error(ErrorOrigin::OsLayer, ErrorKind::UnsupportedOptionalFeature)
246-
.log_error("cannot find keyboard signature because regex feature is disabled")
246+
.log_error(
247+
"cannot find keyboard signature because regex feature is disabled",
248+
),
247249
); // todo: repalce with pelite sig
248250
}
249-
250251

251252
(sig, muddy!("win32k.sys"), 0x824F0, 0x3808) // 24H2 win32k.sys + 0x824F0
252253
} else {
@@ -273,7 +274,9 @@ impl<T> Win32Keyboard<T> {
273274
{
274275
return Err(
275276
Error(ErrorOrigin::OsLayer, ErrorKind::UnsupportedOptionalFeature)
276-
.log_error("cannot find keyboard signature because regex feature is disabled")
277+
.log_error(
278+
"cannot find keyboard signature because regex feature is disabled",
279+
),
277280
); // todo: repalce with pelite sig
278281
}
279282

@@ -286,7 +289,7 @@ impl<T> Win32Keyboard<T> {
286289
Err(_) => {
287290
return Err(
288291
Error(ErrorOrigin::OsLayer, ErrorKind::ModuleNotFound).log_info(
289-
["unable to find kernel module", target_kernel_module_name].join(" ")
292+
["unable to find kernel module", target_kernel_module_name].join(" "),
290293
),
291294
)
292295
}
@@ -352,13 +355,13 @@ impl<T> Win32Keyboard<T> {
352355
&win32ksgd_module_info,
353356
g_session_global_slots_signature,
354357
)
355-
.and_then(|offset| {
358+
.map(|offset| {
356359
// santity check
357-
Ok(if offset == 0 {
360+
if offset == 0 {
358361
g_session_global_slots_offset_fallback
359362
} else {
360363
offset
361-
})
364+
}
362365
})
363366
.unwrap_or(g_session_global_slots_offset_fallback);
364367
};
@@ -505,8 +508,11 @@ impl<T> Win32Keyboard<T> {
505508
.data_part()?;
506509

507510
// 48 8B 05 ? ? ? ? 48 89 81 ? ? 00 00 48 8B 8F + 0x3
508-
let re = Regex::new(ida_regex![48 8B 05 ? ? ? ? 48 89 81 ? ? 00 00 48 8B 8F])
509-
.map_err(|_| Error(ErrorOrigin::OsLayer, ErrorKind::Encoding).log_info(muddy!("malformed gafAsyncKeyState signature")))?;
511+
let re =
512+
Regex::new(ida_regex![48 8B 05 ? ? ? ? 48 89 81 ? ? 00 00 48 8B 8F]).map_err(|_| {
513+
Error(ErrorOrigin::OsLayer, ErrorKind::Encoding)
514+
.log_info(muddy!("malformed gafAsyncKeyState signature"))
515+
})?;
510516
let buf_offs = re
511517
.find(module_buf.as_slice())
512518
.ok_or_else(|| {

memflow-win32/src/win32/vkey.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,20 @@ pub fn vkey_range(start: VKEY, end: VKEY) -> impl Iterator<Item = VKEY> {
6767
(start.0..end.0).map(VKEY)
6868
}
6969

70-
#[cfg(all(feature = "nightly", nightly))]
71-
use std::{iter::Step};
72-
#[cfg(all(feature = "nightly", nightly))]
73-
impl std::iter::Step for VKEY {
74-
fn steps_between(start: &Self, end: &Self) -> Option<usize> {
75-
u16::steps_between(&start.0, &end.0)
76-
}
77-
fn forward_checked(start: Self, count: usize) -> Option<Self> {
78-
u16::forward_checked(start.0, count).map(VKEY)
79-
}
80-
fn backward_checked(start: Self, count: usize) -> Option<Self> {
81-
u16::backward_checked(start.0, count).map(VKEY)
82-
}
83-
}
70+
// #[cfg(all(feature = "nightly", nightly))]
71+
// use std::iter::Step;
72+
// #[cfg(all(feature = "nightly", nightly))]
73+
// impl std::iter::Step for VKEY {
74+
// fn steps_between(start: &Self, end: &Self) -> Option<usize> {
75+
// u16::steps_between(&start.0, &end.0)
76+
// }
77+
// fn forward_checked(start: Self, count: usize) -> Option<Self> {
78+
// u16::forward_checked(start.0, count).map(VKEY)
79+
// }
80+
// fn backward_checked(start: Self, count: usize) -> Option<Self> {
81+
// u16::backward_checked(start.0, count).map(VKEY)
82+
// }
83+
// }
8484

8585
pub const VK_0: VKEY = VKEY(48u16);
8686
pub const VK_1: VKEY = VKEY(49u16);

0 commit comments

Comments
 (0)