aboutsummaryrefslogtreecommitdiff
path: root/src/model/guild
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/model/guild
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/model/guild')
-rw-r--r--src/model/guild/member.rs1
-rw-r--r--src/model/guild/mod.rs6
2 files changed, 6 insertions, 1 deletions
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(),