makes clippy happy

This commit is contained in:
Tamo 2021-10-26 13:43:49 +02:00 committed by marin postma
parent 5508c6c154
commit 6b34318274
No known key found for this signature in database
GPG Key ID: 6088B7721C3E39F9
4 changed files with 9 additions and 7 deletions

View File

@ -552,7 +552,7 @@ pub struct MockAnalytics {
impl MockAnalytics { impl MockAnalytics {
pub fn new(opt: &Opt) -> &'static Self { pub fn new(opt: &Opt) -> &'static Self {
let user = find_user_id(&opt.db_path).unwrap_or(String::new()); let user = find_user_id(&opt.db_path).unwrap_or_default();
let analytics = Box::new(Self { user }); let analytics = Box::new(Self { user });
Box::leak(analytics) Box::leak(analytics)
} }

View File

@ -128,7 +128,7 @@ Anonymous telemetry: \"Enabled\""
} }
let analytics = analytics.to_string(); let analytics = analytics.to_string();
if analytics != "" { if !analytics.is_empty() {
eprintln!("Unique User ID:\t\"{}\"", analytics); eprintln!("Unique User ID:\t\"{}\"", analytics);
} }

View File

@ -102,7 +102,7 @@ make_setting_route!(
"total": setting.as_ref().map(|filter| filter.len()), "total": setting.as_ref().map(|filter| filter.len()),
"has_geo": setting.as_ref().map(|filter| filter.contains("_geo")).unwrap_or(false), "has_geo": setting.as_ref().map(|filter| filter.contains("_geo")).unwrap_or(false),
}), }),
Some(&req), Some(req),
); );
} }
); );
@ -122,7 +122,7 @@ make_setting_route!(
"total": setting.as_ref().map(|sort| sort.len()), "total": setting.as_ref().map(|sort| sort.len()),
"has_geo": setting.as_ref().map(|sort| sort.contains("_geo")).unwrap_or(false), "has_geo": setting.as_ref().map(|sort| sort.contains("_geo")).unwrap_or(false),
}), }),
Some(&req), Some(req),
); );
} }
); );
@ -174,9 +174,9 @@ make_setting_route!(
analytics.publish( analytics.publish(
"RankingRules Updated".to_string(), "RankingRules Updated".to_string(),
json!({ json!({
"sort_position": setting.as_ref().map(|sort| sort.iter().filter(|s| s.contains(":")).count()), "sort_position": setting.as_ref().map(|sort| sort.iter().filter(|s| s.contains(':')).count()),
}), }),
Some(&req), Some(req),
); );
} }
); );
@ -218,7 +218,7 @@ pub async fn update_all(
"Settings Updated".to_string(), "Settings Updated".to_string(),
json!({ json!({
"ranking_rules": { "ranking_rules": {
"sort_position": settings.ranking_rules.as_ref().set().map(|sort| sort.iter().filter(|s| s.contains(":")).count()), "sort_position": settings.ranking_rules.as_ref().set().map(|sort| sort.iter().filter(|s| s.contains(':')).count()),
}, },
"sortable_attributes": { "sortable_attributes": {
"total": settings.sortable_attributes.as_ref().set().map(|sort| sort.len()), "total": settings.sortable_attributes.as_ref().set().map(|sort| sort.len()),

View File

@ -13,12 +13,14 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
.service(web::resource("{update_id}").route(web::get().to(get_update_status))); .service(web::resource("{update_id}").route(web::get().to(get_update_status)));
} }
/*
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase", deny_unknown_fields)] #[serde(rename_all = "camelCase", deny_unknown_fields)]
struct UpdateIndexRequest { struct UpdateIndexRequest {
uid: Option<String>, uid: Option<String>,
primary_key: Option<String>, primary_key: Option<String>,
} }
*/
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]