diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2021-07-12 22:43:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-12 22:43:36 -0400 |
commit | 54ccbb984efa86eb4cd876349f2a512eb4da2d9a (patch) | |
tree | bb7e97a9499da6fecc2ce6f307133c4d3742c502 | |
parent | 01554758a03a2a28e19bcc878f96375a0b44ece1 (diff) | |
parent | 70242bc2b2de5e1092f0e2c3ee978e1040d3e4e5 (diff) |
Merge pull request #539 from ClementTsang/remove_beef
Small refactor to remove the beef dependency for now.
This is likely just a tempoary 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.
-rw-r--r-- | Cargo.lock | 7 | ||||
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | src/app/query.rs | 10 | ||||
-rw-r--r-- | src/options.rs | 2 | ||||
-rw-r--r-- | src/utils/error.rs | 3 |
5 files changed, 6 insertions, 17 deletions
@@ -210,12 +210,6 @@ dependencies = [ ] [[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" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -243,7 +237,6 @@ dependencies = [ "assert_cmd", "backtrace", "battery", - "beef", "cargo-husky", "cfg-if 1.0.0", "chrono", @@ -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")] |