Skip to content

Commit c5c773c

Browse files
Merge pull request #196 from influxdata/crepererum/fix_chrono_deprecations
fix: `chrono` deprecation warnings
2 parents a118ac8 + 4f70f6a commit c5c773c

File tree

10 files changed

+14
-13
lines changed

10 files changed

+14
-13
lines changed

benches/throughput.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
4242
key: Some(vec![b'k'; 10]),
4343
value: Some(vec![b'x'; 10_000]),
4444
headers: BTreeMap::default(),
45-
timestamp: Utc.timestamp_millis(1337),
45+
timestamp: Utc.timestamp_millis_opt(1337).unwrap(),
4646
};
4747

4848
{

src/client/consumer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ mod tests {
517517
key: Some(vec![0; 4]),
518518
value: Some(vec![0; 6]),
519519
headers: Default::default(),
520-
timestamp: Utc.timestamp_millis(1337),
520+
timestamp: Utc.timestamp_millis_opt(1337).unwrap(),
521521
};
522522

523523
let (sender, receiver) = mpsc::channel(10);
@@ -584,7 +584,7 @@ mod tests {
584584
key: Some(vec![0; 4]),
585585
value: Some(vec![0; 6]),
586586
headers: Default::default(),
587-
timestamp: Utc.timestamp_millis(1337),
587+
timestamp: Utc.timestamp_millis_opt(1337).unwrap(),
588588
};
589589

590590
let (sender, receiver) = mpsc::channel(10);
@@ -675,7 +675,7 @@ mod tests {
675675
key: Some(vec![0; 4]),
676676
value: Some(vec![0; 6]),
677677
headers: Default::default(),
678-
timestamp: Utc.timestamp_millis(1337),
678+
timestamp: Utc.timestamp_millis_opt(1337).unwrap(),
679679
};
680680

681681
// Simulate an error on first fetch to encourage an offset update
@@ -722,7 +722,7 @@ mod tests {
722722
key: Some(vec![0; 4]),
723723
value: Some(vec![0; 6]),
724724
headers: Default::default(),
725-
timestamp: Utc.timestamp_millis(1337),
725+
timestamp: Utc.timestamp_millis_opt(1337).unwrap(),
726726
};
727727

728728
// Simulate an error on first fetch to encourage an offset update

src/client/producer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ mod tests {
737737
key: Some(vec![0; 4]),
738738
value: Some(vec![0; 6]),
739739
headers: Default::default(),
740-
timestamp: Utc.timestamp_millis(320),
740+
timestamp: Utc.timestamp_millis_opt(320).unwrap(),
741741
}
742742
}
743743

src/client/producer/aggregator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ mod tests {
153153
key: Some(vec![0; 45]),
154154
value: Some(vec![0; 2]),
155155
headers: Default::default(),
156-
timestamp: Utc.timestamp_millis(1337),
156+
timestamp: Utc.timestamp_millis_opt(1337).unwrap(),
157157
};
158158

159159
let r2 = Record {

src/record.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mod tests {
4545
headers: vec![("a".to_string(), vec![0; 5]), ("b".to_string(), vec![0; 7])]
4646
.into_iter()
4747
.collect(),
48-
timestamp: Utc.timestamp_millis(1337),
48+
timestamp: Utc.timestamp_millis_opt(1337).unwrap(),
4949
};
5050

5151
assert_eq!(record.approximate_size(), 23 + 45 + 1 + 5 + 1 + 7);

tests/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,6 @@ pub fn large_record() -> Record {
685685
key: Some(b"".to_vec()),
686686
value: Some(vec![b'x'; 1024]),
687687
headers: BTreeMap::from([("foo".to_owned(), b"bar".to_vec())]),
688-
timestamp: Utc.timestamp_millis(1337),
688+
timestamp: Utc.timestamp_millis_opt(1337).unwrap(),
689689
}
690690
}

tests/java_helper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ pub async fn consume(
278278
key: Some(key.as_bytes().to_vec()),
279279
value: Some(value.as_bytes().to_vec()),
280280
headers,
281-
timestamp: Utc.timestamp_millis(timestamp),
281+
timestamp: Utc.timestamp_millis_opt(timestamp).unwrap(),
282282
};
283283
let record_and_offset = RecordAndOffset { record, offset };
284284
results.push(record_and_offset);

tests/produce_consume.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ async fn assert_produce_consume<F1, G1, F2, G2>(
269269
);
270270

271271
// timestamps for records. We'll reorder the messages though to ts2, ts1, ts3
272-
let ts1 = Utc.timestamp_millis(1337);
272+
let ts1 = Utc.timestamp_millis_opt(1337).unwrap();
273273
let ts2 = ts1 + Duration::milliseconds(1);
274274
let ts3 = ts2 + Duration::milliseconds(1);
275275

tests/rdkafka_helper.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ pub async fn consume(
114114
})
115115
.unwrap_or_default(),
116116
timestamp: Utc
117-
.timestamp_millis(msg.timestamp().to_millis().unwrap_or_default()),
117+
.timestamp_millis_opt(msg.timestamp().to_millis().unwrap_or_default())
118+
.unwrap(),
118119
},
119120
offset: msg.offset(),
120121
})

tests/test_helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ pub fn record(key: &[u8]) -> Record {
160160
key: Some(key.to_vec()),
161161
value: Some(b"hello kafka".to_vec()),
162162
headers: BTreeMap::from([("foo".to_owned(), b"bar".to_vec())]),
163-
timestamp: Utc.timestamp_millis(1337),
163+
timestamp: Utc.timestamp_millis_opt(1337).unwrap(),
164164
}
165165
}
166166

0 commit comments

Comments
 (0)