From 7e95ff2c7f9de76218f284b10549c5393967c1cd Mon Sep 17 00:00:00 2001 From: Andre Bogus Date: Thu, 29 Dec 2016 00:46:56 +0100 Subject: [PATCH] clippy'd benches + examples --- benches/bench.rs | 5 ++--- examples/dwarfdump.rs | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/benches/bench.rs b/benches/bench.rs index 6d9e3967d..c0938956e 100755 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -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) + -> FrameDescriptionEntry> { let bases = BaseAddresses::default() .set_cfi(0) .set_data(0) diff --git a/examples/dwarfdump.rs b/examples/dwarfdump.rs index 3f81d84b3..712105332 100644 --- a/examples/dwarfdump.rs +++ b/examples/dwarfdump.rs @@ -138,7 +138,7 @@ fn dump_info(file: &object::File, println!("\n.debug_info"); if let Some(debug_info) = file.get_section(".debug_info") { - let debug_info = gimli::DebugInfo::::new(&debug_info); + let debug_info = gimli::DebugInfo::::new(debug_info); let mut iter = debug_info.units(); while let Some(unit) = iter.next().expect("Should parse compilation unit") { @@ -170,7 +170,7 @@ fn dump_types(file: &object::File, if let Some(debug_types) = file.get_section(".debug_types") { println!("\n.debug_types"); - let debug_types = gimli::DebugTypes::::new(&debug_types); + let debug_types = gimli::DebugTypes::::new(debug_types); let mut iter = debug_types.units(); while let Some(unit) = iter.next().expect("Should parse the unit OK") { @@ -477,8 +477,8 @@ fn dump_file_index(file: u64, unit: &Unit) 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()); } } @@ -521,7 +521,7 @@ fn dump_op(dwop: gimli::DwOp, op: gimli::Operation, 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); } @@ -569,7 +569,7 @@ fn dump_op(dwop: gimli::DwOp, op: gimli::Operation, newpc: &[u8] print!(" {}", register); } } - gimli::Operation::RegisterOffset { register: _, offset } => { + gimli::Operation::RegisterOffset { offset, .. } => { print!("{:+}", offset); } gimli::Operation::FrameOffset { offset } => { @@ -628,7 +628,7 @@ fn dump_loc_list(debug_loc: gimli::DebugLoc, if has_end { locations.pop(); } - if locations.len() == 0 { + if locations.is_empty() { println!(""); return; } @@ -698,9 +698,9 @@ fn dump_line(file: &object::File, debug_abbrev: gimli::DebugAbbrev::new(&debug_line); - let debug_info = gimli::DebugInfo::::new(&debug_info); - let debug_str = gimli::DebugStr::::new(&debug_str); + let debug_line = gimli::DebugLine::::new(debug_line); + let debug_info = gimli::DebugInfo::::new(debug_info); + let debug_str = gimli::DebugStr::::new(debug_str); let mut iter = debug_info.units(); while let Some(unit) = iter.next().expect("Should parse unit header OK") {