diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b053dbb..a3fc2f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,6 +15,8 @@ jobs: uses: actions/checkout@v3 - name: Format run: cargo fmt && git diff --exit-code + - name: Lint with Clippy + run: cargo clippy --all-targets --all-features -- -D warnings test: runs-on: ubuntu-latest steps: diff --git a/src/drivers/loki.rs b/src/drivers/loki.rs index 492ed86..aa30542 100644 --- a/src/drivers/loki.rs +++ b/src/drivers/loki.rs @@ -56,7 +56,7 @@ impl LogDriver for LokiDriver { .json(&payload); debug!("built request"); - if self.username != "" && self.password != "" { + if !self.username.is_empty() && !self.password.is_empty() { req = req.basic_auth(&self.username, Some(&self.password)) } let response = req.send().await?; diff --git a/src/main.rs b/src/main.rs index 3c799d3..fce6d1b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -60,7 +60,7 @@ async fn main() -> anyhow::Result<()> { let mut drivers: Vec> = Vec::new(); if args.enable_cloudwatch { - let config = aws_config::load_defaults(aws_config::BehaviorVersion::v2023_11_09()).await; + let config = aws_config::load_defaults(aws_config::BehaviorVersion::v2024_03_28()).await; let cwl_client = aws_sdk_cloudwatchlogs::Client::new(&config); drivers.push(Box::new(CloudWatchDriver::new(cwl_client))); debug!("added cloudwatch driver"); diff --git a/src/types.rs b/src/types.rs index c70143f..242584d 100644 --- a/src/types.rs +++ b/src/types.rs @@ -78,6 +78,12 @@ struct VercelProxy { vercel_cache: Option, } +#[async_trait] +pub trait LogDriver: Send + Sync { + async fn init(&mut self) -> Result<()>; + async fn send_log(&mut self, message: &Message) -> Result<()>; +} + #[cfg(test)] mod test { #[test] @@ -132,9 +138,3 @@ mod test { } } } - -#[async_trait] -pub trait LogDriver: Send + Sync { - async fn init(&mut self) -> Result<()>; - async fn send_log(&mut self, message: &Message) -> Result<()>; -}