diff --git a/src/obj/elf.rs b/src/obj/elf.rs index 505bfb7..cd81306 100644 --- a/src/obj/elf.rs +++ b/src/obj/elf.rs @@ -126,13 +126,10 @@ fn symbols_by_section(obj_file: &File<'_>, section: &ObjSection) -> Result) -> Result> { - let mut result = Vec::::new(); - for symbol in obj_file.symbols() { - if symbol.is_common() { - result.push(to_obj_symbol(obj_file, &symbol, 0)?); - } - } - Ok(result) + obj_file.symbols() + .filter(Symbol::is_common) + .map(|symbol| to_obj_symbol(obj_file, &symbol, 0)) + .collect::>>() } fn find_section_symbol(