From c6455cd7463f77cde73ede7c16f6ad941b188a29 Mon Sep 17 00:00:00 2001 From: Philip Craig Date: Wed, 12 Apr 2023 12:15:59 +1000 Subject: [PATCH] Warn for rust 2018 idioms --- src/lib.rs | 1 + src/read/any.rs | 90 +++++++----------------------------- src/read/coff/symbol.rs | 2 +- src/read/elf/comdat.rs | 2 - src/read/elf/hash.rs | 4 +- src/read/elf/section.rs | 1 - src/read/elf/segment.rs | 1 - src/read/elf/symbol.rs | 3 -- src/read/elf/version.rs | 2 +- src/read/macho/file.rs | 1 - src/read/macho/relocation.rs | 1 - src/read/macho/section.rs | 2 - src/read/macho/segment.rs | 8 ++-- src/read/mod.rs | 2 +- src/read/pe/file.rs | 4 +- src/read/pe/resource.rs | 2 +- src/read/pe/section.rs | 2 - src/read/traits.rs | 2 +- src/read/wasm.rs | 5 +- src/read/xcoff/comdat.rs | 1 - src/read/xcoff/relocation.rs | 1 - src/read/xcoff/section.rs | 1 - src/read/xcoff/segment.rs | 2 - src/read/xcoff/symbol.rs | 3 -- src/write/mod.rs | 2 +- 25 files changed, 32 insertions(+), 113 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9e270dba..e17802c4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -58,6 +58,7 @@ #![deny(missing_docs)] #![deny(missing_debug_implementations)] #![no_std] +#![warn(rust_2018_idioms)] // Style. #![allow(clippy::collapsible_if)] #![allow(clippy::comparison_chain)] diff --git a/src/read/any.rs b/src/read/any.rs index 06af4abb..342ad75f 100644 --- a/src/read/any.rs +++ b/src/read/any.rs @@ -473,7 +473,7 @@ where } #[inline] - fn pdb_info(&self) -> Result> { + fn pdb_info(&self) -> Result>> { with_inner!(self.inner, FileInternal, |x| x.pdb_info()) } @@ -492,18 +492,12 @@ where /// An iterator over the segments of a `File`. #[derive(Debug)] -pub struct SegmentIterator<'data, 'file, R: ReadRef<'data> = &'data [u8]> -where - 'data: 'file, -{ +pub struct SegmentIterator<'data, 'file, R: ReadRef<'data> = &'data [u8]> { inner: SegmentIteratorInternal<'data, 'file, R>, } #[derive(Debug)] -enum SegmentIteratorInternal<'data, 'file, R: ReadRef<'data>> -where - 'data: 'file, -{ +enum SegmentIteratorInternal<'data, 'file, R: ReadRef<'data>> { #[cfg(feature = "coff")] Coff(coff::CoffSegmentIterator<'data, 'file, R>), #[cfg(feature = "coff")] @@ -538,18 +532,12 @@ impl<'data, 'file, R: ReadRef<'data>> Iterator for SegmentIterator<'data, 'file, } /// A segment of a `File`. -pub struct Segment<'data, 'file, R: ReadRef<'data> = &'data [u8]> -where - 'data: 'file, -{ +pub struct Segment<'data, 'file, R: ReadRef<'data> = &'data [u8]> { inner: SegmentInternal<'data, 'file, R>, } #[derive(Debug)] -enum SegmentInternal<'data, 'file, R: ReadRef<'data>> -where - 'data: 'file, -{ +enum SegmentInternal<'data, 'file, R: ReadRef<'data>> { #[cfg(feature = "coff")] Coff(coff::CoffSegment<'data, 'file, R>), #[cfg(feature = "coff")] @@ -635,19 +623,13 @@ impl<'data, 'file, R: ReadRef<'data>> ObjectSegment<'data> for Segment<'data, 'f /// An iterator of the sections of a `File`. #[derive(Debug)] -pub struct SectionIterator<'data, 'file, R: ReadRef<'data> = &'data [u8]> -where - 'data: 'file, -{ +pub struct SectionIterator<'data, 'file, R: ReadRef<'data> = &'data [u8]> { inner: SectionIteratorInternal<'data, 'file, R>, } // we wrap our enums in a struct so that they are kept private. #[derive(Debug)] -enum SectionIteratorInternal<'data, 'file, R: ReadRef<'data>> -where - 'data: 'file, -{ +enum SectionIteratorInternal<'data, 'file, R: ReadRef<'data>> { #[cfg(feature = "coff")] Coff(coff::CoffSectionIterator<'data, 'file, R>), #[cfg(feature = "coff")] @@ -682,17 +664,11 @@ impl<'data, 'file, R: ReadRef<'data>> Iterator for SectionIterator<'data, 'file, } /// A Section of a File -pub struct Section<'data, 'file, R: ReadRef<'data> = &'data [u8]> -where - 'data: 'file, -{ +pub struct Section<'data, 'file, R: ReadRef<'data> = &'data [u8]> { inner: SectionInternal<'data, 'file, R>, } -enum SectionInternal<'data, 'file, R: ReadRef<'data>> -where - 'data: 'file, -{ +enum SectionInternal<'data, 'file, R: ReadRef<'data>> { #[cfg(feature = "coff")] Coff(coff::CoffSection<'data, 'file, R>), #[cfg(feature = "coff")] @@ -819,18 +795,12 @@ impl<'data, 'file, R: ReadRef<'data>> ObjectSection<'data> for Section<'data, 'f /// An iterator of the COMDAT section groups of a `File`. #[derive(Debug)] -pub struct ComdatIterator<'data, 'file, R: ReadRef<'data> = &'data [u8]> -where - 'data: 'file, -{ +pub struct ComdatIterator<'data, 'file, R: ReadRef<'data> = &'data [u8]> { inner: ComdatIteratorInternal<'data, 'file, R>, } #[derive(Debug)] -enum ComdatIteratorInternal<'data, 'file, R: ReadRef<'data>> -where - 'data: 'file, -{ +enum ComdatIteratorInternal<'data, 'file, R: ReadRef<'data>> { #[cfg(feature = "coff")] Coff(coff::CoffComdatIterator<'data, 'file, R>), #[cfg(feature = "coff")] @@ -865,17 +835,11 @@ impl<'data, 'file, R: ReadRef<'data>> Iterator for ComdatIterator<'data, 'file, } /// A COMDAT section group of a `File`. -pub struct Comdat<'data, 'file, R: ReadRef<'data> = &'data [u8]> -where - 'data: 'file, -{ +pub struct Comdat<'data, 'file, R: ReadRef<'data> = &'data [u8]> { inner: ComdatInternal<'data, 'file, R>, } -enum ComdatInternal<'data, 'file, R: ReadRef<'data>> -where - 'data: 'file, -{ +enum ComdatInternal<'data, 'file, R: ReadRef<'data>> { #[cfg(feature = "coff")] Coff(coff::CoffComdat<'data, 'file, R>), #[cfg(feature = "coff")] @@ -945,18 +909,12 @@ impl<'data, 'file, R: ReadRef<'data>> ObjectComdat<'data> for Comdat<'data, 'fil /// An iterator over COMDAT section entries. #[derive(Debug)] -pub struct ComdatSectionIterator<'data, 'file, R: ReadRef<'data> = &'data [u8]> -where - 'data: 'file, -{ +pub struct ComdatSectionIterator<'data, 'file, R: ReadRef<'data> = &'data [u8]> { inner: ComdatSectionIteratorInternal<'data, 'file, R>, } #[derive(Debug)] -enum ComdatSectionIteratorInternal<'data, 'file, R: ReadRef<'data>> -where - 'data: 'file, -{ +enum ComdatSectionIteratorInternal<'data, 'file, R: ReadRef<'data>> { #[cfg(feature = "coff")] Coff(coff::CoffComdatSectionIterator<'data, 'file, R>), #[cfg(feature = "coff")] @@ -993,7 +951,6 @@ impl<'data, 'file, R: ReadRef<'data>> Iterator for ComdatSectionIterator<'data, #[derive(Debug)] pub struct SymbolTable<'data, 'file, R = &'data [u8]> where - 'data: 'file, R: ReadRef<'data>, { inner: SymbolTableInternal<'data, 'file, R>, @@ -1002,7 +959,6 @@ where #[derive(Debug)] enum SymbolTableInternal<'data, 'file, R> where - 'data: 'file, R: ReadRef<'data>, { #[cfg(feature = "coff")] @@ -1079,7 +1035,6 @@ impl<'data, 'file, R: ReadRef<'data>> ObjectSymbolTable<'data> for SymbolTable<' #[derive(Debug)] pub struct SymbolIterator<'data, 'file, R = &'data [u8]> where - 'data: 'file, R: ReadRef<'data>, { inner: SymbolIteratorInternal<'data, 'file, R>, @@ -1088,7 +1043,6 @@ where #[derive(Debug)] enum SymbolIteratorInternal<'data, 'file, R> where - 'data: 'file, R: ReadRef<'data>, { #[cfg(feature = "coff")] @@ -1159,7 +1113,6 @@ impl<'data, 'file, R: ReadRef<'data>> Iterator for SymbolIterator<'data, 'file, /// A symbol table entry. pub struct Symbol<'data, 'file, R = &'data [u8]> where - 'data: 'file, R: ReadRef<'data>, { inner: SymbolInternal<'data, 'file, R>, @@ -1167,7 +1120,6 @@ where enum SymbolInternal<'data, 'file, R> where - 'data: 'file, R: ReadRef<'data>, { #[cfg(feature = "coff")] @@ -1297,7 +1249,6 @@ impl<'data, 'file, R: ReadRef<'data>> ObjectSymbol<'data> for Symbol<'data, 'fil #[derive(Debug)] pub struct DynamicRelocationIterator<'data, 'file, R = &'data [u8]> where - 'data: 'file, R: ReadRef<'data>, { inner: DynamicRelocationIteratorInternal<'data, 'file, R>, @@ -1306,7 +1257,6 @@ where #[derive(Debug)] enum DynamicRelocationIteratorInternal<'data, 'file, R> where - 'data: 'file, R: ReadRef<'data>, { #[cfg(feature = "elf")] @@ -1334,18 +1284,12 @@ impl<'data, 'file, R: ReadRef<'data>> Iterator for DynamicRelocationIterator<'da /// An iterator over section relocation entries. #[derive(Debug)] -pub struct SectionRelocationIterator<'data, 'file, R: ReadRef<'data> = &'data [u8]> -where - 'data: 'file, -{ +pub struct SectionRelocationIterator<'data, 'file, R: ReadRef<'data> = &'data [u8]> { inner: SectionRelocationIteratorInternal<'data, 'file, R>, } #[derive(Debug)] -enum SectionRelocationIteratorInternal<'data, 'file, R: ReadRef<'data>> -where - 'data: 'file, -{ +enum SectionRelocationIteratorInternal<'data, 'file, R: ReadRef<'data>> { #[cfg(feature = "coff")] Coff(coff::CoffRelocationIterator<'data, 'file, R>), #[cfg(feature = "coff")] diff --git a/src/read/coff/symbol.rs b/src/read/coff/symbol.rs index 1c26d0a9..e95468d7 100644 --- a/src/read/coff/symbol.rs +++ b/src/read/coff/symbol.rs @@ -528,7 +528,7 @@ pub trait ImageSymbol: Debug + Pod { /// Return the symbol address. /// /// This takes into account the image base and the section address. - fn address(&self, image_base: u64, sections: &SectionTable) -> Result { + fn address(&self, image_base: u64, sections: &SectionTable<'_>) -> Result { let section_number = self.section_number() as usize; let section = sections.section(section_number)?; let virtual_address = u64::from(section.virtual_address.get(LE)); diff --git a/src/read/elf/comdat.rs b/src/read/elf/comdat.rs index 7cee85bb..1a2f2f44 100644 --- a/src/read/elf/comdat.rs +++ b/src/read/elf/comdat.rs @@ -18,7 +18,6 @@ pub type ElfComdatIterator64<'data, 'file, Endian = Endianness, R = &'data [u8]> #[derive(Debug)] pub struct ElfComdatIterator<'data, 'file, Elf, R = &'data [u8]> where - 'data: 'file, Elf: FileHeader, R: ReadRef<'data>, { @@ -140,7 +139,6 @@ pub type ElfComdatSectionIterator64<'data, 'file, Endian = Endianness, R = &'dat #[derive(Debug)] pub struct ElfComdatSectionIterator<'data, 'file, Elf, R = &'data [u8]> where - 'data: 'file, Elf: FileHeader, R: ReadRef<'data>, { diff --git a/src/read/elf/hash.rs b/src/read/elf/hash.rs index aa1039ac..aadbb920 100644 --- a/src/read/elf/hash.rs +++ b/src/read/elf/hash.rs @@ -45,7 +45,7 @@ impl<'data, Elf: FileHeader> HashTable<'data, Elf> { endian: Elf::Endian, name: &[u8], hash: u32, - version: Option<&Version>, + version: Option<&Version<'_>>, symbols: &SymbolTable<'data, Elf, R>, versions: &VersionTable<'data, Elf>, ) -> Option<(usize, &'data Elf::Sym)> { @@ -160,7 +160,7 @@ impl<'data, Elf: FileHeader> GnuHashTable<'data, Elf> { endian: Elf::Endian, name: &[u8], hash: u32, - version: Option<&Version>, + version: Option<&Version<'_>>, symbols: &SymbolTable<'data, Elf, R>, versions: &VersionTable<'data, Elf>, ) -> Option<(usize, &'data Elf::Sym)> { diff --git a/src/read/elf/section.rs b/src/read/elf/section.rs index 3b103dd3..df08f9e3 100644 --- a/src/read/elf/section.rs +++ b/src/read/elf/section.rs @@ -363,7 +363,6 @@ pub type ElfSection64<'data, 'file, Endian = Endianness, R = &'data [u8]> = #[derive(Debug)] pub struct ElfSection<'data, 'file, Elf, R = &'data [u8]> where - 'data: 'file, Elf: FileHeader, R: ReadRef<'data>, { diff --git a/src/read/elf/segment.rs b/src/read/elf/segment.rs index 445893c8..3972731e 100644 --- a/src/read/elf/segment.rs +++ b/src/read/elf/segment.rs @@ -57,7 +57,6 @@ pub type ElfSegment64<'data, 'file, Endian = Endianness, R = &'data [u8]> = #[derive(Debug)] pub struct ElfSegment<'data, 'file, Elf, R = &'data [u8]> where - 'data: 'file, Elf: FileHeader, R: ReadRef<'data>, { diff --git a/src/read/elf/symbol.rs b/src/read/elf/symbol.rs index d90f18d5..ac109570 100644 --- a/src/read/elf/symbol.rs +++ b/src/read/elf/symbol.rs @@ -208,7 +208,6 @@ pub type ElfSymbolTable64<'data, 'file, Endian = Endianness, R = &'data [u8]> = #[derive(Debug, Clone, Copy)] pub struct ElfSymbolTable<'data, 'file, Elf, R = &'data [u8]> where - 'data: 'file, Elf: FileHeader, R: ReadRef<'data>, { @@ -256,7 +255,6 @@ pub type ElfSymbolIterator64<'data, 'file, Endian = Endianness, R = &'data [u8]> /// An iterator over the symbols of an `ElfFile`. pub struct ElfSymbolIterator<'data, 'file, Elf, R = &'data [u8]> where - 'data: 'file, Elf: FileHeader, R: ReadRef<'data>, { @@ -302,7 +300,6 @@ pub type ElfSymbol64<'data, 'file, Endian = Endianness, R = &'data [u8]> = #[derive(Debug, Clone, Copy)] pub struct ElfSymbol<'data, 'file, Elf, R = &'data [u8]> where - 'data: 'file, Elf: FileHeader, R: ReadRef<'data>, { diff --git a/src/read/elf/version.rs b/src/read/elf/version.rs index 2811f26c..cc87bbef 100644 --- a/src/read/elf/version.rs +++ b/src/read/elf/version.rs @@ -188,7 +188,7 @@ impl<'data, Elf: FileHeader> VersionTable<'data, Elf> { /// Returns false for any error. /// /// Note: this function hasn't been fully tested and is likely to be incomplete. - pub fn matches(&self, endian: Elf::Endian, index: usize, need: Option<&Version>) -> bool { + pub fn matches(&self, endian: Elf::Endian, index: usize, need: Option<&Version<'_>>) -> bool { let version_index = self.version_index(endian, index); let def = match self.version(version_index) { Ok(def) => def, diff --git a/src/read/macho/file.rs b/src/read/macho/file.rs index ab8c0575..bc6fe258 100644 --- a/src/read/macho/file.rs +++ b/src/read/macho/file.rs @@ -531,7 +531,6 @@ pub type MachOComdatSectionIterator64<'data, 'file, Endian = Endianness, R = &'d #[derive(Debug)] pub struct MachOComdatSectionIterator<'data, 'file, Mach, R = &'data [u8]> where - 'data: 'file, Mach: MachHeader, R: ReadRef<'data>, { diff --git a/src/read/macho/relocation.rs b/src/read/macho/relocation.rs index 5dd7df89..35143f64 100644 --- a/src/read/macho/relocation.rs +++ b/src/read/macho/relocation.rs @@ -19,7 +19,6 @@ pub type MachORelocationIterator64<'data, 'file, Endian = Endianness, R = &'data /// An iterator over the relocations in a `MachOSection`. pub struct MachORelocationIterator<'data, 'file, Mach, R = &'data [u8]> where - 'data: 'file, Mach: MachHeader, R: ReadRef<'data>, { diff --git a/src/read/macho/section.rs b/src/read/macho/section.rs index d69174e5..f43a5b83 100644 --- a/src/read/macho/section.rs +++ b/src/read/macho/section.rs @@ -21,7 +21,6 @@ pub type MachOSectionIterator64<'data, 'file, Endian = Endianness, R = &'data [u /// An iterator over the sections of a `MachOFile`. pub struct MachOSectionIterator<'data, 'file, Mach, R = &'data [u8]> where - 'data: 'file, Mach: MachHeader, R: ReadRef<'data>, { @@ -66,7 +65,6 @@ pub type MachOSection64<'data, 'file, Endian = Endianness, R = &'data [u8]> = #[derive(Debug)] pub struct MachOSection<'data, 'file, Mach, R = &'data [u8]> where - 'data: 'file, Mach: MachHeader, R: ReadRef<'data>, { diff --git a/src/read/macho/segment.rs b/src/read/macho/segment.rs index c7eaa6ff..01037e1d 100644 --- a/src/read/macho/segment.rs +++ b/src/read/macho/segment.rs @@ -19,7 +19,6 @@ pub type MachOSegmentIterator64<'data, 'file, Endian = Endianness, R = &'data [u #[derive(Debug)] pub struct MachOSegmentIterator<'data, 'file, Mach, R = &'data [u8]> where - 'data: 'file, Mach: MachHeader, R: ReadRef<'data>, { @@ -53,7 +52,6 @@ pub type MachOSegment64<'data, 'file, Endian = Endianness, R = &'data [u8]> = #[derive(Debug)] pub struct MachOSegment<'data, 'file, Mach, R = &'data [u8]> where - 'data: 'file, Mach: MachHeader, R: ReadRef<'data>, { @@ -160,7 +158,7 @@ pub trait Segment: Debug + Pod { type Endian: endian::Endian; type Section: Section; - fn from_command(command: LoadCommandData) -> Result>; + fn from_command(command: LoadCommandData<'_, Self::Endian>) -> Result>; fn cmd(&self, endian: Self::Endian) -> u32; fn cmdsize(&self, endian: Self::Endian) -> u32; @@ -219,7 +217,7 @@ impl Segment for macho::SegmentCommand32 { type Endian = Endian; type Section = macho::Section32; - fn from_command(command: LoadCommandData) -> Result> { + fn from_command(command: LoadCommandData<'_, Self::Endian>) -> Result> { command.segment_32() } @@ -263,7 +261,7 @@ impl Segment for macho::SegmentCommand64 { type Endian = Endian; type Section = macho::Section64; - fn from_command(command: LoadCommandData) -> Result> { + fn from_command(command: LoadCommandData<'_, Self::Endian>) -> Result> { command.segment_64() } diff --git a/src/read/mod.rs b/src/read/mod.rs index 8a37dcd3..0a450359 100644 --- a/src/read/mod.rs +++ b/src/read/mod.rs @@ -70,7 +70,7 @@ pub struct Error(&'static str); impl fmt::Display for Error { #[inline] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.0) } } diff --git a/src/read/pe/file.rs b/src/read/pe/file.rs index 8dd85131..0f8ce9f2 100644 --- a/src/read/pe/file.rs +++ b/src/read/pe/file.rs @@ -80,7 +80,7 @@ where } /// Returns information about the rich header of this file (if any). - pub fn rich_header_info(&self) -> Option { + pub fn rich_header_info(&self) -> Option> { RichHeaderInfo::parse(self.data, self.dos_header.nt_headers_offset().into()) } @@ -298,7 +298,7 @@ where Ok(exports) } - fn pdb_info(&self) -> Result> { + fn pdb_info(&self) -> Result>> { let data_dir = match self.data_directory(pe::IMAGE_DIRECTORY_ENTRY_DEBUG) { Some(data_dir) => data_dir, None => return Ok(None), diff --git a/src/read/pe/resource.rs b/src/read/pe/resource.rs index e667f0d9..646eaefa 100644 --- a/src/read/pe/resource.rs +++ b/src/read/pe/resource.rs @@ -143,7 +143,7 @@ pub struct ResourceName { impl ResourceName { /// Converts to a `String`. - pub fn to_string_lossy(&self, directory: ResourceDirectory) -> Result { + pub fn to_string_lossy(&self, directory: ResourceDirectory<'_>) -> Result { let d = self.data(directory)?.iter().map(|c| c.get(LE)); Ok(char::decode_utf16(d) diff --git a/src/read/pe/section.rs b/src/read/pe/section.rs index 439d42da..2880e401 100644 --- a/src/read/pe/section.rs +++ b/src/read/pe/section.rs @@ -143,7 +143,6 @@ pub type PeSectionIterator64<'data, 'file, R = &'data [u8]> = #[derive(Debug)] pub struct PeSectionIterator<'data, 'file, Pe, R = &'data [u8]> where - 'data: 'file, Pe: ImageNtHeaders, R: ReadRef<'data>, { @@ -178,7 +177,6 @@ pub type PeSection64<'data, 'file, R = &'data [u8]> = #[derive(Debug)] pub struct PeSection<'data, 'file, Pe, R = &'data [u8]> where - 'data: 'file, Pe: ImageNtHeaders, R: ReadRef<'data>, { diff --git a/src/read/traits.rs b/src/read/traits.rs index a2bcc656..d35b0b0c 100644 --- a/src/read/traits.rs +++ b/src/read/traits.rs @@ -210,7 +210,7 @@ pub trait Object<'data: 'file, 'file>: read::private::Sealed { /// The filename and GUID from the PE CodeView section #[inline] - fn pdb_info(&self) -> Result> { + fn pdb_info(&self) -> Result>> { Ok(None) } diff --git a/src/read/wasm.rs b/src/read/wasm.rs index 9eade77f..16d39328 100644 --- a/src/read/wasm.rs +++ b/src/read/wasm.rs @@ -744,10 +744,7 @@ impl<'data, 'file, R> ObjectComdat<'data> for WasmComdat<'data, 'file, R> { /// An iterator over the sections in a COMDAT section group of a `WasmFile`. #[derive(Debug)] -pub struct WasmComdatSectionIterator<'data, 'file, R = &'data [u8]> -where - 'data: 'file, -{ +pub struct WasmComdatSectionIterator<'data, 'file, R = &'data [u8]> { #[allow(unused)] file: &'file WasmFile<'data, R>, } diff --git a/src/read/xcoff/comdat.rs b/src/read/xcoff/comdat.rs index eeed2f54..2b23d1db 100644 --- a/src/read/xcoff/comdat.rs +++ b/src/read/xcoff/comdat.rs @@ -109,7 +109,6 @@ pub type XcoffComdatSectionIterator64<'data, 'file, R = &'data [u8]> = #[derive(Debug)] pub struct XcoffComdatSectionIterator<'data, 'file, Xcoff, R = &'data [u8]> where - 'data: 'file, Xcoff: FileHeader, R: ReadRef<'data>, { diff --git a/src/read/xcoff/relocation.rs b/src/read/xcoff/relocation.rs index 8107a2e8..78c6acfc 100644 --- a/src/read/xcoff/relocation.rs +++ b/src/read/xcoff/relocation.rs @@ -19,7 +19,6 @@ pub type XcoffRelocationIterator64<'data, 'file, R = &'data [u8]> = /// An iterator over the relocations in a `XcoffSection`. pub struct XcoffRelocationIterator<'data, 'file, Xcoff, R = &'data [u8]> where - 'data: 'file, Xcoff: FileHeader, R: ReadRef<'data>, { diff --git a/src/read/xcoff/section.rs b/src/read/xcoff/section.rs index 0d351e85..77453fcd 100644 --- a/src/read/xcoff/section.rs +++ b/src/read/xcoff/section.rs @@ -54,7 +54,6 @@ pub type XcoffSection64<'data, 'file, R = &'data [u8]> = #[derive(Debug)] pub struct XcoffSection<'data, 'file, Xcoff, R = &'data [u8]> where - 'data: 'file, Xcoff: FileHeader, R: ReadRef<'data>, { diff --git a/src/read/xcoff/segment.rs b/src/read/xcoff/segment.rs index 49969438..7eca7236 100644 --- a/src/read/xcoff/segment.rs +++ b/src/read/xcoff/segment.rs @@ -19,7 +19,6 @@ pub type XcoffSegmentIterator64<'data, 'file, R = &'data [u8]> = #[derive(Debug)] pub struct XcoffSegmentIterator<'data, 'file, Xcoff, R = &'data [u8]> where - 'data: 'file, Xcoff: FileHeader, R: ReadRef<'data>, { @@ -50,7 +49,6 @@ pub type XcoffSegment64<'data, 'file, R = &'data [u8]> = #[derive(Debug)] pub struct XcoffSegment<'data, 'file, Xcoff, R = &'data [u8]> where - 'data: 'file, Xcoff: FileHeader, R: ReadRef<'data>, { diff --git a/src/read/xcoff/symbol.rs b/src/read/xcoff/symbol.rs index 4c17d1df..7ce215fa 100644 --- a/src/read/xcoff/symbol.rs +++ b/src/read/xcoff/symbol.rs @@ -145,7 +145,6 @@ pub type XcoffSymbolTable64<'data, 'file, R = &'data [u8]> = #[derive(Debug, Clone, Copy)] pub struct XcoffSymbolTable<'data, 'file, Xcoff, R = &'data [u8]> where - 'data: 'file, Xcoff: FileHeader, R: ReadRef<'data>, { @@ -193,7 +192,6 @@ pub type XcoffSymbolIterator64<'data, 'file, R = &'data [u8]> = /// An iterator over the symbols of an `XcoffFile`. pub struct XcoffSymbolIterator<'data, 'file, Xcoff, R = &'data [u8]> where - 'data: 'file, Xcoff: FileHeader, R: ReadRef<'data>, { @@ -240,7 +238,6 @@ pub type XcoffSymbol64<'data, 'file, R = &'data [u8]> = #[derive(Debug, Clone, Copy)] pub struct XcoffSymbol<'data, 'file, Xcoff, R = &'data [u8]> where - 'data: 'file, Xcoff: FileHeader, R: ReadRef<'data>, { diff --git a/src/write/mod.rs b/src/write/mod.rs index f89ec19c..da1a7de6 100644 --- a/src/write/mod.rs +++ b/src/write/mod.rs @@ -46,7 +46,7 @@ pub struct Error(String); impl fmt::Display for Error { #[inline] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(&self.0) } }