@@ -121,6 +121,12 @@ pub enum OptionalCmd {
121
121
#[ derive( Debug , Clone , Copy , Deserialize ) ]
122
122
struct RetainFor ( Option < Duration > ) ;
123
123
124
+ impl Default for RetainFor {
125
+ fn default ( ) -> Self {
126
+ Self ( Some ( Duration :: from_secs ( 6 ) ) )
127
+ }
128
+ }
129
+
124
130
impl fmt:: Display for RetainFor {
125
131
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
126
132
match self . 0 {
@@ -320,7 +326,7 @@ impl Config {
320
326
}
321
327
322
328
pub ( crate ) fn retain_for ( & self ) -> Option < Duration > {
323
- self . retain_for . as_ref ( ) . and_then ( |value| value . 0 )
329
+ self . retain_for . unwrap_or_default ( ) . 0
324
330
}
325
331
326
332
pub ( crate ) fn target_addr ( & self ) -> Uri {
@@ -390,7 +396,7 @@ impl Default for Config {
390
396
target_addr : Some ( default_target_addr ( ) ) ,
391
397
env_filter : Some ( tracing_subscriber:: EnvFilter :: new ( "off" ) ) ,
392
398
log_directory : Some ( default_log_directory ( ) ) ,
393
- retain_for : Some ( RetainFor ( Some ( Duration :: from_secs ( 6 ) ) ) ) ,
399
+ retain_for : Some ( RetainFor :: default ( ) ) ,
394
400
view_options : ViewOptions :: default ( ) ,
395
401
subcmd : None ,
396
402
}
0 commit comments