Skip to content

Commit 8fe4997

Browse files
committed
Remove iso8601, switch to directly using chrono for our tests
1 parent ae23788 commit 8fe4997

File tree

5 files changed

+2
-42
lines changed

5 files changed

+2
-42
lines changed

Cargo.lock

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

glean-core/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ oslog = { version = "0.1.0", default-features = false, features = ["logger"] }
5555
[dev-dependencies]
5656
env_logger = { version = "0.10.0", default-features = false, features = ["humantime"] }
5757
tempfile = "3.8.0"
58-
iso8601 = "0.4"
5958
ctor = "0.2.2"
6059
criterion = "0.7.0"
6160

glean-core/tests/common/mod.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55
// #[allow(dead_code)] is required on this module as a workaround for
66
// https://github.com/rust-lang/rust/issues/46379
77
#![allow(dead_code)]
8-
use chrono::Timelike;
98
use glean_core::{Glean, PingType, Result};
109

1110
use std::fs::{read_dir, File};
1211
use std::io::{BufRead, BufReader};
1312
use std::path::Path;
1413

15-
use chrono::offset::TimeZone;
16-
use iso8601::Date::YMD;
1714
use serde_json::Value as JsonValue;
1815

1916
use ctor::ctor;
@@ -170,26 +167,6 @@ impl PingBuilder {
170167
}
171168
}
172169

173-
/// Converts an iso8601::DateTime to a chrono::DateTime<FixedOffset>
174-
pub fn iso8601_to_chrono(datetime: &iso8601::DateTime) -> chrono::DateTime<chrono::FixedOffset> {
175-
if let YMD { year, month, day } = datetime.date {
176-
return chrono::FixedOffset::east_opt(datetime.time.tz_offset_hours * 3600)
177-
.unwrap()
178-
.with_ymd_and_hms(
179-
year,
180-
month,
181-
day,
182-
datetime.time.hour,
183-
datetime.time.minute,
184-
datetime.time.second,
185-
)
186-
.unwrap()
187-
.with_nanosecond(datetime.time.millisecond * 1_000_000)
188-
.unwrap();
189-
};
190-
panic!("Unsupported datetime format");
191-
}
192-
193170
/// Gets a vector of the currently queued pings.
194171
///
195172
/// # Arguments

glean-core/tests/ping_maker.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ fn ping_info_must_contain_a_nonempty_start_and_end_time() {
4141
let ping_info = ping.content["ping_info"].as_object().unwrap();
4242

4343
let start_time_str = ping_info["start_time"].as_str().unwrap();
44-
let start_time_date = iso8601_to_chrono(&iso8601::datetime(start_time_str).unwrap());
44+
let start_time_date = chrono::DateTime::parse_from_rfc3339(start_time_str).unwrap();
4545

4646
let end_time_str = ping_info["end_time"].as_str().unwrap();
47-
let end_time_date = iso8601_to_chrono(&iso8601::datetime(end_time_str).unwrap());
47+
let end_time_date = chrono::DateTime::parse_from_rfc3339(end_time_str).unwrap();
4848

4949
assert!(start_time_date <= end_time_date);
5050
}

supply-chain/imports.lock

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,12 +1125,6 @@ No `unsafe` introduced or affected in:
11251125
"""
11261126
aggregated-from = "https://chromium.googlesource.com/chromium/src/+/main/third_party/rust/chromium_crates_io/supply-chain/audits.toml?format=TEXT"
11271127

1128-
[[audits.google.audits.iso8601]]
1129-
who = "George Burgess IV <[email protected]>"
1130-
criteria = "safe-to-run"
1131-
version = "0.4.2"
1132-
aggregated-from = "https://chromium.googlesource.com/chromiumos/third_party/rust_crates/+/refs/heads/main/cargo-vet/audits.toml?format=TEXT"
1133-
11341128
[[audits.google.audits.itertools]]
11351129
who = "ChromeOS"
11361130
criteria = "safe-to-run"

0 commit comments

Comments
 (0)