Skip to content

Commit

Permalink
Appease clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielesvelto committed Feb 28, 2023
1 parent 55392e9 commit 0ad69de
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/bin/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ mod linux {
fn test_file_id() -> Result<()> {
let ppid = getppid().as_raw();
let exe_link = format!("/proc/{}/exe", ppid);
let exe_name = std::fs::read_link(&exe_link)?.into_os_string();
let exe_name = std::fs::read_link(exe_link)?.into_os_string();
let mut dumper = PtraceDumper::new(getppid().as_raw())?;
let mut found_exe = None;
for (idx, mapping) in dumper.mappings.iter().enumerate() {
Expand Down
6 changes: 3 additions & 3 deletions src/dir_section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
mem_writer::{Buffer, MemoryArrayWriter, MemoryWriterError},
minidump_format::MDRawDirectory,
};
use std::io::{Error, Seek, SeekFrom, Write};
use std::io::{Error, Seek, Write};

pub type DumpBuf = Buffer;

Expand Down Expand Up @@ -44,7 +44,7 @@ where
Ok(Self {
curr_idx: 0,
section: dir_section,
destination_start_offset: destination.seek(SeekFrom::Current(0))?,
destination_start_offset: destination.stream_position()?,
destination,
last_position_written_to_file: 0,
})
Expand All @@ -65,7 +65,7 @@ where
// Now write it to file

// First get all the positions
let curr_file_pos = self.destination.seek(SeekFrom::Current(0))?;
let curr_file_pos = self.destination.stream_position()?;
let idx_pos = self.section.location_of_index(self.curr_idx);
self.curr_idx += 1;

Expand Down
4 changes: 2 additions & 2 deletions src/linux/minidump_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl MinidumpWriter {
return true;
}

let (stack_ptr, stack_len) = match dumper.get_stack_info(stack_pointer as usize) {
let (stack_ptr, stack_len) = match dumper.get_stack_info(stack_pointer) {
Ok(x) => x,
Err(_) => {
return false;
Expand All @@ -173,7 +173,7 @@ impl MinidumpWriter {
}
};

let sp_offset = stack_pointer as usize - stack_ptr;
let sp_offset = stack_pointer - stack_ptr;
self.principal_mapping
.as_ref()
.unwrap()
Expand Down
4 changes: 2 additions & 2 deletions src/linux/sections/exception_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ pub fn write(
) -> Result<MDRawDirectory, errors::SectionExceptionStreamError> {
let exception = if let Some(context) = &config.crash_context {
MDException {
exception_code: context.inner.siginfo.ssi_signo as u32,
exception_code: context.inner.siginfo.ssi_signo,
exception_flags: context.inner.siginfo.ssi_code as u32,
exception_address: context.inner.siginfo.ssi_addr as u64,
exception_address: context.inner.siginfo.ssi_addr,
..Default::default()
}
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/linux/sections/thread_list_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ pub fn write(
// unhelpful.
if config.crash_context.is_some() && thread.thread_id == config.blamed_thread as u32 {
let crash_context = config.crash_context.as_ref().unwrap();
let instruction_ptr = crash_context.get_instruction_pointer() as usize;
let stack_pointer = crash_context.get_stack_pointer() as usize;
let instruction_ptr = crash_context.get_instruction_pointer();
let stack_pointer = crash_context.get_stack_pointer();
fill_thread_stack(
config,
buffer,
Expand Down Expand Up @@ -142,7 +142,7 @@ pub fn write(
} else {
MaxStackLen::None // default to no maximum for this thread
};
let instruction_ptr = info.get_instruction_pointer() as usize;
let instruction_ptr = info.get_instruction_pointer();
fill_thread_stack(
config,
buffer,
Expand Down
2 changes: 1 addition & 1 deletion src/mem_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ where
let position = buffer.reserve(size) as u32;

Ok(Self {
position: position as u32,
position,
size,
phantom: std::marker::PhantomData,
})
Expand Down
2 changes: 1 addition & 1 deletion tests/ptrace_dumper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ fn test_sanitize_stack_copy() {
}

// The instruction pointer definitely should point into an executable mapping.
let instr_ptr = thread_info.get_instruction_pointer() as usize;
let instr_ptr = thread_info.get_instruction_pointer();
let mapping_info = dumper
.find_mapping_no_bias(instr_ptr)
.expect("Failed to find mapping info");
Expand Down

0 comments on commit 0ad69de

Please sign in to comment.