From 70242bc2b2de5e1092f0e2c3ee978e1040d3e4e5 Mon Sep 17 00:00:00 2001 From: ClementTsang Date: Mon, 12 Jul 2021 22:31:55 -0400 Subject: refactor: remove beef dependency for now This is just a temp change, I wanted to remove it just for clarity's sake among dependencies, and will probably add it back in the future. For now I'll just stick to std's beef. --- Cargo.lock | 7 ------- Cargo.toml | 1 - src/app/query.rs | 10 ++++------ src/options.rs | 2 +- src/utils/error.rs | 3 +-- 5 files changed, 6 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e3d44adf..8b38605d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -209,12 +209,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "beef" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6736e2428df2ca2848d846c43e88745121a6654696e349ce0054a420815a7409" - [[package]] name = "bitflags" version = "1.2.1" @@ -243,7 +237,6 @@ dependencies = [ "assert_cmd", "backtrace", "battery", - "beef", "cargo-husky", "cfg-if 1.0.0", "chrono", diff --git a/Cargo.toml b/Cargo.toml index d28922ea..c104daa2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,6 @@ default = ["fern", "log"] anyhow = "1.0.40" backtrace = "0.3.59" battery = "0.7.8" -beef = "0.5.0" chrono = "0.4.19" crossterm = "0.18.2" ctrlc = { version = "3.1.9", features = ["termination"] } diff --git a/src/app/query.rs b/src/app/query.rs index a783c658..0f18c901 100644 --- a/src/app/query.rs +++ b/src/app/query.rs @@ -6,8 +6,8 @@ use crate::{ Result, }, }; -use std::collections::VecDeque; use std::fmt::Debug; +use std::{borrow::Cow, collections::VecDeque}; const DELIMITER_LIST: [char; 6] = ['=', '>', '<', '(', ')', '\"']; const COMPARISON_LIST: [&str; 3] = [">", "=", "<"]; @@ -79,7 +79,7 @@ impl ProcessQuery for ProcWidgetState { break; } } else if COMPARISON_LIST.contains(&queue_top.to_lowercase().as_str()) { - return Err(QueryError(beef::Cow::borrowed("Comparison not valid here"))); + return Err(QueryError(Cow::Borrowed("Comparison not valid here"))); } else { break; } @@ -118,7 +118,7 @@ impl ProcessQuery for ProcWidgetState { break; } } else if COMPARISON_LIST.contains(&queue_top.to_lowercase().as_str()) { - return Err(QueryError(beef::Cow::borrowed("Comparison not valid here"))); + return Err(QueryError(Cow::Borrowed("Comparison not valid here"))); } else { break; } @@ -164,9 +164,7 @@ impl ProcessQuery for ProcWidgetState { } } else if queue_top == "(" { if query.is_empty() { - return Err(QueryError(beef::Cow::borrowed( - "Missing closing parentheses", - ))); + return Err(QueryError(Cow::Borrowed("Missing closing parentheses"))); } let mut list_of_ors = VecDeque::new(); diff --git a/src/options.rs b/src/options.rs index 45aee033..dd1ce026 100644 --- a/src/options.rs +++ b/src/options.rs @@ -1,7 +1,7 @@ -use beef::Cow; use regex::Regex; use serde::{Deserialize, Serialize}; use std::{ + borrow::Cow, collections::{HashMap, HashSet}, path::PathBuf, str::FromStr, diff --git a/src/utils/error.rs b/src/utils/error.rs index 8f8da789..e265ad3e 100644 --- a/src/utils/error.rs +++ b/src/utils/error.rs @@ -1,5 +1,4 @@ -use beef::Cow; -use std::result; +use std::{borrow::Cow, result}; use thiserror::Error; #[cfg(target_os = "linux")] -- cgit v1.2.3