Pārlūkot izejas kodu

ci: treat clippy lints as errors (#16)

* fix: clippy lint

* ci: treat clippy as errors
Yujia Qiao 4 gadi atpakaļ
vecāks
revīzija
65c75da633
2 mainītis faili ar 4 papildinājumiem un 2 dzēšanām
  1. 1 1
      .github/workflows/rust.yml
  2. 3 1
      src/main.rs

+ 1 - 1
.github/workflows/rust.yml

@@ -23,7 +23,7 @@ jobs:
         components: clippy
     - uses: Swatinem/rust-cache@v1
     - name: Clippy
-      run: cargo clippy
+      run: cargo clippy -- -D warnings
     - name: Build
       run: cargo build --verbose
     - name: Build with features

+ 3 - 1
src/main.rs

@@ -24,7 +24,9 @@ async fn main() -> Result<()> {
 
     let level = "info"; // if RUST_LOG not present, use `info` level
     tracing_subscriber::fmt()
-        .with_env_filter(EnvFilter::try_from_default_env().unwrap_or(EnvFilter::from(level)))
+        .with_env_filter(
+            EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::from(level)),
+        )
         .init();
 
     run(&args, shutdown_rx).await