diff --git a/pulsar/src/commands/farm.rs b/pulsar/src/commands/farm.rs index 16e77d7..bb6354e 100644 --- a/pulsar/src/commands/farm.rs +++ b/pulsar/src/commands/farm.rs @@ -2,7 +2,7 @@ use std::io::Write; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; -use color_eyre::eyre::{eyre, Context, Error, Result}; +use color_eyre::eyre::{bail, eyre, Context, Error, Result}; use color_eyre::Report; use futures::prelude::*; use indicatif::{ProgressBar, ProgressStyle}; @@ -42,9 +42,7 @@ pub(crate) async fn farm(is_verbose: bool, enable_domains: bool, no_rotation: bo let instance = SingleInstance::new(SINGLE_INSTANCE) .context("Cannot take the instance lock from the OS! Aborting...")?; if !instance.is_single() { - return Err(eyre!( - "It seems like there is already a farming instance running. Aborting...", - )); + bail!("It seems like there is already a farming instance running. Aborting...",) } // raise file limit raise_fd_limit(); diff --git a/pulsar/src/commands/init.rs b/pulsar/src/commands/init.rs index 3004a22..704835c 100644 --- a/pulsar/src/commands/init.rs +++ b/pulsar/src/commands/init.rs @@ -1,7 +1,7 @@ use std::io::{BufRead, Write}; use std::str::FromStr; -use color_eyre::eyre::{eyre, Context, Error, Result}; +use color_eyre::eyre::{bail, Context, Error, Result}; use crossterm::terminal::{Clear, ClearType}; use crossterm::{cursor, execute}; use rand::prelude::IteratorRandom; @@ -137,7 +137,7 @@ fn generate_or_get_reward_address(reward_address_exist: bool) -> Result Result { /// utilize `ByteSize` crate for the validation pub(crate) fn size_parser(size: &str) -> Result { - let Ok(size) = size.parse::() else { - return Err(eyre!("could not parse the value!")); - }; + let Ok(size) = size.parse::() else { bail!("could not parse the value!") }; if size < MIN_FARM_SIZE { Err(eyre!(format!("farm size cannot be smaller than {}", MIN_FARM_SIZE))) } else {