Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CI (clippy lints) #10

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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<()>;
}
Loading