Skip to content

Commit fddcc47

Browse files
committed
build: fix unused function warning and upcoming lifetime warnings
1 parent d950c19 commit fddcc47

File tree

6 files changed

+11
-16
lines changed

6 files changed

+11
-16
lines changed

src/archive/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ impl<'a> Archive<'a> {
546546
/// Get the member named `member` in this archive, if any. If there are
547547
/// multiple files in the archive with the same name it only returns one
548548
/// of them.
549-
pub fn get(&self, member: &str) -> Option<&Member> {
549+
pub fn get(&self, member: &str) -> Option<&Member<'_>> {
550550
if let Some(idx) = self.members.get(member) {
551551
Some(&self.member_array[*idx])
552552
} else {
@@ -555,7 +555,7 @@ impl<'a> Archive<'a> {
555555
}
556556

557557
/// Get the member at position `index` in this archive, if any.
558-
pub fn get_at(&self, index: usize) -> Option<&Member> {
558+
pub fn get_at(&self, index: usize) -> Option<&Member<'_>> {
559559
self.member_array.get(index)
560560
}
561561

@@ -578,7 +578,7 @@ impl<'a> Archive<'a> {
578578
}
579579

580580
/// Gets a summary of this archive, returning a list of membername, the member, and the list of symbols the member contains
581-
pub fn summarize(&self) -> Vec<(&str, &Member, Vec<&'a str>)> {
581+
pub fn summarize(&self) -> Vec<(&str, &Member<'_>, Vec<&'a str>)> {
582582
// build a result array, with indexes matching the member indexes
583583
let mut result = self
584584
.member_array

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ if_everything! {
306306

307307
impl<'a> Object<'a> {
308308
/// Tries to parse an `Object` from `bytes`
309-
pub fn parse(bytes: &[u8]) -> error::Result<Object> {
309+
pub fn parse(bytes: &[u8]) -> error::Result<Object<'_>> {
310310
if let Some(hint_bytes) = take_hint_bytes(bytes) {
311311
match peek_bytes(hint_bytes)? {
312312
Hint::Elf(_) => Ok(Object::Elf(elf::Elf::parse(bytes)?)),

src/mach/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl<'a> MachO<'a> {
117117
/// Return a vector of the relocations in this binary
118118
pub fn relocations(
119119
&self,
120-
) -> error::Result<Vec<(usize, segment::RelocationIterator, segment::Section)>> {
120+
) -> error::Result<Vec<(usize, segment::RelocationIterator<'_>, segment::Section)>> {
121121
debug!("Iterating relocations");
122122
let mut relocs = Vec::new();
123123
for (_i, segment) in (&self.segments).into_iter().enumerate() {
@@ -131,15 +131,15 @@ impl<'a> MachO<'a> {
131131
Ok(relocs)
132132
}
133133
/// Return the exported symbols in this binary (if any)
134-
pub fn exports(&self) -> error::Result<Vec<exports::Export>> {
134+
pub fn exports(&self) -> error::Result<Vec<exports::Export<'_>>> {
135135
if let Some(ref trie) = self.export_trie {
136136
trie.exports(self.libs.as_slice())
137137
} else {
138138
Ok(vec![])
139139
}
140140
}
141141
/// Return the imported symbols in this binary that dyld knows about (if any)
142-
pub fn imports(&self) -> error::Result<Vec<imports::Import>> {
142+
pub fn imports(&self) -> error::Result<Vec<imports::Import<'_>>> {
143143
if let Some(ref interpreter) = self.bind_interpreter {
144144
interpreter.imports(self.libs.as_slice(), self.segments.as_slice(), self.ctx)
145145
} else {
@@ -391,7 +391,7 @@ pub fn peek_bytes(bytes: &[u8; 16]) -> error::Result<crate::Hint> {
391391
}
392392
}
393393

394-
fn extract_multi_entry(bytes: &[u8]) -> error::Result<SingleArch> {
394+
fn extract_multi_entry(bytes: &[u8]) -> error::Result<SingleArch<'_>> {
395395
if let Some(hint_bytes) = take_hint_bytes(bytes) {
396396
match peek_bytes(hint_bytes)? {
397397
crate::Hint::Mach(_) => {
@@ -455,7 +455,7 @@ impl<'a> MultiArch<'a> {
455455
})
456456
}
457457
/// Iterate every fat arch header
458-
pub fn iter_arches(&self) -> FatArchIterator {
458+
pub fn iter_arches(&self) -> FatArchIterator<'_> {
459459
FatArchIterator {
460460
index: 0,
461461
data: self.data,

src/options.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ impl ParseMode {
2020
pub(crate) fn is_permissive(&self) -> bool {
2121
matches!(self, ParseMode::Permissive)
2222
}
23-
24-
/// True if strict.
25-
pub(crate) fn is_strict(&self) -> bool {
26-
matches!(self, ParseMode::Strict)
27-
}
2823
}
2924

3025
/// Common parsing options.

src/pe/certificate_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pub(crate) fn enumerate_certificates(
156156
bytes: &[u8],
157157
table_virtual_address: u32,
158158
table_size: u32,
159-
) -> Result<CertificateDirectoryTable, error::Error> {
159+
) -> Result<CertificateDirectoryTable<'_>, error::Error> {
160160
let table_start_offset = usize::try_from(table_virtual_address).map_err(|_err| {
161161
error::Error::Malformed("Certificate table RVA do not fit in a usize".to_string())
162162
})?;

src/pe/relocation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ pub struct RelocationBlock<'a> {
427427

428428
impl RelocationBlock<'_> {
429429
/// Returns iterator for [`RelocationWord`]
430-
pub fn words(&self) -> RelocationWordIterator {
430+
pub fn words(&self) -> RelocationWordIterator<'_> {
431431
RelocationWordIterator {
432432
bytes: &self.bytes,
433433
offset: 0,

0 commit comments

Comments
 (0)