@@ -121,6 +121,12 @@ pub enum OptionalCmd {
121121#[ derive( Debug , Clone , Copy , Deserialize ) ]
122122struct RetainFor ( Option < Duration > ) ;
123123
124+ impl Default for RetainFor {
125+ fn default ( ) -> Self {
126+ Self ( Some ( Duration :: from_secs ( 6 ) ) )
127+ }
128+ }
129+
124130impl fmt:: Display for RetainFor {
125131 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
126132 match self . 0 {
@@ -320,7 +326,7 @@ impl Config {
320326 }
321327
322328 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
324330 }
325331
326332 pub ( crate ) fn target_addr ( & self ) -> Uri {
@@ -390,7 +396,7 @@ impl Default for Config {
390396 target_addr : Some ( default_target_addr ( ) ) ,
391397 env_filter : Some ( tracing_subscriber:: EnvFilter :: new ( "off" ) ) ,
392398 log_directory : Some ( default_log_directory ( ) ) ,
393- retain_for : Some ( RetainFor ( Some ( Duration :: from_secs ( 6 ) ) ) ) ,
399+ retain_for : Some ( RetainFor :: default ( ) ) ,
394400 view_options : ViewOptions :: default ( ) ,
395401 subcmd : None ,
396402 }
0 commit comments