From cca50a19bdcd781b4501b9986a59d54ac6fec172 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Tue, 20 Aug 2024 10:17:01 +0200 Subject: [PATCH] don't panic, but return None --- neqo-common/src/qlog.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/neqo-common/src/qlog.rs b/neqo-common/src/qlog.rs index 99d909c92f..04651b587b 100644 --- a/neqo-common/src/qlog.rs +++ b/neqo-common/src/qlog.rs @@ -153,7 +153,6 @@ impl Drop for NeqoQlogShared { } } -#[allow(clippy::missing_panics_doc)] #[must_use] pub fn new_trace(role: Role) -> qlog::TraceSeq { TraceSeq { @@ -174,15 +173,10 @@ pub fn new_trace(role: Role) -> qlog::TraceSeq { common_fields: Some(CommonFields { group_id: None, protocol_type: None, - reference_time: { - Some( - SystemTime::now() - .duration_since(SystemTime::UNIX_EPOCH) - .expect("expect UNIX_EPOCH to always be earlier than now") - .as_secs_f64() - * 1_000.0, - ) - }, + reference_time: SystemTime::now() + .duration_since(SystemTime::UNIX_EPOCH) + .map(|d| d.as_secs_f64() * 1_000.0) + .ok(), time_format: Some("relative".to_string()), }), }