clippy
This commit is contained in:
parent
32a9ed081e
commit
382e43b55f
@ -1,10 +1,8 @@
|
||||
use std::{thread::sleep, time::Duration};
|
||||
|
||||
use log::error;
|
||||
use nanobyte_opentelemetry::rocket::{OtelReqwestClient, TracingSpan};
|
||||
use nanobyte_tera::l18n::LanguageDescription;
|
||||
use ovlach_data::cv::data::CV;
|
||||
use rocket::{get, State, response::Redirect, http::Status, futures::executor::enter};
|
||||
use rocket::{get, State, response::Redirect, http::Status};
|
||||
use rocket_dyn_templates::Template;
|
||||
use serde::Serialize;
|
||||
|
||||
@ -28,7 +26,7 @@ default_person: &State<DefaultPerson>, frontend_svc: &State<FrontendSVCConfig>,
|
||||
Ok(cv) => RootPage {
|
||||
static_host: presentation_config.static_route.clone(),
|
||||
cv,
|
||||
lang: LanguageDescription::new(&language.language.as_str(), "ovlach_frontend"),
|
||||
lang: LanguageDescription::new(language.language.as_str(), "ovlach_frontend"),
|
||||
contact_svc: frontend_svc.inner().contact_service.clone(),
|
||||
pdf_download_url: format!("{}/cv/{}/output.pdf", frontend_svc.inner().pdf_service.clone(), default_person.default_person_name)
|
||||
},
|
||||
@ -39,7 +37,7 @@ default_person: &State<DefaultPerson>, frontend_svc: &State<FrontendSVCConfig>,
|
||||
}
|
||||
};
|
||||
|
||||
let result = Ok(Template::render("default", &context));
|
||||
let result = Ok(Template::render("default", context));
|
||||
drop(span);
|
||||
result
|
||||
}
|
||||
|
@ -1,3 +0,0 @@
|
||||
pub fn get_lang_name_from_code(lang: &str) -> &str {
|
||||
lang.split("-").collect::<Vec<&str>>()[0]
|
||||
}
|
@ -1,3 +1,2 @@
|
||||
pub(crate) mod rocket;
|
||||
pub(crate) mod lang;
|
||||
pub(crate) mod tera;
|
||||
|
@ -1,6 +1,4 @@
|
||||
use std::time::SystemTime;
|
||||
use log::info;
|
||||
use rocket::{Request, Response, Data, fairing::{Kind, Info, Fairing}, request::{self, FromRequest, FromParam}, http::Status};
|
||||
use rocket::request::FromParam;
|
||||
use phf::phf_map;
|
||||
|
||||
|
||||
|
@ -39,8 +39,7 @@ pub fn advanced_filter(value: &Value, args: &HashMap<String, Value>) -> Result<V
|
||||
"only" => true,
|
||||
_ => false,
|
||||
}
|
||||
} else {
|
||||
if null != "only" {
|
||||
} else if null != "only" {
|
||||
let val = tested_value.as_str();
|
||||
match val {
|
||||
Some(match_v) => {
|
||||
@ -54,7 +53,6 @@ pub fn advanced_filter(value: &Value, args: &HashMap<String, Value>) -> Result<V
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@ -99,8 +97,6 @@ mod tests {
|
||||
assert_eq!(result, json!(generate_test_class(Some("foo".to_string()), None)));
|
||||
let result = call_advanced_filter(&data, "none", None).unwrap();
|
||||
assert_eq!(result, json!(vec![TestClass::new(Some("foo".to_string()))]));
|
||||
let mut vec: Vec<TestClass> = Vec::new();
|
||||
vec.push(TestClass::new(None));
|
||||
let result = call_advanced_filter(&data, "only", None).unwrap();
|
||||
assert_eq!(result, json!(vec![TestClass::new(None)]));
|
||||
|
||||
@ -108,9 +104,9 @@ mod tests {
|
||||
let result = call_advanced_filter(&data, "all", Some("foo")).unwrap();
|
||||
assert_eq!(result, json!(vec![TestClass::new(Some("foo".to_string())), TestClass::new(None)]));
|
||||
let result = call_advanced_filter(&data, "none", Some("bar")).unwrap();
|
||||
let vec: Vec<TestClass> = Vec::new();
|
||||
let vec: Vec<TestClass> = vec![];
|
||||
assert_eq!(result, json!(vec));
|
||||
let result = call_advanced_filter(&data, "only", Some("zz")).is_err();
|
||||
assert_eq!(result, true);
|
||||
assert!(result);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user