Skip to content

Commit

Permalink
clippy: Configure via lints table in Cargo.toml (#514)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
waywardmonkeys committed Mar 9, 2024
1 parent 6828361 commit 2076ea2
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 6 deletions.
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ default = ["wgpu"]
hot_reload = []
buffer_labels = []

[lints]
workspace = true

[dependencies]
vello_encoding = { workspace = true }
bytemuck = { workspace = true }
Expand All @@ -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"] }
Expand Down
3 changes: 3 additions & 0 deletions crates/encoding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 0 additions & 2 deletions crates/encoding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

//! Raw scene encoding.

#![warn(clippy::doc_markdown, clippy::semicolon_if_nothing_returned)]

mod binning;
mod clip;
mod config;
Expand Down
3 changes: 3 additions & 0 deletions crates/shaders/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 0 additions & 2 deletions crates/shaders/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down
3 changes: 3 additions & 0 deletions crates/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ license.workspace = true
repository.workspace = true
publish = false

[lints]
workspace = true

[dependencies]
vello = { path = "../.." }
image = "0.24.9"
Expand Down
3 changes: 3 additions & 0 deletions examples/headless/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ license.workspace = true
repository.workspace = true
publish = false

[lints]
workspace = true

[dependencies]
vello = { path = "../../" }
scenes = { path = "../scenes" }
Expand Down
3 changes: 3 additions & 0 deletions examples/run_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ license.workspace = true
repository.workspace = true
publish = false

[lints]
workspace = true

[dependencies]
cargo-run-wasm = "0.3.2"
3 changes: 3 additions & 0 deletions examples/scenes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ license.workspace = true
repository.workspace = true
publish = false

[lints]
workspace = true

[dependencies]
vello = { path = "../../" }
vello_svg = { path = "../../integrations/vello_svg" }
Expand Down
3 changes: 3 additions & 0 deletions examples/simple/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions examples/with_bevy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ license.workspace = true
repository.workspace = true
publish = false

[lints]
workspace = true

[dependencies]
vello = { path = "../../" }
bevy = { version = "0.13", features = [
Expand Down
3 changes: 3 additions & 0 deletions examples/with_winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions integrations/vello_svg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ license.workspace = true
repository.workspace = true
publish = false

[lints]
workspace = true

[dependencies]
vello = { path = "../../" }
usvg = "0.37.0"
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -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.
//!
Expand Down

0 comments on commit 2076ea2

Please sign in to comment.