@@ -97,7 +97,7 @@ impl Program {
9797 . e_entry
9898 . try_into ( )
9999 . map_err ( |err| anyhow ! ( "e_entry was larger than 32 bits. {err}" ) ) ?;
100- if entry >= max_mem || entry % WORD_SIZE as u32 != 0 {
100+ if entry >= max_mem || ! entry. is_multiple_of ( WORD_SIZE as u32 ) {
101101 bail ! ( "Invalid entrypoint" ) ;
102102 }
103103 let segments = elf. segments ( ) . ok_or ( anyhow ! ( "Missing segment table" ) ) ?;
@@ -136,7 +136,7 @@ impl Program {
136136 return Err ( anyhow ! ( "only support one executable segment" ) ) ;
137137 }
138138 }
139- if vaddr % WORD_SIZE as u32 != 0 {
139+ if ! vaddr. is_multiple_of ( WORD_SIZE as u32 ) {
140140 bail ! ( "vaddr {vaddr:08x} is unaligned" ) ;
141141 }
142142 tracing:: debug!(
@@ -270,10 +270,11 @@ fn collect_addr_symbols_mapping<'data>(
270270
271271 if let Some ( ( symtab, strtab) ) = elf. symbol_table ( ) ? {
272272 for symbol in symtab. iter ( ) {
273- if let Ok ( name) = strtab. get ( symbol. st_name as usize ) {
274- if !name. is_empty ( ) && symbol. st_value != 0 {
275- symbols. insert ( symbol. st_value , name. to_string ( ) ) ;
276- }
273+ if let Ok ( name) = strtab. get ( symbol. st_name as usize )
274+ && !name. is_empty ( )
275+ && symbol. st_value != 0
276+ {
277+ symbols. insert ( symbol. st_value , name. to_string ( ) ) ;
277278 }
278279 }
279280 }
@@ -286,5 +287,5 @@ fn find_max_symbol_in_range(
286287 start : u64 ,
287288 end : u64 ,
288289) -> Option < ( & u64 , & String ) > {
289- symbols. range ( start..end) . max_by_key ( |( & addr, _) | addr)
290+ symbols. range ( start..end) . max_by_key ( |& ( addr, _) | addr)
290291}
0 commit comments