about summary refs log tree commit diff
path: root/tvix/store/src/bin
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-12-31T14·44+0200
committerclbot <clbot@tvl.fyi>2023-12-31T22·23+0000
commit694ed7ea1a8fe61b90c103639ef1964ce6173761 (patch)
tree34d3d49e8a3b181de83e386f1aa0b7690125f2ab /tvix/store/src/bin
parentf6d1a56c8c2446b97e4147980a842d0a9de04e75 (diff)
refactor(tvix/store/bin): condense subscriber setup a bit r/7296
We can use cli.json.then_some(…) to create a Some(…), allowing us to
omit the else { None } lines.

Change-Id: I6c8142a08d8cb88d6c8302e5ca7570698fcf2aa3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10505
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/store/src/bin')
-rw-r--r--tvix/store/src/bin/tvix-store.rs20
1 files changed, 8 insertions, 12 deletions
diff --git a/tvix/store/src/bin/tvix-store.rs b/tvix/store/src/bin/tvix-store.rs
index ca79378eb4fc..f241a80bf575 100644
--- a/tvix/store/src/bin/tvix-store.rs
+++ b/tvix/store/src/bin/tvix-store.rs
@@ -162,24 +162,20 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
     let level = cli.log_level.unwrap_or(Level::INFO);
 
     let subscriber = tracing_subscriber::registry()
-        .with(if cli.json {
-            Some(
+        .with(
+            cli.json.then_some(
                 tracing_subscriber::fmt::Layer::new()
                     .with_writer(std::io::stderr.with_max_level(level))
                     .json(),
-            )
-        } else {
-            None
-        })
-        .with(if !cli.json {
-            Some(
+            ),
+        )
+        .with(
+            (!cli.json).then_some(
                 tracing_subscriber::fmt::Layer::new()
                     .with_writer(std::io::stderr.with_max_level(level))
                     .pretty(),
-            )
-        } else {
-            None
-        });
+            ),
+        );
 
     tracing::subscriber::set_global_default(subscriber).expect("Unable to set global subscriber");