satisfy clippy
This commit is contained in:
parent
65f0ac7630
commit
b20822a644
|
@ -40,7 +40,7 @@ fn invite_form_template(
|
|||
// avoid displaying the invite code-containing flash msg
|
||||
@if name != "code" {
|
||||
(PreEscaped("<!-- FLASH MESSAGE -->"))
|
||||
(templates::flash::build_template(&name, &msg))
|
||||
(templates::flash::build_template(name, msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ pub fn build_template(request: &Request) -> PreEscaped<String> {
|
|||
// render flash message if cookies were found in the request
|
||||
@if let (Some(name), Some(msg)) = (flash_name, flash_msg) {
|
||||
(PreEscaped("<!-- FLASH MESSAGE -->"))
|
||||
(templates::flash::build_template(name, &msg))
|
||||
(templates::flash::build_template(name, msg))
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -45,7 +45,7 @@ pub fn build_template(request: &Request) -> PreEscaped<String> {
|
|||
// render flash message if cookies were found in the request
|
||||
@if let (Some(name), Some(msg)) = (flash_name, flash_msg) {
|
||||
(PreEscaped("<!-- FLASH MESSAGE -->"))
|
||||
(templates::flash::build_template(name, &msg))
|
||||
(templates::flash::build_template(name, msg))
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -52,14 +52,15 @@ fn database_element(state: &str) -> Markup {
|
|||
// retrieve the sequence number of the latest message in the sbot database
|
||||
let sequence_num = sbot::latest_sequence_number();
|
||||
|
||||
if state == "active" && sequence_num.is_ok() {
|
||||
let number = sequence_num.unwrap();
|
||||
html! {
|
||||
label class="card-text" style="margin-right: 5px;" { (number) }
|
||||
label class="label-small font-gray" { "MESSAGES IN LOCAL DATABASE" }
|
||||
match (state, sequence_num) {
|
||||
// if the state is "active" and latest_sequence_number() was successful
|
||||
("active", Ok(number)) => {
|
||||
html! {
|
||||
label class="card-text" style="margin-right: 5px;" { (number) }
|
||||
label class="label-small font-gray" { "MESSAGES IN LOCAL DATABASE" }
|
||||
}
|
||||
}
|
||||
} else {
|
||||
html! { label class="label-small font-gray" { "DATABASE UNAVAILABLE" } }
|
||||
(_, _) => html! { label class="label-small font-gray" { "DATABASE UNAVAILABLE" } },
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@ pub trait FlashRequest {
|
|||
impl FlashRequest for Request {
|
||||
fn retrieve_flash(&self) -> (Option<&str>, Option<&str>) {
|
||||
// check for flash cookies
|
||||
let flash_name = input::cookies(&self)
|
||||
let flash_name = input::cookies(self)
|
||||
.find(|&(n, _)| n == "flash_name")
|
||||
// return the value of the cookie (key is already known)
|
||||
.map(|key_val| key_val.1);
|
||||
let flash_msg = input::cookies(&self)
|
||||
let flash_msg = input::cookies(self)
|
||||
.find(|&(n, _)| n == "flash_msg")
|
||||
.map(|key_val| key_val.1);
|
||||
|
||||
|
|
Loading…
Reference in New Issue