Skip to content

Commit

Permalink
Use $crate in the command macro
Browse files Browse the repository at this point in the history
  • Loading branch information
arqunis authored and zeyla committed Dec 24, 2016
1 parent b38f5dd commit abd22d2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ A basic ping-pong bot looks like:
```rust,no-run
extern crate serenity;
use serenity::client::{Client, Context};
use serenity::model::Message;
use serenity::client::Client;
use std::env;
fn main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/07_voice/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#[macro_use]
extern crate serenity;

use serenity::client::{CACHE, Client, Context};
use serenity::client::{CACHE, Client};
use serenity::ext::voice;
use serenity::model::{ChannelId, Message, Mentionable};
use serenity::Result as SerenityResult;
Expand Down
8 changes: 4 additions & 4 deletions src/ext/framework/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,28 +113,28 @@ use ::client::CACHE;
#[macro_export]
macro_rules! command {
($fname:ident($c:ident) $b:block) => {
pub fn $fname($c: &Context, _: &Message, _: Vec<String>) -> Result<(), String> {
pub fn $fname($c: &$crate::client::Context, _: &$crate::model::Message, _: Vec<String>) -> Result<(), String> {
$b

Ok(())
}
};
($fname:ident($c:ident, $m:ident) $b:block) => {
pub fn $fname($c: &Context, $m: &Message, _: Vec<String>) -> Result<(), String> {
pub fn $fname($c: &$crate::client::Context, $m: &$crate::model::Message, _: Vec<String>) -> Result<(), String> {
$b

Ok(())
}
};
($fname:ident($c:ident, $m:ident, $a:ident) $b:block) => {
pub fn $fname($c: &Context, $m: &Message, $a: Vec<String>) -> Result<(), String> {
pub fn $fname($c: &$crate::client::Context, $m: &$crate::model::Message, $a: Vec<String>) -> Result<(), String> {
$b

Ok(())
}
};
($fname:ident($c:ident, $m:ident, $a:ident, $($name:ident: $t:ty),*) $b:block) => {
pub fn $fname($c: &Context, $m: &Message, $a: Vec<String>) -> Result<(), String> {
pub fn $fname($c: &$crate::client::Context, $m: &$crate::model::Message, $a: Vec<String>) -> Result<(), String> {
let mut i = $a.iter();
let mut arg_counter = 0;

Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
//! ```rust,ignore
//! extern crate serenity;
//!
//! use serenity::client::{Client, Context};
//! use serenity::model::Message;
//! use serenity::client::Client;
//! use std::env;
//!
//! fn main() {
Expand Down

0 comments on commit abd22d2

Please sign in to comment.