diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/display/mod.rs | 4 | ||||
-rw-r--r-- | src/display/ui.rs | 66 | ||||
-rw-r--r-- | src/display/ui_state.rs | 4 | ||||
-rw-r--r-- | src/main.rs | 199 | ||||
-rw-r--r-- | src/network/connection.rs | 2 | ||||
-rw-r--r-- | src/network/dns_queue.rs | 4 | ||||
-rw-r--r-- | src/network/sniffer.rs | 5 | ||||
-rw-r--r-- | src/os/linux.rs | 2 | ||||
-rw-r--r-- | src/tests/cases/mod.rs | 2 | ||||
-rw-r--r-- | src/tests/cases/raw_mode.rs | 49 | ||||
-rw-r--r-- | src/tests/cases/ui.rs | 99 | ||||
-rw-r--r-- | src/tests/mod.rs | 2 |
12 files changed, 176 insertions, 262 deletions
diff --git a/src/display/mod.rs b/src/display/mod.rs index 396b5d9..127c2bc 100644 --- a/src/display/mod.rs +++ b/src/display/mod.rs @@ -1,9 +1,9 @@ mod components; +mod raw_terminal_backend; mod ui; mod ui_state; -mod raw_terminal_backend; pub use components::*; +pub use raw_terminal_backend::*; pub use ui::*; pub use ui_state::*; -pub use raw_terminal_backend::*; diff --git a/src/display/ui.rs b/src/display/ui.rs index e23843e..f40b084 100644 --- a/src/display/ui.rs +++ b/src/display/ui.rs @@ -5,7 +5,7 @@ use ::tui::Terminal; use crate::display::components::{Layout, Table, TotalBandwidth}; use crate::display::UIState; -use crate::network::{Connection, Utilization, display_connection_string, display_ip_or_host}; +use crate::network::{display_connection_string, display_ip_or_host, Connection, Utilization}; use ::std::net::Ipv4Addr; @@ -28,11 +28,11 @@ where let mut terminal = Terminal::new(terminal_backend).unwrap(); terminal.clear().unwrap(); terminal.hide_cursor().unwrap(); - Ui { - terminal: terminal, - state: Default::default(), - ip_to_host: Default::default(), - } + Ui { + terminal: terminal, + state: Default::default(), + ip_to_host: Default::default(), + } } pub fn output_text(&mut self, write_to_stdout: &mut Box<dyn FnMut(String) + Send>) { let state = &self.state; @@ -40,40 +40,34 @@ where let local_time: DateTime<Local> = Local::now(); let timestamp = local_time.timestamp(); for (process, process_network_data) in &state.processes { - write_to_stdout( - format!( - "process: <{}> \"{}\" up/down Bps: {}/{} connections: {}", - timestamp, - process, - process_network_data.total_bytes_uploaded, - process_network_data.total_bytes_downloaded, - process_network_data.connection_count - ) - ); + write_to_stdout(format!( + "process: <{}> \"{}\" up/down Bps: {}/{} connections: {}", + timestamp, + process, + process_network_data.total_bytes_uploaded, + process_network_data.total_bytes_downloaded, + process_network_data.connection_count + )); } for (connection, connection_network_data) in &state.connections { - write_to_stdout( - format!( - "connection: <{}> {} up/down Bps: {}/{} process: \"{}\"", - timestamp, - display_connection_string(connection, ip_to_host), - connection_network_data.total_bytes_uploaded, - connection_network_data.total_bytes_downloaded, - connection_network_data.process_name - ) - ); + write_to_stdout(format!( + "connection: <{}> {} up/down Bps: {}/{} process: \"{}\"", + timestamp, + display_connection_string(connection, ip_to_host), + connection_network_data.total_bytes_uploaded, + connection_network_data.total_bytes_downloaded, + connection_network_data.process_name + )); } for (remote_address, remote_address_network_data) in &state.remote_addresses { - write_to_stdout( - format!( - "remote_address: <{}> {} up/down Bps: {}/{} connections: {}", - timestamp, - display_ip_or_host(*remote_address, ip_to_host), - remote_address_network_data.total_bytes_uploaded, - remote_address_network_data.total_bytes_downloaded, - remote_address_network_data.connection_count - ) - ); + write_to_stdout(format!( + "remote_address: <{}> {} up/down Bps: {}/{} connections: {}", + timestamp, + display_ip_or_host(*remote_address, ip_to_host), + remote_address_network_data.total_bytes_uploaded, + remote_address_network_data.total_bytes_downloaded, + remote_address_network_data.connection_count + )); } } pub fn draw(&mut self) { diff --git a/src/display/ui_state.rs b/src/display/ui_state.rs index 1bf235a..a027ff4 100644 --- a/src/display/ui_state.rs +++ b/src/display/ui_state.rs @@ -63,7 +63,9 @@ impl UIState { if let Some(connection_bandwidth_utilization) = network_utilization.connections.get(&connection) { - let data_for_remote_address = remote_addresses.entry(connection.remote_socket.ip).or_default(); + let data_for_remote_address = remote_addresses + .entry(connection.remote_socket.ip) + .or_default(); let connection_data = connections.entry(connection).or_default(); let data_for_process = processes.entry(process_name.clone()).or_default(); diff --git a/src/main.rs b/src/main.rs index a28b2a0..1387490 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ mod os; #[cfg(test)] mod tests; -use display::{Ui, RawTerminalBackend}; +use display::{RawTerminalBackend, Ui}; use network::{Connection, DnsQueue, Sniffer, Utilization}; use ::std::net::IpAddr; @@ -65,7 +65,7 @@ fn try_main() -> Result<(), failure::Error> { Ok(stdout) => { let terminal_backend = TermionBackend::new(stdout); start(terminal_backend, os_input, opts); - }, + } Err(_) => failure::bail!( "Failed to get stdout: 'what' does not (yet) support piping, is it being piped?" ), @@ -115,108 +115,131 @@ where let ip_to_host = Arc::new(Mutex::new(HashMap::new())); if !no_resolve { - active_threads.push(thread::Builder::new().name("dns_resolver".to_string()).spawn({ - let dns_queue = dns_queue.clone(); - let ip_to_host = ip_to_host.clone(); - move || { - if let Some(dns_queue) = Option::as_ref(&dns_queue) { - while let Some(ip) = dns_queue.wait_for_job() { - if let Some(addr) = lookup_addr(&IpAddr::V4(ip)) { - ip_to_host.lock().unwrap().insert(ip, addr); + active_threads.push( + thread::Builder::new() + .name("dns_resolver".to_string()) + .spawn({ + let dns_queue = dns_queue.clone(); + let ip_to_host = ip_to_host.clone(); + move || { + if let Some(dns_queue) = Option::as_ref(&dns_queue) { + while let Some(ip) = dns_queue.wait_for_job() { + if let Some(addr) = lookup_addr(&IpAddr::V4(ip)) { + ip_to_host.lock().unwrap().insert(ip, addr); + } + } } } - } - } - }).unwrap()); + }) + .unwrap(), + ); } if !raw_mode { - active_threads.push(thread::Builder::new().name("resize_handler".to_string()).spawn({ - let ui = ui.clone(); - move || { - on_winch({ - Box::new(move || { - let mut ui = ui.lock().unwrap(); - ui.draw(); - }) - }); - } - }).unwrap()); + active_threads.push( + thread::Builder::new() + .name("resize_handler".to_string()) + .spawn({ + let ui = ui.clone(); + move || { + on_winch({ + Box::new(move || { + let mut ui = ui.lock().unwrap(); + ui.draw(); + }) + }); + } + }) + .unwrap(), + ); } - let display_handler = thread::Builder::new().name("display_handler".to_string()).spawn({ - let running = running.clone(); - let network_utilization = network_utilization.clone(); - let ip_to_host = ip_to_host.clone(); - let dns_queue = dns_queue.clone(); - let ui = ui.clone(); - move || { - while running.load(Ordering::Acquire) { - let connections_to_procs = get_open_sockets(); - let ip_to_host = { ip_to_host.lock().unwrap().clone() }; - let utilization = { - let mut network_utilization = network_utilization.lock().unwrap(); - network_utilization.clone_and_reset() - }; - let mut unresolved_ips = Vec::new(); - for connection in connections_to_procs.keys() { - if !ip_to_host.contains_key(&connection.remote_socket.ip) { - unresolved_ips.push(connection.remote_socket.ip); + let display_handler = thread::Builder::new() + .name("display_handler".to_string()) + .spawn({ + let running = running.clone(); + let network_utilization = network_utilization.clone(); + let ip_to_host = ip_to_host.clone(); + let dns_queue = dns_queue.clone(); + let ui = ui.clone(); + move || { + while running.load(Ordering::Acquire) { + let connections_to_procs = get_open_sockets(); + let ip_to_host = { ip_to_host.lock().unwrap().clone() }; + let utilization = { + let mut network_utilization = network_utilization.lock().unwrap(); + network_utilization.clone_and_reset() + }; + let mut unresolved_ips = Vec::new(); + for connection in connections_to_procs.keys() { + if !ip_to_host.contains_key(&connection.remote_socket.ip) { + unresolved_ips.push(connection.remote_socket.ip); + } } - } - if let Some(dns_queue) = Option::as_ref(&dns_queue) { - if !unresolved_ips.is_empty() { - dns_queue.resolve_ips(unresolved_ips); + if let Some(dns_queue) = Option::as_ref(&dns_queue) { + if !unresolved_ips.is_empty() { + dns_queue.resolve_ips(unresolved_ips); + } } + { + let mut ui = ui.lock().unwrap(); + ui.update_state(connections_to_procs, utilization, ip_to_host); + if raw_mode { + ui.output_text(&mut write_to_stdout); + } else { + ui.draw(); + } + } + park_timeout(time::Duration::from_secs(1)); } - { + if !raw_mode { let mut ui = ui.lock().unwrap(); - ui.update_state(connections_to_procs, utilization, ip_to_host); - if raw_mode { - ui.output_text(&mut write_to_stdout); - } else { - ui.draw(); - } + ui.end(); + } + if let Some(dns_queue) = Option::as_ref(&dns_queue) { + dns_queue.end(); } - park_timeout(time::Duration::from_secs(1)); - } - if !raw_mode { - let mut ui = ui.lock().unwrap(); - ui.end(); - } - if let Some(dns_queue) = Option::as_ref(&dns_queue) { - dns_queue.end(); } - } - }).unwrap(); - - active_threads.push(thread::Builder::new().name("stdin_handler".to_string()).spawn({ - let running = running.clone(); - let display_handler = display_handler.thread().clone(); - move || { - for evt in keyboard_events { - match evt { - Event::Key(Key::Ctrl('c')) | Event::Key(Key::Char('q')) => { - running.store(false, Ordering::Release); - cleanup(); - display_handler.unpark(); - break; + }) + .unwrap(); + + active_threads.push( + thread::Builder::new() + .name("stdin_handler".to_string()) + .spawn({ + let running = running.clone(); + let display_handler = display_handler.thread().clone(); + move || { + for evt in keyboard_events { + match evt { + Event::Key(Key::Ctrl('c')) | Event::Key(Key::Char('q')) => { + running.store(false, Ordering::Release); + cleanup(); + display_handler.unpark(); + break; + } + _ => (), + }; } - _ => (), - }; - } - } - }).unwrap()); + } + }) + .unwrap(), + ); active_threads.push(display_handler); - active_threads.push(thread::Builder::new().name("sniffing_handler".to_string()).spawn(move || { - while running.load(Ordering::Acquire) { - if let Some(segment) = sniffer.next() { - network_utilization.lock().unwrap().update(&segment) - } - } - }).unwrap()); + active_threads.push( + thread::Builder::new() + .name("sniffing_handler".to_string()) + .spawn(move || { + while running.load(Ordering::Acquire) { + if let Some(segment) = sniffer.next() { + network_utilization.lock().unwrap().update(&segment) + } + } + }) + .unwrap(), + ); for thread_handler in active_threads { thread_handler.join().unwrap() - }; + } } diff --git a/src/network/connection.rs b/src/network/connection.rs index e22e4eb..a5a3b50 100644 --- a/src/network/connection.rs +++ b/src/network/connection.rs @@ -39,7 +39,6 @@ pub fn display_ip_or_host(ip: Ipv4Addr, ip_to_host: &HashMap<Ipv4Addr, String>) } } - pub fn display_connection_string( connection: &Connection, ip_to_host: &HashMap<Ipv4Addr, String>, @@ -53,7 +52,6 @@ pub fn display_connection_string( ) } - impl Connection { pub fn new(remote_socket: SocketAddr, local_port: u16, protocol: Protocol) -> Option<Self> { match remote_socket { diff --git a/src/network/dns_queue.rs b/src/network/dns_queue.rs index c7de950..0110df2 100644 --- a/src/network/dns_queue.rs +++ b/src/network/dns_queue.rs @@ -29,9 +29,7 @@ impl DnsQueue { loop { match jobs.as_mut()?.pop_front() { Some(job) => return Some(job), - None => { - jobs = self.cvar.wait(jobs).unwrap() - } + None => jobs = self.cvar.wait(jobs).unwrap(), } } } diff --git a/src/network/sniffer.rs b/src/network/sniffer.rs index 51bcef2..3ec6886 100644 --- a/src/network/sniffer.rs +++ b/src/network/sniffer.rs @@ -44,7 +44,10 @@ pub struct Sniffer { } impl Sniffer { - pub fn new(network_interface: NetworkInterface, network_frames: Box<dyn DataLinkReceiver>) -> Self { + pub fn new( + network_interface: NetworkInterface, + network_frames: Box<dyn DataLinkReceiver>, + ) -> Self { Sniffer { network_interface, network_frames, diff --git a/src/os/linux.rs b/src/os/linux.rs index f7db89b..f72f613 100644 --- a/src/os/linux.rs +++ b/src/os/linux.rs @@ -108,7 +108,7 @@ fn sigwinch() -> (Box<dyn Fn(Box<dyn Fn()>) + Send>, Box<dyn Fn() + Send>) { (Box::new(on_winch), Box::new(cleanup)) } -pub fn create_write_to_stdout () -> Box<dyn FnMut(String) + Send> { +pub fn create_write_to_stdout() -> Box<dyn FnMut(String) + Send> { Box::new({ let mut stdout = io::stdout(); move |output: String| { diff --git a/src/tests/cases/mod.rs b/src/tests/cases/mod.rs index c917d49..87c141b 100644 --- a/src/tests/cases/mod.rs +++ b/src/tests/cases/mod.rs @@ -1,2 +1,2 @@ -pub mod ui; pub mod raw_mode; +pub mod ui; diff --git a/src/tests/cases/raw_mode.rs b/src/tests/cases/raw_mode.rs index 4e05c3f..3658f28 100644 --- a/src/tests/cases/raw_mode.rs +++ b/src/tests/cases/raw_mode.rs @@ -37,7 +37,7 @@ fn build_tcp_packet( pkt.packet().to_vec() } -fn format_raw_output<'t> (output: Vec<u8>) -> String { +fn format_raw_output<'t>(output: Vec<u8>) -> String { let stdout_utf8 = String::from_utf8(output).unwrap(); use regex::Regex; let timestamp = Regex::new(r"<\d+>").unwrap(); @@ -58,53 +58,6 @@ impl<T> LogWithMirror<T> { } } -// #[test] -// fn basic_startup() { -// let keyboard_events = Box::new(KeyboardEvents::new(vec![ -// None, // sleep -// Some(Event::Key(Key::Ctrl('c'))), -// ])); -// let network_frames = NetworkFrames::new(vec![ -// None, // sleep -// ]); -// -// let terminal_width = Arc::new(Mutex::new(190)); -// let terminal_height = Arc::new(Mutex::new(50)); -// let terminal_events = LogWithMirror::new(Vec::new()); -// let terminal_draw_events = LogWithMirror::new(Vec::new()); -// -// let backend = TestBackend::new( -// terminal_events.write, -// terminal_draw_events.write, -// terminal_width, -// terminal_height, -// ); -// let network_interface = get_interface(); -// let lookup_addr = create_fake_lookup_addr(HashMap::new()); -// let on_winch = create_fake_on_winch(false); -// let cleanup = Box::new(|| {}); -// -// let os_input = OsInputOutput { -// network_interface, -// network_frames, -// get_open_sockets, -// keyboard_events, -// lookup_addr, -// on_winch, -// cleanup, -// }; -// let opts = Opt { -// interface: String::from("interface_name"), -// raw: true, -// no_resolve: false, -// }; -// let fake_stdout = Box::new(Vec::new()); -// let clone_stdout = fake_stdout.clone(); -// start(backend, os_input, Box::new(fake_stdout), opts); -// -// assert_snapshot!(String::from_utf8(*clone_stdout).unwrap()); -// } - #[test] fn one_packet_of_traffic() { let keyboard_events = Box::new(KeyboardEvents::new(vec![ diff --git a/src/tests/cases/ui.rs b/src/tests/cases/ui.rs index 9750799..4b81f87 100644 --- a/src/tests/cases/ui.rs +++ b/src/tests/cases/ui.rs @@ -74,10 +74,7 @@ fn basic_startup() { let lookup_addr = create_fake_lookup_addr(HashMap::new()); let on_winch = create_fake_on_winch(false); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -136,10 +133,7 @@ fn one_packet_of_traffic() { let lookup_addr = create_fake_lookup_addr(HashMap::new()); let on_winch = create_fake_on_winch(false); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -149,7 +143,7 @@ fn one_packet_of_traffic() { lookup_addr, on_winch, cleanup, - write_to_stdout + write_to_stdout, }; let opts = Opt { interface: String::from("interface_name"), @@ -209,10 +203,7 @@ fn bi_directional_traffic() { let network_interface = get_interface(); let lookup_addr = create_fake_lookup_addr(HashMap::new()); let on_winch = create_fake_on_winch(false); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let cleanup = Box::new(|| {}); let os_input = OsInputOutput { @@ -284,10 +275,7 @@ fn multiple_packets_of_traffic_from_different_connections() { let cleanup = Box::new(|| {}); let network_interface = get_interface(); let lookup_addr = create_fake_lookup_addr(HashMap::new()); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -358,10 +346,7 @@ fn multiple_packets_of_traffic_from_single_connection() { let lookup_addr = create_fake_lookup_addr(HashMap::new()); let on_winch = create_fake_on_winch(false); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -432,10 +417,7 @@ fn one_process_with_multiple_connections() { let lookup_addr = create_fake_lookup_addr(HashMap::new()); let on_winch = create_fake_on_winch(false); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -445,7 +427,7 @@ fn one_process_with_multiple_connections() { lookup_addr, on_winch, cleanup, - write_to_stdout + write_to_stdout, }; let opts = Opt { interface: String::from("interface_name"), @@ -520,10 +502,7 @@ fn multiple_processes_with_multiple_connections() { let lookup_addr = create_fake_lookup_addr(HashMap::new()); let on_winch = create_fake_on_winch(false); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -594,10 +573,7 @@ fn multiple_connections_from_remote_address() { let lookup_addr = create_fake_lookup_addr(HashMap::new()); let on_winch = create_fake_on_winch(false); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -670,10 +646,7 @@ fn sustained_traffic_from_one_process() { let lookup_addr = create_fake_lookup_addr(HashMap::new()); let on_winch = create_fake_on_winch(false); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -760,10 +733,7 @@ fn sustained_traffic_from_multiple_processes() { let lookup_addr = create_fake_lookup_addr(HashMap::new()); let on_winch = create_fake_on_winch(false); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -878,10 +848,7 @@ fn sustained_traffic_from_multiple_processes_bi_directional() { let lookup_addr = create_fake_lookup_addr(HashMap::new()); let on_winch = create_fake_on_winch(false); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -1009,10 +976,7 @@ fn traffic_with_host_names() { let lookup_addr = create_fake_lookup_addr(ips_to_hostnames); let on_winch = create_fake_on_winch(false); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -1140,10 +1104,7 @@ fn no_resolve_mode() { let lookup_addr = create_fake_lookup_addr(ips_to_hostnames); let on_winch = create_fake_on_winch(false); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -1205,10 +1166,7 @@ fn traffic_with_winch_event() { let lookup_addr = create_fake_lookup_addr(HashMap::new()); let on_winch = create_fake_on_winch(true); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -1294,10 +1252,7 @@ fn layout_full_width_under_30_height() { let lookup_addr = create_fake_lookup_addr(HashMap::new()); let on_winch = create_fake_on_winch(false); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -1382,10 +1337,7 @@ fn layout_under_150_width_full_height() { let lookup_addr = create_fake_lookup_addr(HashMap::new()); let on_winch = create_fake_on_winch(false); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -1470,10 +1422,7 @@ fn layout_under_150_width_under_30_height() { let lookup_addr = create_fake_lookup_addr(HashMap::new()); let on_winch = create_fake_on_winch(false); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -1558,10 +1507,7 @@ fn layout_under_120_width_full_height() { let lookup_addr = create_fake_lookup_addr(HashMap::new()); let on_winch = create_fake_on_winch(false); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, @@ -1646,10 +1592,7 @@ fn layout_under_120_width_under_30_height() { let lookup_addr = create_fake_lookup_addr(HashMap::new()); let on_winch = create_fake_on_winch(false); let cleanup = Box::new(|| {}); - let write_to_stdout = Box::new({ - move |_output: String| { - } - }); + let write_to_stdout = Box::new({ move |_output: String| {} }); let os_input = OsInputOutput { network_interface, diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 995353a..3e6e8f9 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -1,2 +1,2 @@ -pub mod fakes; pub mod cases; +pub mod fakes; |