diff --git a/src/instrumentation_profile/raw_profile.rs b/src/instrumentation_profile/raw_profile.rs index a5deedf..2307848 100644 --- a/src/instrumentation_profile/raw_profile.rs +++ b/src/instrumentation_profile/raw_profile.rs @@ -244,8 +244,7 @@ where inner, ))) } else { - let mut counts = Vec::::new(); - counts.reserve(data.num_counters as usize); + let mut counts = Vec::::with_capacity(data.num_counters as usize); bytes = &bytes[(counter_offset as usize)..]; for _ in 0..(data.num_counters as usize) { let counter = if header.has_byte_coverage() { diff --git a/src/instrumentation_profile/text_profile.rs b/src/instrumentation_profile/text_profile.rs index b3772ca..9ddbd9d 100644 --- a/src/instrumentation_profile/text_profile.rs +++ b/src/instrumentation_profile/text_profile.rs @@ -119,7 +119,7 @@ fn memop_value_site(s: &[u8]) -> ParseResult<(u64, u64)> { fn read_value_profile_data(mut input: &[u8]) -> ParseResult>> { if let Ok((bytes, n_kinds)) = read_digit(input) { - let mut record = Box::new(ValueProfDataRecord::default()); + let mut record = Box::::default(); // We have value profiling data! if n_kinds == 0 || n_kinds > ValueKind::len() as u64 { // TODO I am malformed diff --git a/src/instrumentation_profile/types.rs b/src/instrumentation_profile/types.rs index cdc7aa4..5169161 100644 --- a/src/instrumentation_profile/types.rs +++ b/src/instrumentation_profile/types.rs @@ -393,16 +393,6 @@ pub struct ValueProfRecord { site_count: u8, } -impl ValueProfData { - fn deserialize_to(&self, _record: &mut InstrProfRecord, _symtab: Option<&Symtab>) { - if self.num_value_kinds == 0 { - return; - } - - todo!() - } -} - impl PartialOrd for InstrProfValueData { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) diff --git a/src/util.rs b/src/util.rs index ac2f87c..e628dba 100644 --- a/src/util.rs +++ b/src/util.rs @@ -38,7 +38,7 @@ where let compressed_size = compressed_size as usize; let mut decoder = ZlibDecoder::new(&input[..compressed_size]); let mut output = vec![]; - if let Ok(_) = decoder.read_to_end(&mut output) { + if decoder.read_to_end(&mut output).is_ok() { let name = String::from_utf8(output); let name = name.unwrap(); Ok((&input[compressed_size..], name)) @@ -92,8 +92,7 @@ where Ok((input, values)) } else { let mut decoder = ZlibDecoder::new(&input[..compressed_size]); - let mut output = vec![]; - output.reserve(uncompressed_size); + let mut output = Vec::with_capacity(uncompressed_size); decoder.read_to_end(&mut output).unwrap(); // Use context error to let values = parse_uncompressed_string_list::<()>(&output)