From b44b646b5ef95d5b44911f70bc092bd11361e064 Mon Sep 17 00:00:00 2001 From: Eduardo Broto Date: Fri, 20 Dec 2019 21:20:13 +0100 Subject: style(code): fix clippy errors --- src/tests/cases/raw_mode.rs | 25 +++++++++++++------------ src/tests/cases/ui.rs | 39 ++++++++++++++++++++------------------- src/tests/fakes/fake_input.rs | 2 +- 3 files changed, 34 insertions(+), 32 deletions(-) (limited to 'src/tests') diff --git a/src/tests/cases/raw_mode.rs b/src/tests/cases/raw_mode.rs index 54cea9e..93c2afa 100644 --- a/src/tests/cases/raw_mode.rs +++ b/src/tests/cases/raw_mode.rs @@ -12,6 +12,7 @@ use ::std::net::IpAddr; use packet_builder::payload::PayloadData; use packet_builder::*; +use pnet::datalink::DataLinkReceiver; use pnet::packet::Packet; use pnet_base::MacAddr; @@ -71,7 +72,7 @@ fn one_packet_of_traffic() { 443, 12345, b"I am a fake tcp packet", - ))])]; + ))]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -140,7 +141,7 @@ fn bi_directional_traffic() { 443, b"I am a fake tcp download packet", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -209,7 +210,7 @@ fn multiple_packets_of_traffic_from_different_connections() { 443, b"I come from 2.2.2.2", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -278,7 +279,7 @@ fn multiple_packets_of_traffic_from_single_connection() { 443, b"I've come from 1.1.1.1 too!", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -347,7 +348,7 @@ fn one_process_with_multiple_connections() { 443, b"Funny that, I'm from 3.3.3.3", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -430,7 +431,7 @@ fn multiple_processes_with_multiple_connections() { 443, b"I'm partial to 4.4.4.4", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -499,7 +500,7 @@ fn multiple_connections_from_remote_address() { 443, b"Me too, but on a different port", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -570,7 +571,7 @@ fn sustained_traffic_from_one_process() { 443, b"Same here, but one second later", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -655,7 +656,7 @@ fn sustained_traffic_from_multiple_processes() { 443, b"I come 3.3.3.3 one second later", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -768,7 +769,7 @@ fn sustained_traffic_from_multiple_processes_bi_directional() { 12345, b"10.0.0.2 forever!", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -881,7 +882,7 @@ fn traffic_with_host_names() { 12345, b"10.0.0.2 forever!", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -1007,7 +1008,7 @@ fn no_resolve_mode() { 12345, b"10.0.0.2 forever!", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); diff --git a/src/tests/cases/ui.rs b/src/tests/cases/ui.rs index 78f4f73..b89c28d 100644 --- a/src/tests/cases/ui.rs +++ b/src/tests/cases/ui.rs @@ -13,6 +13,7 @@ use ::std::net::IpAddr; use packet_builder::payload::PayloadData; use packet_builder::*; +use pnet::datalink::DataLinkReceiver; use pnet::packet::Packet; use pnet_base::MacAddr; @@ -57,7 +58,7 @@ fn basic_startup() { ])); let network_frames = vec![NetworkFrames::new(vec![ None, // sleep - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -116,7 +117,7 @@ fn one_packet_of_traffic() { 443, 12345, b"I am a fake tcp packet", - ))])]; + ))]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -187,7 +188,7 @@ fn bi_directional_traffic() { 443, b"I am a fake tcp download packet", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -258,7 +259,7 @@ fn multiple_packets_of_traffic_from_different_connections() { 443, b"I come from 2.2.2.2", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -329,7 +330,7 @@ fn multiple_packets_of_traffic_from_single_connection() { 443, b"I've come from 1.1.1.1 too!", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -400,7 +401,7 @@ fn one_process_with_multiple_connections() { 443, b"Funny that, I'm from 3.3.3.3", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -485,7 +486,7 @@ fn multiple_processes_with_multiple_connections() { 443, b"I'm partial to 4.4.4.4", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -556,7 +557,7 @@ fn multiple_connections_from_remote_address() { 443, b"Me too, but on a different port", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -629,7 +630,7 @@ fn sustained_traffic_from_one_process() { 443, b"Same here, but one second later", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -716,7 +717,7 @@ fn sustained_traffic_from_multiple_processes() { 443, b"I come 3.3.3.3 one second later", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -831,7 +832,7 @@ fn sustained_traffic_from_multiple_processes_bi_directional() { 12345, b"10.0.0.2 forever!", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -946,7 +947,7 @@ fn traffic_with_host_names() { 12345, b"10.0.0.2 forever!", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -1074,7 +1075,7 @@ fn no_resolve_mode() { 12345, b"10.0.0.2 forever!", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -1149,7 +1150,7 @@ fn traffic_with_winch_event() { 443, 12345, b"I am a fake tcp packet", - ))])]; + ))]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(50)); @@ -1235,7 +1236,7 @@ fn layout_full_width_under_30_height() { 443, b"I'm partial to 4.4.4.4", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(190)); let terminal_height = Arc::new(Mutex::new(29)); @@ -1320,7 +1321,7 @@ fn layout_under_150_width_full_height() { 443, b"I'm partial to 4.4.4.4", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(149)); let terminal_height = Arc::new(Mutex::new(50)); @@ -1405,7 +1406,7 @@ fn layout_under_150_width_under_30_height() { 443, b"I'm partial to 4.4.4.4", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(149)); let terminal_height = Arc::new(Mutex::new(29)); @@ -1490,7 +1491,7 @@ fn layout_under_120_width_full_height() { 443, b"I'm partial to 4.4.4.4", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(119)); let terminal_height = Arc::new(Mutex::new(50)); @@ -1575,7 +1576,7 @@ fn layout_under_120_width_under_30_height() { 443, b"I'm partial to 4.4.4.4", )), - ])]; + ]) as Box]; let terminal_width = Arc::new(Mutex::new(119)); let terminal_height = Arc::new(Mutex::new(29)); diff --git a/src/tests/fakes/fake_input.rs b/src/tests/fakes/fake_input.rs index 5e02d83..a3b84b3 100644 --- a/src/tests/fakes/fake_input.rs +++ b/src/tests/fakes/fake_input.rs @@ -50,7 +50,7 @@ pub struct NetworkFrames { } impl NetworkFrames { - pub fn new(packets: Vec>>) -> Box { + pub fn new(packets: Vec>>) -> Box { Box::new(NetworkFrames { packets, current_index: 0, -- cgit v1.2.3