Skip to content

Commit

Permalink
Fix Rust warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-va committed Nov 26, 2024
1 parent 0498c0d commit 42ab3fd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
33 changes: 17 additions & 16 deletions api/src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ pub struct View {
}

#[derive(Serialize, Deserialize, Clone, Debug, FromRow)]
#[allow(non_snake_case)]
#[serde(rename_all = "camelCase")]
pub struct Asset {
pub name: String,
pub key: String,
pub clampToGround: Option<bool>,
pub clamp_to_ground: Option<bool>,
}

#[derive(Serialize, Deserialize, Clone, Debug, FromRow)]
Expand All @@ -84,27 +84,28 @@ pub struct Member {
}

#[derive(Serialize, Deserialize, Clone, Debug, FromRow)]
#[allow(non_snake_case)]
#[serde(rename_all = "camelCase")]
pub struct Geometry {
r#type: String,
#[serde(rename="type")]
typ: String,
positions: Vec<Cartesian3>,
id: Option<String>,
name: Option<String>,
show: Option<bool>,
area: Option<String>,
perimeter: Option<String>,
sidesLength: Option<Vec<Number>>,
numberOfSegments: Option<Number>,
sides_length: Option<Vec<Number>>,
number_of_segments: Option<Number>,
description: Option<String>,
image: Option<String>,
website: Option<String>,
pointSymbol: Option<String>,
point_symbol: Option<String>,
color: Option<CesiumColor>,
clampPoint: Option<bool>,
showSlicingBox: Option<bool>,
volumeShowed: Option<bool>,
volumeHeightLimits: Option<GeometryVolumeHeightLimits>,
swissforagesId: Option<String>,
clamp_point: Option<bool>,
show_slicing_box: Option<bool>,
volume_showed: Option<bool>,
volume_height_limits: Option<GeometryVolumeHeightLimits>,
swissforages_id: Option<String>,
depth: Option<Number>,
diameter: Option<Number>,
editable: Option<bool>,
Expand All @@ -127,9 +128,9 @@ struct CesiumColor {
}

#[derive(Serialize, Deserialize, Clone, Debug, FromRow)]
#[serde(rename_all = "camelCase")]
struct GeometryVolumeHeightLimits {
#[allow(non_snake_case)]
lowerLimit: Number,
lower_limit: Number,
height: Number,
}

Expand Down Expand Up @@ -473,7 +474,7 @@ pub async fn duplicate_project(
assets.push(Asset {
name: asset.name.clone(),
key: generated_file_name,
clampToGround: asset.clampToGround,
clamp_to_ground: asset.clamp_to_ground,
});
}
}
Expand Down Expand Up @@ -596,5 +597,5 @@ fn generate_asset_name() -> String {
.take(40)
.map(char::from)
.collect();
return format!("{}_{}.kml", Utc::now().timestamp(), rand_string);
format!("{}_{}.kml", Utc::now().timestamp(), rand_string)
}
3 changes: 1 addition & 2 deletions api/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use axum::response::IntoResponse;
use axum::{
extract::{DefaultBodyLimit, Extension},
http::{HeaderValue, Method},
Expand All @@ -10,7 +9,7 @@ use axum::{
use clap::Parser;
use hyper::header::{ACCEPT, AUTHORIZATION, CONTENT_TYPE};
use sqlx::PgPool;
use tower::{ServiceBuilder, ServiceExt};
use tower::{ServiceBuilder};
use tower_http::{cors::CorsLayer, trace::TraceLayer};

pub use config::Config;
Expand Down

0 comments on commit 42ab3fd

Please sign in to comment.