From db8a37cfe4953d92907f86db4f858231700dc37a Mon Sep 17 00:00:00 2001 From: josuebarretogit Date: Tue, 4 Jun 2024 21:55:22 -0500 Subject: [PATCH] removed unused imports --- Cargo.toml | 2 -- src/tui/handler.rs | 5 ++-- src/utils.rs | 3 +-- src/view/ui.rs | 67 +++++++++++----------------------------------- 4 files changed, 18 insertions(+), 59 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0d3ef33..9550b05 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,8 +10,6 @@ description = "Terminal tool to get you the best crates for your rust projects w keywords = ["cli", "command-line", "developer-tools", "dependencies"] categories = ["utilities", "development-tools" , "command-line", "dependencies"] license = "MIT" - -[package] exclude = [ "public/*" ] diff --git a/src/tui/handler.rs b/src/tui/handler.rs index a6cac1d..e31268b 100644 --- a/src/tui/handler.rs +++ b/src/tui/handler.rs @@ -1,4 +1,4 @@ -use core::{alloc, panic}; +use core::{panic}; use std::sync::Arc; use std::{error::Error, time::Duration}; @@ -7,9 +7,8 @@ use ratatui::{backend::CrosstermBackend, Terminal}; use tokio::sync::mpsc::{self, UnboundedSender}; use crate::content_parser::jsoncontentparser::JsonContentParser; -use crate::dependency_builder::CrateToAdd; use crate::utils::select_crate_if_features_are_selected; -use crate::view::widgets::{CategoriesTabs, CrateItemList, FeatureItemList, ItemListStatus}; +use crate::view::widgets::{CategoriesTabs, CrateItemList, FeatureItemList}; use crate::{dependency_builder::DependenciesBuilder, view::ui::AppView}; #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] diff --git a/src/utils.rs b/src/utils.rs index 254ff70..272bcfa 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -7,7 +7,7 @@ use crate::{ dependency_builder::CrateToAdd, view::{ ui::AppView, - widgets::{CategoriesTabs, CrateItemList, FeatureItemList, ItemListStatus}, + widgets::{CategoriesTabs, CrateItemList, ItemListStatus}, }, }; @@ -76,7 +76,6 @@ pub fn toggle_one_feature(current_crate: &mut CrateItemList, features_list_state pub fn select_crate_if_features_are_selected(app: &mut AppView) { if let Some((crate_selected, index_current_crate)) = app.get_current_crate_selected() { - let current_crate_is_selected = app .dependencies_to_add_list .dependencies_to_add diff --git a/src/view/ui.rs b/src/view/ui.rs index dd1178e..7d54e30 100644 --- a/src/view/ui.rs +++ b/src/view/ui.rs @@ -1,14 +1,13 @@ #![allow(clippy::too_many_lines)] -use std::{thread::spawn, time::Duration, usize}; -use throbber_widgets_tui::{symbols::throbber, Throbber, ThrobberState}; -use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender}; +use throbber_widgets_tui::{Throbber, ThrobberState}; +use tokio::sync::mpsc::UnboundedSender; use ratatui::{ prelude::*, symbols::border, widgets::{ block::{Block, Position, Title}, - Clear, ListState, Paragraph, + Clear, ListState, }, }; @@ -24,25 +23,21 @@ use crate::{ }; use super::widgets::{ - CategoriesTabs, CrateItemList, CratesListWidget, DependenciesListWidget, FeatureItemList, - FeaturesWidgetList, FooterInstructions, ItemListStatus, Popup, + CategoriesTabs, CrateItemList, CratesListWidget, DependenciesListWidget, FeaturesWidgetList, + FooterInstructions, Popup, }; pub struct AppView { pub action_tx: UnboundedSender, pub dependencies_to_add_list: DependenciesList, pub crates_list: CratesList, - pub category_tabs: CategoriesTabs, - is_adding_dependencies: bool, - popup_widget: Popup, features: Features, loader_state: throbber_widgets_tui::ThrobberState, pub exit: bool, pub is_showing_features: bool, - pub categories_list_state: ListState, pub general_crates: Vec, pub math_crates: Vec, @@ -674,80 +669,48 @@ impl AppView { CategoriesTabs::General => { let current_crate = &mut self.general_crates[index_current_crate_selected]; - toggle_one_feature( - current_crate, - &self.features.state, - ); - - + toggle_one_feature(current_crate, &self.features.state); } CategoriesTabs::Common => { let current_crate = &mut self.common_crates[index_current_crate_selected]; - toggle_one_feature( - current_crate, - &self.features.state, - ); + toggle_one_feature(current_crate, &self.features.state); } CategoriesTabs::FFI => { let current_crate = &mut self.ffi_crates[index_current_crate_selected]; - toggle_one_feature( - current_crate, - &self.features.state, - ); + toggle_one_feature(current_crate, &self.features.state); } CategoriesTabs::Math => { let current_crate = &mut self.math_crates[index_current_crate_selected]; - toggle_one_feature( - current_crate, - &self.features.state, - ); + toggle_one_feature(current_crate, &self.features.state); } CategoriesTabs::Clis => { let current_crate = &mut self.clis_crates[index_current_crate_selected]; - toggle_one_feature( - current_crate, - &self.features.state, - ); + toggle_one_feature(current_crate, &self.features.state); } CategoriesTabs::Graphics => { let current_crate = &mut self.graphics_crates[index_current_crate_selected]; - toggle_one_feature( - current_crate, - &self.features.state, - ); + toggle_one_feature(current_crate, &self.features.state); } CategoriesTabs::Databases => { let current_crate = &mut self.database_crates[index_current_crate_selected]; - toggle_one_feature( - current_crate, - &self.features.state, - ); + toggle_one_feature(current_crate, &self.features.state); } CategoriesTabs::Networking => { let current_crate = &mut self.networking_crates[index_current_crate_selected]; - toggle_one_feature( - current_crate, - &self.features.state, - ); + toggle_one_feature(current_crate, &self.features.state); } CategoriesTabs::Concurrency => { let current_crate = &mut self.concurrency_crates[index_current_crate_selected]; - toggle_one_feature( - current_crate, - &self.features.state, - ); + toggle_one_feature(current_crate, &self.features.state); } CategoriesTabs::Cryptography => { let current_crate = &mut self.cryptography_crates[index_current_crate_selected]; - toggle_one_feature( - current_crate, - &self.features.state, - ); + toggle_one_feature(current_crate, &self.features.state); } } }