src/api2/admin/datastore/h2upload.rs: avoid unwrap
This commit is contained in:
parent
4e3da4b366
commit
090ac9f79a
|
@ -183,15 +183,14 @@ fn upgrade_h2upload(
|
||||||
.select(abort_future.map_err(|_| {}).then(move |_| { bail!("task aborted"); }))
|
.select(abort_future.map_err(|_| {}).then(move |_| { bail!("task aborted"); }))
|
||||||
.and_then(|(result, _)| Ok(result))
|
.and_then(|(result, _)| Ok(result))
|
||||||
.map_err(|(err, _)| err)
|
.map_err(|(err, _)| err)
|
||||||
}).unwrap();
|
})?;
|
||||||
|
|
||||||
Ok(Box::new(futures::future::ok(
|
let response = Response::builder()
|
||||||
Response::builder()
|
.status(StatusCode::SWITCHING_PROTOCOLS)
|
||||||
.status(StatusCode::SWITCHING_PROTOCOLS)
|
.header(UPGRADE, HeaderValue::from_static(expected_protocol))
|
||||||
.header(UPGRADE, HeaderValue::from_static(expected_protocol))
|
.body(Body::empty())?;
|
||||||
.body(Body::empty())
|
|
||||||
.unwrap()
|
Ok(Box::new(futures::future::ok(response)))
|
||||||
)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn backup_api() -> Router {
|
fn backup_api() -> Router {
|
||||||
|
@ -248,8 +247,7 @@ fn test2_get(
|
||||||
println!("TASK DONE");
|
println!("TASK DONE");
|
||||||
Ok(Response::builder()
|
Ok(Response::builder()
|
||||||
.status(StatusCode::OK)
|
.status(StatusCode::OK)
|
||||||
.body(Body::empty())
|
.body(Body::empty())?)
|
||||||
.unwrap())
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(Box::new(fut))
|
Ok(Box::new(fut))
|
||||||
|
|
Loading…
Reference in New Issue