🚨 update: `cargo clippy` pass

main
_ 2022-05-26 01:19:54 +00:00
parent 2732e03763
commit ead9ebdcf8
7 changed files with 37 additions and 35 deletions

View File

@ -26,7 +26,6 @@ use sha2::{
use tokio::{
sync::mpsc,
task::{
spawn,
spawn_blocking,
},
};
@ -35,7 +34,7 @@ pub async fn main (args: &[OsString]) -> anyhow::Result <()> {
let mut url = None;
let mut expected_sha512 = None;
let mut args = args [1..].into_iter ();
let mut args = args [1..].iter ();
loop {
let arg = match args.next () {
@ -79,7 +78,7 @@ pub async fn main (args: &[OsString]) -> anyhow::Result <()> {
let mut resp_stream = resp.bytes_stream ();
// The hasher is owned by a task because it makes ownership simpler
let (mut hash_tx, mut hash_rx) = mpsc::channel (1);
let (hash_tx, mut hash_rx) = mpsc::channel (1);
let hasher_task = spawn_blocking (move || {
let mut hasher = Sha512::new ();

View File

@ -29,10 +29,13 @@ async fn main () -> anyhow::Result <()> {
let (subcommand, args) = parse_args (&args)?;
match subcommand {
Diceware => Ok (diceware::main ()),
Download => download::main (&args).await,
PtthServer => ptth_server::executable::main (&args).await,
PtthFileServer => ptth_file_server::main (&args).await,
Diceware => {
diceware::main ();
Ok (())
},
Download => download::main (args).await,
PtthServer => ptth_server::executable::main (args).await,
PtthFileServer => ptth_file_server::main (args).await,
PtthQuicEndServer => {
let (shutdown_tx, shutdown_rx) = watch::channel (false);
@ -40,11 +43,11 @@ async fn main () -> anyhow::Result <()> {
shutdown_tx.send (true).expect ("Couldn't forward Ctrl+C signal");
})?;
tracing::trace! ("Set Ctrl+C handler");
quic_demo::executable_end_server::main (&args, Some (shutdown_rx)).await?;
quic_demo::executable_end_server::main (args, Some (shutdown_rx)).await?;
Ok (())
}
Ulid => ulid::main (&args).await,
Ulid => ulid::main (args).await,
}
}

View File

@ -4,7 +4,7 @@ use std::{
use anyhow::Result;
pub async fn main (args: &[OsString]) -> Result <()>
pub async fn main (_args: &[OsString]) -> Result <()>
{
println! ("{}", rusty_ulid::generate_ulid_string ());

View File

@ -58,11 +58,11 @@ fn main ()
let (hit_tx, mut hit_rx) = mpsc::channel (1);
{
let fltk_tx = fltk_tx.clone ();
let fltk_tx = fltk_tx;
rt.spawn (async move {
eprintln! ("Entering channel task");
while let Some (_) = hit_rx.recv ().await {
while hit_rx.recv ().await.is_some () {
eprintln! ("fltk_tx");
fltk_tx.send (Message::Hit);
}

View File

@ -96,7 +96,7 @@ impl GuiClient <'_> {
port_idx: usize,
) -> anyhow::Result <()>
{
self.ports [port_idx].open_port (&self.rt, connection_p2_p3)?;
self.ports [port_idx].open_port (self.rt, connection_p2_p3)?;
self.sync_status ();
Ok (())
@ -142,9 +142,9 @@ impl GuiClient <'_> {
return;
}
let mut gui = GuiPort::new (fltk_tx, self.ports.len ());
let gui = GuiPort::new (fltk_tx, self.ports.len ());
ports_col.add (&gui.row);
ports_col.set_size (&mut gui.row, 30);
ports_col.set_size (&gui.row, 30);
let port = Port {
gui,
@ -175,21 +175,21 @@ fn main () -> anyhow::Result <()> {
let mut col = Flex::default ().column ().size_of_parent ();
let mut frame_status = Frame::default ();
col.set_size (&mut frame_status, 30);
let frame_status = Frame::default ();
col.set_size (&frame_status, 30);
{
let mut row = Flex::default ().row ();
let mut l = Frame::default ().with_label ("Server ID");
row.set_size (&mut l, 120);
let mut l = Frame::default ().with_label ("Server port");
row.set_size (&mut l, 80);
let mut l = Frame::default ().with_label ("Local port");
row.set_size (&mut l, 80);
let l = Frame::default ().with_label ("Server ID");
row.set_size (&l, 120);
let l = Frame::default ().with_label ("Server port");
row.set_size (&l, 80);
let l = Frame::default ().with_label ("Local port");
row.set_size (&l, 80);
row.end ();
col.set_size (&mut row, 30);
col.set_size (&row, 30);
}
let mut ports_col = Flex::default ().column ();
@ -198,7 +198,7 @@ fn main () -> anyhow::Result <()> {
let mut but_add_port = Button::default ().with_label ("+");
but_add_port.set_trigger (CallbackTrigger::Release);
but_add_port.emit (fltk_tx, Message::AddPort);
col.set_size (&mut but_add_port, 30);
col.set_size (&but_add_port, 30);
col.end ();
@ -286,11 +286,11 @@ impl GuiPort {
let mut but_open = Button::default ().with_label ("Open");
let mut but_close = Button::default ().with_label ("Close");
row.set_size (&mut input_server_id, 120);
row.set_size (&mut input_server_port, 80);
row.set_size (&mut input_client_port, 80);
row.set_size (&mut but_open, 80);
row.set_size (&mut but_close, 80);
row.set_size (&input_server_id, 120);
row.set_size (&input_server_port, 80);
row.set_size (&input_client_port, 80);
row.set_size (&but_open, 80);
row.set_size (&but_close, 80);
input_client_port.set_value ("");
input_client_port.set_readonly (true);
@ -389,7 +389,7 @@ mod test {
let port = rng.gen_range (tcp_eph_range);
assert_eq! (port, 49408);
for (input, expected) in vec! [
for (input, expected) in [
(("127.0.0.1:4000", "bogus_server", 22), 51168),
// The relay address is explicitly excluded from the eph port
// computation in case I want to support connecting to a server

View File

@ -99,7 +99,7 @@ async fn main () -> anyhow::Result <()> {
let resp = client.get (&format! ("{}/frontend/servers/{}/files/COPYING", relay_url, server_name))
.send ().await.expect ("Couldn't find license").bytes ().await.expect ("Couldn't find license");
if blake3::hash (&resp) != blake3::Hash::from ([
if blake3::hash (&resp) != [
0xca, 0x02, 0x92, 0x78,
0x9c, 0x0a, 0x0e, 0xcb,
0xa7, 0x06, 0xf4, 0xb3,
@ -109,7 +109,7 @@ async fn main () -> anyhow::Result <()> {
0xc1, 0xd4, 0x32, 0xc5,
0x2c, 0x4a, 0xac, 0x1f,
0x1a, 0xbb, 0xa8, 0xef,
]) {
] {
panic! ("{}", String::from_utf8 (resp.to_vec ()).expect ("???"));
}

View File

@ -45,7 +45,7 @@ async fn testing_client_checks (
.send ();
let resp = tokio::time::timeout (Duration::from_secs (2), req).await.expect ("Request timed out").expect ("Couldn't find license").bytes ().await.expect ("Couldn't find license");
if blake3::hash (&resp) != blake3::Hash::from ([
if blake3::hash (&resp) != [
0xca, 0x02, 0x92, 0x78,
0x9c, 0x0a, 0x0e, 0xcb,
0xa7, 0x06, 0xf4, 0xb3,
@ -55,7 +55,7 @@ async fn testing_client_checks (
0xc1, 0xd4, 0x32, 0xc5,
0x2c, 0x4a, 0xac, 0x1f,
0x1a, 0xbb, 0xa8, 0xef,
]) {
] {
panic! ("{}", String::from_utf8 (resp.to_vec ()).expect ("???"));
}