Skip to content

Commit 7b8b7b3

Browse files
committed
fix: applied cargo fmt
1 parent 49664ce commit 7b8b7b3

File tree

11 files changed

+23
-34
lines changed

11 files changed

+23
-34
lines changed

aw-client-rust/tests/test.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ mod test {
2727
Ok(_) => break,
2828
Err(err) => {
2929
if i == timeout_s - 1 {
30-
panic!(
31-
"Timed out starting aw-server after {timeout_s}s: {err:?}"
32-
);
30+
panic!("Timed out starting aw-server after {timeout_s}s: {err:?}");
3331
}
3432
}
3533
}

aw-datastore/src/worker.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ impl DatastoreWorker {
135135
if self.legacy_import {
136136
let transaction = match conn.transaction_with_behavior(TransactionBehavior::Immediate) {
137137
Ok(transaction) => transaction,
138-
Err(err) => panic!(
139-
"Unable to start immediate transaction on SQLite database! {err}"
140-
),
138+
Err(err) => {
139+
panic!("Unable to start immediate transaction on SQLite database! {err}")
140+
}
141141
};
142142
match ds.ensure_legacy_import(&transaction) {
143143
Ok(_) => (),

aw-datastore/tests/datastore.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ mod datastore_tests {
3434
}
3535
}
3636

37-
#[cfg(not(target_os = "android"))]
38-
3937
#[cfg(not(target_os = "android"))]
4038
use std::fs;
4139
use std::path::PathBuf;

aw-models/src/bucket.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,13 @@ pub struct Bucket {
3030
pub last_updated: Option<DateTime<Utc>>, // TODO: Should probably be moved into metadata field
3131
}
3232

33-
#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug)]
34-
#[derive(Default)]
33+
#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, Default)]
3534
pub struct BucketMetadata {
3635
#[serde(default)]
3736
pub start: Option<DateTime<Utc>>,
3837
pub end: Option<DateTime<Utc>>,
3938
}
4039

41-
42-
4340
#[derive(Serialize, Deserialize, JsonSchema, Clone)]
4441
pub struct BucketsExport {
4542
pub buckets: HashMap<String, Bucket>,

aw-models/src/event.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ impl Event {
4040
}
4141
}
4242
pub fn calculate_endtime(&self) -> DateTime<Utc> {
43-
self.timestamp
44-
+ chrono::Duration::nanoseconds(self.duration.num_nanoseconds().unwrap())
43+
self.timestamp + chrono::Duration::nanoseconds(self.duration.num_nanoseconds().unwrap())
4544
}
4645
pub fn interval(&self) -> TimeInterval {
4746
TimeInterval::new(self.timestamp, self.calculate_endtime())

aw-models/src/tryvec.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@ where
119119
let res = match access.next_element() {
120120
Ok(val) => val,
121121
Err(err) => {
122-
println!(
123-
"Failed to parse event because '{err}', the event will be discarded"
124-
);
122+
println!("Failed to parse event because '{err}', the event will be discarded");
125123
continue;
126124
}
127125
};

aw-query/src/functions.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,20 +212,23 @@ mod qfunctions {
212212
)))
213213
}
214214
};
215-
let bucketname =
216-
match aw_transform::find_bucket(&bucket_filter, &hostname_filter, buckets.values()) {
217-
Some(bucketname) => bucketname,
218-
None => {
219-
return Err(QueryError::BucketQueryError(match hostname_filter {
215+
let bucketname = match aw_transform::find_bucket(
216+
&bucket_filter,
217+
&hostname_filter,
218+
buckets.values(),
219+
) {
220+
Some(bucketname) => bucketname,
221+
None => {
222+
return Err(QueryError::BucketQueryError(match hostname_filter {
220223
None => {
221224
format!("Failed to find bucket matching filter '{bucket_filter}'")
222225
}
223226
Some(hostname_filter) => format!(
224227
"Failed to find bucket matching filter '{bucket_filter}' and hostname '{hostname_filter}'"
225228
),
226229
}));
227-
}
228-
};
230+
}
231+
};
229232
Ok(DataType::String(bucketname))
230233
}
231234

aw-query/tests/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ macro_rules! json_map {
2020

2121
#[cfg(test)]
2222
mod query_tests {
23-
23+
2424
use chrono::Duration;
2525
use serde_json::json;
2626
use std::convert::TryFrom;

aw-server/src/endpoints/bucket.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ pub fn bucket_events_get(
8282
Some(dt_str) => match DateTime::parse_from_rfc3339(&dt_str) {
8383
Ok(dt) => Some(dt.with_timezone(&Utc)),
8484
Err(e) => {
85-
let err_msg = format!(
86-
"Failed to parse endtime, datetime needs to be in rfc3339 format: {e}"
87-
);
85+
let err_msg =
86+
format!("Failed to parse endtime, datetime needs to be in rfc3339 format: {e}");
8887
warn!("{}", err_msg);
8988
return Err(HttpErrorJson::new(Status::BadRequest, err_msg));
9089
}

aw-sync/tests/sync.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ mod sync_tests {
151151
&SyncSpec::default(),
152152
);
153153

154-
let all_datastores: Vec<&Datastore> =
155-
[&state.ds_src, &state.ds_dest].to_vec();
154+
let all_datastores: Vec<&Datastore> = [&state.ds_src, &state.ds_dest].to_vec();
156155
let all_buckets_map = get_all_buckets_map(all_datastores);
157156

158157
// Check that all synced buckets are identical to source bucket
@@ -190,8 +189,7 @@ mod sync_tests {
190189
&SyncSpec::default(),
191190
);
192191

193-
let all_datastores: Vec<&Datastore> =
194-
[&state.ds_src, &state.ds_dest].to_vec();
192+
let all_datastores: Vec<&Datastore> = [&state.ds_src, &state.ds_dest].to_vec();
195193
let all_buckets_map = get_all_buckets_map(all_datastores);
196194

197195
// Check that all synced buckets are identical to source bucket

0 commit comments

Comments
 (0)