From 2de76e2f358be9c1500ca3dc4f9df0979ed8ed28 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Sun, 19 Nov 2023 22:48:40 +0000 Subject: [PATCH] chore: lints moved from main.rs to Cargo.toml --- Cargo.toml | 14 ++++++++++++++ src/main.rs | 22 +++++----------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e938ac5..7257fa2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,20 @@ readme = "README.md" keywords = ["docker", "tui", "tokio", "terminal", "podman"] categories = ["command-line-utilities"] +[lints.rust] +unsafe_code = "forbid" + +[lints.clippy] +expect_used = "warn" +nursery = "warn" +pedantic ="warn" +todo = "warn" +unused_async = "warn" +unwrap_used = "warn" +module_name_repetitions = "allow" +doc_markdown = "allow" +similar_names = "allow" + [dependencies] anyhow = "1.0" # bollard = "0.15" diff --git a/src/main.rs b/src/main.rs index 059076c..c3199da 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,19 +1,5 @@ -#![forbid(unsafe_code)] -#![warn( - clippy::expect_used, - clippy::nursery, - clippy::pedantic, - clippy::todo, - clippy::unused_async, - clippy::unwrap_used -)] -#![allow( - clippy::module_name_repetitions, - clippy::doc_markdown, - clippy::similar_names -)] // Only allow when debugging -#![allow(unused)] +// #![allow(unused)] use app_data::AppData; use app_error::AppError; @@ -123,6 +109,8 @@ async fn main() { let args = CliArgs::new(); + // If running via Docker image, need to sleep else program will just quit straight away, no real idea why + // So just sleep for small while if args.in_container { std::thread::sleep(std::time::Duration::from_millis(250)); } @@ -144,9 +132,9 @@ async fn main() { .await; if args.gui { - let (input_sx, input_rx) = tokio::sync::mpsc::channel(32); + let (sx, input_rx) = tokio::sync::mpsc::channel(32); handler_init(&app_data, &docker_tx, &gui_state, input_rx, &is_running); - Ui::create(app_data, docker_tx.clone(), gui_state, is_running, input_sx).await; + Ui::create(app_data, gui_state, is_running, sx).await; } else { info!("in debug mode\n"); // Debug mode for testing, less pointless now, will display some basic information