aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-08-19 02:05:11 +0200
committeracdenisSK <[email protected]>2017-08-19 02:05:39 +0200
commit3e97e77ce8878c65cf3051c053d32af8e4888957 (patch)
tree5c0d90317ec87b1e4740b78e41a78ba9e3f2b924 /src
parentFix a failing test (#140) (diff)
downloadserenity-3e97e77ce8878c65cf3051c053d32af8e4888957.tar.xz
serenity-3e97e77ce8878c65cf3051c053d32af8e4888957.zip
Clippy
Diffstat (limited to 'src')
-rw-r--r--src/cache/cache_events_impl.rs2
-rw-r--r--src/framework/command.rs4
-rw-r--r--src/framework/mod.rs4
-rw-r--r--src/lib.rs2
-rw-r--r--src/model/guild/audit_log.rs2
-rw-r--r--src/model/guild/mod.rs14
6 files changed, 11 insertions, 17 deletions
diff --git a/src/cache/cache_events_impl.rs b/src/cache/cache_events_impl.rs
index 8146e73..7424add 100644
--- a/src/cache/cache_events_impl.rs
+++ b/src/cache/cache_events_impl.rs
@@ -113,7 +113,7 @@ impl CacheEventsImpl for super::Cache {
.map(Channel::Guild)
},
Channel::Private(ref channel) => {
- if let Some(ref channel) = self.private_channels.get(&channel.read().unwrap().id) {
+ if let Some(channel) = self.private_channels.get(&channel.read().unwrap().id) {
return Some(Channel::Private((*channel).clone()));
}
diff --git a/src/framework/command.rs b/src/framework/command.rs
index ed38a14..3528e85 100644
--- a/src/framework/command.rs
+++ b/src/framework/command.rs
@@ -9,8 +9,8 @@ pub type Exec = Fn(&mut Context, &Message, Vec<String>, String) -> Result<(), St
pub type Help = Fn(&mut Context, &Message, HashMap<String, Arc<CommandGroup>>, &[String])
-> Result<(), String>
+ 'static;
-pub type BeforeHook = Fn(&mut Context, &Message, &String) -> bool + 'static;
-pub type AfterHook = Fn(&mut Context, &Message, &String, Result<(), String>) + 'static;
+pub type BeforeHook = Fn(&mut Context, &Message, &str) -> bool + 'static;
+pub type AfterHook = Fn(&mut Context, &Message, &str, Result<(), String>) + 'static;
pub(crate) type InternalCommand = Arc<Command>;
pub type PrefixCheck = Fn(&mut Context, &Message) -> Option<String> + 'static;
diff --git a/src/framework/mod.rs b/src/framework/mod.rs
index 5c676ec..98f7d40 100644
--- a/src/framework/mod.rs
+++ b/src/framework/mod.rs
@@ -850,7 +850,7 @@ impl BuiltinFramework {
/// ```
///
pub fn before<F>(mut self, f: F) -> Self
- where F: Fn(&mut Context, &Message, &String) -> bool + 'static {
+ where F: Fn(&mut Context, &Message, &str) -> bool + 'static {
self.before = Some(Arc::new(f));
self
@@ -881,7 +881,7 @@ impl BuiltinFramework {
/// }));
/// ```
pub fn after<F>(mut self, f: F) -> Self
- where F: Fn(&mut Context, &Message, &String, Result<(), String>) + 'static {
+ where F: Fn(&mut Context, &Message, &str, Result<(), String>) + 'static {
self.after = Some(Arc::new(f));
self
diff --git a/src/lib.rs b/src/lib.rs
index 4fc9d68..a9c4cc2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -85,7 +85,7 @@
//! [examples]: https://github.com/zeyla/serenity/tree/master/examples
//! [gateway docs]: gateway/index.html
#![allow(doc_markdown, inline_always, unknown_lints)]
-#![warn(enum_glob_use, if_not_else)]
+#![warn(enum_glob_use)]
#[macro_use]
extern crate bitflags;
diff --git a/src/model/guild/audit_log.rs b/src/model/guild/audit_log.rs
index 34d45a8..916530e 100644
--- a/src/model/guild/audit_log.rs
+++ b/src/model/guild/audit_log.rs
@@ -160,7 +160,7 @@ fn deserialize_action<'de, D: Deserializer<'de>>(de: D) -> Result<Action, D::Err
fn visit_i32<E: de::Error>(self, value: i32) -> Result<Action, E> {
Ok(match value {
1 => Action::GuildUpdate,
- 10...13 => Action::Channel(unsafe { transmute(value) }),
+ 10...12 => Action::Channel(unsafe { transmute(value) }),
13...15 => Action::ChannelOverwrite(unsafe { transmute(value) }),
20...25 => Action::Member(unsafe { transmute(value) }),
30...32 => Action::Role(unsafe { transmute(value) }),
diff --git a/src/model/guild/mod.rs b/src/model/guild/mod.rs
index 9e6d6ee..e5e997c 100644
--- a/src/model/guild/mod.rs
+++ b/src/model/guild/mod.rs
@@ -130,10 +130,7 @@ impl Guild {
let uid = CACHE.read().unwrap().user.id;
for (cid, channel) in &self.channels {
- if {
- let perms = self.permissions_for(*cid, uid);
- perms.read_messages()
- } {
+ if self.permissions_for(*cid, uid).read_messages() {
return Some(channel.read().unwrap().clone());
}
}
@@ -147,12 +144,9 @@ impl Guild {
pub fn default_channel_guaranteed(&self) -> Option<GuildChannel> {
for (cid, channel) in &self.channels {
for memid in self.members.keys() {
- if {
- let perms = self.permissions_for(*cid, *memid);
- perms.read_messages()
- } {
- return Some(channel.read().unwrap().clone());
- }
+ if self.permissions_for(*cid, *memid).read_messages() {
+ return Some(channel.read().unwrap().clone());
+ }
}
}