aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorMaiddog <[email protected]>2017-08-22 06:27:10 -0500
committeralex <[email protected]>2017-08-22 13:27:10 +0200
commitcb072aab60ac67bc4d52aed3554300c1c5e83081 (patch)
treefc00dd5d91b989582e10a93afb4713f1fbd6c88f /src/model
parentFix presence updates (diff)
downloadserenity-cb072aab60ac67bc4d52aed3554300c1c5e83081.tar.xz
serenity-cb072aab60ac67bc4d52aed3554300c1c5e83081.zip
Fix tests (#145)
Diffstat (limited to 'src/model')
-rw-r--r--src/model/channel/message.rs1
-rw-r--r--src/model/gateway.rs9
-rw-r--r--src/model/misc.rs38
3 files changed, 24 insertions, 24 deletions
diff --git a/src/model/channel/message.rs b/src/model/channel/message.rs
index dc6dcfa..27f4e31 100644
--- a/src/model/channel/message.rs
+++ b/src/model/channel/message.rs
@@ -82,6 +82,7 @@ impl Message {
/// #
/// # fn main() {
/// # use serenity::prelude::*;
+ /// # use serenity::framework::standard::Args;
/// # struct Handler;
/// #
/// # impl EventHandler for Handler {}
diff --git a/src/model/gateway.rs b/src/model/gateway.rs
index 6153abb..1b3a40b 100644
--- a/src/model/gateway.rs
+++ b/src/model/gateway.rs
@@ -47,6 +47,7 @@ impl Game {
/// ```rust,no_run
/// # #[macro_use] extern crate serenity;
/// #
+ /// use serenity::framework::standard::Args;
/// use serenity::model::Game;
///
/// command!(game(ctx, _msg, args) {
@@ -75,12 +76,14 @@ impl Game {
/// ```rust,no_run
/// # #[macro_use] extern crate serenity;
/// #
+ /// use serenity::framework::standard::Args;
/// use serenity::model::Game;
///
/// // Assumes command has min_args set to 2.
- /// command!(stream(ctx, _msg, args, stream: String) {
- /// let name = args[1..].join(" ");
- /// ctx.set_game(Game::streaming(&name, &stream));
+ /// command!(stream(ctx, _msg, args) {
+ /// # let stream_url = String::from("");
+ /// let name = args.full();
+ /// ctx.set_game(Game::streaming(&name, &stream_url));
/// });
/// #
/// # fn main() {}
diff --git a/src/model/misc.rs b/src/model/misc.rs
index 8106c40..dee915e 100644
--- a/src/model/misc.rs
+++ b/src/model/misc.rs
@@ -60,25 +60,23 @@ impl Mentionable for User {
#[derive(Debug)]
pub enum UserParseError {
NotPresentInCache,
- InvalidUsername
+ InvalidUsername,
}
#[cfg(all(feature = "model", feature = "utils"))]
impl fmt::Display for UserParseError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "{}", self.description())
- }
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.description()) }
}
#[cfg(all(feature = "cache", feature = "utils"))]
impl StdError for UserParseError {
fn description(&self) -> &str {
use self::UserParseError::*;
-
+
match *self {
NotPresentInCache => "not present in cache",
- InvalidUsername => "invalid username"
+ InvalidUsername => "invalid username",
}
}
}
@@ -108,16 +106,14 @@ pub enum UserIdParseError {
#[cfg(all(feature = "model", feature = "utils"))]
impl fmt::Display for UserIdParseError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "{}", self.description())
- }
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.description()) }
}
#[cfg(all(feature = "cache", feature = "utils"))]
impl StdError for UserIdParseError {
fn description(&self) -> &str {
use self::UserIdParseError::*;
-
+
match *self {
NotPresentInCache => "not present in cache",
}
@@ -129,7 +125,9 @@ impl FromStr for UserId {
type Err = UserIdParseError;
fn from_str(s: &str) -> StdResult<Self, Self::Err> {
- utils::parse_username(s).ok_or_else(|| UserIdParseError::NotPresentInCache).map(UserId)
+ utils::parse_username(s)
+ .ok_or_else(|| UserIdParseError::NotPresentInCache)
+ .map(UserId)
}
}
@@ -142,19 +140,17 @@ pub enum RoleParseError {
#[cfg(all(feature = "model", feature = "utils"))]
impl fmt::Display for RoleParseError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "{}", self.description())
- }
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.description()) }
}
#[cfg(all(feature = "cache", feature = "utils"))]
impl StdError for RoleParseError {
fn description(&self) -> &str {
use self::RoleParseError::*;
-
+
match *self {
NotPresentInCache => "not present in cache",
- InvalidRole => "invalid role"
+ InvalidRole => "invalid role",
}
}
}
@@ -184,16 +180,14 @@ pub enum RoleIdParseError {
#[cfg(all(feature = "model", feature = "utils"))]
impl fmt::Display for RoleIdParseError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "{}", self.description())
- }
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.description()) }
}
#[cfg(all(feature = "cache", feature = "utils"))]
impl StdError for RoleIdParseError {
fn description(&self) -> &str {
use self::RoleIdParseError::*;
-
+
match *self {
NotPresentInCache => "not present in cache",
}
@@ -205,7 +199,9 @@ impl FromStr for RoleId {
type Err = RoleIdParseError;
fn from_str(s: &str) -> StdResult<Self, Self::Err> {
- utils::parse_role(s).ok_or_else(|| RoleIdParseError::NotPresentInCache).map(RoleId)
+ utils::parse_role(s)
+ .ok_or_else(|| RoleIdParseError::NotPresentInCache)
+ .map(RoleId)
}
}