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

chore: address clippy warnings #549

Closed
Closed
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
4 changes: 2 additions & 2 deletions Cargo.lock

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

13 changes: 6 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ keywords = ["webassembly", "wasmcloud", "wadm"]
license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/wasmcloud/wadm"
default-run = "wadm"

[workspace.package]
version = "0.19.0"
Expand All @@ -22,11 +23,7 @@ members = ["crates/*"]

[dependencies]
anyhow = { workspace = true }
async-nats = { workspace = true }
async-trait = { workspace = true }
clap = { workspace = true, features = ["derive", "cargo", "env"] }
futures = { workspace = true }
nkeys = { workspace = true }
# One version back to avoid clashes with 0.10 of otlp
opentelemetry = { workspace = true, features = ["rt-tokio"] }
# 0.10 to avoid protoc dep
Expand All @@ -40,8 +37,7 @@ tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true, features = ["log"] }
tracing-opentelemetry = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter", "json"] }
wasmcloud-control-interface = { workspace = true }
wadm = { workspace = true }
wadm = { workspace = true, features = ["cli"] }
wadm-types = { workspace = true }

[workspace.dependencies]
Expand Down Expand Up @@ -83,7 +79,7 @@ tracing-subscriber = { version = "0.3.7", features = ["env-filter", "json"] }
ulid = { version = "1", features = ["serde"] }
utoipa = "5"
uuid = "1"
wadm = { version = "0.19.0", path = "./crates/wadm" }
wadm = { version = "0.19.0", path = "./crates/wadm"}
wadm-client = { version = "0.8.0", path = "./crates/wadm-client" }
wadm-types = { version = "0.8.0", path = "./crates/wadm-types" }
wasmcloud-control-interface = { version = "2.2.0" }
Expand All @@ -92,13 +88,16 @@ wit-bindgen-wrpc = { version = "0.9", default-features = false }
wit-bindgen = { version = "0.36.0", default-features = false }

[dev-dependencies]
async-nats = { workspace = true }
chrono = { workspace = true }
futures = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
serde_yaml = { workspace = true }
serial_test = "3"
wadm-client = { workspace = true }
wadm-types = { workspace = true }
wasmcloud-control-interface = { workspace = true }
testcontainers = "0.23"

[build-dependencies]
Expand Down
28 changes: 7 additions & 21 deletions crates/wadm-types/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,38 +702,24 @@ pub fn validate_link_configs(manifest: &Manifest) -> Vec<ValidationFailure> {
let mut failures = Vec::new();
let mut link_config_names = HashSet::new();
for link_trait in manifest.links() {
if let TraitProperty::Link(LinkProperty {
target,
source,
..
}) = &link_trait.properties {
if let TraitProperty::Link(LinkProperty { target, source, .. }) = &link_trait.properties {
for config in target.config.iter() {
// Check if config name is unique
if !link_config_names.insert((
config.name.clone(),
)) {
if !link_config_names.insert((config.name.clone(),)) {
failures.push(ValidationFailure::new(
ValidationFailureLevel::Error,
format!(
"Duplicate link config name found: '{}'",
config.name
),
format!("Duplicate link config name found: '{}'", config.name),
));
}
}

if let Some(source) = source {
for config in source.config.iter() {
// Check if config name is unique
if !link_config_names.insert((
config.name.clone(),
)) {
if !link_config_names.insert((config.name.clone(),)) {
failures.push(ValidationFailure::new(
ValidationFailureLevel::Error,
format!(
"Duplicate link config name found: '{}'",
config.name
),
format!("Duplicate link config name found: '{}'", config.name),
));
}
}
Expand Down Expand Up @@ -772,13 +758,13 @@ fn get_deprecated_configs(component: &serde_yaml::Value) -> Vec<ValidationFailur
}
}
if let Some(trait_properties) = trait_.get("properties") {
if let Some(_) = trait_properties.get("source_config") {
if trait_properties.get("source_config").is_some() {
failures.push(ValidationFailure {
level: ValidationFailureLevel::Warning,
msg: "one of the components' link trait contains a source_config key, please use source:config: rather".to_string(),
});
}
if let Some(_) = trait_properties.get("target_config") {
if trait_properties.get("target_config").is_some() {
failures.push(ValidationFailure {
level: ValidationFailureLevel::Warning,
msg: "one of the components' link trait contains a target_config key, please use target:config: rather".to_string(),
Expand Down
7 changes: 7 additions & 0 deletions crates/wadm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ license = "Apache-2.0"
readme = "../../README.md"
repository = "https://github.com/wasmcloud/wadm"

[features]
# Enables clap attributes on the wadm configuration struct
cli = ["clap"]
default = []

[package.metadata.cargo-machete]
ignored = ["cloudevents-sdk"]

Expand All @@ -17,9 +22,11 @@ anyhow = { workspace = true }
async-nats = { workspace = true }
async-trait = { workspace = true }
chrono = { workspace = true }
clap = { workspace = true, optional = true, features = ["derive", "cargo", "env"]}
cloudevents-sdk = { workspace = true }
futures = { workspace = true }
indexmap = { workspace = true, features = ["serde"] }
nkeys = { workspace = true }
semver = { workspace = true, features = ["serde"] }
serde = { workspace = true }
serde_json = { workspace = true }
Expand Down
Loading