Skip to content

Commit

Permalink
removed unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
josueBarretogit committed Jun 5, 2024
1 parent e5d2990 commit db8a37c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 59 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*"
]
Expand Down
5 changes: 2 additions & 3 deletions src/tui/handler.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::{alloc, panic};
use core::{panic};
use std::sync::Arc;
use std::{error::Error, time::Duration};

Expand All @@ -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)]
Expand Down
3 changes: 1 addition & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
dependency_builder::CrateToAdd,
view::{
ui::AppView,
widgets::{CategoriesTabs, CrateItemList, FeatureItemList, ItemListStatus},
widgets::{CategoriesTabs, CrateItemList, ItemListStatus},
},
};

Expand Down Expand Up @@ -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
Expand Down
67 changes: 15 additions & 52 deletions src/view/ui.rs
Original file line number Diff line number Diff line change
@@ -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,
},
};

Expand All @@ -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<Action>,
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<CrateItemList>,
pub math_crates: Vec<CrateItemList>,
Expand Down Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit db8a37c

Please sign in to comment.