diff options
| -rw-r--r-- | Cargo.toml | 6 | ||||
| -rw-r--r-- | src/internal/macros.rs | 1 | ||||
| -rw-r--r-- | src/lib.rs | 3 | ||||
| -rw-r--r-- | src/model/guild/member.rs | 1 | ||||
| -rw-r--r-- | src/model/guild/mod.rs | 6 |
5 files changed, 9 insertions, 8 deletions
@@ -13,6 +13,7 @@ version = "0.4.1" [dependencies] bitflags = "^1.0" log = "~0.3" +parking_lot = "^0.4" serde = "^1.0" serde_derive = "^1.0" serde_json = "^1.0" @@ -59,10 +60,6 @@ version = "0.1" optional = true version = "0.2" -[dependencies.parking_lot] -optional = true -version = "0.4" - [dependencies.sodiumoxide] default-features = false optional = true @@ -104,7 +101,6 @@ client = [ "gateway", "http", "lazy_static", - "parking_lot", "threadpool", "typemap", ] diff --git a/src/internal/macros.rs b/src/internal/macros.rs index 92a21c1..3bcc5c5 100644 --- a/src/internal/macros.rs +++ b/src/internal/macros.rs @@ -182,6 +182,7 @@ macro_rules! enum_number { } } +#[allow(unused_macros)] macro_rules! try_opt { ($x:expr) => (match $x { Some(v) => v, @@ -104,6 +104,7 @@ extern crate serde_json; extern crate lazy_static; extern crate chrono; +extern crate parking_lot; extern crate serde; #[cfg(feature = "base64")] @@ -122,8 +123,6 @@ extern crate multipart; extern crate native_tls; #[cfg(feature = "opus")] extern crate opus; -#[cfg(feature = "parking_lot")] -extern crate parking_lot; #[cfg(feature = "sodiumoxide")] extern crate sodiumoxide; #[cfg(feature = "threadpool")] diff --git a/src/model/guild/member.rs b/src/model/guild/member.rs index 02e5afb..90dca58 100644 --- a/src/model/guild/member.rs +++ b/src/model/guild/member.rs @@ -178,6 +178,7 @@ impl Member { /// Returns the "default channel" of the guild for the member. /// (This returns the first channel that can be read by the member, if there isn't /// one returns `None`) + #[cfg(feature = "cache")] pub fn default_channel(&self) -> Option<Arc<RwLock<GuildChannel>>> { let guild = match self.guild_id.find() { Some(guild) => guild, diff --git a/src/model/guild/mod.rs b/src/model/guild/mod.rs index 3615e5d..90938d9 100644 --- a/src/model/guild/mod.rs +++ b/src/model/guild/mod.rs @@ -19,7 +19,6 @@ use serde::de::Error as DeError; use serde_json; use super::utils::*; use model::*; -use std; #[cfg(all(feature = "cache", feature = "model"))] use CACHE; @@ -29,6 +28,8 @@ use http; use builder::{EditGuild, EditMember, EditRole}; #[cfg(feature = "model")] use constants::LARGE_THRESHOLD; +#[cfg(feature = "model")] +use std; /// A representation of a banning of a user. #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Hash)] @@ -1446,11 +1447,13 @@ impl<'de> Deserialize<'de> for Guild { } /// Checks if a `&str` contains another `&str`. +#[cfg(feature = "model")] fn contains_case_insensitive(to_look_at: &str, to_find: &str) -> bool { to_look_at.to_lowercase().contains(to_find) } /// Checks if a `&str` starts with another `&str`. +#[cfg(feature = "model")] fn starts_with_case_insensitive(to_look_at: &str, to_find: &str) -> bool { to_look_at.to_lowercase().starts_with(to_find) } @@ -1462,6 +1465,7 @@ fn starts_with_case_insensitive(to_look_at: &str, to_find: &str) -> bool { /// expected to contain `origin` as substring. /// If not, using `closest_to_origin` would sort these /// the end. +#[cfg(feature = "model")] fn closest_to_origin(origin: &str, word_a: &str, word_b: &str) -> std::cmp::Ordering { let value_a = match word_a.find(origin) { Some(value) => value + word_a.len(), |