Skip to content

Commit

Permalink
fix clippy pedantic lints
Browse files Browse the repository at this point in the history
  • Loading branch information
GyulyVGC committed Jan 23, 2025
1 parent b4d7a8d commit 957e300
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/gui/pages/inspect_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ fn get_agglomerates_row<'a>(
.iter()
.filter(|x| *x != &ReportCol::Bytes && *x != &ReportCol::Packets)
.fold(0.0, |acc, x| acc + x.get_width());
#[allow(clippy::cast_precision_loss)]
let in_length = width * (tot_in_bytes as f32 / tot_bytes as f32);
let out_length = width - in_length;
let bars = get_bars(in_length, out_length);
Expand Down
24 changes: 12 additions & 12 deletions src/report/get_report_entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ pub fn get_searched_entries(
u128,
u128,
) {
let mut tot_packets = 0;
let mut tot_in_bytes = 0;
let mut tot_out_bytes = 0;
let info_traffic_lock = sniffer.info_traffic.lock().unwrap();
let mut all_results: Vec<(&AddressPortPair, &InfoAddressPortPair)> = info_traffic_lock
.map
Expand All @@ -39,20 +42,17 @@ pub fn get_searched_entries(
.search
.match_entry(key, value, r_dns_host, is_favorite)
})
.map(|(key, val)| {
tot_packets += val.transmitted_packets;
if val.traffic_direction == TrafficDirection::Outgoing {
tot_out_bytes += val.transmitted_bytes;
} else {
tot_in_bytes += val.transmitted_bytes;
}
(key, val)
})
.collect();

let mut tot_packets = 0;
let mut tot_in_bytes = 0;
let mut tot_out_bytes = 0;
all_results.iter().for_each(|(_, val)| {
tot_packets += val.transmitted_packets;
if val.traffic_direction == TrafficDirection::Outgoing {
tot_out_bytes += val.transmitted_bytes;
} else {
tot_in_bytes += val.transmitted_bytes;
}
});

all_results.sort_by(|&(_, a), &(_, b)| match sniffer.report_sort_type {
ReportSortType {
byte_sort,
Expand Down

0 comments on commit 957e300

Please sign in to comment.