diff options
| author | Austin Hellyer <[email protected]> | 2016-11-10 17:09:24 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-10 17:09:24 -0800 |
| commit | b0e1a70418a629eb1cc71339c9ca6dc2ae0ec2a1 (patch) | |
| tree | dbea47d3cfcf983ba95411fd2e8af35f141cd807 /src | |
| parent | Implementing missing HTTP methods (diff) | |
| download | serenity-b0e1a70418a629eb1cc71339c9ca6dc2ae0ec2a1.tar.xz serenity-b0e1a70418a629eb1cc71339c9ca6dc2ae0ec2a1.zip | |
Fix some clippy lints
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/http/ratelimiting.rs | 2 | ||||
| -rw-r--r-- | src/constants.rs | 3 | ||||
| -rw-r--r-- | src/ext/framework/mod.rs | 18 | ||||
| -rw-r--r-- | src/lib.rs | 4 | ||||
| -rw-r--r-- | src/model/channel.rs | 2 | ||||
| -rw-r--r-- | src/model/utils.rs | 12 | ||||
| -rw-r--r-- | src/model/webhook.rs | 2 | ||||
| -rw-r--r-- | src/utils/mod.rs | 3 |
8 files changed, 10 insertions, 36 deletions
diff --git a/src/client/http/ratelimiting.rs b/src/client/http/ratelimiting.rs index 8ca7d5d..9928535 100644 --- a/src/client/http/ratelimiting.rs +++ b/src/client/http/ratelimiting.rs @@ -70,7 +70,6 @@ pub enum Route { ChannelsIdWebhooks(u64), Gateway, GatewayBot, - Global, Guilds, GuildsId(u64), GuildsIdBans(u64), @@ -83,7 +82,6 @@ pub enum Route { GuildsIdIntegrationsId(u64), GuildsIdIntegrationsIdSync(u64), GuildsIdInvites(u64), - GuildsIdMembers(u64), GuildsIdMembersId(u64), GuildsIdPrune(u64), GuildsIdRegions(u64), diff --git a/src/constants.rs b/src/constants.rs index c16c11c..7f71f5b 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -1,7 +1,5 @@ use ::prelude_internal::*; -/// The base URI for the API. -pub const API_BASE: &'static str = "https://discordapp.com/api/v6"; /// The gateway version used by the library. The gateway URI is retrieved via /// the REST API. pub const GATEWAY_VERSION: u8 = 6; @@ -10,6 +8,7 @@ pub const GATEWAY_VERSION: u8 = 6; /// [UserAgent]: ../hyper/header/struct.UserAgent.html pub const USER_AGENT: &'static str = concat!("DiscordBot (https://github.com/zeyla/serenity, ", env!("CARGO_PKG_VERSION"), ")"); +#[allow(dead_code)] #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum ErrorCode { BotsCannotUse, diff --git a/src/ext/framework/mod.rs b/src/ext/framework/mod.rs index 80844c3..c5e68ec 100644 --- a/src/ext/framework/mod.rs +++ b/src/ext/framework/mod.rs @@ -40,8 +40,8 @@ impl Framework { pub fn dispatch(&mut self, context: Context, message: Message) { let res = command::positions(&message.content, &self.configuration); - let (positions, kind) = match res { - Some((positions, kind)) => (positions, kind), + let positions = match res { + Some((positions, _kind)) => positions, None => return, }; @@ -114,18 +114,4 @@ impl Framework { self } - - fn find_mention_end(&self, content: &str) -> Option<usize> { - if let Some(ref mentions) = self.configuration.on_mention { - for mention in mentions { - if !content.starts_with(&mention[..]) { - continue; - } - - return Some(mention.len() + 1); - } - } - - None - } } @@ -74,8 +74,8 @@ //! [docs]: https://discordapp.com/developers/docs/intro //! [examples]: https://github.com/zeyla/serenity.rs/tree/master/examples //! [state docs]: ext/state/index.html -#![allow(doc_markdown, unknown_lints)] -#![allow(dead_code)] +#![allow(doc_markdown, inline_always, unknown_lints)] +#![warn(dead_code)] #[macro_use] extern crate bitflags; diff --git a/src/model/channel.rs b/src/model/channel.rs index facb67a..178db25 100644 --- a/src/model/channel.rs +++ b/src/model/channel.rs @@ -966,7 +966,7 @@ impl fmt::Display for ReactionType { try!(fmt::Display::fmt(&id, f)); f.write_char('>') }, - ReactionType::Unicode(ref unicode) => f.write_str(&unicode), + ReactionType::Unicode(ref unicode) => f.write_str(unicode), } } } diff --git a/src/model/utils.rs b/src/model/utils.rs index a05ff20..d66b258 100644 --- a/src/model/utils.rs +++ b/src/model/utils.rs @@ -7,7 +7,6 @@ use super::{ EmojiId, Member, Presence, - PublicChannel, ReadState, Relationship, Role, @@ -146,17 +145,6 @@ pub fn decode_private_channels(value: Value) Ok(private_channels) } -pub fn decode_public_channels(value: Value) - -> Result<HashMap<ChannelId, PublicChannel>> { - let mut public_channels = HashMap::new(); - - for public_channel in try!(decode_array(value, PublicChannel::decode)) { - public_channels.insert(public_channel.id, public_channel); - } - - Ok(public_channels) -} - pub fn decode_read_states(value: Value) -> Result<HashMap<ChannelId, ReadState>> { let mut read_states = HashMap::new(); diff --git a/src/model/webhook.rs b/src/model/webhook.rs index 70acd68..aaab2ab 100644 --- a/src/model/webhook.rs +++ b/src/model/webhook.rs @@ -71,7 +71,7 @@ impl Webhook { let mut map = ObjectBuilder::new(); if let Some(avatar) = avatar { - map = map.insert("avatar", if avatar.len() == 0 { + map = map.insert("avatar", if avatar.is_empty() { Value::Null } else { Value::String(avatar.to_owned()) diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 103a73e..66f0f70 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -43,12 +43,14 @@ macro_rules! status_concat { macro_rules! map_nums { ($item:ident; $($entry:ident $value:expr,)*) => { impl $item { + #[allow(dead_code)] pub fn num(&self) -> u64 { match *self { $($item::$entry => $value,)* } } + #[allow(dead_code)] pub fn from_num(num: u64) -> Option<Self> { match num { $($value => Some($item::$entry),)* @@ -56,6 +58,7 @@ macro_rules! map_nums { } } + #[allow(dead_code)] fn decode(value: Value) -> Result<Self> { value.as_u64().and_then(Self::from_num).ok_or(Error::Decode( concat!("Expected valid ", stringify!($item)), |