From 49893a0b5420ca0480de0be97d6e579f9a40fe27 Mon Sep 17 00:00:00 2001 From: Sebastian Zivota Date: Fri, 29 Nov 2024 11:30:38 +0100 Subject: [PATCH 1/3] chore: Fix lints --- examples/minidump_stackwalk/src/main.rs | 2 +- symbolic-cabi/src/core.rs | 2 +- symbolic-cabi/src/proguard.rs | 2 +- symbolic-cfi/src/lib.rs | 2 +- symbolic-debuginfo/src/base.rs | 4 ++-- symbolic-debuginfo/src/breakpad.rs | 10 +++++----- symbolic-debuginfo/src/dwarf.rs | 6 +++--- symbolic-debuginfo/src/elf.rs | 2 +- symbolic-debuginfo/src/function_builder.rs | 4 ++-- symbolic-debuginfo/src/macho/bcsymbolmap.rs | 2 +- symbolic-debuginfo/src/macho/compact.rs | 5 ++--- symbolic-debuginfo/src/macho/mod.rs | 4 ++-- symbolic-debuginfo/src/object.rs | 6 +++--- symbolic-debuginfo/src/pdb.rs | 2 +- symbolic-debuginfo/src/pe.rs | 6 +++--- symbolic-debuginfo/src/ppdb.rs | 2 +- symbolic-debuginfo/src/sourcebundle.rs | 4 ++-- symbolic-debuginfo/src/wasm.rs | 2 +- symbolic-debuginfo/src/wasm/parser.rs | 2 +- symbolic-demangle/src/lib.rs | 2 +- symbolic-ppdb/src/cache/mod.rs | 2 +- symbolic-ppdb/src/format/metadata.rs | 8 ++++---- symbolic-ppdb/src/format/mod.rs | 2 +- symbolic-ppdb/src/format/sequence_points.rs | 2 +- symbolic-sourcemapcache/src/lookup.rs | 2 +- symbolic-symcache/src/lib.rs | 2 +- symbolic-symcache/src/lookup.rs | 6 +++--- symbolic-symcache/src/transform/mod.rs | 2 +- 28 files changed, 48 insertions(+), 49 deletions(-) diff --git a/examples/minidump_stackwalk/src/main.rs b/examples/minidump_stackwalk/src/main.rs index fd6a53029..b7bf9c66f 100644 --- a/examples/minidump_stackwalk/src/main.rs +++ b/examples/minidump_stackwalk/src/main.rs @@ -262,7 +262,7 @@ impl<'a> LocalSymbolProvider<'a> { } #[async_trait] -impl<'a> minidump_unwind::SymbolProvider for LocalSymbolProvider<'a> { +impl minidump_unwind::SymbolProvider for LocalSymbolProvider<'_> { #[tracing::instrument( skip(self, module, frame), fields(module.id, frame.instruction = frame.get_instruction()) diff --git a/symbolic-cabi/src/core.rs b/symbolic-cabi/src/core.rs index 6e0d8e922..77e8b25aa 100644 --- a/symbolic-cabi/src/core.rs +++ b/symbolic-cabi/src/core.rs @@ -87,7 +87,7 @@ impl From for SymbolicStr { } } -impl<'a> From<&'a str> for SymbolicStr { +impl From<&str> for SymbolicStr { fn from(string: &str) -> SymbolicStr { SymbolicStr::new(string) } diff --git a/symbolic-cabi/src/proguard.rs b/symbolic-cabi/src/proguard.rs index 02798312e..92c91caec 100644 --- a/symbolic-cabi/src/proguard.rs +++ b/symbolic-cabi/src/proguard.rs @@ -33,7 +33,7 @@ struct Inner<'a> { impl<'slf, 'a: 'slf> AsSelf<'slf> for Inner<'a> { type Ref = Inner<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { self } } diff --git a/symbolic-cfi/src/lib.rs b/symbolic-cfi/src/lib.rs index 7bc69b7ab..089a98b88 100644 --- a/symbolic-cfi/src/lib.rs +++ b/symbolic-cfi/src/lib.rs @@ -1198,7 +1198,7 @@ struct CfiCacheV1<'a> { byteview: ByteView<'a>, } -impl<'a> CfiCacheV1<'a> { +impl CfiCacheV1<'_> { pub fn raw(&self) -> &[u8] { &self.byteview } diff --git a/symbolic-debuginfo/src/base.rs b/symbolic-debuginfo/src/base.rs index 256ff2f59..794437275 100644 --- a/symbolic-debuginfo/src/base.rs +++ b/symbolic-debuginfo/src/base.rs @@ -235,7 +235,7 @@ pub struct Symbol<'data> { pub size: u64, } -impl<'data> Symbol<'data> { +impl Symbol<'_> { /// Returns the name of this symbol as string. pub fn name(&self) -> Option<&str> { self.name.as_ref().map(Cow::as_ref) @@ -251,7 +251,7 @@ impl<'data> Symbol<'data> { } } -impl<'d> fmt::Debug for Symbol<'d> { +impl fmt::Debug for Symbol<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Symbol") .field("name", &self.name().unwrap_or("")) diff --git a/symbolic-debuginfo/src/breakpad.rs b/symbolic-debuginfo/src/breakpad.rs index 6c91aedbf..94e4803c4 100644 --- a/symbolic-debuginfo/src/breakpad.rs +++ b/symbolic-debuginfo/src/breakpad.rs @@ -605,7 +605,7 @@ pub struct BreakpadLineRecords<'d> { finished: bool, } -impl<'d> Iterator for BreakpadLineRecords<'d> { +impl Iterator for BreakpadLineRecords<'_> { type Item = Result; fn next(&mut self) -> Option { @@ -752,13 +752,13 @@ impl<'d> BreakpadStackCfiRecord<'d> { } } -impl<'d> PartialEq for BreakpadStackCfiRecord<'d> { +impl PartialEq for BreakpadStackCfiRecord<'_> { fn eq(&self, other: &Self) -> bool { self.start == other.start && self.size == other.size && self.init_rules == other.init_rules } } -impl<'d> Eq for BreakpadStackCfiRecord<'d> {} +impl Eq for BreakpadStackCfiRecord<'_> {} /// An iterator over stack cfi delta records associated with a particular /// [`BreakpadStackCfiRecord`]. @@ -1263,7 +1263,7 @@ pub struct BreakpadDebugSession<'data> { lines: Lines<'data>, } -impl<'data> BreakpadDebugSession<'data> { +impl BreakpadDebugSession<'_> { /// Returns an iterator over all functions in this debug file. pub fn functions(&self) -> BreakpadFunctionIterator<'_> { BreakpadFunctionIterator::new(&self.file_map, self.lines.clone()) @@ -1285,7 +1285,7 @@ impl<'data> BreakpadDebugSession<'data> { } } -impl<'data, 'session> DebugSession<'session> for BreakpadDebugSession<'data> { +impl<'session> DebugSession<'session> for BreakpadDebugSession<'_> { type Error = BreakpadError; type FunctionIterator = BreakpadFunctionIterator<'session>; type FileIterator = BreakpadFileIterator<'session>; diff --git a/symbolic-debuginfo/src/dwarf.rs b/symbolic-debuginfo/src/dwarf.rs index e9d32922a..b33bf648b 100644 --- a/symbolic-debuginfo/src/dwarf.rs +++ b/symbolic-debuginfo/src/dwarf.rs @@ -366,7 +366,7 @@ struct UnitRef<'d, 'a> { unit: &'a Unit<'d>, } -impl<'d, 'a> UnitRef<'d, 'a> { +impl<'d> UnitRef<'d, '_> { /// Resolve the binary value of an attribute. #[inline(always)] fn slice_value(&self, value: AttributeValue>) -> Option<&'d [u8]> { @@ -996,7 +996,7 @@ struct FunctionsOutput<'a, 'd> { pub seen_ranges: &'a mut BTreeSet<(u64, u64)>, } -impl<'a, 'd> FunctionsOutput<'a, 'd> { +impl<'a> FunctionsOutput<'a, '_> { pub fn with_seen_ranges(seen_ranges: &'a mut BTreeSet<(u64, u64)>) -> Self { Self { functions: Vec::new(), @@ -1356,7 +1356,7 @@ impl<'data> DwarfDebugSession<'data> { } } -impl<'data, 'session> DebugSession<'session> for DwarfDebugSession<'data> { +impl<'session> DebugSession<'session> for DwarfDebugSession<'_> { type Error = DwarfError; type FunctionIterator = DwarfFunctionIterator<'session>; type FileIterator = DwarfFileIterator<'session>; diff --git a/symbolic-debuginfo/src/elf.rs b/symbolic-debuginfo/src/elf.rs index 6ddb2f298..cdaddb4a9 100644 --- a/symbolic-debuginfo/src/elf.rs +++ b/symbolic-debuginfo/src/elf.rs @@ -863,7 +863,7 @@ pub struct ElfSymbolIterator<'data, 'object> { load_addr: u64, } -impl<'data, 'object> Iterator for ElfSymbolIterator<'data, 'object> { +impl<'data> Iterator for ElfSymbolIterator<'data, '_> { type Item = Symbol<'data>; fn next(&mut self) -> Option { diff --git a/symbolic-debuginfo/src/function_builder.rs b/symbolic-debuginfo/src/function_builder.rs index af1ff4fd7..0bc2cad07 100644 --- a/symbolic-debuginfo/src/function_builder.rs +++ b/symbolic-debuginfo/src/function_builder.rs @@ -237,14 +237,14 @@ struct FunctionBuilderInlinee<'s> { } /// Implement ordering in DFS order, i.e. first by address and then by depth. -impl<'s> PartialOrd for FunctionBuilderInlinee<'s> { +impl PartialOrd for FunctionBuilderInlinee<'_> { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } } /// Implement ordering in DFS order, i.e. first by address and then by depth. -impl<'s> Ord for FunctionBuilderInlinee<'s> { +impl Ord for FunctionBuilderInlinee<'_> { fn cmp(&self, other: &Self) -> std::cmp::Ordering { (self.address, self.depth).cmp(&(other.address, other.depth)) } diff --git a/symbolic-debuginfo/src/macho/bcsymbolmap.rs b/symbolic-debuginfo/src/macho/bcsymbolmap.rs index 6a4c15e47..59dbf98a1 100644 --- a/symbolic-debuginfo/src/macho/bcsymbolmap.rs +++ b/symbolic-debuginfo/src/macho/bcsymbolmap.rs @@ -194,7 +194,7 @@ pub struct BcSymbolMapIterator<'a, 'd> { iter: std::slice::Iter<'a, &'d str>, } -impl<'a, 'd> Iterator for BcSymbolMapIterator<'a, 'd> { +impl<'d> Iterator for BcSymbolMapIterator<'_, 'd> { type Item = &'d str; fn next(&mut self) -> Option { diff --git a/symbolic-debuginfo/src/macho/compact.rs b/symbolic-debuginfo/src/macho/compact.rs index db40d21b0..716e2de52 100644 --- a/symbolic-debuginfo/src/macho/compact.rs +++ b/symbolic-debuginfo/src/macho/compact.rs @@ -2103,10 +2103,9 @@ mod test { const COMPRESSED_PAGE_KIND: u32 = 3; fn align(offset: u32, align: u32) -> u32 { - // Adding `align - 1` to a value push unaligned values to the next multiple, - // and integer division + multiplication can then remove the remainder. - ((offset + align - 1) / align) * align + offset.div_ceil(align) * align } + fn pack_x86_rbp_registers(regs: [u8; 5]) -> u32 { let mut result: u32 = 0; let base_offset = 0; diff --git a/symbolic-debuginfo/src/macho/mod.rs b/symbolic-debuginfo/src/macho/mod.rs index 7fd53b399..dc858e788 100644 --- a/symbolic-debuginfo/src/macho/mod.rs +++ b/symbolic-debuginfo/src/macho/mod.rs @@ -559,7 +559,7 @@ pub struct FatMachObjectIterator<'d, 'a> { data: &'d [u8], } -impl<'d, 'a> Iterator for FatMachObjectIterator<'d, 'a> { +impl<'d> Iterator for FatMachObjectIterator<'d, '_> { type Item = Result, MachError>; fn next(&mut self) -> Option { @@ -661,7 +661,7 @@ enum MachObjectIteratorInner<'d, 'a> { /// An iterator over objects in a [`MachArchive`](struct.MachArchive.html). pub struct MachObjectIterator<'d, 'a>(MachObjectIteratorInner<'d, 'a>); -impl<'d, 'a> Iterator for MachObjectIterator<'d, 'a> { +impl<'d> Iterator for MachObjectIterator<'d, '_> { type Item = Result, MachError>; fn next(&mut self) -> Option { diff --git a/symbolic-debuginfo/src/object.rs b/symbolic-debuginfo/src/object.rs index e3281ce7f..1ebb1148c 100644 --- a/symbolic-debuginfo/src/object.rs +++ b/symbolic-debuginfo/src/object.rs @@ -449,7 +449,7 @@ pub enum ObjectDebugSession<'d> { PortablePdb(PortablePdbDebugSession<'d>), } -impl<'d> ObjectDebugSession<'d> { +impl ObjectDebugSession<'_> { /// Returns an iterator over all functions in this debug file. /// /// Functions are iterated in the order they are declared in their compilation units. The @@ -606,7 +606,7 @@ pub enum SymbolIterator<'data, 'object> { PortablePdb(PortablePdbSymbolIterator<'data>), } -impl<'data, 'object> Iterator for SymbolIterator<'data, 'object> { +impl<'data> Iterator for SymbolIterator<'data, '_> { type Item = Symbol<'data>; fn next(&mut self) -> Option { @@ -778,7 +778,7 @@ enum ObjectIteratorInner<'d, 'a> { /// An iterator over [`Object`](enum.Object.html)s in an [`Archive`](struct.Archive.html). pub struct ObjectIterator<'d, 'a>(ObjectIteratorInner<'d, 'a>); -impl<'d, 'a> Iterator for ObjectIterator<'d, 'a> { +impl<'d> Iterator for ObjectIterator<'d, '_> { type Item = Result, ObjectError>; fn next(&mut self) -> Option { diff --git a/symbolic-debuginfo/src/pdb.rs b/symbolic-debuginfo/src/pdb.rs index dd2a24c9a..bad07160e 100644 --- a/symbolic-debuginfo/src/pdb.rs +++ b/symbolic-debuginfo/src/pdb.rs @@ -434,7 +434,7 @@ pub struct PdbSymbolIterator<'data, 'object> { executable_sections: &'object ExecutableSections, } -impl<'data, 'object> Iterator for PdbSymbolIterator<'data, 'object> { +impl<'data> Iterator for PdbSymbolIterator<'data, '_> { type Item = Symbol<'data>; fn next(&mut self) -> Option { diff --git a/symbolic-debuginfo/src/pe.rs b/symbolic-debuginfo/src/pe.rs index 146226e8e..c4a371382 100644 --- a/symbolic-debuginfo/src/pe.rs +++ b/symbolic-debuginfo/src/pe.rs @@ -463,7 +463,7 @@ pub struct PeSymbolIterator<'data, 'object> { exports: std::slice::Iter<'object, pe::export::Export<'data>>, } -impl<'data, 'object> Iterator for PeSymbolIterator<'data, 'object> { +impl<'data> Iterator for PeSymbolIterator<'data, '_> { type Item = Symbol<'data>; fn next(&mut self) -> Option { @@ -506,9 +506,9 @@ pub struct PeEmbeddedPortablePDB<'data> { uncompressed_size: usize, } -impl<'data, 'object> PeEmbeddedPortablePDB<'data> { +impl PeEmbeddedPortablePDB<'_> { /// Returns the uncompressed size of the Portable PDB buffer. - pub fn get_size(&'object self) -> usize { + pub fn get_size(&self) -> usize { self.uncompressed_size } diff --git a/symbolic-debuginfo/src/ppdb.rs b/symbolic-debuginfo/src/ppdb.rs index 25ae919f8..05219f294 100644 --- a/symbolic-debuginfo/src/ppdb.rs +++ b/symbolic-debuginfo/src/ppdb.rs @@ -214,7 +214,7 @@ impl<'data> PortablePdbDebugSession<'data> { } } -impl<'data, 'session> DebugSession<'session> for PortablePdbDebugSession<'data> { +impl<'session> DebugSession<'session> for PortablePdbDebugSession<'_> { type Error = FormatError; type FunctionIterator = PortablePdbFunctionIterator<'session>; type FileIterator = PortablePdbFileIterator<'session>; diff --git a/symbolic-debuginfo/src/sourcebundle.rs b/symbolic-debuginfo/src/sourcebundle.rs index 4ab5d05ab..4eeeb8e7d 100644 --- a/symbolic-debuginfo/src/sourcebundle.rs +++ b/symbolic-debuginfo/src/sourcebundle.rs @@ -880,7 +880,7 @@ pub struct SourceBundleDebugSession<'data> { source_links: SourceLinkMappings, } -impl<'data> SourceBundleDebugSession<'data> { +impl SourceBundleDebugSession<'_> { /// Returns an iterator over all source files in this debug file. pub fn files(&self) -> SourceBundleFileIterator<'_> { SourceBundleFileIterator { @@ -970,7 +970,7 @@ impl<'data> SourceBundleDebugSession<'data> { } } -impl<'data, 'session> DebugSession<'session> for SourceBundleDebugSession<'data> { +impl<'session> DebugSession<'session> for SourceBundleDebugSession<'_> { type Error = SourceBundleError; type FunctionIterator = SourceBundleFunctionIterator<'session>; type FileIterator = SourceBundleFileIterator<'session>; diff --git a/symbolic-debuginfo/src/wasm.rs b/symbolic-debuginfo/src/wasm.rs index 1454f2f49..a23bc3a31 100644 --- a/symbolic-debuginfo/src/wasm.rs +++ b/symbolic-debuginfo/src/wasm.rs @@ -278,7 +278,7 @@ pub struct WasmSymbolIterator<'data, 'object> { _marker: std::marker::PhantomData<&'object u8>, } -impl<'data, 'object> Iterator for WasmSymbolIterator<'data, 'object> { +impl<'data> Iterator for WasmSymbolIterator<'data, '_> { type Item = Symbol<'data>; fn next(&mut self) -> Option { diff --git a/symbolic-debuginfo/src/wasm/parser.rs b/symbolic-debuginfo/src/wasm/parser.rs index 3ce02f157..183f3091e 100644 --- a/symbolic-debuginfo/src/wasm/parser.rs +++ b/symbolic-debuginfo/src/wasm/parser.rs @@ -20,7 +20,7 @@ impl BitVec { pub fn resize(&mut self, count: usize, value: bool) { self.data.resize( - (count + u64::BITS as usize - 1) / u64::BITS as usize, + count.div_ceil(u64::BITS as usize), if value { u64::MAX } else { u64::MIN }, ); self.len = count; diff --git a/symbolic-demangle/src/lib.rs b/symbolic-demangle/src/lib.rs index b6a3ec031..acc9c3cb1 100644 --- a/symbolic-demangle/src/lib.rs +++ b/symbolic-demangle/src/lib.rs @@ -416,7 +416,7 @@ pub trait Demangle { fn try_demangle(&self, opts: DemangleOptions) -> Cow<'_, str>; } -impl<'a> Demangle for Name<'a> { +impl Demangle for Name<'_> { fn detect_language(&self) -> Language { if self.language() != Language::Unknown { return self.language(); diff --git a/symbolic-ppdb/src/cache/mod.rs b/symbolic-ppdb/src/cache/mod.rs index 6330e9dad..d1de297ce 100644 --- a/symbolic-ppdb/src/cache/mod.rs +++ b/symbolic-ppdb/src/cache/mod.rs @@ -207,7 +207,7 @@ impl<'data> PortablePdbCache<'data> { } } -impl<'data> std::fmt::Debug for PortablePdbCache<'data> { +impl std::fmt::Debug for PortablePdbCache<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("PortablePdbCache") .field("version", &self.header.version) diff --git a/symbolic-ppdb/src/format/metadata.rs b/symbolic-ppdb/src/format/metadata.rs index ee11a7da5..88e451b45 100644 --- a/symbolic-ppdb/src/format/metadata.rs +++ b/symbolic-ppdb/src/format/metadata.rs @@ -128,7 +128,7 @@ pub struct Table<'data> { contents: &'data [u8], } -impl<'data> fmt::Debug for Table<'data> { +impl fmt::Debug for Table<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let cols: Vec = self .columns @@ -231,7 +231,7 @@ pub(crate) struct Row<'data> { table: &'data Table<'data>, } -impl<'data> Row<'data> { +impl Row<'_> { /// Reads the `col` cell in the given table as a `u32`. /// /// This returns an error if the indices are out of bounds for the table @@ -861,7 +861,7 @@ impl<'data> Index for MetadataStream<'data> { } } -impl<'data> IndexMut for MetadataStream<'data> { +impl IndexMut for MetadataStream<'_> { fn index_mut(&mut self, index: TableType) -> &mut Self::Output { &mut self.tables[index as usize] } @@ -910,7 +910,7 @@ macro_rules! ok_or_return { }; } -impl<'data> Iterator for CustomDebugInformationIterator<'data> { +impl Iterator for CustomDebugInformationIterator<'_> { type Item = Result; fn next(&mut self) -> Option { diff --git a/symbolic-ppdb/src/format/mod.rs b/symbolic-ppdb/src/format/mod.rs index 3f9e2dd85..d76847d13 100644 --- a/symbolic-ppdb/src/format/mod.rs +++ b/symbolic-ppdb/src/format/mod.rs @@ -442,7 +442,7 @@ impl<'object, 'data> EmbeddedSourceIterator<'object, 'data> { } } -impl<'object, 'data> Iterator for EmbeddedSourceIterator<'object, 'data> { +impl<'data> Iterator for EmbeddedSourceIterator<'_, 'data> { type Item = Result, FormatError>; fn next(&mut self) -> Option { diff --git a/symbolic-ppdb/src/format/sequence_points.rs b/symbolic-ppdb/src/format/sequence_points.rs index 476dad4e3..dd8e46088 100644 --- a/symbolic-ppdb/src/format/sequence_points.rs +++ b/symbolic-ppdb/src/format/sequence_points.rs @@ -266,7 +266,7 @@ pub(crate) struct SequencePoints<'data, 'ppdb> { count: usize, } -impl<'data, 'ppdb> Iterator for SequencePoints<'data, 'ppdb> { +impl Iterator for SequencePoints<'_, '_> { type Item = Result, FormatError>; fn next(&mut self) -> Option { diff --git a/symbolic-sourcemapcache/src/lookup.rs b/symbolic-sourcemapcache/src/lookup.rs index 2f5c6d8d7..d1d70e0e9 100644 --- a/symbolic-sourcemapcache/src/lookup.rs +++ b/symbolic-sourcemapcache/src/lookup.rs @@ -87,7 +87,7 @@ impl<'slf, 'a: 'slf> AsSelf<'slf> for SourceMapCache<'a> { } } -impl<'data> std::fmt::Debug for SourceMapCache<'data> { +impl std::fmt::Debug for SourceMapCache<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("SourceMapCache") .field("version", &self.header.version) diff --git a/symbolic-symcache/src/lib.rs b/symbolic-symcache/src/lib.rs index 670f03d21..3eddb8a70 100644 --- a/symbolic-symcache/src/lib.rs +++ b/symbolic-symcache/src/lib.rs @@ -147,7 +147,7 @@ pub struct SymCache<'data> { string_bytes: &'data [u8], } -impl<'data> std::fmt::Debug for SymCache<'data> { +impl std::fmt::Debug for SymCache<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("SymCache") .field("version", &self.header.version) diff --git a/symbolic-symcache/src/lookup.rs b/symbolic-symcache/src/lookup.rs index 9c1a4f4a9..f5eccb1e6 100644 --- a/symbolic-symcache/src/lookup.rs +++ b/symbolic-symcache/src/lookup.rs @@ -91,7 +91,7 @@ pub struct File<'data> { name: &'data str, } -impl<'data> File<'data> { +impl File<'_> { /// Returns this file's full path. pub fn full_path(&self) -> String { let comp_dir = self.comp_dir.unwrap_or_default(); @@ -135,7 +135,7 @@ impl<'data> Function<'data> { } } -impl<'data> Default for Function<'data> { +impl Default for Function<'_> { fn default() -> Self { Self { name: "?", @@ -155,7 +155,7 @@ pub struct SourceLocation<'data, 'cache> { pub(crate) source_location: &'data raw::SourceLocation, } -impl<'data, 'cache> SourceLocation<'data, 'cache> { +impl<'data> SourceLocation<'data, '_> { /// The source line corresponding to the instruction. /// /// 0 denotes an unknown line number. diff --git a/symbolic-symcache/src/transform/mod.rs b/symbolic-symcache/src/transform/mod.rs index 1dda26090..453a87ec5 100644 --- a/symbolic-symcache/src/transform/mod.rs +++ b/symbolic-symcache/src/transform/mod.rs @@ -58,7 +58,7 @@ pub trait Transformer { #[derive(Default)] pub(crate) struct Transformers<'a>(pub Vec>); -impl<'a> std::fmt::Debug for Transformers<'a> { +impl std::fmt::Debug for Transformers<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let len = self.0.len(); f.debug_tuple("Transformers").field(&len).finish() From 9381057f76a3cbd4e2cc6de931a40a8f14ec610a Mon Sep 17 00:00:00 2001 From: Sebastian Zivota Date: Fri, 29 Nov 2024 11:40:22 +0100 Subject: [PATCH 2/3] Forgot a bunch --- symbolic-common/src/cell.rs | 16 ++++++++-------- symbolic-debuginfo/src/breakpad.rs | 2 +- symbolic-debuginfo/src/dwarf.rs | 4 ++-- symbolic-debuginfo/src/elf.rs | 2 +- symbolic-debuginfo/src/macho/bcsymbolmap.rs | 2 +- symbolic-debuginfo/src/macho/mod.rs | 6 +++--- symbolic-debuginfo/src/object.rs | 4 ++-- symbolic-debuginfo/src/pdb.rs | 8 ++++---- symbolic-debuginfo/src/pe.rs | 2 +- symbolic-debuginfo/src/sourcebundle.rs | 4 ++-- symbolic-debuginfo/src/wasm.rs | 2 +- symbolic-ppdb/src/cache/mod.rs | 2 +- symbolic-sourcemapcache/src/lookup.rs | 2 +- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/symbolic-common/src/cell.rs b/symbolic-common/src/cell.rs index 19ce3d4eb..671422a40 100644 --- a/symbolic-common/src/cell.rs +++ b/symbolic-common/src/cell.rs @@ -80,7 +80,7 @@ pub trait AsSelf<'slf> { type Ref: ?Sized; /// Returns a reference to `self` with downcasted lifetime. - fn as_self(&'slf self) -> &Self::Ref; + fn as_self(&'slf self) -> &'slf Self::Ref; } impl AsSelf<'_> for u8 { @@ -106,7 +106,7 @@ where { type Ref = [T::Ref]; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { unsafe { &*(self as *const [T] as *const [T::Ref]) } } } @@ -117,7 +117,7 @@ where { type Ref = T::Ref; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { (*self).as_self() } } @@ -128,7 +128,7 @@ where { type Ref = T::Ref; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { (**self).as_self() } } @@ -140,7 +140,7 @@ where { type Ref = [T::Ref]; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { (**self).as_self() } } @@ -151,7 +151,7 @@ where { type Ref = T::Ref; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { (**self).as_self() } } @@ -162,7 +162,7 @@ where { type Ref = T::Ref; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { (**self).as_self() } } @@ -368,7 +368,7 @@ mod tests { impl<'slf> AsSelf<'slf> for Foo<'_> { type Ref = Foo<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { self } } diff --git a/symbolic-debuginfo/src/breakpad.rs b/symbolic-debuginfo/src/breakpad.rs index 94e4803c4..2713580d6 100644 --- a/symbolic-debuginfo/src/breakpad.rs +++ b/symbolic-debuginfo/src/breakpad.rs @@ -1159,7 +1159,7 @@ impl fmt::Debug for BreakpadObject<'_> { impl<'slf, 'data: 'slf> AsSelf<'slf> for BreakpadObject<'data> { type Ref = BreakpadObject<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { self } } diff --git a/symbolic-debuginfo/src/dwarf.rs b/symbolic-debuginfo/src/dwarf.rs index b33bf648b..541a5e6f2 100644 --- a/symbolic-debuginfo/src/dwarf.rs +++ b/symbolic-debuginfo/src/dwarf.rs @@ -1230,7 +1230,7 @@ impl<'d> DwarfInfo<'d> { } /// Returns an iterator over all compilation units. - fn units(&'d self, bcsymbolmap: Option<&'d BcSymbolMap<'d>>) -> DwarfUnitIterator<'_> { + fn units(&'d self, bcsymbolmap: Option<&'d BcSymbolMap<'d>>) -> DwarfUnitIterator<'d> { DwarfUnitIterator { info: self, bcsymbolmap, @@ -1242,7 +1242,7 @@ impl<'d> DwarfInfo<'d> { impl<'slf, 'd: 'slf> AsSelf<'slf> for DwarfInfo<'d> { type Ref = DwarfInfo<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { unsafe { std::mem::transmute(self) } } } diff --git a/symbolic-debuginfo/src/elf.rs b/symbolic-debuginfo/src/elf.rs index cdaddb4a9..768e122e1 100644 --- a/symbolic-debuginfo/src/elf.rs +++ b/symbolic-debuginfo/src/elf.rs @@ -746,7 +746,7 @@ impl fmt::Debug for ElfObject<'_> { impl<'slf, 'data: 'slf> AsSelf<'slf> for ElfObject<'data> { type Ref = ElfObject<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { self } } diff --git a/symbolic-debuginfo/src/macho/bcsymbolmap.rs b/symbolic-debuginfo/src/macho/bcsymbolmap.rs index 59dbf98a1..bd9c6c70d 100644 --- a/symbolic-debuginfo/src/macho/bcsymbolmap.rs +++ b/symbolic-debuginfo/src/macho/bcsymbolmap.rs @@ -78,7 +78,7 @@ impl From for BcSymbolMapError { impl<'slf> AsSelf<'slf> for BcSymbolMap<'_> { type Ref = BcSymbolMap<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { self } } diff --git a/symbolic-debuginfo/src/macho/mod.rs b/symbolic-debuginfo/src/macho/mod.rs index dc858e788..d09f47676 100644 --- a/symbolic-debuginfo/src/macho/mod.rs +++ b/symbolic-debuginfo/src/macho/mod.rs @@ -375,7 +375,7 @@ impl fmt::Debug for MachObject<'_> { impl<'slf, 'd: 'slf> AsSelf<'slf> for MachObject<'d> { type Ref = MachObject<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { self } } @@ -647,7 +647,7 @@ impl fmt::Debug for FatMachO<'_> { impl<'slf, 'd: 'slf> AsSelf<'slf> for FatMachO<'d> { type Ref = FatMachO<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { self } } @@ -796,7 +796,7 @@ impl<'d> MachArchive<'d> { impl<'slf, 'd: 'slf> AsSelf<'slf> for MachArchive<'d> { type Ref = MachArchive<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { self } } diff --git a/symbolic-debuginfo/src/object.rs b/symbolic-debuginfo/src/object.rs index 1ebb1148c..8cd5260f6 100644 --- a/symbolic-debuginfo/src/object.rs +++ b/symbolic-debuginfo/src/object.rs @@ -371,7 +371,7 @@ impl<'data> Object<'data> { impl<'slf, 'data: 'slf> AsSelf<'slf> for Object<'data> { type Ref = Object<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { unsafe { std::mem::transmute(self) } } } @@ -758,7 +758,7 @@ impl<'d> Archive<'d> { impl<'slf, 'd: 'slf> AsSelf<'slf> for Archive<'d> { type Ref = Archive<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { unsafe { std::mem::transmute(self) } } } diff --git a/symbolic-debuginfo/src/pdb.rs b/symbolic-debuginfo/src/pdb.rs index bad07160e..a30759650 100644 --- a/symbolic-debuginfo/src/pdb.rs +++ b/symbolic-debuginfo/src/pdb.rs @@ -298,7 +298,7 @@ impl fmt::Debug for PdbObject<'_> { impl<'slf, 'data: 'slf> AsSelf<'slf> for PdbObject<'data> { type Ref = PdbObject<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { unsafe { std::mem::transmute(self) } } } @@ -565,7 +565,7 @@ impl<'d> PdbDebugInfo<'d> { } /// Returns an iterator over all compilation units (modules). - fn units(&'d self) -> PdbUnitIterator<'_> { + fn units(&'d self) -> PdbUnitIterator<'d> { PdbUnitIterator { debug_info: self, index: 0, @@ -576,7 +576,7 @@ impl<'d> PdbDebugInfo<'d> { self.type_formatter.modules() } - fn get_module(&'d self, index: usize) -> Result>, PdbError> { + fn get_module(&'d self, index: usize) -> Result>, PdbError> { // Silently ignore module references out-of-bound let module = match self.modules().get(index) { Some(module) => module, @@ -599,7 +599,7 @@ impl<'d> PdbDebugInfo<'d> { impl<'slf, 'd: 'slf> AsSelf<'slf> for PdbDebugInfo<'d> { type Ref = PdbDebugInfo<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { unsafe { std::mem::transmute(self) } } } diff --git a/symbolic-debuginfo/src/pe.rs b/symbolic-debuginfo/src/pe.rs index c4a371382..ba33156d5 100644 --- a/symbolic-debuginfo/src/pe.rs +++ b/symbolic-debuginfo/src/pe.rs @@ -377,7 +377,7 @@ impl fmt::Debug for PeObject<'_> { impl<'slf, 'data: 'slf> AsSelf<'slf> for PeObject<'data> { type Ref = PeObject<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { self } } diff --git a/symbolic-debuginfo/src/sourcebundle.rs b/symbolic-debuginfo/src/sourcebundle.rs index 4eeeb8e7d..1dbce62c7 100644 --- a/symbolic-debuginfo/src/sourcebundle.rs +++ b/symbolic-debuginfo/src/sourcebundle.rs @@ -784,7 +784,7 @@ impl<'data> SourceBundle<'data> { impl<'slf, 'data: 'slf> AsSelf<'slf> for SourceBundle<'data> { type Ref = SourceBundle<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { unsafe { std::mem::transmute(self) } } } @@ -991,7 +991,7 @@ impl<'session> DebugSession<'session> for SourceBundleDebugSession<'_> { impl<'slf, 'data: 'slf> AsSelf<'slf> for SourceBundleDebugSession<'data> { type Ref = SourceBundleDebugSession<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { unsafe { std::mem::transmute(self) } } } diff --git a/symbolic-debuginfo/src/wasm.rs b/symbolic-debuginfo/src/wasm.rs index a23bc3a31..bafd252d3 100644 --- a/symbolic-debuginfo/src/wasm.rs +++ b/symbolic-debuginfo/src/wasm.rs @@ -169,7 +169,7 @@ impl fmt::Debug for WasmObject<'_> { impl<'slf, 'd: 'slf> AsSelf<'slf> for WasmObject<'d> { type Ref = WasmObject<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { self } } diff --git a/symbolic-ppdb/src/cache/mod.rs b/symbolic-ppdb/src/cache/mod.rs index d1de297ce..f387e9afa 100644 --- a/symbolic-ppdb/src/cache/mod.rs +++ b/symbolic-ppdb/src/cache/mod.rs @@ -222,7 +222,7 @@ impl std::fmt::Debug for PortablePdbCache<'_> { impl<'slf, 'd: 'slf> AsSelf<'slf> for PortablePdbCache<'d> { type Ref = PortablePdbCache<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { self } } diff --git a/symbolic-sourcemapcache/src/lookup.rs b/symbolic-sourcemapcache/src/lookup.rs index d1d70e0e9..4e613d4f1 100644 --- a/symbolic-sourcemapcache/src/lookup.rs +++ b/symbolic-sourcemapcache/src/lookup.rs @@ -82,7 +82,7 @@ pub struct SourceMapCache<'data> { impl<'slf, 'a: 'slf> AsSelf<'slf> for SourceMapCache<'a> { type Ref = SourceMapCache<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { self } } From 63cc479b750ee127558aaed0e7ceafbe9aad0ac4 Mon Sep 17 00:00:00 2001 From: Sebastian Zivota Date: Fri, 29 Nov 2024 11:51:14 +0100 Subject: [PATCH 3/3] And one more --- symbolic-symcache/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/symbolic-symcache/src/lib.rs b/symbolic-symcache/src/lib.rs index 3eddb8a70..d0d9f7b1d 100644 --- a/symbolic-symcache/src/lib.rs +++ b/symbolic-symcache/src/lib.rs @@ -268,7 +268,7 @@ impl<'data> SymCache<'data> { impl<'slf, 'd: 'slf> AsSelf<'slf> for SymCache<'d> { type Ref = SymCache<'slf>; - fn as_self(&'slf self) -> &Self::Ref { + fn as_self(&'slf self) -> &'slf Self::Ref { self } }