@@ -651,11 +651,8 @@ where
651651fn symbol_section < ' obj > ( obj : & ' obj Object , symbol : & Symbol ) -> Option < ( & ' obj str , SectionKind ) > {
652652 if let Some ( section) = symbol. section . and_then ( |section_idx| obj. sections . get ( section_idx) ) {
653653 // Match x86 .rdata$r against .rdata$rs
654- let section_name = if let Some ( ( prefix, _) ) = section. name . split_once ( '$' ) {
655- prefix
656- } else {
657- section. name . as_str ( )
658- } ;
654+ let section_name =
655+ section. name . split_once ( '$' ) . map_or ( section. name . as_str ( ) , |( prefix, _) | prefix) ;
659656 Some ( ( section_name, section. kind ) )
660657 } else if symbol. flags . contains ( SymbolFlag :: Common ) {
661658 Some ( ( ".comm" , SectionKind :: Common ) )
@@ -664,13 +661,6 @@ fn symbol_section<'obj>(obj: &'obj Object, symbol: &Symbol) -> Option<(&'obj str
664661 }
665662}
666663
667- fn symbol_section_name < ' obj > ( obj : & ' obj Object , symbol : & Symbol ) -> Option < & ' obj str > {
668- if let Some ( ( name, _kind) ) = symbol_section ( obj, symbol) {
669- return Some ( name) ;
670- }
671- None
672- }
673-
674664fn symbol_section_kind ( obj : & Object , symbol : & Symbol ) -> SectionKind {
675665 match symbol. section {
676666 Some ( section_index) => obj. sections [ section_index] . kind ,
@@ -762,7 +752,7 @@ fn find_symbol(
762752 if let Some ( ( symbol_idx, _) ) = unmatched_symbols ( obj, used) . find ( |& ( _, symbol) | {
763753 symbol_name_matches ( & in_symbol. name , & symbol. name )
764754 && symbol_section_kind ( obj, symbol) == section_kind
765- && symbol_section_name ( obj, symbol) == Some ( section_name)
755+ && symbol_section ( obj, symbol) . is_some_and ( | ( name , _ ) | name == section_name)
766756 } ) {
767757 return Some ( symbol_idx) ;
768758 }
0 commit comments