Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
medal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bwinf
medal
Commits
cf18e9a2
Commit
cf18e9a2
authored
5 years ago
by
Robert Czechowski
Browse files
Options
Downloads
Patches
Plain Diff
Clippy fix: Replace try! macro by ? operator
parent
0f141018
Branches
test-try-removal
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#288
passed
5 years ago
Stage: test
Stage: build
Stage: testdeploy
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
iron-sessionstorage/src/backends/redis.rs
+4
-6
4 additions, 6 deletions
iron-sessionstorage/src/backends/redis.rs
iron-sessionstorage/src/lib.rs
+3
-3
3 additions, 3 deletions
iron-sessionstorage/src/lib.rs
with
7 additions
and
9 deletions
iron-sessionstorage/src/backends/redis.rs
+
4
−
6
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
})
}
...
...
This diff is collapsed.
Click to expand it.
iron-sessionstorage/src/lib.rs
+
3
−
3
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment