Skip to content
This repository was archived by the owner on Sep 28, 2025. It is now read-only.

Commit 543fcb9

Browse files
fix: address clippy warnings
1 parent 0be5104 commit 543fcb9

7 files changed

Lines changed: 22 additions & 10 deletions

File tree

BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2150
1+
2162

src/binary/arm64.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub enum Register {
4646
X28,
4747
X29, // FP
4848
X30, // LR
49-
XZR, // Zero Register (or SP in some contexts)
49+
Xzr, // Zero Register (or SP in some contexts)
5050
}
5151

5252
impl TryFrom<u8> for Register {
@@ -90,7 +90,7 @@ impl TryFrom<u8> for Register {
9090
28 => Ok(Register::X28),
9191
29 => Ok(Register::X29),
9292
30 => Ok(Register::X30),
93-
31 => Ok(Register::XZR),
93+
31 => Ok(Register::Xzr),
9494
_ => Err(()),
9595
}
9696
}
@@ -107,7 +107,7 @@ pub enum ShiftAmount {
107107

108108
impl ShiftAmount {
109109
/// Returns the 2-bit encoding (0–3) corresponding to the half-word field.
110-
pub fn to_u8(&self) -> u8 {
110+
pub fn to_u8(self) -> u8 {
111111
match self {
112112
ShiftAmount::Lsl0 => 0,
113113
ShiftAmount::Lsl16 => 1,
@@ -117,7 +117,7 @@ impl ShiftAmount {
117117
}
118118

119119
/// Computes the actual shift amount in bits by multiplying the encoded value by 16.
120-
pub fn to_shift_bits(&self) -> u8 {
120+
pub fn to_shift_bits(self) -> u8 {
121121
self.to_u8() * 16
122122
}
123123
}

src/commands/patch/hash_constants.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ fn extract_reg_value(instructions: &[u32], start_idx: usize, reg: Register) -> O
149149
let base = match mov_inst {
150150
// For register-to-register MOV, treat it as setting the register to zero only if the source is XZR.
151151
Mov::Register(mov) => {
152-
if mov.rm == Register::XZR {
152+
if mov.rm == Register::Xzr {
153153
0
154154
} else {
155155
return None;
@@ -218,7 +218,7 @@ where
218218
.par_iter()
219219
.enumerate()
220220
.fold(
221-
|| IntSet::default(),
221+
IntSet::default,
222222
|mut local_set, (i, &inst)| {
223223
// Check if the instruction is a MADD.
224224
if let Some(madd) = parse_madd(inst) {
@@ -237,7 +237,7 @@ where
237237
},
238238
)
239239
.reduce(
240-
|| IntSet::default(),
240+
IntSet::default,
241241
|mut a, b| {
242242
a.extend(b);
243243
a

src/unity/generated/headers/gen_rs.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ $bindgenArgs = @(
1010
"--use-array-pointers-in-arguments"
1111
"--raw-line", "#![allow(unused_qualifications)]",
1212
"--raw-line", "#![allow(unsafe_op_in_unsafe_fn)]"
13+
"--raw-line", "#![allow(clippy::useless_transmute)]"
14+
"--raw-line", "#![allow(clippy::too_many_arguments)]"
15+
"--raw-line", "#![allow(clippy::ptr_offset_with_cast)]"
1316
)
1417

1518
Get-ChildItem -Path . -Filter "*.h" | ForEach-Object {

src/unity/generated/headers/gen_rs.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ bindgenArgs=(
1111
"--ignore-functions"
1212
"--no-prepend-enum-name"
1313
"--use-array-pointers-in-arguments"
14-
"--raw-line" "#![allow(unused_qualifications)]"
15-
"--raw-line" "#![allow(unsafe_op_in_unsafe_fn)]"
14+
"--raw-line", "#![allow(unused_qualifications)]",
15+
"--raw-line", "#![allow(unsafe_op_in_unsafe_fn)]"
16+
"--raw-line", "#![allow(clippy::useless_transmute)]"
17+
"--raw-line", "#![allow(clippy::too_many_arguments)]"
18+
"--raw-line", "#![allow(clippy::ptr_offset_with_cast)]"
1619
)
1720

1821
for header in *.h; do

src/unity/generated/il2cpp_2022322f1.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#![allow(unused_qualifications)]
22
#![allow(unsafe_op_in_unsafe_fn)]
3+
#![allow(clippy::useless_transmute)]
4+
#![allow(clippy::too_many_arguments)]
5+
#![allow(clippy::ptr_offset_with_cast)]
36

47
#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
58
pub mod CIl2Cpp {

src/unity/generated/il2cpp_2022356f1.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#![allow(unused_qualifications)]
22
#![allow(unsafe_op_in_unsafe_fn)]
3+
#![allow(clippy::useless_transmute)]
4+
#![allow(clippy::too_many_arguments)]
5+
#![allow(clippy::ptr_offset_with_cast)]
36

47
#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
58
pub mod CIl2Cpp {

0 commit comments

Comments
 (0)