Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix lints #879

Merged
merged 3 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/minidump_stackwalk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion symbolic-cabi/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl From<String> for SymbolicStr {
}
}

impl<'a> From<&'a str> for SymbolicStr {
impl From<&str> for SymbolicStr {
fn from(string: &str) -> SymbolicStr {
SymbolicStr::new(string)
}
Expand Down
2 changes: 1 addition & 1 deletion symbolic-cabi/src/proguard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion symbolic-cfi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ struct CfiCacheV1<'a> {
byteview: ByteView<'a>,
}

impl<'a> CfiCacheV1<'a> {
impl CfiCacheV1<'_> {
pub fn raw(&self) -> &[u8] {
&self.byteview
}
Expand Down
16 changes: 8 additions & 8 deletions symbolic-common/src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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]) }
}
}
Expand All @@ -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()
}
}
Expand All @@ -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()
}
}
Expand All @@ -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()
}
}
Expand All @@ -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()
}
}
Expand All @@ -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()
}
}
Expand Down Expand Up @@ -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
}
}
Expand Down
4 changes: 2 additions & 2 deletions symbolic-debuginfo/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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("<unknown>"))
Expand Down
12 changes: 6 additions & 6 deletions symbolic-debuginfo/src/breakpad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ pub struct BreakpadLineRecords<'d> {
finished: bool,
}

impl<'d> Iterator for BreakpadLineRecords<'d> {
impl Iterator for BreakpadLineRecords<'_> {
type Item = Result<BreakpadLineRecord, BreakpadError>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down Expand Up @@ -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`].
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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())
Expand All @@ -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>;
Expand Down
10 changes: 5 additions & 5 deletions symbolic-debuginfo/src/dwarf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Slice<'d>>) -> Option<&'d [u8]> {
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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,
Expand All @@ -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) }
}
}
Expand Down Expand Up @@ -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>;
Expand Down
4 changes: 2 additions & 2 deletions symbolic-debuginfo/src/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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<Self::Item> {
Expand Down
4 changes: 2 additions & 2 deletions symbolic-debuginfo/src/function_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::cmp::Ordering> {
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))
}
Expand Down
4 changes: 2 additions & 2 deletions symbolic-debuginfo/src/macho/bcsymbolmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl From<BcSymbolMapErrorKind> 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
}
}
Expand Down Expand Up @@ -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<Self::Item> {
Expand Down
5 changes: 2 additions & 3 deletions symbolic-debuginfo/src/macho/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions symbolic-debuginfo/src/macho/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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<MachObject<'d>, MachError>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down Expand Up @@ -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
}
}
Expand All @@ -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<MachObject<'d>, MachError>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down Expand Up @@ -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
}
}
Expand Down
10 changes: 5 additions & 5 deletions symbolic-debuginfo/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<Self::Item> {
Expand Down Expand Up @@ -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) }
}
}
Expand All @@ -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<Object<'d>, ObjectError>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
Loading
Loading