mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-06-03 03:33:34 -07:00
remove format! calls entirely
This commit is contained in:
committed by
Will Greenberg
parent
bd5dfb1a75
commit
3aa3ce89c8
+3
-2
@@ -170,9 +170,10 @@ impl DiagTask {
|
|||||||
lat,
|
lat,
|
||||||
lon,
|
lon,
|
||||||
};
|
};
|
||||||
let json = serde_json::to_string(&record)?;
|
let mut json = serde_json::to_vec(&record)?;
|
||||||
|
json.push(b'\n');
|
||||||
gps_file
|
gps_file
|
||||||
.write_all(format!("{json}\n").as_bytes())
|
.write_all(&json)
|
||||||
.await
|
.await
|
||||||
.map_err(RecordingStoreError::WriteFileError)?;
|
.map_err(RecordingStoreError::WriteFileError)?;
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-10
@@ -122,22 +122,21 @@ pub async fn post_gps(
|
|||||||
lat: gps_data.latitude,
|
lat: gps_data.latitude,
|
||||||
lon: gps_data.longitude,
|
lon: gps_data.longitude,
|
||||||
};
|
};
|
||||||
let json = serde_json::to_string(&record).map_err(|e| {
|
let mut json = serde_json::to_vec(&record).map_err(|e| {
|
||||||
error!("failed to serialize GPS record: {e}");
|
error!("failed to serialize GPS record: {e}");
|
||||||
(
|
(
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
format!("failed to serialize GPS record: {e}"),
|
format!("failed to serialize GPS record: {e}"),
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
file.write_all(format!("{json}\n").as_bytes())
|
json.push(b'\n');
|
||||||
.await
|
file.write_all(&json).await.map_err(|e| {
|
||||||
.map_err(|e| {
|
error!("failed to write GPS record to sidecar: {e}");
|
||||||
error!("failed to write GPS record to sidecar: {e}");
|
(
|
||||||
(
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
format!("failed to write GPS record to sidecar: {e}"),
|
||||||
format!("failed to write GPS record to sidecar: {e}"),
|
)
|
||||||
)
|
})?;
|
||||||
})?;
|
|
||||||
}
|
}
|
||||||
Ok(None) => error!("GPS sidecar directory not found, cannot write GPS record"),
|
Ok(None) => error!("GPS sidecar directory not found, cannot write GPS record"),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user