Skip to content

Commit

Permalink
Merge pull request #174 from fitzgen/clippy2
Browse files Browse the repository at this point in the history
[rebased] clippy'd benches + examples
  • Loading branch information
fitzgen committed Jan 5, 2017
2 parents 335a005 + 7e95ff2 commit ac1de18
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
5 changes: 2 additions & 3 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,8 @@ mod cfi {
fde.instructions().fold(0, |count, _| count + 1).expect("fold over instructions OK")
}

fn get_fde_with_longest_cfi_instructions<'input>
(eh_frame: EhFrame<'input, LittleEndian>)
-> FrameDescriptionEntry<'input, LittleEndian, EhFrame<'input, LittleEndian>> {
fn get_fde_with_longest_cfi_instructions(eh_frame: EhFrame<LittleEndian>)
-> FrameDescriptionEntry<LittleEndian, EhFrame<LittleEndian>> {
let bases = BaseAddresses::default()
.set_cfi(0)
.set_data(0)
Expand Down
20 changes: 10 additions & 10 deletions examples/dwarfdump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ fn dump_info<Endian>(file: &object::File,
println!("\n.debug_info");

if let Some(debug_info) = file.get_section(".debug_info") {
let debug_info = gimli::DebugInfo::<Endian>::new(&debug_info);
let debug_info = gimli::DebugInfo::<Endian>::new(debug_info);

let mut iter = debug_info.units();
while let Some(unit) = iter.next().expect("Should parse compilation unit") {
Expand Down Expand Up @@ -170,7 +170,7 @@ fn dump_types<Endian>(file: &object::File,
if let Some(debug_types) = file.get_section(".debug_types") {
println!("\n.debug_types");

let debug_types = gimli::DebugTypes::<Endian>::new(&debug_types);
let debug_types = gimli::DebugTypes::<Endian>::new(debug_types);

let mut iter = debug_types.units();
while let Some(unit) = iter.next().expect("Should parse the unit OK") {
Expand Down Expand Up @@ -477,8 +477,8 @@ fn dump_file_index<Endian>(file: u64, unit: &Unit<Endian>)
print!(" ");
if let Some(directory) = file.directory(header) {
let directory = directory.to_string_lossy();
if !directory.starts_with("/") {
if let Some(ref comp_dir) = unit.comp_dir {
if !directory.starts_with('/') {
if let Some(comp_dir) = unit.comp_dir {
print!("{}/", comp_dir.to_string_lossy());
}
}
Expand Down Expand Up @@ -521,7 +521,7 @@ fn dump_op<Endian>(dwop: gimli::DwOp, op: gimli::Operation<Endian>, newpc: &[u8]
{
print!("{}", dwop);
match op {
gimli::Operation::Deref { size, space: _ } => {
gimli::Operation::Deref { size, .. } => {
if dwop == gimli::DW_OP_deref_size || dwop == gimli::DW_OP_xderef_size {
print!(" {}", size);
}
Expand Down Expand Up @@ -569,7 +569,7 @@ fn dump_op<Endian>(dwop: gimli::DwOp, op: gimli::Operation<Endian>, newpc: &[u8]
print!(" {}", register);
}
}
gimli::Operation::RegisterOffset { register: _, offset } => {
gimli::Operation::RegisterOffset { offset, .. } => {
print!("{:+}", offset);
}
gimli::Operation::FrameOffset { offset } => {
Expand Down Expand Up @@ -628,7 +628,7 @@ fn dump_loc_list<Endian>(debug_loc: gimli::DebugLoc<Endian>,
if has_end {
locations.pop();
}
if locations.len() == 0 {
if locations.is_empty() {
println!("");
return;
}
Expand Down Expand Up @@ -698,9 +698,9 @@ fn dump_line<Endian>(file: &object::File, debug_abbrev: gimli::DebugAbbrev<Endia
println!(".debug_line");
println!("");

let debug_line = gimli::DebugLine::<Endian>::new(&debug_line);
let debug_info = gimli::DebugInfo::<Endian>::new(&debug_info);
let debug_str = gimli::DebugStr::<Endian>::new(&debug_str);
let debug_line = gimli::DebugLine::<Endian>::new(debug_line);
let debug_info = gimli::DebugInfo::<Endian>::new(debug_info);
let debug_str = gimli::DebugStr::<Endian>::new(debug_str);

let mut iter = debug_info.units();
while let Some(unit) = iter.next().expect("Should parse unit header OK") {
Expand Down

0 comments on commit ac1de18

Please sign in to comment.