From 2076ea21147c8cf34ee27eec322ca97759137bbc Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sat, 9 Mar 2024 23:25:50 +0700 Subject: [PATCH] clippy: Configure via `lints` table in `Cargo.toml` (#514) As of Rust 1.74, lints can be configured within the `Cargo.toml` which allows us to not have to configure them in the source code as well as simplifying having a single configuration across an entire workspace. This is documented at: https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-lints-section --- Cargo.toml | 7 +++++++ crates/encoding/Cargo.toml | 3 +++ crates/encoding/src/lib.rs | 2 -- crates/shaders/Cargo.toml | 3 +++ crates/shaders/src/lib.rs | 2 -- crates/tests/Cargo.toml | 3 +++ examples/headless/Cargo.toml | 3 +++ examples/run_wasm/Cargo.toml | 3 +++ examples/scenes/Cargo.toml | 3 +++ examples/simple/Cargo.toml | 3 +++ examples/with_bevy/Cargo.toml | 3 +++ examples/with_winit/Cargo.toml | 3 +++ integrations/vello_svg/Cargo.toml | 3 +++ src/lib.rs | 2 -- 14 files changed, 37 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fa8646f6..42931c15 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,6 +46,9 @@ default = ["wgpu"] hot_reload = [] buffer_labels = [] +[lints] +workspace = true + [dependencies] vello_encoding = { workspace = true } bytemuck = { workspace = true } @@ -57,6 +60,10 @@ raw-window-handle = { workspace = true } futures-intrusive = { workspace = true } wgpu-profiler = { workspace = true, optional = true } +[workspace.lints] +clippy.doc_markdown = "warn" +clippy.semicolon_if_nothing_returned = "warn" + [workspace.dependencies] vello_encoding = { version = "0.1.0", path = "crates/encoding" } bytemuck = { version = "1.14.3", features = ["derive"] } diff --git a/crates/encoding/Cargo.toml b/crates/encoding/Cargo.toml index 763e5fba..f7868a8b 100644 --- a/crates/encoding/Cargo.toml +++ b/crates/encoding/Cargo.toml @@ -13,6 +13,9 @@ default = ["full"] # resources (gradients, images and glyph runs) full = ["skrifa", "guillotiere"] +[lints] +workspace = true + [dependencies] bytemuck = { workspace = true } skrifa = { workspace = true, optional = true } diff --git a/crates/encoding/src/lib.rs b/crates/encoding/src/lib.rs index 7679700b..2ace2819 100644 --- a/crates/encoding/src/lib.rs +++ b/crates/encoding/src/lib.rs @@ -3,8 +3,6 @@ //! Raw scene encoding. -#![warn(clippy::doc_markdown, clippy::semicolon_if_nothing_returned)] - mod binning; mod clip; mod config; diff --git a/crates/shaders/Cargo.toml b/crates/shaders/Cargo.toml index 9114fef3..37f439c6 100644 --- a/crates/shaders/Cargo.toml +++ b/crates/shaders/Cargo.toml @@ -30,6 +30,9 @@ force_rw_storage = [] wgsl = [] msl = [] +[lints] +workspace = true + [dependencies] naga = { version = "0.13", features = ["wgsl-in", "msl-out", "validate"], optional = true } thiserror = { version = "1.0.57", optional = true } diff --git a/crates/shaders/src/lib.rs b/crates/shaders/src/lib.rs index a57037ac..2678827f 100644 --- a/crates/shaders/src/lib.rs +++ b/crates/shaders/src/lib.rs @@ -1,8 +1,6 @@ // Copyright 2023 the Vello Authors // SPDX-License-Identifier: Apache-2.0 OR MIT -#![warn(clippy::doc_markdown, clippy::semicolon_if_nothing_returned)] - mod types; #[cfg(feature = "compile")] diff --git a/crates/tests/Cargo.toml b/crates/tests/Cargo.toml index 8a6ce575..7a037de4 100644 --- a/crates/tests/Cargo.toml +++ b/crates/tests/Cargo.toml @@ -6,6 +6,9 @@ license.workspace = true repository.workspace = true publish = false +[lints] +workspace = true + [dependencies] vello = { path = "../.." } image = "0.24.9" diff --git a/examples/headless/Cargo.toml b/examples/headless/Cargo.toml index 6c04262a..da324c54 100644 --- a/examples/headless/Cargo.toml +++ b/examples/headless/Cargo.toml @@ -6,6 +6,9 @@ license.workspace = true repository.workspace = true publish = false +[lints] +workspace = true + [dependencies] vello = { path = "../../" } scenes = { path = "../scenes" } diff --git a/examples/run_wasm/Cargo.toml b/examples/run_wasm/Cargo.toml index 76068dd0..f98e9b17 100644 --- a/examples/run_wasm/Cargo.toml +++ b/examples/run_wasm/Cargo.toml @@ -5,5 +5,8 @@ license.workspace = true repository.workspace = true publish = false +[lints] +workspace = true + [dependencies] cargo-run-wasm = "0.3.2" diff --git a/examples/scenes/Cargo.toml b/examples/scenes/Cargo.toml index e7a3d5a5..92283682 100644 --- a/examples/scenes/Cargo.toml +++ b/examples/scenes/Cargo.toml @@ -6,6 +6,9 @@ license.workspace = true repository.workspace = true publish = false +[lints] +workspace = true + [dependencies] vello = { path = "../../" } vello_svg = { path = "../../integrations/vello_svg" } diff --git a/examples/simple/Cargo.toml b/examples/simple/Cargo.toml index 3bfff70d..8d4d7f5e 100644 --- a/examples/simple/Cargo.toml +++ b/examples/simple/Cargo.toml @@ -5,6 +5,9 @@ license.workspace = true repository.workspace = true publish = false +[lints] +workspace = true + # The dependencies here are independent from the workspace versions [dependencies] # When using this example outside of the original Vello workspace, diff --git a/examples/with_bevy/Cargo.toml b/examples/with_bevy/Cargo.toml index 7c8b01bb..17aabb92 100644 --- a/examples/with_bevy/Cargo.toml +++ b/examples/with_bevy/Cargo.toml @@ -6,6 +6,9 @@ license.workspace = true repository.workspace = true publish = false +[lints] +workspace = true + [dependencies] vello = { path = "../../" } bevy = { version = "0.13", features = [ diff --git a/examples/with_winit/Cargo.toml b/examples/with_winit/Cargo.toml index d1b7be11..616f2535 100644 --- a/examples/with_winit/Cargo.toml +++ b/examples/with_winit/Cargo.toml @@ -17,6 +17,9 @@ default = ["wgpu-profiler"] # wgpu (which means the dependency used in wgpu-profiler would be incompatible) wgpu-profiler = ["dep:wgpu-profiler", "vello/wgpu-profiler"] +[lints] +workspace = true + [[bin]] # Stop the PDB collision warning on windows name = "with_winit_bin" diff --git a/integrations/vello_svg/Cargo.toml b/integrations/vello_svg/Cargo.toml index 7120d1ff..9693712f 100644 --- a/integrations/vello_svg/Cargo.toml +++ b/integrations/vello_svg/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true repository.workspace = true publish = false +[lints] +workspace = true + [dependencies] vello = { path = "../../" } usvg = "0.37.0" diff --git a/src/lib.rs b/src/lib.rs index 8705d77b..ed56b5ff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,6 @@ // Copyright 2022 the Vello Authors // SPDX-License-Identifier: Apache-2.0 OR MIT -#![warn(clippy::doc_markdown, clippy::semicolon_if_nothing_returned)] - //! Vello is an experimental 2d graphics rendering engine written in Rust, using [`wgpu`]. //! It efficiently draws large 2d scenes with interactive or near-interactive performance. //!