From a1019038711cad4ca469d1f7c0986a802ca2ff89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= Date: Wed, 29 Jan 2025 12:30:52 +0100 Subject: [PATCH] Minor clean-ups * add missing softlinks * sorted `Cargo.toml`s in root and testing * suppress warnings in expanded code --- .github/workflows/rust.yml | 1 + Cargo.toml | 9 ++++++++- rinja/Cargo.toml | 7 +++++-- rinja_derive/src/generator.rs | 8 +++++--- rinja_derive/src/tests.rs | 8 +++++--- testing/.rustfmt.toml | 1 + testing/Cargo.toml | 22 +++++++++++----------- testing/LICENSE-APACHE | 1 + testing/LICENSE-MIT | 1 + testing/_typos.toml | 1 + testing/deny.toml | 1 + testing/tomlfmt.toml | 1 + 12 files changed, 41 insertions(+), 20 deletions(-) create mode 120000 testing/.rustfmt.toml create mode 120000 testing/LICENSE-APACHE create mode 120000 testing/LICENSE-MIT create mode 120000 testing/_typos.toml create mode 120000 testing/deny.toml create mode 120000 testing/tomlfmt.toml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f9eda2045..9f4bee17c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -113,6 +113,7 @@ jobs: with: tool: cargo-sort - run: | + cargo sort --check --check-format --grouped set -eu for PKG in \ examples/actix-web-app examples/axum-app examples/poem-app examples/rocket-app examples/salvo-app examples/warp-app fuzzing \ diff --git a/Cargo.toml b/Cargo.toml index a8021b63f..ddaa1b60d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,10 @@ [workspace] -members = ["rinja", "rinja_derive", "rinja_parser", "testing", "testing-alloc", "testing-no-std"] +members = [ + "rinja", + "rinja_derive", + "rinja_parser", + "testing", + "testing-alloc", + "testing-no-std" +] resolver = "2" diff --git a/rinja/Cargo.toml b/rinja/Cargo.toml index 1d14f0979..efc71169b 100644 --- a/rinja/Cargo.toml +++ b/rinja/Cargo.toml @@ -26,11 +26,14 @@ harness = false [dependencies] rinja_derive = { version = "=0.3.5", path = "../rinja_derive" } -percent-encoding = { version = "2.1.0", optional = true, default-features = false } +itoa = "1.0.11" + +# needed by feature "serde_json" serde = { version = "1.0", optional = true, default-features = false } serde_json = { version = "1.0", optional = true, default-features = false, features = [] } -itoa = "1.0.11" +# needed by feature "urlencode" +percent-encoding = { version = "2.1.0", optional = true, default-features = false } [dev-dependencies] assert_matches = "1.5.0" diff --git a/rinja_derive/src/generator.rs b/rinja_derive/src/generator.rs index 473a4a27e..5b7d91957 100644 --- a/rinja_derive/src/generator.rs +++ b/rinja_derive/src/generator.rs @@ -136,9 +136,11 @@ impl<'a, 'h> Generator<'a, 'h> { where \ RinjaW: rinja::helpers::core::fmt::Write + ?rinja::helpers::core::marker::Sized\ {\ - use rinja::filters::{AutoEscape as _, WriteWritable as _};\ - use rinja::helpers::ResultConverter as _;\ - use rinja::helpers::core::fmt::Write as _;", + #[allow(unused_imports)]\ + use rinja::{\ + filters::{AutoEscape as _, WriteWritable as _},\ + helpers::{ResultConverter as _, core::fmt::Write as _},\ + };", ); // Make sure the compiler understands that the generated code depends on the template files. diff --git a/rinja_derive/src/tests.rs b/rinja_derive/src/tests.rs index 0c1833839..9d1c32b83 100644 --- a/rinja_derive/src/tests.rs +++ b/rinja_derive/src/tests.rs @@ -35,9 +35,11 @@ fn compare(jinja: &str, expected: &str, fields: &[(&str, &str)], size_hint: usiz where RinjaW: rinja::helpers::core::fmt::Write + ?rinja::helpers::core::marker::Sized, { - use rinja::filters::{AutoEscape as _, WriteWritable as _}; - use rinja::helpers::ResultConverter as _; - use rinja::helpers::core::fmt::Write as _; + #[allow(unused_imports)] + use rinja::{ + filters::{AutoEscape as _, WriteWritable as _}, + helpers::{ResultConverter as _, core::fmt::Write as _}, + }; #expected rinja::Result::Ok(()) } diff --git a/testing/.rustfmt.toml b/testing/.rustfmt.toml new file mode 120000 index 000000000..a7ef950cc --- /dev/null +++ b/testing/.rustfmt.toml @@ -0,0 +1 @@ +../.rustfmt.toml \ No newline at end of file diff --git a/testing/Cargo.toml b/testing/Cargo.toml index 9ef5c310b..6a4817bde 100644 --- a/testing/Cargo.toml +++ b/testing/Cargo.toml @@ -6,10 +6,13 @@ edition = "2021" rust-version = "1.81" publish = false -[features] -default = ["code-in-doc", "serde_json"] -code-in-doc = ["rinja/code-in-doc"] -serde_json = ["dep:serde_json", "rinja/serde_json"] +[[bench]] +name = "all" +harness = false + +[[bench]] +name = "normalize_identifier" +harness = false [dependencies] rinja = { path = "../rinja", version = "0.3.5" } @@ -27,13 +30,10 @@ criterion = "0.5" phf = { version = "0.11", features = ["macros" ] } trybuild = "1.0.100" -[[bench]] -name = "all" -harness = false - -[[bench]] -name = "normalize_identifier" -harness = false +[features] +default = ["code-in-doc", "serde_json"] +code-in-doc = ["rinja/code-in-doc"] +serde_json = ["dep:serde_json", "rinja/serde_json"] [lints.rust] # Set in `build.rs` if we are compiling in stable rust, used by `ui.rs` diff --git a/testing/LICENSE-APACHE b/testing/LICENSE-APACHE new file mode 120000 index 000000000..965b606f3 --- /dev/null +++ b/testing/LICENSE-APACHE @@ -0,0 +1 @@ +../LICENSE-APACHE \ No newline at end of file diff --git a/testing/LICENSE-MIT b/testing/LICENSE-MIT new file mode 120000 index 000000000..76219eb72 --- /dev/null +++ b/testing/LICENSE-MIT @@ -0,0 +1 @@ +../LICENSE-MIT \ No newline at end of file diff --git a/testing/_typos.toml b/testing/_typos.toml new file mode 120000 index 000000000..2264b5db8 --- /dev/null +++ b/testing/_typos.toml @@ -0,0 +1 @@ +../_typos.toml \ No newline at end of file diff --git a/testing/deny.toml b/testing/deny.toml new file mode 120000 index 000000000..a65e17bb8 --- /dev/null +++ b/testing/deny.toml @@ -0,0 +1 @@ +../deny.toml \ No newline at end of file diff --git a/testing/tomlfmt.toml b/testing/tomlfmt.toml new file mode 120000 index 000000000..053191ccf --- /dev/null +++ b/testing/tomlfmt.toml @@ -0,0 +1 @@ +../tomlfmt.toml \ No newline at end of file