From 799cd269cdd1ae7634637389327e76a8705190a2 Mon Sep 17 00:00:00 2001 From: David Bernard Date: Tue, 30 Jan 2024 20:19:34 +0100 Subject: [PATCH] build: change clipy configuration to support workspace and features - avoid clippy genarte wrong warning about useless stuff - apply some clippy recommandation Signed-off-by: David Bernard --- Makefile | 2 +- cdevents-sdk/src/id.rs | 2 +- cdevents-sdk/src/uri_reference.rs | 2 +- cdevents-sdk/tests/specs.rs | 8 +++----- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index a5d16a5..b0ef6b1 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ lint_cargo_deny: --config=tools/cargo-deny/deny.toml lint_cargo_clippy: - cargo clippy --no-deps --all-targets -- -D warnings + cargo clippy --workspace --all-features --no-deps --all-targets -- --deny warnings lint_cargo_toml_fmt_files: dprint fmt --config=tools/dprint/dprint.json diff --git a/cdevents-sdk/src/id.rs b/cdevents-sdk/src/id.rs index ccebdc6..49e3d51 100644 --- a/cdevents-sdk/src/id.rs +++ b/cdevents-sdk/src/id.rs @@ -11,7 +11,7 @@ pub struct NonEmptyString(String); impl NonEmptyString { pub fn as_str(&self) -> &str { - &self.0.as_str() + self.0.as_str() } } diff --git a/cdevents-sdk/src/uri_reference.rs b/cdevents-sdk/src/uri_reference.rs index 53b48d7..11385ce 100644 --- a/cdevents-sdk/src/uri_reference.rs +++ b/cdevents-sdk/src/uri_reference.rs @@ -76,7 +76,7 @@ impl<> proptest::arbitrary::Arbitrary for UriReference { use proptest::prelude::*; (prop_oneof![ "\\/[a-z_\\-\\/]+".prop_map(|s| UriReference::from_str(&s).unwrap()), - Just("https://example.com/").prop_map(|s| UriReference::from_str(&s).unwrap()), + Just("https://example.com/").prop_map(|s| UriReference::from_str(s).unwrap()), ]).boxed() } } diff --git a/cdevents-sdk/tests/specs.rs b/cdevents-sdk/tests/specs.rs index e2b6e70..06cc5ec 100644 --- a/cdevents-sdk/tests/specs.rs +++ b/cdevents-sdk/tests/specs.rs @@ -38,14 +38,12 @@ fn check_against_schema(json: &serde_json::Value, ty: &str) { let mut compiler = Compiler::new(); let sch_index = compiler.compile(&schemapath, &mut schemas); if let Err(err) = sch_index { - assert!(false, "{err:#}"); - return; // to allow sch_index.unwrap() + panic!("{err:#}"); //like a assert(false,...) } let sch_index = sch_index.unwrap(); - let result = schemas.validate(&json, sch_index); + let result = schemas.validate(json, sch_index); if let Err(err) = result { - assert!(false, "{err}"); - return; + panic!("{err}"); } }