@@ -6,7 +6,10 @@ use objdiff_core::{
66 diff:: {
77 DiffObjConfig , ObjectDiff , SymbolDiff ,
88 data:: BYTES_PER_ROW ,
9- display:: { ContextItem , DiffText , HoverItem , HoverItemColor , SymbolFilter , SymbolNavigationKind , display_row} ,
9+ display:: {
10+ ContextItem , DiffText , HoverItem , HoverItemColor , SymbolFilter , SymbolNavigationKind ,
11+ display_row,
12+ } ,
1013 } ,
1114 obj:: { InstructionArgValue , Object , Symbol } ,
1215 util:: ReallySigned ,
@@ -61,16 +64,25 @@ impl<'a> DiffColumnContext<'a> {
6164 }
6265
6366 #[ inline]
64- pub fn has_symbol ( & self ) -> bool { self . symbol . is_some ( ) }
67+ pub fn has_symbol ( & self ) -> bool {
68+ self . symbol . is_some ( )
69+ }
6570
6671 #[ inline]
67- pub fn id ( & self ) -> Option < & str > { self . symbol . map ( |( symbol, _, _) | symbol. name . as_str ( ) ) }
72+ pub fn id ( & self ) -> Option < & str > {
73+ self . symbol . map ( |( symbol, _, _) | symbol. name . as_str ( ) )
74+ }
6875}
6976
7077/// Obtains the assembly text for a given symbol diff, suitable for copying to clipboard.
71- fn get_asm_text ( obj : & Object , symbol_diff : & SymbolDiff , symbol_idx : usize , diff_config : & DiffObjConfig ) -> String {
78+ fn get_asm_text (
79+ obj : & Object ,
80+ symbol_diff : & SymbolDiff ,
81+ symbol_idx : usize ,
82+ diff_config : & DiffObjConfig ,
83+ ) -> String {
7284 let mut asm_text = String :: new ( ) ;
73-
85+
7486 for ins_row in & symbol_diff. instruction_rows {
7587 let mut line = String :: new ( ) ;
7688 let result = display_row ( obj, symbol_idx, ins_row, diff_config, |segment| {
@@ -97,13 +109,13 @@ fn get_asm_text(obj: &Object, symbol_diff: &SymbolDiff, symbol_idx: usize, diff_
97109 line. push_str ( & text) ;
98110 Ok ( ( ) )
99111 } ) ;
100-
112+
101113 if result. is_ok ( ) {
102114 asm_text. push_str ( & line) ;
103115 asm_text. push ( '\n' ) ;
104116 }
105117 }
106-
118+
107119 asm_text
108120}
109121
@@ -255,15 +267,17 @@ pub fn diff_view_ui(
255267 if state. current_view == View :: FunctionDiff
256268 && ui
257269 . button ( "Change target" )
258- . on_hover_text_at_pointer ( "Choose a different symbol to use as the target" )
270+ . on_hover_text_at_pointer (
271+ "Choose a different symbol to use as the target" ,
272+ )
259273 . clicked ( )
260274 || hotkeys:: consume_change_target_shortcut ( ui. ctx ( ) )
261275 {
262276 if let Some ( symbol_ref) = state. symbol_state . right_symbol . as_ref ( ) {
263277 ret = Some ( DiffViewAction :: SelectingLeft ( symbol_ref. clone ( ) ) ) ;
264278 }
265279 }
266-
280+
267281 // Copy target ASM button.
268282 if state. current_view == View :: FunctionDiff {
269283 if let Some ( ( _, symbol_diff, symbol_idx) ) = left_ctx. symbol {
@@ -273,7 +287,8 @@ pub fn diff_view_ui(
273287 . on_hover_text_at_pointer ( "Copy assembly to clipboard" )
274288 . clicked ( )
275289 {
276- let asm_text = get_asm_text ( obj, symbol_diff, symbol_idx, diff_config) ;
290+ let asm_text =
291+ get_asm_text ( obj, symbol_diff, symbol_idx, diff_config) ;
277292 ui. ctx ( ) . copy_text ( asm_text) ;
278293 }
279294 }
@@ -436,7 +451,7 @@ pub fn diff_view_ui(
436451 {
437452 ret = Some ( DiffViewAction :: SelectingRight ( symbol_ref. clone ( ) ) ) ;
438453 }
439-
454+
440455 // Copy base ASM button.
441456 if let Some ( ( _, symbol_diff, symbol_idx) ) = right_ctx. symbol {
442457 if let Some ( ( obj, _) ) = right_ctx. obj {
@@ -445,7 +460,8 @@ pub fn diff_view_ui(
445460 . on_hover_text_at_pointer ( "Copy assembly to clipboard" )
446461 . clicked ( )
447462 {
448- let asm_text = get_asm_text ( obj, symbol_diff, symbol_idx, diff_config) ;
463+ let asm_text =
464+ get_asm_text ( obj, symbol_diff, symbol_idx, diff_config) ;
449465 ui. ctx ( ) . copy_text ( asm_text) ;
450466 }
451467 }
0 commit comments