Skip to content

Commit bc3e9b0

Browse files
committed
Fix Rust warnings
1 parent 0498c0d commit bc3e9b0

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

api/src/handlers.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub struct View {
7373
pub struct Asset {
7474
pub name: String,
7575
pub key: String,
76-
pub clampToGround: Option<bool>,
76+
pub clamp_to_ground: Option<bool>,
7777
}
7878

7979
#[derive(Serialize, Deserialize, Clone, Debug, FromRow)]
@@ -85,26 +85,28 @@ pub struct Member {
8585

8686
#[derive(Serialize, Deserialize, Clone, Debug, FromRow)]
8787
#[allow(non_snake_case)]
88+
#[serde(rename_all = "camelCase")]
8889
pub struct Geometry {
89-
r#type: String,
90+
#[serde(rename="type")]
91+
typ: String,
9092
positions: Vec<Cartesian3>,
9193
id: Option<String>,
9294
name: Option<String>,
9395
show: Option<bool>,
9496
area: Option<String>,
9597
perimeter: Option<String>,
96-
sidesLength: Option<Vec<Number>>,
97-
numberOfSegments: Option<Number>,
98+
sides_length: Option<Vec<Number>>,
99+
number_of_segments: Option<Number>,
98100
description: Option<String>,
99101
image: Option<String>,
100102
website: Option<String>,
101-
pointSymbol: Option<String>,
103+
point_symbol: Option<String>,
102104
color: Option<CesiumColor>,
103-
clampPoint: Option<bool>,
104-
showSlicingBox: Option<bool>,
105-
volumeShowed: Option<bool>,
106-
volumeHeightLimits: Option<GeometryVolumeHeightLimits>,
107-
swissforagesId: Option<String>,
105+
clamp_point: Option<bool>,
106+
show_slicing_box: Option<bool>,
107+
volume_showed: Option<bool>,
108+
volume_height_limits: Option<GeometryVolumeHeightLimits>,
109+
swissforages_id: Option<String>,
108110
depth: Option<Number>,
109111
diameter: Option<Number>,
110112
editable: Option<bool>,
@@ -127,9 +129,9 @@ struct CesiumColor {
127129
}
128130

129131
#[derive(Serialize, Deserialize, Clone, Debug, FromRow)]
132+
#[serde(rename_all = "camelCase")]
130133
struct GeometryVolumeHeightLimits {
131-
#[allow(non_snake_case)]
132-
lowerLimit: Number,
134+
lower_limit: Number,
133135
height: Number,
134136
}
135137

@@ -473,7 +475,7 @@ pub async fn duplicate_project(
473475
assets.push(Asset {
474476
name: asset.name.clone(),
475477
key: generated_file_name,
476-
clampToGround: asset.clampToGround,
478+
clamp_to_ground: asset.clamp_to_ground,
477479
});
478480
}
479481
}
@@ -596,5 +598,5 @@ fn generate_asset_name() -> String {
596598
.take(40)
597599
.map(char::from)
598600
.collect();
599-
return format!("{}_{}.kml", Utc::now().timestamp(), rand_string);
601+
format!("{}_{}.kml", Utc::now().timestamp(), rand_string)
600602
}

api/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use axum::response::IntoResponse;
21
use axum::{
32
extract::{DefaultBodyLimit, Extension},
43
http::{HeaderValue, Method},
@@ -10,7 +9,7 @@ use axum::{
109
use clap::Parser;
1110
use hyper::header::{ACCEPT, AUTHORIZATION, CONTENT_TYPE};
1211
use sqlx::PgPool;
13-
use tower::{ServiceBuilder, ServiceExt};
12+
use tower::{ServiceBuilder};
1413
use tower_http::{cors::CorsLayer, trace::TraceLayer};
1514

1615
pub use config::Config;

0 commit comments

Comments
 (0)