Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

Commit 86b2874

Browse files
committed
Removes std::borrow::Cow.
1 parent 8afc3cc commit 86b2874

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

src/elf.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use crate::{
2727
use crate::jit::{JitCompiler, JitProgram};
2828
use byteorder::{ByteOrder, LittleEndian};
2929
use std::{
30-
borrow::Cow,
3130
collections::{btree_map::Entry, BTreeMap},
3231
fmt::Debug,
3332
mem,
@@ -1075,12 +1074,7 @@ impl<C: ContextObject> Executable<C> {
10751074
let mut program_header: Option<&Elf64Phdr> = None;
10761075

10771076
// Fixup all the relocations in the relocation section if exists
1078-
for relocation in elf
1079-
.dynamic_relocations_table()
1080-
.unwrap_or(&[])
1081-
.iter()
1082-
.map(Cow::Borrowed)
1083-
{
1077+
for relocation in elf.dynamic_relocations_table().unwrap_or(&[]).iter() {
10841078
let mut r_offset = relocation.r_offset as usize;
10851079

10861080
// When sbpf_version.enable_elf_vaddr()=true, we allow section.sh_addr !=
@@ -1347,14 +1341,7 @@ impl<C: ContextObject> Executable<C> {
13471341

13481342
if config.enable_symbol_and_section_labels {
13491343
// Register all known function names from the symbol table
1350-
for symbol in elf
1351-
.symbol_table()
1352-
.ok()
1353-
.flatten()
1354-
.unwrap_or(&[])
1355-
.iter()
1356-
.map(Cow::Borrowed)
1357-
{
1344+
for symbol in elf.symbol_table().ok().flatten().unwrap_or(&[]).iter() {
13581345
if symbol.st_info & 0xEF != 0x02 {
13591346
continue;
13601347
}

0 commit comments

Comments
 (0)