Skip to content

Commit

Permalink
remove unecessary lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad-Owais-Warsi committed Oct 7, 2024
1 parent a53ca00 commit e2a7c52
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 136 deletions.
39 changes: 0 additions & 39 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ pub enum ScrollDirection {
impl ScrollDirection {

/// Return iterator of the available scroll directions.


#[allow(dead_code)]
pub fn iter() -> Iter<'static, ScrollDirection> {
[
Expand All @@ -67,7 +65,6 @@ impl ScrollDirection {
}

/// Main blocks of the terminal

#[derive(Clone, Copy, Debug, PartialEq, Eq, Sequence)]
pub enum Block {
UserInput,
Expand Down Expand Up @@ -105,8 +102,6 @@ pub enum InputMode {
impl InputMode {

/// Check if input mode is set.


pub fn is_none(self) -> bool {
self == Self::None
}
Expand Down Expand Up @@ -143,8 +138,6 @@ pub struct App {
impl App {

/// Create a new app instance.


pub fn new(block: Block, style: Style) -> Self {
Self {
selected_block: block,
Expand Down Expand Up @@ -186,8 +179,6 @@ impl App {


/// Get style depending on the selected state of the block.


pub fn block_style(&self, block: Block) -> TuiStyle {
if self.show_options {
self.style.colored
Expand All @@ -200,9 +191,6 @@ impl App {


/// Get the size of the selected block.



pub fn block_size(&mut self) -> &mut u16 {
match self.selected_block {
Block::ModuleInfo => &mut self.block_size.info,
Expand All @@ -213,8 +201,6 @@ impl App {


/// Get clipboard contents as String.


pub fn get_clipboard_contents(&mut self) -> String {
if let Some(clipboard) = self.clipboard.as_mut() {
if let Ok(contents) = clipboard.get_contents() {
Expand All @@ -226,8 +212,6 @@ impl App {


/// Set clipboard contents.


pub fn set_clipboard_contents(&mut self, contents: &str) {
if let Some(clipboard) = self.clipboard.as_mut() {
if let Err(e) = clipboard.set_contents(contents.to_string()) {
Expand All @@ -238,8 +222,6 @@ impl App {


/// Show help message on the information block.


pub fn show_help_message(&mut self, kernel_modules: &mut KernelModules<'_>) {
let key_bindings: Vec<(&str, &str)> = util::KEY_BINDINGS.to_vec();
let mut help_text = Vec::new();
Expand Down Expand Up @@ -267,8 +249,6 @@ impl App {


/// Show dependent modules on the information block.


#[allow(clippy::nonminimal_bool)]
pub fn show_dependent_modules(
&mut self,
Expand Down Expand Up @@ -308,9 +288,6 @@ impl App {


/// Draw a block according to the index.



pub fn draw_dynamic_block(
&mut self,
frame: &mut Frame,
Expand All @@ -331,9 +308,6 @@ impl App {


/// Draw a paragraph widget for using as user input.



pub fn draw_user_input(
&self,
frame: &mut Frame,
Expand Down Expand Up @@ -374,9 +348,6 @@ impl App {


/// Draw a paragraph widget for showing the kernel information.



pub fn draw_kernel_info(&self, frame: &mut Frame, area: Rect, info: &[String]) {
frame.render_widget(
Paragraph::new(Span::raw(&info[1]))
Expand All @@ -402,9 +373,6 @@ impl App {


/// Configure and draw kernel modules table.



pub fn draw_kernel_modules(
&mut self,
frame: &mut Frame,
Expand Down Expand Up @@ -503,9 +471,6 @@ impl App {


/// Draws the options menu as a popup.



pub fn draw_options_menu(
&mut self,
frame: &mut Frame,
Expand Down Expand Up @@ -585,8 +550,6 @@ impl App {


/// Draw a paragraph widget for showing module information.


pub fn draw_module_info(
&self,
frame: &mut Frame,
Expand Down Expand Up @@ -630,8 +593,6 @@ impl App {


/// Draw a paragraph widget for showing kernel activities.


pub fn draw_kernel_activities(
&self,
frame: &mut Frame,
Expand Down
2 changes: 0 additions & 2 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ const ASCII_LOGO: &str = "


/// Parse command line arguments using clap.


pub fn get_args() -> App {
App::new(env!("CARGO_PKG_NAME"))
.version(env!("CARGO_PKG_VERSION"))
Expand Down
2 changes: 0 additions & 2 deletions src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ pub struct Events {
impl Events {

/// Create a new events instance.


pub fn new(refresh_rate: u64, kernel_logs: &KernelLogs) -> Self {
/// Convert refresh rate to Duration from milliseconds.

Check warning on line 30 in src/event.rs

View workflow job for this annotation

GitHub Actions / Build for x86_64-unknown-linux-musl using Rust stable (on ubuntu-22.04)

unused doc comment

Check warning on line 30 in src/event.rs

View workflow job for this annotation

GitHub Actions / Build for x86_64-unknown-linux-musl using Rust nightly (on ubuntu-22.04)

unused doc comment

Check warning on line 30 in src/event.rs

View workflow job for this annotation

GitHub Actions / Build for x86_64-unknown-linux-gnu using Rust stable (on ubuntu-22.04)

unused doc comment

Check warning on line 30 in src/event.rs

View workflow job for this annotation

GitHub Actions / Build for x86_64-unknown-linux-gnu using Rust nightly (on ubuntu-22.04)

unused doc comment
let refresh_rate = Duration::from_millis(refresh_rate);
Expand Down
10 changes: 0 additions & 10 deletions src/kernel/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ pub struct Command {
impl Command {

/// Create a new command instance.


fn new(
cmd: String,
desc: &'static str,
Expand Down Expand Up @@ -66,8 +64,6 @@ impl TryFrom<String> for ModuleCommand {
impl ModuleCommand {

/// Get Command struct from a enum element.


pub fn get(self, module_name: &str) -> Command {
match self {
Self::None => Command::new(String::from(""), "", format!("Module: {module_name}"), Symbol::None),
Expand Down Expand Up @@ -126,18 +122,12 @@ impl ModuleCommand {


/// Check if module command is set.



pub fn is_none(self) -> bool {
self == Self::None
}


/// Check if module name is a filename with suffix 'ko'



pub fn is_module_filename(module_name: &str) -> bool {
match module_name.split('.').collect::<Vec<&str>>().last() {
Some(v) => *v == "ko",
Expand Down
7 changes: 0 additions & 7 deletions src/kernel/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ impl Default for KernelInfo {
impl KernelInfo {

/// Create a new kernel info instance.



pub fn new() -> Self {
let mut kernel_info = Self {
current_info: Vec::new(),
Expand All @@ -36,7 +33,6 @@ impl KernelInfo {


/// Select the next 'uname' output as kernel information.

pub fn next(&mut self) {
match self.uname_output.next() {
Some(v) => self.current_info = v,
Expand All @@ -46,9 +42,6 @@ impl KernelInfo {


/// Execute 'uname' command and return its output along with its description.



fn get_infos() -> IntoIter<Vec<String>> {
vec![
vec![
Expand Down
27 changes: 0 additions & 27 deletions src/kernel/lkm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ enum SortType {
impl SortType {

/// Return iterator for the sort types.



#[allow(dead_code)]
pub fn iter() -> Iter<'static, SortType> {
[
Expand All @@ -44,9 +41,6 @@ pub struct ListArgs {
impl ListArgs {

/// Create a new list arguments instance.



pub fn new(args: &ArgMatches) -> Self {
let mut sort_type = SortType::None;
if let Some(("sort", matches)) = args.subcommand() {
Expand Down Expand Up @@ -82,8 +76,6 @@ pub struct KernelModules<'a> {
impl KernelModules<'_> {

/// Create a new kernel modules instance.


pub fn new(args: ListArgs, style: Style) -> Self {
let mut kernel_modules = Self {
default_list: Vec::new(),
Expand Down Expand Up @@ -142,17 +134,12 @@ impl KernelModules<'_> {


/// Get the current command using current module name.



pub fn get_current_command(&self) -> Command {
self.command.get(&self.current_name)
}


/// Set the current module command and show confirmation message.


pub fn set_current_command(
&mut self,
module_command: ModuleCommand,
Expand Down Expand Up @@ -193,9 +180,6 @@ impl KernelModules<'_> {


/// Execute the current module command.



pub fn execute_command(&mut self) -> bool {
let mut command_executed = false;
if !self.command.is_none() {
Expand Down Expand Up @@ -238,9 +222,6 @@ impl KernelModules<'_> {


/// Cancel the execution of the current command.



pub fn cancel_execution(&mut self) -> bool {
if !self.command.is_none() {
self.command = ModuleCommand::None;
Expand All @@ -259,8 +240,6 @@ impl KernelModules<'_> {


/// Scroll to the position of used module at given index.


pub fn show_used_module(&mut self, mod_index: usize) {
if let Some(used_module) = self.list[self.index][2]
.split(' ')
Expand Down Expand Up @@ -293,8 +272,6 @@ impl KernelModules<'_> {


/// Scroll module list up/down and select module.


pub fn scroll_list(&mut self, direction: ScrollDirection) {
self.info_scroll_offset = 0;
if self.list.is_empty() {
Expand Down Expand Up @@ -337,7 +314,6 @@ impl KernelModules<'_> {


/// Select the next module.

pub fn next_module(&mut self) {
self.index += 1;
if self.index > self.list.len() - 1 {
Expand All @@ -347,7 +323,6 @@ impl KernelModules<'_> {


/// Select the previous module.

pub fn previous_module(&mut self) {
if self.index > 0 {
self.index -= 1;
Expand All @@ -358,8 +333,6 @@ impl KernelModules<'_> {


/// Scroll the module information text up/down.


pub fn scroll_mod_info(
&mut self,
direction: ScrollDirection,
Expand Down
8 changes: 0 additions & 8 deletions src/kernel/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ pub struct KernelLogs {
impl KernelLogs {

/// Update the output variable value if 'dmesg' logs changed.



pub fn update(&mut self) -> bool {
self.output = util::exec_cmd(
"dmesg",
Expand Down Expand Up @@ -45,9 +42,6 @@ impl KernelLogs {


/// Select a part of the output depending on the area properties.



pub fn select(&mut self, area_height: u16, area_sub: u16) -> &str {
self.selected_output = self
.output
Expand All @@ -74,8 +68,6 @@ impl KernelLogs {


/// Scroll the kernel logs up/down.


pub fn scroll(&mut self, direction: ScrollDirection, smooth_scroll: bool) {
let scroll_amount = if smooth_scroll { 1 } else { 3 };
match direction {
Expand Down
2 changes: 0 additions & 2 deletions src/kernel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ pub struct Kernel {
impl Kernel {

/// Create a new kernel instance.


pub fn new(args: &ArgMatches) -> Self {
Self {
logs: KernelLogs::default(),
Expand Down
Loading

0 comments on commit e2a7c52

Please sign in to comment.