aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-10-17 15:53:41 -0700
committerZeyla Hellyer <[email protected]>2017-10-17 15:53:41 -0700
commit9115dadb78404d332630ff47472a5c7218e72022 (patch)
tree1b11ea1b6db3b2aeab09d9b61d4373fe83f389bc /src
parentChange `features` fields to be a Vec<String> (diff)
downloadserenity-9115dadb78404d332630ff47472a5c7218e72022.tar.xz
serenity-9115dadb78404d332630ff47472a5c7218e72022.zip
Fix some compilation feature targets, fix lints
Diffstat (limited to 'src')
-rw-r--r--src/internal/macros.rs1
-rw-r--r--src/lib.rs3
-rw-r--r--src/model/guild/member.rs1
-rw-r--r--src/model/guild/mod.rs6
4 files changed, 8 insertions, 3 deletions
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,
diff --git a/src/lib.rs b/src/lib.rs
index 121740e..0564a3d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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(),