Skip to content

Commit 3248ee2

Browse files
committed
fmt
1 parent da72bd4 commit 3248ee2

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

ptolemy/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
pub mod api;
12
pub mod error;
23
pub mod models;
34
pub mod prelude;
45
pub mod writer;
5-
pub mod api;
66

77
#[rustfmt::skip]
88
pub mod generated;

ptolemy/src/models/record.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use super::super::error::ParseError;
2-
use chrono::{naive::serde::ts_microseconds, DateTime, NaiveDateTime};
32
use crate::{
43
generated::record_publisher::{self, record::RecordData},
54
models::{FieldValueType, Id, Tier, JSON},
65
};
6+
use chrono::{naive::serde::ts_microseconds, DateTime, NaiveDateTime};
77
use serde::Serialize;
88

99
#[derive(Debug, Clone, Serialize)]
@@ -38,11 +38,11 @@ impl TryFrom<record_publisher::Record> for Record {
3838
.tier()
3939
.try_into()
4040
.map_err(|_| ParseError::UndefinedTier)?;
41-
let id: Id = value
42-
.id
41+
let id: Id = value.id.try_into().map_err(|_| ParseError::InvalidUuid)?;
42+
let parent_id: Id = value
43+
.parent_id
4344
.try_into()
4445
.map_err(|_| ParseError::InvalidUuid)?;
45-
let parent_id: Id = value.parent_id.try_into().map_err(|_| ParseError::InvalidUuid)?;
4646
let data = match value.record_data.ok_or(ParseError::MissingField)? {
4747
RecordData::Event(e) => Self::Event(Event {
4848
tier,
@@ -51,11 +51,7 @@ impl TryFrom<record_publisher::Record> for Record {
5151
name: e.name,
5252
parameters: e
5353
.parameters
54-
.map(|p| {
55-
p.try_into().map_err(|_| {
56-
ParseError::BadJSON
57-
})
58-
})
54+
.map(|p| p.try_into().map_err(|_| ParseError::BadJSON))
5955
.transpose()?,
6056
version: e.version,
6157
environment: e.environment,
@@ -140,9 +136,7 @@ impl IOF {
140136
let field_value: JSON = field_value
141137
.ok_or(ParseError::MissingField)?
142138
.try_into()
143-
.map_err(|_| {
144-
ParseError::BadJSON
145-
})?;
139+
.map_err(|_| ParseError::BadJSON)?;
146140

147141
let field_value_type = field_value.field_value_type();
148142

0 commit comments

Comments
 (0)