aboutsummaryrefslogtreecommitdiff
path: root/src/client/context.rs
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2016-12-07 19:10:21 +0100
committerzeyla <[email protected]>2016-12-07 10:10:21 -0800
commitf69512beaa157775accd4392295dba112adcf1df (patch)
tree0944aeabdec8609393f78b9ec257dc5d09d4f6c0 /src/client/context.rs
parentAllow mentionable structs to be used as command arguments (diff)
downloadserenity-f69512beaa157775accd4392295dba112adcf1df.tar.xz
serenity-f69512beaa157775accd4392295dba112adcf1df.zip
Change all try's into ?s
This breaks compatibility with < 1.13, but we didn't support that anyway.
Diffstat (limited to 'src/client/context.rs')
-rw-r--r--src/client/context.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/client/context.rs b/src/client/context.rs
index af90447..f0ead27 100644
--- a/src/client/context.rs
+++ b/src/client/context.rs
@@ -507,7 +507,7 @@ impl Context {
// edit.
//
// [this]: http://github.com/hammerandchisel/discord-api-docs/issues/156
- let role = try!(rest::create_role(id));
+ let role = rest::create_role(id)?;
let map = f(EditRole::default()).0.build();
rest::edit_role(id, role.id.0, map)
@@ -775,7 +775,7 @@ impl Context {
F: FnOnce(EditChannel) -> EditChannel {
let channel_id = channel_id.into();
- let map = match try!(self.get_channel(channel_id)) {
+ let map = match self.get_channel(channel_id)? {
Channel::Guild(channel) => {
let map = ObjectBuilder::new()
.insert("name", channel.name)
@@ -906,7 +906,7 @@ impl Context {
/// ```
pub fn edit_profile<F: FnOnce(EditProfile) -> EditProfile>(&self, f: F)
-> Result<CurrentUser> {
- let user = try!(rest::get_current_user());
+ let user = rest::get_current_user()?;
let mut map = ObjectBuilder::new()
.insert("avatar", user.avatar)
@@ -1070,7 +1070,7 @@ impl Context {
let mut channels = HashMap::new();
- for channel in try!(rest::get_channels(guild_id.0)) {
+ for channel in rest::get_channels(guild_id.0)? {
channels.insert(channel.id, channel);
}
@@ -1250,18 +1250,18 @@ impl Context {
let query = {
let mut map = f(GetMessages::default()).0;
let mut query = String::new();
- try!(write!(query, "?limit={}", map.remove("limit").unwrap_or(50)));
+ write!(query, "?limit={}", map.remove("limit").unwrap_or(50))?;
if let Some(after) = map.remove("after") {
- try!(write!(query, "&after={}", after));
+ write!(query, "&after={}", after)?;
}
if let Some(around) = map.remove("around") {
- try!(write!(query, "&around={}", around));
+ write!(query, "&around={}", around)?;
}
if let Some(before) = map.remove("before") {
- try!(write!(query, "&before={}", before));
+ write!(query, "&before={}", before)?;
}
query