Skip to content

Commit

Permalink
Some clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
xd009642 committed May 13, 2024
1 parent c6b38c3 commit da7fd26
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/instrumentation_profile/raw_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ where
inner,
)))
} else {
let mut counts = Vec::<u64>::new();
counts.reserve(data.num_counters as usize);
let mut counts = Vec::<u64>::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() {
Expand Down
2 changes: 1 addition & 1 deletion src/instrumentation_profile/text_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fn memop_value_site(s: &[u8]) -> ParseResult<(u64, u64)> {

fn read_value_profile_data(mut input: &[u8]) -> ParseResult<Option<Box<ValueProfDataRecord>>> {
if let Ok((bytes, n_kinds)) = read_digit(input) {
let mut record = Box::new(ValueProfDataRecord::default());
let mut record = Box::<ValueProfDataRecord>::default();
// We have value profiling data!
if n_kinds == 0 || n_kinds > ValueKind::len() as u64 {
// TODO I am malformed
Expand Down
10 changes: 0 additions & 10 deletions src/instrumentation_profile/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Ordering> {
Some(self.cmp(other))
Expand Down
5 changes: 2 additions & 3 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit da7fd26

Please sign in to comment.