Skip to content

Commit

Permalink
Fix unreachable patterns in command macro
Browse files Browse the repository at this point in the history
When attempting to use a named argument with a type of String, the
framework will try to parse the received argument - a String - into a
String. This can never fail, so Rust warns that the `Err` arm of the
`match` can never be reached.

Let's just ignore that and everything will be fine.
  • Loading branch information
Austin Hellyer committed Feb 2, 2017
1 parent 9392f61 commit 97f9bd1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ext/framework/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ macro_rules! command {
}
};
($fname:ident($c:ident, $m:ident, $a:ident, $($name:ident: $t:ty),*) $b:block) => {
#[allow(unused_mut)]
#[allow(unreachable_patterns, unused_mut)]
pub fn $fname(mut $c: &mut $crate::client::Context, $m: &$crate::model::Message, $a: Vec<String>) -> ::std::result::Result<(), String> {
let mut i = $a.iter();
let mut arg_counter = 0;
Expand Down

0 comments on commit 97f9bd1

Please sign in to comment.