diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f9eda204..9f4bee17 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 a8021b63..ddaa1b60 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 1d14f097..efc71169 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 473a4a27..5b7d9195 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 0c183383..9d1c32b8 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 00000000..a7ef950c --- /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 9ef5c310..6a4817bd 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 00000000..965b606f --- /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 00000000..76219eb7 --- /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 00000000..2264b5db --- /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 00000000..a65e17bb --- /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 00000000..053191cc --- /dev/null +++ b/testing/tomlfmt.toml @@ -0,0 +1 @@ +../tomlfmt.toml \ No newline at end of file