Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bwinf
medal
Commits
cf18e9a2
Commit
cf18e9a2
authored
Nov 08, 2019
by
Robert Czechowski
Browse files
Clippy fix: Replace try! macro by ? operator
parent
0f141018
Pipeline
#288
passed with stages
in 19 minutes and 25 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
iron-sessionstorage/src/backends/redis.rs
View file @
cf18e9a2
...
...
@@ -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
})
}
...
...
iron-sessionstorage/src/lib.rs
View file @
cf18e9a2
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment