Skip to content

Commit

Permalink
fix rust 1.83 lints
Browse files Browse the repository at this point in the history
  • Loading branch information
GyulyVGC committed Nov 29, 2024
1 parent c159cfb commit ed60ea1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/gui/components/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub fn button_open_file<'a>(
.class(tooltip_style)
}

pub fn row_open_link_tooltip(text: &'static str, font: Font) -> Row<Message, StyleType> {
pub fn row_open_link_tooltip<'a>(text: &'static str, font: Font) -> Row<'a, Message, StyleType> {
Row::new()
.align_y(Alignment::Center)
.spacing(10)
Expand Down
4 changes: 2 additions & 2 deletions src/gui/components/modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ pub fn get_clear_all_overlay<'a>(
.class(ContainerType::Modal)
}

fn get_modal_header(
fn get_modal_header<'a>(
font: Font,
font_headers: Font,
color_gradient: GradientType,
language: Language,
title: &'static str,
) -> Container<Message, StyleType> {
) -> Container<'a, Message, StyleType> {
Container::new(
Row::new()
.push(horizontal_space())
Expand Down
6 changes: 3 additions & 3 deletions src/gui/pages/connection_details_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fn page_content<'a>(sniffer: &Sniffer, key: &AddressPortPair) -> Container<'a, M
source_caption,
&key.address1,
key.port1,
&val.mac_address1,
val.mac_address1.as_ref(),
font,
language,
&sniffer.timing_events,
Expand All @@ -126,7 +126,7 @@ fn page_content<'a>(sniffer: &Sniffer, key: &AddressPortPair) -> Container<'a, M
dest_caption,
&key.address2,
key.port2,
&val.mac_address2,
val.mac_address2.as_ref(),
font,
language,
&sniffer.timing_events,
Expand Down Expand Up @@ -322,7 +322,7 @@ fn get_src_or_dest_col<'a>(
caption: Row<'a, Message, StyleType>,
ip: &String,
port: Option<u16>,
mac: &Option<String>,
mac: Option<&String>,
font: Font,
language: Language,
timing_events: &TimingEvents,
Expand Down
2 changes: 1 addition & 1 deletion src/gui/pages/inspect_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ fn get_change_page_row<'a>(
))
.font(font),
)
.push(if page_number < (results_number + 20 - 1) / 20 {
.push(if page_number < results_number.div_ceil(20) {
Container::new(get_button_change_page(true).width(25))
} else {
Container::new(Space::with_width(25))
Expand Down
20 changes: 11 additions & 9 deletions src/gui/sniffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ impl Sniffer {
&& self.modal.is_none()
{
if increment {
if self.page_number < (get_searched_entries(self).1 + 20 - 1) / 20 {
if self.page_number < get_searched_entries(self).1.div_ceil(20) {
return self.update(Message::UpdatePageNumber(increment));
}
} else if self.page_number > 1 {
Expand Down Expand Up @@ -652,26 +652,28 @@ impl Sniffer {

fn open_web(web_page: &WebPage) {
let url = web_page.get_url();

#[cfg(target_os = "windows")]
std::process::Command::new("explorer")
.arg(url)
.spawn()
.unwrap();
let cmd = "explorer";
#[cfg(target_os = "macos")]
std::process::Command::new("open").arg(url).spawn().unwrap();
let cmd = "open";
#[cfg(all(not(target_os = "windows"), not(target_os = "macos")))]
std::process::Command::new("xdg-open")
let cmd = "xdg-open";

std::process::Command::new(cmd)
.arg(url)
.spawn()
.unwrap();
.unwrap()
.wait()
.unwrap_or_default();
}

fn start(&mut self) {
let current_device_name = &*self.device.name.clone();
self.set_adapter(current_device_name);
let device = self.device.clone();
let pcap_path = self.export_pcap.full_path();
let capture_context = CaptureContext::new(&device, &pcap_path);
let capture_context = CaptureContext::new(&device, pcap_path.as_ref());
self.pcap_error = capture_context.error().map(ToString::to_string);
let info_traffic_mutex = self.info_traffic.clone();
*info_traffic_mutex.lock().unwrap() = InfoTraffic::new();
Expand Down
2 changes: 1 addition & 1 deletion src/networking/types/capture_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub enum CaptureContext {
}

impl CaptureContext {
pub fn new(device: &MyDevice, pcap_path: &Option<String>) -> Self {
pub fn new(device: &MyDevice, pcap_path: Option<&String>) -> Self {
let cap_res = Capture::from_device(device.to_pcap_device())
.expect("Capture initialization error\n\r")
.promisc(true)
Expand Down

0 comments on commit ed60ea1

Please sign in to comment.