Skip to content

Commit

Permalink
chore(formatting): Fixed formatting mistakes (#1715)
Browse files Browse the repository at this point in the history
fixed formatting mistakes have sneaked into prod

Co-authored-by: CommanderStorm <[email protected]>
  • Loading branch information
github-actions[bot] and CommanderStorm authored Dec 9, 2024
1 parent 6b306ea commit e4fa97b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
19 changes: 12 additions & 7 deletions server/src/search/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::fmt::{Debug, Formatter};
use std::time::Instant;

use crate::search::search_executor::ResultFacet;
use crate::AppData;
use actix_web::http::header::{CacheControl, CacheDirective};
use actix_web::{get, web, HttpResponse};
Expand All @@ -10,7 +11,6 @@ use serde::{Deserialize, Serialize};
use tokio::join;
use tracing::{debug, error};
use unicode_truncate::UnicodeTruncateStr;
use crate::search::search_executor::ResultFacet;

mod search_executor;

Expand Down Expand Up @@ -38,11 +38,16 @@ impl Debug for SearchResults {
base.field("time_ms", &self.time_ms);
for section in self.sections.iter() {
match section.facet {
ResultFacet::SitesBuildings => {base.field("sites_buildings", section);}
ResultFacet::Rooms => {base.field("rooms", section);}
ResultFacet::Addresses => {base.field("sites_buildings", section);}
ResultFacet::SitesBuildings => {
base.field("sites_buildings", section);
}
ResultFacet::Rooms => {
base.field("rooms", section);
}
ResultFacet::Addresses => {
base.field("sites_buildings", section);
}
}

}
base.finish()
}
Expand Down Expand Up @@ -181,9 +186,9 @@ async fn cached_geoentry_search(
let Ok(client) = Client::new(ms_url, std::env::var("MEILI_MASTER_KEY").ok()) else {
error!("Failed to create a meilisearch client");
if search_addresses {
return search_executor::address_search(&q).await.0
return search_executor::address_search(&q).await.0;
} else {
return vec![]
return vec![];
}
};
let geoentry_search = search_executor::do_geoentry_search(&client, &q, highlighting, limits);
Expand Down
20 changes: 10 additions & 10 deletions server/src/search/search_executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,25 +79,25 @@ struct NominatimAddressResponse {
impl NominatimAddressResponse {
fn serialise(&self) -> String {
let mut result = Vec::<String>::new();
if let Some(state)= self.state.clone() {
if let Some(state) = self.state.clone() {
result.push(state);
}
if let Some(county)=self.county.clone(){
if let Some(county) = self.county.clone() {
result.push(county);
}
if let Some(town)=self.town.clone(){
if let Some(town) = self.town.clone() {
result.push(town);
}
if let Some(suburb)=self.suburb.clone(){
if let Some(suburb) = self.suburb.clone() {
result.push(suburb);
}
if let Some(village)=self.village.clone(){
if let Some(village) = self.village.clone() {
result.push(village);
}
if let Some(hamlet)=self.hamlet.clone(){
if let Some(hamlet) = self.hamlet.clone() {
result.push(hamlet);
}
if let Some(road)=self.road.clone(){
if let Some(road) = self.road.clone() {
result.push(road);
}
result.join(", ")
Expand Down Expand Up @@ -289,10 +289,10 @@ mod test {
});
}
}

#[test]
fn serialize_address(){
let response=NominatimAddressResponse{
fn serialize_address() {
let response = NominatimAddressResponse {
state: None,
county: None,
town: None,
Expand Down

0 comments on commit e4fa97b

Please sign in to comment.