Migrate to Rust edition 2024

This commit is contained in:
2025-03-04 22:31:38 -07:00
parent 8eef37e8df
commit 799971d54e
46 changed files with 154 additions and 207 deletions

View File

@@ -1,16 +1,16 @@
use alloc::{
collections::{btree_map, BTreeMap},
collections::{BTreeMap, btree_map},
string::{String, ToString},
vec,
vec::Vec,
};
use anyhow::{anyhow, ensure, Context, Result};
use anyhow::{Context, Result, anyhow, ensure};
use super::{
display::display_ins_data_literals, DiffObjConfig, FunctionRelocDiffs, InstructionArgDiffIndex,
InstructionBranchFrom, InstructionBranchTo, InstructionDiffKind, InstructionDiffRow,
SymbolDiff,
DiffObjConfig, FunctionRelocDiffs, InstructionArgDiffIndex, InstructionBranchFrom,
InstructionBranchTo, InstructionDiffKind, InstructionDiffRow, SymbolDiff,
display::display_ins_data_literals,
};
use crate::obj::{
InstructionArg, InstructionArgValue, InstructionRef, Object, ResolvedInstructionRef,

View File

@@ -1,12 +1,12 @@
use alloc::{vec, vec::Vec};
use core::{cmp::Ordering, ops::Range};
use anyhow::{anyhow, Result};
use similar::{capture_diff_slices, get_diff_ratio, Algorithm};
use anyhow::{Result, anyhow};
use similar::{Algorithm, capture_diff_slices, get_diff_ratio};
use super::{
code::{address_eq, section_name_eq},
DataDiff, DataDiffKind, DataRelocationDiff, ObjectDiff, SectionDiff, SymbolDiff,
code::{address_eq, section_name_eq},
};
use crate::obj::{Object, Relocation, ResolvedRelocation, Symbol, SymbolFlag, SymbolKind};
@@ -431,11 +431,7 @@ pub fn diff_generic_section(
.fold((0.0, 0.0), |(matched, total), (s, d)| {
(matched + d.match_percent.unwrap_or(0.0) * s.size as f32, total + s.size as f32)
});
if total == 0.0 {
100.0
} else {
matched / total
}
if total == 0.0 { 100.0 } else { matched / total }
};
Ok((
SectionDiff { match_percent: Some(match_percent), data_diff: vec![], reloc_diff: vec![] },

View File

@@ -26,13 +26,7 @@ pub mod display;
include!(concat!(env!("OUT_DIR"), "/config.gen.rs"));
impl DiffObjConfig {
pub fn separator(&self) -> &'static str {
if self.space_between_args {
", "
} else {
","
}
}
pub fn separator(&self) -> &'static str { if self.space_between_args { ", " } else { "," } }
}
#[derive(Debug, Clone)]