11use std:: path:: Path ;
22
3- use object:: { self , Object , Symbol , ObjectSymbol , SymbolIterator } ;
3+ use object:: { self , Object , ObjectSymbol , Symbol , SymbolIterator } ;
44
55/// Iterate through the symbols in an object file.
66///
@@ -50,7 +50,11 @@ pub fn any_symbol_contains(path: impl AsRef<Path>, substrings: &[&str]) -> bool
5050/// The symbol names must match exactly.
5151///
5252/// Panics if `path` is not a valid object file readable by the current user.
53- pub fn missing_exact_symbols < ' a > ( path : impl AsRef < Path > , symbol_names : & [ & ' a str ] , pred : impl Fn ( & Symbol < ' _ , ' _ > ) -> bool ) -> Vec < & ' a str > {
53+ pub fn missing_exact_symbols < ' a > (
54+ path : impl AsRef < Path > ,
55+ symbol_names : & [ & ' a str ] ,
56+ pred : impl Fn ( & Symbol < ' _ , ' _ > ) -> bool ,
57+ ) -> Vec < & ' a str > {
5458 let mut found = vec ! [ false ; symbol_names. len( ) ] ;
5559 with_symbol_iter ( path, |syms| {
5660 for sym in syms. filter ( & pred) {
@@ -59,16 +63,19 @@ pub fn missing_exact_symbols<'a>(path: impl AsRef<Path>, symbol_names: &[&'a str
5963 }
6064 }
6165 } ) ;
62- return found. iter ( ) . enumerate ( )
63- . filter_map ( |( i, found) | if !* found {
64- Some ( symbol_names[ i] )
65- } else {
66- None
67- } ) . collect ( ) ;
66+ return found
67+ . iter ( )
68+ . enumerate ( )
69+ . filter_map ( |( i, found) | if !* found { Some ( symbol_names[ i] ) } else { None } )
70+ . collect ( ) ;
6871}
6972
7073/// Assert that the symbol file contains all of the listed symbols and they all match the given predicate
71- pub fn assert_contains_exact_symbols ( path : impl AsRef < Path > , symbol_names : & [ & str ] , pred : impl Fn ( & Symbol < ' _ , ' _ > ) -> bool ) {
74+ pub fn assert_contains_exact_symbols (
75+ path : impl AsRef < Path > ,
76+ symbol_names : & [ & str ] ,
77+ pred : impl Fn ( & Symbol < ' _ , ' _ > ) -> bool ,
78+ ) {
7279 let missing = missing_exact_symbols ( path. as_ref ( ) , symbol_names, pred) ;
7380 if missing. len ( ) > 0 {
7481 eprintln ! ( "{} does not contain symbol(s): " , path. as_ref( ) . display( ) ) ;
0 commit comments