aboutsummaryrefslogtreecommitdiff
path: root/src/utils
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/utils
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/utils')
-rw-r--r--src/utils/macros.rs16
-rw-r--r--src/utils/mod.rs2
2 files changed, 9 insertions, 9 deletions
diff --git a/src/utils/macros.rs b/src/utils/macros.rs
index e8f74dd..2ba37e0 100644
--- a/src/utils/macros.rs
+++ b/src/utils/macros.rs
@@ -1,25 +1,25 @@
macro_rules! request {
($route:expr, $method:ident($body:expr), $url:expr, $($rest:tt)*) => {{
let client = HyperClient::new();
- try!(request($route, || client
+ request($route, || client
.$method(&format!(api!($url), $($rest)*))
- .body(&$body)))
+ .body(&$body))?
}};
($route:expr, $method:ident($body:expr), $url:expr) => {{
let client = HyperClient::new();
- try!(request($route, || client
+ request($route, || client
.$method(api!($url))
- .body(&$body)))
+ .body(&$body))?
}};
($route:expr, $method:ident, $url:expr, $($rest:tt)*) => {{
let client = HyperClient::new();
- try!(request($route, || client
- .$method(&format!(api!($url), $($rest)*))))
+ request($route, || client
+ .$method(&format!(api!($url), $($rest)*)))?
}};
($route:expr, $method:ident, $url:expr) => {{
let client = HyperClient::new();
- try!(request($route, || client
- .$method(api!($url))))
+ request($route, || client
+ .$method(api!($url)))?
}};
}
diff --git a/src/utils/mod.rs b/src/utils/mod.rs
index 2401a1b..a7a14a3 100644
--- a/src/utils/mod.rs
+++ b/src/utils/mod.rs
@@ -186,7 +186,7 @@ pub fn read_image<P: AsRef<Path>>(path: P) -> Result<String> {
let path = path.as_ref();
let mut v = Vec::default();
- let mut f = try!(File::open(path));
+ let mut f = File::open(path)?;
let _ = f.read_to_end(&mut v);
let b64 = base64::encode(&v);