cargo clippy --fix

This commit is contained in:
2025-06-01 16:42:00 -06:00
parent f212b35d28
commit 88d0e6b789
36 changed files with 181 additions and 187 deletions

View File

@@ -191,7 +191,7 @@ impl AnalyzerState {
};
obj.add_symbol(
ObjSymbol {
name: format!("jumptable_{}", address_str),
name: format!("jumptable_{address_str}"),
address: addr.address as u64,
section: Some(addr.section),
size: size as u64,
@@ -275,7 +275,7 @@ impl AnalyzerState {
let (section_index, _) = obj
.sections
.at_address(entry)
.context(format!("Entry point {:#010X} outside of any section", entry))?;
.context(format!("Entry point {entry:#010X} outside of any section"))?;
self.process_function_at(obj, SectionAddress::new(section_index, entry))?;
}
// Locate bounds for referenced functions until none are left
@@ -530,7 +530,7 @@ pub fn locate_sda_bases(obj: &mut ObjInfo) -> Result<bool> {
let (section_index, _) = obj
.sections
.at_address(entry as u32)
.context(format!("Entry point {:#010X} outside of any section", entry))?;
.context(format!("Entry point {entry:#010X} outside of any section"))?;
let entry_addr = SectionAddress::new(section_index, entry as u32);
let mut executor = Executor::new(obj);
@@ -589,7 +589,7 @@ pub fn locate_bss_memsets(obj: &mut ObjInfo) -> Result<Vec<(u32, u32)>> {
let (section_index, _) = obj
.sections
.at_address(entry as u32)
.context(format!("Entry point {:#010X} outside of any section", entry))?;
.context(format!("Entry point {entry:#010X} outside of any section"))?;
let entry_addr = SectionAddress::new(section_index, entry as u32);
let mut executor = Executor::new(obj);

View File

@@ -183,8 +183,7 @@ fn get_jump_table_entries(
let (section_index, _) =
obj.sections.at_address(entry_addr).with_context(|| {
format!(
"Invalid jump table entry {:#010X} at {:#010X}",
entry_addr, cur_addr
"Invalid jump table entry {entry_addr:#010X} at {cur_addr:#010X}"
)
})?;
entries.push(SectionAddress::new(section_index, entry_addr));

View File

@@ -101,7 +101,7 @@ impl AnalysisPass for FindSaveRestSleds {
for i in reg_start..reg_end {
let addr = start + (i - reg_start) * step_size;
state.known_symbols.entry(addr).or_default().push(ObjSymbol {
name: format!("{}{}", label, i),
name: format!("{label}{i}"),
address: addr.address as u64,
section: Some(start.section),
size_known: true,

View File

@@ -227,7 +227,7 @@ impl FunctionSlices {
})?;
}
self.check_epilogue(section, ins_addr, ins)
.with_context(|| format!("While processing {:#010X}: {:#?}", function_start, self))?;
.with_context(|| format!("While processing {function_start:#010X}: {self:#?}"))?;
if !self.has_conditional_blr && is_conditional_blr(ins) {
self.has_conditional_blr = true;
}

View File

@@ -576,7 +576,7 @@ impl Tracker {
let relocation_target = relocation_target_for(obj, from, None).ok().flatten();
if !matches!(relocation_target, None | Some(RelocationTarget::External)) {
// VM should have already handled this
panic!("Relocation already exists for {:#010X} (from {:#010X})", addr, from);
panic!("Relocation already exists for {addr:#010X} (from {from:#010X})");
}
}
// Remainder of this function is for executable objects only
@@ -668,7 +668,7 @@ impl Tracker {
0
};
let new_name =
if module_id == 0 { name.to_string() } else { format!("{}:{}", name, module_id) };
if module_id == 0 { name.to_string() } else { format!("{name}:{module_id}") };
log::debug!("Renaming {} to {}", section.name, new_name);
section.name = new_name;
}