@@ -205,35 +205,33 @@ impl Ord for Segment<'_> {
205
205
pub ( crate ) fn ram_segments < ' a > (
206
206
chip : Chip ,
207
207
elf : & ' a ElfFile < ' a > ,
208
- ) -> Box < dyn Iterator < Item = Segment < ' a > > + ' a > {
209
- Box :: new ( segments ( elf) . filter ( move |segment| !chip. addr_is_flash ( segment. addr ) ) )
208
+ ) -> impl Iterator < Item = Segment < ' a > > {
209
+ segments ( elf) . filter ( move |segment| !chip. addr_is_flash ( segment. addr ) )
210
210
}
211
211
212
212
/// Returns an iterator over all ROM segments for a given chip and ELF file.
213
213
pub ( crate ) fn rom_segments < ' a > (
214
214
chip : Chip ,
215
215
elf : & ' a ElfFile < ' a > ,
216
- ) -> Box < dyn Iterator < Item = Segment < ' a > > + ' a > {
217
- Box :: new ( segments ( elf) . filter ( move |segment| chip. addr_is_flash ( segment. addr ) ) )
216
+ ) -> impl Iterator < Item = Segment < ' a > > {
217
+ segments ( elf) . filter ( move |segment| chip. addr_is_flash ( segment. addr ) )
218
218
}
219
219
220
- fn segments < ' a > ( elf : & ' a ElfFile < ' a > ) -> Box < dyn Iterator < Item = Segment < ' a > > + ' a > {
221
- Box :: new (
222
- elf. sections ( )
223
- . filter ( |section| {
224
- let header = section. elf_section_header ( ) ;
225
-
226
- section. size ( ) > 0
227
- && header. sh_type ( Endianness :: Little ) == SHT_PROGBITS
228
- && header. sh_offset . get ( Endianness :: Little ) > 0
229
- && section. address ( ) > 0
230
- && !is_empty ( section. flags ( ) )
231
- } )
232
- . flat_map ( move |section| match section. data ( ) {
233
- Ok ( data) => Some ( Segment :: new ( section. address ( ) as u32 , data) ) ,
234
- _ => None ,
235
- } ) ,
236
- )
220
+ fn segments < ' a > ( elf : & ' a ElfFile < ' a > ) -> impl Iterator < Item = Segment < ' a > > {
221
+ elf. sections ( )
222
+ . filter ( |section| {
223
+ let header = section. elf_section_header ( ) ;
224
+
225
+ section. size ( ) > 0
226
+ && header. sh_type ( Endianness :: Little ) == SHT_PROGBITS
227
+ && header. sh_offset . get ( Endianness :: Little ) > 0
228
+ && section. address ( ) > 0
229
+ && !is_empty ( section. flags ( ) )
230
+ } )
231
+ . flat_map ( move |section| match section. data ( ) {
232
+ Ok ( data) => Some ( Segment :: new ( section. address ( ) as u32 , data) ) ,
233
+ _ => None ,
234
+ } )
237
235
}
238
236
239
237
fn is_empty ( flags : object:: SectionFlags ) -> bool {
0 commit comments