Skip to content
Snippets Groups Projects
Commit cf18e9a2 authored by Robert Czechowski's avatar Robert Czechowski
Browse files

Clippy fix: Replace try! macro by ? operator

parent 0f141018
Branches test-try-removal
Tags
No related merge requests found
Pipeline #288 passed
......@@ -63,15 +63,13 @@ pub struct RedisBackend {
impl RedisBackend {
pub fn new<T: redis::IntoConnectionInfo>(params: T) -> Result<Self> {
let manager = try!(
let manager =
RedisConnectionManager::new(params)
.chain_err(|| "Couldn't create redis connection manager")
);
let pool = try!(
.chain_err(|| "Couldn't create redis connection manager")?;
let pool =
r2d2::Pool::builder()
.build(manager)
.chain_err(|| "Couldn't create redis connection pool")
);
.chain_err(|| "Couldn't create redis connection pool")?;
Ok(RedisBackend { pool: pool })
}
......
......@@ -82,7 +82,7 @@ pub trait Value: Sized + 'static {
impl Session {
/// Get a `Value` from the session.
pub fn get<T: Value + Sized + 'static>(&self) -> IronResult<Option<T>> {
Ok(try!(self.inner.get_raw(T::get_key())).and_then(T::from_raw))
Ok(self.inner.get_raw(T::get_key())?.and_then(T::from_raw))
}
/// Set a `Value` in the session.
......@@ -112,8 +112,8 @@ impl<B: SessionBackend> AroundMiddleware for SessionStorage<B> {
let s = req.extensions.remove::<SessionKey>().unwrap();
if s.has_changed {
match res {
Ok(ref mut r) => try!(s.inner.write(r)),
Err(ref mut e) => try!(s.inner.write(&mut e.response))
Ok(ref mut r) => s.inner.write(r)?,
Err(ref mut e) => s.inner.write(&mut e.response)?
}
};
res
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment