Skip to content

Commit

Permalink
feat: update external crates, apply clippy recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
ralvescosta committed Jun 23, 2024
1 parent f64b0e6 commit 09b3806
Show file tree
Hide file tree
Showing 31 changed files with 147 additions and 159 deletions.
55 changes: 27 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions configs/src/mqtt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub enum MQTTBrokerKind {
impl From<&str> for MQTTBrokerKind {
fn from(value: &str) -> Self {
match value.to_uppercase().as_str() {
"AWSIOTCORE" => MQTTBrokerKind::AWSIoTCore,
"AWSIoTCore" => MQTTBrokerKind::AWSIoTCore,
_ => MQTTBrokerKind::Default,
}
}
Expand All @@ -19,7 +19,7 @@ impl From<&str> for MQTTBrokerKind {
impl From<&String> for MQTTBrokerKind {
fn from(value: &String) -> Self {
match value.to_uppercase().as_str() {
"AWSIOTCORE" => MQTTBrokerKind::AWSIoTCore,
"AWSIoTCore" => MQTTBrokerKind::AWSIoTCore,
_ => MQTTBrokerKind::Default,
}
}
Expand Down
12 changes: 11 additions & 1 deletion configs/src/sqlite.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[derive(Debug, Clone, Default)]
#[derive(Debug, Clone)]
pub struct SqliteConfigs {
///Default: local.db
pub file: String,
Expand All @@ -7,3 +7,13 @@ pub struct SqliteConfigs {
/// Default: postgres
pub password: String,
}

impl Default for SqliteConfigs {
fn default() -> Self {
Self {
file: Default::default(),
user: Default::default(),
password: Default::default(),
}
}
}
11 changes: 5 additions & 6 deletions configs_builder/src/configs_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,14 @@ impl ConfigBuilder {
app_cfg: &AppConfigs,
) -> Result<Option<Arc<dyn SecretClient>>, ConfigsError> {
match app_cfg.secret_manager {
SecretsManagerKind::None => Ok(Some(Arc::new(FakeSecretClient::new()))),
SecretsManagerKind::None => {
return Ok(Some(Arc::new(FakeSecretClient::new())));
}

SecretsManagerKind::AWSSecretManager => {
let secret_key = env::var(SECRET_KEY_ENV_KEY).unwrap_or_default();

match AWSSecretClientBuilder::new(secret_key)
.build()
.await
{
match AWSSecretClientBuilder::new(secret_key).build().await {
Ok(c) => Ok(Some(Arc::new(c))),
Err(err) => {
error!(error = err.to_string(), "error to create aws secret client");
Expand Down Expand Up @@ -647,7 +646,7 @@ impl ConfigBuilder {

v.parse().unwrap_or_else(|_| {
error!(key = key, value = v, "parse went wrong");
default
return default;
})
}

Expand Down
2 changes: 1 addition & 1 deletion health_http_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ health-readiness = { path = '../health_readiness' }
thiserror = { workspace = true }
tracing = { workspace = true }
opentelemetry = { workspace = true }
actix-web = { version = "4.7.0" }
actix-web = { version = "4.8.0" }

prometheus = { version = "0.13.4", optional = true }

Expand Down
4 changes: 2 additions & 2 deletions health_readiness/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ pub struct HealthReadinessServiceImpl {

impl HealthReadinessServiceImpl {
pub fn empty() -> Arc<HealthReadinessServiceImpl> {
Arc::new(HealthReadinessServiceImpl { checkers: vec![] })
return Arc::new(HealthReadinessServiceImpl { checkers: vec![] });
}

pub fn new(checkers: Vec<Arc<dyn HealthChecker>>) -> Arc<HealthReadinessServiceImpl> {
Arc::new(HealthReadinessServiceImpl { checkers })
return Arc::new(HealthReadinessServiceImpl { checkers });
}

#[cfg(feature = "mqtt")]
Expand Down
4 changes: 2 additions & 2 deletions http_components/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ validator = ["dep:validator"]
health = ["dep:health-readiness"]

[dependencies]
actix-web = { version = "4.6.0" }
actix-http = { version = "3.7.0" }
actix-web = { version = "4.8.0" }
actix-http = { version = "3.8.0" }
actix-cors = { version = "0.7.0" }
futures-util = { version = "0.3.30" }
serde = { workspace = true, features = ["derive"] }
Expand Down
1 change: 0 additions & 1 deletion http_components/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion http_components/src/middlewares/deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn handler() -> JsonConfig {
format!("JSON error: {:?}", err),
HttpResponse::BadRequest().json(HTTPError::bad_request(
"unformatted body",
format!("{}", err),
&format!("{}", err),
)),
)
.into()
Expand Down
6 changes: 0 additions & 6 deletions http_components/src/middlewares/otel/http_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ impl HTTPOtelMetrics {
}
}

impl Default for HTTPOtelMetrics {
fn default() -> Self {
Self::new()
}
}

impl<S, B> dev::Transform<S, dev::ServiceRequest> for HTTPOtelMetrics
where
S: dev::Service<
Expand Down
2 changes: 1 addition & 1 deletion http_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ http-components = { path = '../http_components', features = ["tracing", "metrics
health-readiness = { path = '../health_readiness' }
auth = { path = "../auth" }

actix-web = { version = "4.6.0" }
actix-web = { version = "4.8.0" }
thiserror = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
Expand Down
1 change: 0 additions & 1 deletion kafka/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ async-trait = { workspace = true }
opentelemetry = { workspace = true }
tracing = { workspace = true }
tokio = { workspace = true, features = ["default"] }
thiserror = { workspace = true }
1 change: 0 additions & 1 deletion kafka/README.md

This file was deleted.

7 changes: 0 additions & 7 deletions kafka/src/errors.rs

This file was deleted.

1 change: 0 additions & 1 deletion kafka/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pub mod connection;
pub mod dispatcher;
pub mod errors;
pub mod otel;
pub mod publisher;
Loading

0 comments on commit 09b3806

Please sign in to comment.