From eb43b9c4a4e43a8e097ea71fdc7584c8108b52a3 Mon Sep 17 00:00:00 2001 From: Ken Swenson Date: Fri, 19 May 2017 00:53:32 -0400 Subject: Allow unreachable_code lint in command! macro If a user returns at the end of a `command!` macro block, the library's return value will never be processed, as it's unreachable. Instead of warning for this, allow it. --- src/ext/framework/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/ext/framework') diff --git a/src/ext/framework/mod.rs b/src/ext/framework/mod.rs index ffcb648..cde10b2 100644 --- a/src/ext/framework/mod.rs +++ b/src/ext/framework/mod.rs @@ -117,7 +117,7 @@ use ::model::Channel; #[macro_export] macro_rules! command { ($fname:ident($c:ident) $b:block) => { - #[allow(unused_mut)] + #[allow(unreachable_code, unused_mut)] pub fn $fname(mut $c: &mut $crate::client::Context, _: &$crate::model::Message, _: Vec) -> ::std::result::Result<(), String> { $b @@ -125,7 +125,7 @@ macro_rules! command { } }; ($fname:ident($c:ident, $m:ident) $b:block) => { - #[allow(unused_mut)] + #[allow(unreachable_code, unused_mut)] pub fn $fname(mut $c: &mut $crate::client::Context, $m: &$crate::model::Message, _: Vec) -> ::std::result::Result<(), String> { $b @@ -133,7 +133,7 @@ macro_rules! command { } }; ($fname:ident($c:ident, $m:ident, $a:ident) $b:block) => { - #[allow(unused_mut)] + #[allow(unreachable_code, unused_mut)] pub fn $fname(mut $c: &mut $crate::client::Context, $m: &$crate::model::Message, $a: Vec) -> ::std::result::Result<(), String> { $b @@ -141,7 +141,7 @@ macro_rules! command { } }; ($fname:ident($c:ident, $m:ident, $a:ident, $($name:ident: $t:ty),*) $b:block) => { - #[allow(unreachable_patterns, unused_mut)] + #[allow(unreachable_code, unreachable_patterns, unused_mut)] pub fn $fname(mut $c: &mut $crate::client::Context, $m: &$crate::model::Message, $a: Vec) -> ::std::result::Result<(), String> { let mut i = $a.iter(); let mut arg_counter = 0; -- cgit v1.2.3