Fixing clippy warnings
This commit is contained in:
parent
4d29508b4c
commit
ed0d60bc16
@ -35,18 +35,22 @@ impl ws::Handler for Session {
|
|||||||
|
|
||||||
// Otherwise try to serve a page.
|
// Otherwise try to serve a page.
|
||||||
sysui::handle(req.resource())
|
sysui::handle(req.resource())
|
||||||
.map(|f| {
|
.map_or_else(
|
||||||
let content_len = format!("{}", f.content.as_bytes().len());
|
// return error
|
||||||
let mut res = ws::Response::ok(f.content.into());
|
|| ws::Response::from_request(req),
|
||||||
{
|
// or serve the file
|
||||||
let mut headers = res.headers_mut();
|
|f| {
|
||||||
headers.push(("Server".into(), "Parity/SystemUI".as_bytes().to_vec()));
|
let content_len = format!("{}", f.content.as_bytes().len());
|
||||||
headers.push(("Connection".into(), "Closed".as_bytes().to_vec()));
|
let mut res = ws::Response::ok(f.content.into());
|
||||||
headers.push(("Content-Length".into(), content_len.as_bytes().to_vec()));
|
{
|
||||||
headers.push(("Content-Type".into(), f.mime.as_bytes().to_vec()));
|
let mut headers = res.headers_mut();
|
||||||
}
|
headers.push(("Server".into(), b"Parity/SystemUI".to_vec()));
|
||||||
Ok(res)
|
headers.push(("Connection".into(), b"Closed".to_vec()));
|
||||||
}).unwrap_or_else(|| ws::Response::from_request(req))
|
headers.push(("Content-Length".into(), content_len.as_bytes().to_vec()));
|
||||||
|
headers.push(("Content-Type".into(), f.mime.as_bytes().to_vec()));
|
||||||
|
}
|
||||||
|
Ok(res)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_message(&mut self, msg: ws::Message) -> ws::Result<()> {
|
fn on_message(&mut self, msg: ws::Message) -> ws::Result<()> {
|
||||||
|
Loading…
Reference in New Issue
Block a user