Skip to content

Commit a1237bc

Browse files
committed
Fix a few warnings
1 parent 089bc05 commit a1237bc

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/elf_sections.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ impl ElfSectionsTag {
4343
/// ```
4444
pub fn sections(&self) -> ElfSectionIter {
4545
let string_section_offset = (self.get().shndx * self.get().entry_size) as isize;
46-
let string_section_ptr = unsafe {
47-
self.first_section().offset(string_section_offset) as *const _
48-
};
46+
let string_section_ptr =
47+
unsafe { self.first_section().offset(string_section_offset) as *const _ };
4948
ElfSectionIter {
5049
current_section: self.first_section(),
5150
remaining_sections: self.get().number_of_sections,
@@ -152,8 +151,8 @@ impl ElfSection {
152151
9 => ElfSectionType::RelRelocation,
153152
10 => ElfSectionType::Reserved,
154153
11 => ElfSectionType::DynamicLoaderSymbolTable,
155-
0x6000_0000...0x6FFF_FFFF => ElfSectionType::EnvironmentSpecific,
156-
0x7000_0000...0x7FFF_FFFF => ElfSectionType::ProcessorSpecific,
154+
0x6000_0000..=0x6FFF_FFFF => ElfSectionType::EnvironmentSpecific,
155+
0x7000_0000..=0x7FFF_FFFF => ElfSectionType::ProcessorSpecific,
157156
_ => panic!(),
158157
}
159158
}
@@ -165,11 +164,9 @@ impl ElfSection {
165164

166165
/// Read the name of the section.
167166
pub fn name(&self) -> &str {
168-
use core::{str, slice};
167+
use core::{slice, str};
169168

170-
let name_ptr = unsafe {
171-
self.string_table().offset(self.get().name_index() as isize)
172-
};
169+
let name_ptr = unsafe { self.string_table().offset(self.get().name_index() as isize) };
173170
let strlen = {
174171
let mut len = 0;
175172
while unsafe { *name_ptr.offset(len) } != 0 {
@@ -218,7 +215,7 @@ impl ElfSection {
218215
self.flags().contains(ElfSectionFlags::ALLOCATED)
219216
}
220217

221-
fn get(&self) -> &ElfSectionInner {
218+
fn get(&self) -> &dyn ElfSectionInner {
222219
match self.entry_size {
223220
40 => unsafe { &*(self.inner as *const ElfSectionInner32) },
224221
64 => unsafe { &*(self.inner as *const ElfSectionInner64) },

0 commit comments

Comments
 (0)