Skip to content

Commit 33ad7a4

Browse files
committed
Remove unneeded mut from Architecture trait signatures
These are never expressed, just adds another unneeded constraint on the impl
1 parent fe7b9b5 commit 33ad7a4

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

arch/msp430/src/architecture.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ impl Architecture for Msp430 {
194194
&self,
195195
data: &[u8],
196196
addr: u64,
197-
il: &mut MutableLiftedILFunction,
197+
il: &MutableLiftedILFunction,
198198
) -> Option<(usize, bool)> {
199199
match msp430_asm::decode(data) {
200200
Ok(inst) => {
@@ -226,7 +226,7 @@ impl Architecture for Msp430 {
226226
fn flag_group_llil<'a>(
227227
&self,
228228
_group: Self::FlagGroup,
229-
_il: &'a mut MutableLiftedILFunction,
229+
_il: &'a MutableLiftedILFunction,
230230
) -> Option<MutableLiftedILExpr<'a, ValueExpr>> {
231231
None
232232
}

arch/riscv/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ impl<D: RiscVDisassembler> Architecture for RiscVArch<D> {
10621062
&self,
10631063
data: &[u8],
10641064
addr: u64,
1065-
il: &mut MutableLiftedILFunction,
1065+
il: &MutableLiftedILFunction,
10661066
) -> Option<(usize, bool)> {
10671067
let max_width = self.default_integer_size();
10681068

rust/src/architecture.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ pub trait Architecture: 'static + Sized + AsRef<CoreArchitecture> {
467467
&self,
468468
data: &[u8],
469469
addr: u64,
470-
il: &mut MutableLiftedILFunction,
470+
il: &MutableLiftedILFunction,
471471
) -> Option<(usize, bool)>;
472472

473473
/// Fallback flag value calculation path. This method is invoked when the core is unable to
@@ -484,7 +484,7 @@ pub trait Architecture: 'static + Sized + AsRef<CoreArchitecture> {
484484
flag: Self::Flag,
485485
flag_write_type: Self::FlagWrite,
486486
op: LowLevelILFlagWriteOp<Self::Register>,
487-
il: &'a mut MutableLiftedILFunction,
487+
il: &'a MutableLiftedILFunction,
488488
) -> Option<MutableLiftedILExpr<'a, ValueExpr>> {
489489
let role = flag.role(flag_write_type.class());
490490
Some(get_default_flag_write_llil(self, role, op, il))
@@ -513,7 +513,7 @@ pub trait Architecture: 'static + Sized + AsRef<CoreArchitecture> {
513513
&self,
514514
cond: FlagCondition,
515515
class: Option<Self::FlagClass>,
516-
il: &'a mut MutableLiftedILFunction,
516+
il: &'a MutableLiftedILFunction,
517517
) -> Option<MutableLiftedILExpr<'a, ValueExpr>> {
518518
Some(get_default_flag_cond_llil(self, cond, class, il))
519519
}
@@ -535,7 +535,7 @@ pub trait Architecture: 'static + Sized + AsRef<CoreArchitecture> {
535535
fn flag_group_llil<'a>(
536536
&self,
537537
_group: Self::FlagGroup,
538-
_il: &'a mut MutableLiftedILFunction,
538+
_il: &'a MutableLiftedILFunction,
539539
) -> Option<MutableLiftedILExpr<'a, ValueExpr>> {
540540
None
541541
}
@@ -1512,7 +1512,7 @@ impl Architecture for CoreArchitecture {
15121512
&self,
15131513
data: &[u8],
15141514
addr: u64,
1515-
il: &mut MutableLiftedILFunction,
1515+
il: &MutableLiftedILFunction,
15161516
) -> Option<(usize, bool)> {
15171517
let mut size = data.len();
15181518
let success = unsafe {
@@ -1537,7 +1537,7 @@ impl Architecture for CoreArchitecture {
15371537
_flag: Self::Flag,
15381538
_flag_write: Self::FlagWrite,
15391539
_op: LowLevelILFlagWriteOp<Self::Register>,
1540-
_il: &'a mut MutableLiftedILFunction,
1540+
_il: &'a MutableLiftedILFunction,
15411541
) -> Option<MutableLiftedILExpr<'a, ValueExpr>> {
15421542
None
15431543
}
@@ -1574,15 +1574,15 @@ impl Architecture for CoreArchitecture {
15741574
&self,
15751575
_cond: FlagCondition,
15761576
_class: Option<Self::FlagClass>,
1577-
_il: &'a mut MutableLiftedILFunction,
1577+
_il: &'a MutableLiftedILFunction,
15781578
) -> Option<MutableLiftedILExpr<'a, ValueExpr>> {
15791579
None
15801580
}
15811581

