Apply clippy suggestion

This commit is contained in:
Luke Street 2025-03-19 19:00:01 -06:00
parent d8fdfaa2c0
commit 485b259c32

View File

@ -1,4 +1,5 @@
use alloc::{boxed::Box, format, string::String, vec::Vec}; use alloc::{boxed::Box, format, string::String, vec::Vec};
use core::cmp::Ordering;
use anyhow::{Context, Result, anyhow, bail}; use anyhow::{Context, Result, anyhow, bail};
use iced_x86::{ use iced_x86::{
@ -100,9 +101,11 @@ impl Arch for ArchX86 {
'outer: while decoder.can_decode() { 'outer: while decoder.can_decode() {
let address = decoder.ip(); let address = decoder.ip();
while let Some(reloc) = reloc_iter.peek() { while let Some(reloc) = reloc_iter.peek() {
if reloc.address < address { match reloc.address.cmp(&address) {
Ordering::Less => {
reloc_iter.next(); reloc_iter.next();
} else if reloc.address == address { }
Ordering::Equal => {
// If the instruction starts at a relocation, it's inline data // If the instruction starts at a relocation, it's inline data
let size = self.reloc_size(reloc.flags).with_context(|| { let size = self.reloc_size(reloc.flags).with_context(|| {
format!("Unsupported inline x86 relocation {:?}", reloc.flags) format!("Unsupported inline x86 relocation {:?}", reloc.flags)
@ -120,8 +123,8 @@ impl Arch for ArchX86 {
reloc_iter.next(); reloc_iter.next();
continue 'outer; continue 'outer;
} }
} else { }
break; Ordering::Greater => break,
} }
} }
decoder.decode_out(&mut instruction); decoder.decode_out(&mut instruction);