diff --git a/src/app/data_collection.rs b/src/app/data_collection.rs index 73c0008c..f9731aef 100644 --- a/src/app/data_collection.rs +++ b/src/app/data_collection.rs @@ -11,13 +11,13 @@ pub mod network; pub mod processes; pub mod temperature; -fn set_if_valid(result: &Result, value_to_set: &mut T) { +fn set_if_valid(result: &Result, value_to_set: &mut T) { if let Ok(result) = result { *value_to_set = (*result).clone(); } } -fn push_if_valid(result: &Result, vector_to_push: &mut Vec) { +fn push_if_valid(result: &Result, vector_to_push: &mut Vec) { if let Ok(result) = result { vector_to_push.push(result.clone()); } diff --git a/src/main.rs b/src/main.rs index 473dd9a7..a12938d9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,7 +29,7 @@ mod data_conversion; use app::data_collection; use constants::TICK_RATE_IN_MILLISECONDS; use data_conversion::*; -use utils::error::{self, RustopError}; +use utils::error::{self, BottomError}; // End imports @@ -74,11 +74,11 @@ fn main() -> error::Result<()> { }; if update_rate_in_milliseconds < 250 { - return Err(RustopError::InvalidArg { + return Err(BottomError::InvalidArg { message: "Please set your update rate to be greater than 250 milliseconds.".to_string(), }); } else if update_rate_in_milliseconds > u128::from(std::u64::MAX) { - return Err(RustopError::InvalidArg { + return Err(BottomError::InvalidArg { message: "Please set your update rate to be less than unsigned INT_MAX.".to_string(), }); } diff --git a/src/utils/error.rs b/src/utils/error.rs index 0a71c7d0..666ca2f4 100644 --- a/src/utils/error.rs +++ b/src/utils/error.rs @@ -1,12 +1,12 @@ use failure::Fail; use std::result; -/// A type alias for handling errors related to Rustop. -pub type Result = result::Result; +/// A type alias for handling errors related to Bottom. +pub type Result = result::Result; -/// An error that can occur while Rustop runs. +/// An error that can occur while Bottom runs. #[derive(Debug, Fail)] -pub enum RustopError { +pub enum BottomError { /// An error when there is an IO exception. /// /// The data provided is the error found. @@ -39,38 +39,38 @@ pub enum RustopError { FernError { message: String }, } -impl From for RustopError { +impl From for BottomError { fn from(err: std::io::Error) -> Self { - RustopError::InvalidIO { message: err.to_string() } + BottomError::InvalidIO { message: err.to_string() } } } -impl From for RustopError { +impl From for BottomError { fn from(err: heim::Error) -> Self { - RustopError::InvalidHeim { message: err.to_string() } + BottomError::InvalidHeim { message: err.to_string() } } } -impl From for RustopError { +impl From for BottomError { fn from(err: crossterm::ErrorKind) -> Self { - RustopError::CrosstermError { message: err.to_string() } + BottomError::CrosstermError { message: err.to_string() } } } -impl From for RustopError { +impl From for BottomError { fn from(err: std::num::ParseIntError) -> Self { - RustopError::InvalidArg { message: err.to_string() } + BottomError::InvalidArg { message: err.to_string() } } } -impl From for RustopError { +impl From for BottomError { fn from(err: std::string::String) -> Self { - RustopError::GenericError { message: err.to_string() } + BottomError::GenericError { message: err.to_string() } } } -impl From for RustopError { +impl From for BottomError { fn from(err: fern::InitError) -> Self { - RustopError::FernError { message: err.to_string() } + BottomError::FernError { message: err.to_string() } } }