about summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs
index b4eeed5..f9815f3 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -14,11 +14,10 @@ async fn main() {
 
     info!("Starting the kittybox server...");
 
-    let backend_uri: String;
-    match env::var("BACKEND_URI") {
+    let backend_uri: String = match env::var("BACKEND_URI") {
         Ok(val) => {
             debug!("Backend URI: {}", val);
-            backend_uri = val
+            val
         }
         Err(_) => {
             error!("BACKEND_URI is not set, cannot find a database");
@@ -220,13 +219,12 @@ async fn main() {
 
         let svc = warp::service(app);
 
-        let tcp_listener: std::net::TcpListener;
         let mut listenfd = listenfd::ListenFd::from_env();
-        if let Ok(Some(listener)) = listenfd.take_tcp_listener(0) {
-            tcp_listener = listener;
+        let tcp_listener: std::net::TcpListener = if let Ok(Some(listener)) = listenfd.take_tcp_listener(0) {
+            listener
         } else {
-            tcp_listener = std::net::TcpListener::bind(listen_at).unwrap();
-        }
+            std::net::TcpListener::bind(listen_at).unwrap()
+        };
         tcp_listener.set_nonblocking(true).unwrap();
 
         info!("Listening on {}", tcp_listener.local_addr().unwrap());