15821582
fn flag_group_llil<'a>(
15831583
&self,
15841584
_group: Self::FlagGroup,
1585-
_il: &'a mut MutableLiftedILFunction,
1585+
_il: &'a MutableLiftedILFunction,
15861586
) -> Option<MutableLiftedILExpr<'a, ValueExpr>> {
15871587
None
15881588
}
@@ -2223,10 +2223,10 @@ where
22232223
{
22242224
let custom_arch = unsafe { &*(ctxt as *mut A) };
22252225
let data = unsafe { std::slice::from_raw_parts(data, *len) };
2226-
let mut lifter =
2226+
let lifter =
22272227
unsafe { MutableLiftedILFunction::from_raw_with_arch(il, Some(*custom_arch.as_ref())) };
22282228

2229-
match custom_arch.instruction_llil(data, addr, &mut lifter) {
2229+
match custom_arch.instruction_llil(data, addr, &lifter) {
22302230
Some((res_len, res_value)) => {
22312231
unsafe { *len = res_len };
22322232
res_value
@@ -2610,12 +2610,12 @@ where
26102610
let flag_write = custom_arch.flag_write_from_id(FlagWriteId(flag_write));
26112611
let flag = custom_arch.flag_from_id(FlagId(flag));
26122612
let operands = unsafe { std::slice::from_raw_parts(operands_raw, operand_count) };
2613-
let mut lifter =
2613+
let lifter =
26142614
unsafe { MutableLiftedILFunction::from_raw_with_arch(il, Some(*custom_arch.as_ref())) };
26152615

26162616
if let (Some(flag_write), Some(flag)) = (flag_write, flag) {
26172617
if let Some(op) = LowLevelILFlagWriteOp::from_op(custom_arch, size, op, operands) {
2618-
if let Some(expr) = custom_arch.flag_write_llil(flag, flag_write, op, &mut lifter) {
2618+
if let Some(expr) = custom_arch.flag_write_llil(flag, flag_write, op, &lifter) {
26192619
// TODO verify that returned expr is a bool value
26202620
return expr.index.0;
26212621
}
@@ -2659,9 +2659,9 @@ where
26592659
let custom_arch = unsafe { &*(ctxt as *mut A) };
26602660
let class = custom_arch.flag_class_from_id(FlagClassId(class));
26612661

2662-
let mut lifter =
2662+
let lifter =
26632663
unsafe { MutableLiftedILFunction::from_raw_with_arch(il, Some(*custom_arch.as_ref())) };
2664-
if let Some(expr) = custom_arch.flag_cond_llil(cond, class, &mut lifter) {
2664+
if let Some(expr) = custom_arch.flag_cond_llil(cond, class, &lifter) {
26652665
// TODO verify that returned expr is a bool value
26662666
return expr.index.0;
26672667
}
@@ -2678,11 +2678,11 @@ where
26782678
A: 'static + Architecture<Handle = CustomArchitectureHandle<A>> + Send + Sync,
26792679
{
26802680
let custom_arch = unsafe { &*(ctxt as *mut A) };
2681-
let mut lifter =
2681+
let lifter =
26822682
unsafe { MutableLiftedILFunction::from_raw_with_arch(il, Some(*custom_arch.as_ref())) };
26832683

26842684
if let Some(group) = custom_arch.flag_group_from_id(FlagGroupId(group)) {
2685-
if let Some(expr) = custom_arch.flag_group_llil(group, &mut lifter) {
2685+
if let Some(expr) = custom_arch.flag_group_llil(group, &lifter) {
26862686
// TODO verify that returned expr is a bool value
26872687
return expr.index.0;
26882688
}

0 commit comments

Comments
 (0)