Skip to content

Commit

Permalink
Improve CI (clippy lints) (#10)
Browse files Browse the repository at this point in the history
* clippy linting

* clippy lints
  • Loading branch information
dacbd committed Aug 29, 2024
1 parent 77629c8 commit c2528da
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/loki.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async fn main() -> anyhow::Result<()> {
let mut drivers: Vec<Box<dyn LogDriver>> = 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");
Expand Down
12 changes: 6 additions & 6 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ struct VercelProxy {
vercel_cache: Option<String>,
}

#[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]
Expand Down Expand Up @@ -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<()>;
}

0 comments on commit c2528da

Please sign in to comment.