mirror of
https://github.com/encounter/objdiff.git
synced 2025-12-12 22:56:19 +00:00
Migrate to Rust edition 2024
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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![] },
|
||||
|
||||
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user