diff --git a/Cargo.toml b/Cargo.toml index 12d2e954be..db5060184b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -162,6 +162,48 @@ default-members = [ ] resolver = "2" +# +# Tree-wide lint configuration. +# https://doc.rust-lang.org/stable/cargo/reference/manifest.html#the-lints-section +# +# For a list of Clippy lints, see +# https://rust-lang.github.io/rust-clippy/master. +# +[workspace.lints.clippy] +# Clippy's style nits are useful, but not worth keeping in CI. +style = { level = "allow", priority = -1 } +# But continue to warn on anything in the "disallowed_" namespace. +disallowed_macros = "warn" +disallowed_methods = "warn" +disallowed_names = "warn" +disallowed_script_idents = "warn" +disallowed_types = "warn" +# Warn on some more style lints that are relatively stable and make sense. +iter_cloned_collect = "warn" +iter_next_slice = "warn" +iter_nth = "warn" +iter_nth_zero = "warn" +iter_skip_next = "warn" +len_zero = "warn" +redundant_field_names = "warn" +# `declare_interior_mutable_const` is classified as a style lint, but it can +# identify real bugs (e.g., declarying a `const Atomic` and using it like +# a `static Atomic`). However, it is also subject to false positives (e.g., +# idiomatically declaring a static array of atomics uses `const Atomic`). We +# warn on this to catch the former, and expect any uses of the latter to allow +# this locally. +# +# Note: any const value with a type containing a `bytes::Bytes` hits this lint, +# and you should `#![allow]` it for now. This is most likely to be seen with +# `http::header::{HeaderName, HeaderValue}`. This is a Clippy bug which will be +# fixed in the Rust 1.80 toolchain (rust-lang/rust-clippy#12691). +declare_interior_mutable_const = "warn" +# Also warn on casts, preferring explicit conversions instead. +# +# We'd like to warn on lossy casts in the future, but lossless casts are the +# easiest ones to convert over. +cast_lossless = "warn" + [workspace.dependencies] anyhow = "1.0" anstyle = "1.0.6" diff --git a/api_identity/Cargo.toml b/api_identity/Cargo.toml index 547defa7c5..6d53ee12c9 100644 --- a/api_identity/Cargo.toml +++ b/api_identity/Cargo.toml @@ -10,6 +10,9 @@ license = "MPL-2.0" [lib] proc-macro = true +[lints] +workspace = true + [dependencies] proc-macro2.workspace = true quote.workspace = true diff --git a/bootstore/Cargo.toml b/bootstore/Cargo.toml index 5e9bcd1ef4..6d1ca97e44 100644 --- a/bootstore/Cargo.toml +++ b/bootstore/Cargo.toml @@ -8,6 +8,9 @@ license = "MPL-2.0" [build-dependencies] omicron-rpaths.workspace = true +[lints] +workspace = true + [dependencies] bytes.workspace = true camino.workspace = true diff --git a/caboose-util/Cargo.toml b/caboose-util/Cargo.toml index 91bf00741e..ceff70b41d 100644 --- a/caboose-util/Cargo.toml +++ b/caboose-util/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true hubtools.workspace = true diff --git a/certificates/Cargo.toml b/certificates/Cargo.toml index 87b12fd167..51e4a2e421 100644 --- a/certificates/Cargo.toml +++ b/certificates/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] display-error-chain.workspace = true foreign-types.workspace = true diff --git a/clients/bootstrap-agent-client/Cargo.toml b/clients/bootstrap-agent-client/Cargo.toml index ce97789fb2..272abdedae 100644 --- a/clients/bootstrap-agent-client/Cargo.toml +++ b/clients/bootstrap-agent-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] omicron-common.workspace = true progenitor.workspace = true diff --git a/clients/ddm-admin-client/Cargo.toml b/clients/ddm-admin-client/Cargo.toml index 1b0fca2951..bd99492f30 100644 --- a/clients/ddm-admin-client/Cargo.toml +++ b/clients/ddm-admin-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] either.workspace = true progenitor-client.workspace = true diff --git a/clients/dns-service-client/Cargo.toml b/clients/dns-service-client/Cargo.toml index fb393d77b1..cdaef701bd 100644 --- a/clients/dns-service-client/Cargo.toml +++ b/clients/dns-service-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true chrono.workspace = true diff --git a/clients/dpd-client/Cargo.toml b/clients/dpd-client/Cargo.toml index 0239c6d9b0..477435d8bb 100644 --- a/clients/dpd-client/Cargo.toml +++ b/clients/dpd-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] futures.workspace = true progenitor-client.workspace = true diff --git a/clients/gateway-client/Cargo.toml b/clients/gateway-client/Cargo.toml index 9e1118cf59..96f6484122 100644 --- a/clients/gateway-client/Cargo.toml +++ b/clients/gateway-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] base64.workspace = true chrono.workspace = true diff --git a/clients/installinator-artifact-client/Cargo.toml b/clients/installinator-artifact-client/Cargo.toml index c3ddc529d9..f1e896864f 100644 --- a/clients/installinator-artifact-client/Cargo.toml +++ b/clients/installinator-artifact-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] installinator-common.workspace = true progenitor.workspace = true diff --git a/clients/nexus-client/Cargo.toml b/clients/nexus-client/Cargo.toml index fd6df6919f..1d5cced21c 100644 --- a/clients/nexus-client/Cargo.toml +++ b/clients/nexus-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] chrono.workspace = true futures.workspace = true diff --git a/clients/oxide-client/Cargo.toml b/clients/oxide-client/Cargo.toml index 3cb411729d..f2adcacb1b 100644 --- a/clients/oxide-client/Cargo.toml +++ b/clients/oxide-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true base64.workspace = true diff --git a/clients/oximeter-client/Cargo.toml b/clients/oximeter-client/Cargo.toml index e54b152415..dadf6d8c4d 100644 --- a/clients/oximeter-client/Cargo.toml +++ b/clients/oximeter-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] chrono.workspace = true futures.workspace = true diff --git a/clients/sled-agent-client/Cargo.toml b/clients/sled-agent-client/Cargo.toml index 1f5453d298..3f3d82bf80 100644 --- a/clients/sled-agent-client/Cargo.toml +++ b/clients/sled-agent-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-trait.workspace = true diff --git a/clients/wicketd-client/Cargo.toml b/clients/wicketd-client/Cargo.toml index 6da60b3a61..364cb5ec86 100644 --- a/clients/wicketd-client/Cargo.toml +++ b/clients/wicketd-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] chrono.workspace = true installinator-common.workspace = true diff --git a/common/Cargo.toml b/common/Cargo.toml index 23499039e6..39508ac6f0 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + # NOTE: # # This crate is depended on by several other workspaces! Be careful of adding diff --git a/dev-tools/crdb-seed/Cargo.toml b/dev-tools/crdb-seed/Cargo.toml index aff26995dc..778a65b4b5 100644 --- a/dev-tools/crdb-seed/Cargo.toml +++ b/dev-tools/crdb-seed/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" license = "MPL-2.0" readme = "README.md" +[lints] +workspace = true + [dependencies] anyhow.workspace = true dropshot.workspace = true diff --git a/dev-tools/omdb/Cargo.toml b/dev-tools/omdb/Cargo.toml index a0c4e2fe56..3c466b1683 100644 --- a/dev-tools/omdb/Cargo.toml +++ b/dev-tools/omdb/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [build-dependencies] omicron-rpaths.workspace = true diff --git a/dev-tools/omicron-dev/Cargo.toml b/dev-tools/omicron-dev/Cargo.toml index 6aa480b2c6..1dcc4eada7 100644 --- a/dev-tools/omicron-dev/Cargo.toml +++ b/dev-tools/omicron-dev/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [build-dependencies] omicron-rpaths.workspace = true diff --git a/dev-tools/oxlog/Cargo.toml b/dev-tools/oxlog/Cargo.toml index 3c3d983d09..9b59647691 100644 --- a/dev-tools/oxlog/Cargo.toml +++ b/dev-tools/oxlog/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true camino.workspace = true diff --git a/dev-tools/reconfigurator-cli/Cargo.toml b/dev-tools/reconfigurator-cli/Cargo.toml index ad3cdf61f1..5edf9d0ef8 100644 --- a/dev-tools/reconfigurator-cli/Cargo.toml +++ b/dev-tools/reconfigurator-cli/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [build-dependencies] omicron-rpaths.workspace = true diff --git a/dev-tools/xtask/Cargo.toml b/dev-tools/xtask/Cargo.toml index e6ec16fbfb..11fcf405bd 100644 --- a/dev-tools/xtask/Cargo.toml +++ b/dev-tools/xtask/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true camino.workspace = true diff --git a/dev-tools/xtask/src/check_workspace_deps.rs b/dev-tools/xtask/src/check_workspace_deps.rs index 6e84380c69..76e405ce1a 100644 --- a/dev-tools/xtask/src/check_workspace_deps.rs +++ b/dev-tools/xtask/src/check_workspace_deps.rs @@ -31,14 +31,24 @@ pub fn run_cmd() -> Result<()> { // Iterate the workspace packages and fill out the maps above. for pkg_info in workspace.workspace_packages() { + let manifest_path = &pkg_info.manifest_path; + let manifest = read_cargo_toml(manifest_path)?; + + // Check that `[lints] workspace = true` is set. + if !manifest.lints.map(|lints| lints.workspace).unwrap_or(false) { + eprintln!( + "error: package {:?} does not have `[lints] workspace = true` set", + pkg_info.name + ); + nerrors += 1; + } + if pkg_info.name == WORKSPACE_HACK_PACKAGE_NAME { // Skip over workspace-hack because hakari doesn't yet support // workspace deps: https://github.com/guppy-rs/guppy/issues/7 continue; } - let manifest_path = &pkg_info.manifest_path; - let manifest = read_cargo_toml(manifest_path)?; for tree in [ &manifest.dependencies, &manifest.dev_dependencies, diff --git a/dev-tools/xtask/src/clippy.rs b/dev-tools/xtask/src/clippy.rs index ec89707e06..8eb1659da7 100644 --- a/dev-tools/xtask/src/clippy.rs +++ b/dev-tools/xtask/src/clippy.rs @@ -34,54 +34,7 @@ pub fn run_cmd(args: ClippyArgs) -> Result<()> { // // We disallow warnings by default. .arg("--deny") - .arg("warnings") - // Clippy's style nits are useful, but not worth keeping in CI. This - // override belongs in src/lib.rs, and it is there, but that doesn't - // reliably work due to rust-lang/rust-clippy#6610. - .arg("--allow") - .arg("clippy::style") - // But continue to warn on anything in the "disallowed_" namespace. - // (These will be turned into errors by `--deny warnings` above.) - .arg("--warn") - .arg("clippy::disallowed_macros") - .arg("--warn") - .arg("clippy::disallowed_methods") - .arg("--warn") - .arg("clippy::disallowed_names") - .arg("--warn") - .arg("clippy::disallowed_script_idents") - .arg("--warn") - .arg("clippy::disallowed_types") - // Warn on some more style lints that are relatively stable and make - // sense. - .arg("--warn") - .arg("clippy::iter_cloned_collect") - .arg("--warn") - .arg("clippy::iter_next_slice") - .arg("--warn") - .arg("clippy::iter_nth") - .arg("--warn") - .arg("clippy::iter_nth_zero") - .arg("--warn") - .arg("clippy::iter_skip_next") - .arg("--warn") - .arg("clippy::len_zero") - .arg("--warn") - .arg("clippy::redundant_field_names") - // `declare_interior_mutable_const` is classified as a style lint, but - // it can identify real bugs (e.g., declarying a `const Atomic` and - // using it like a `static Atomic`). However, it is also subject to - // false positives (e.g., idiomatically declaring a static array of - // atomics uses `const Atomic`). We warn on this to catch the former, - // and expect any uses of the latter to allow this locally. - .arg("--warn") - .arg("clippy::declare_interior_mutable_const") - // Also warn on casts, preferring explicit conversions instead. - // - // We'd like to warn on lossy casts in the future, but lossless casts - // are the easiest ones to convert over. - .arg("--warn") - .arg("clippy::cast_lossless"); + .arg("warnings"); eprintln!( "running: {:?} {}", diff --git a/dns-server/Cargo.toml b/dns-server/Cargo.toml index 3440ebcfe8..237d2a2fbb 100644 --- a/dns-server/Cargo.toml +++ b/dns-server/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true camino.workspace = true diff --git a/end-to-end-tests/Cargo.toml b/end-to-end-tests/Cargo.toml index 754d85512c..1102094b61 100644 --- a/end-to-end-tests/Cargo.toml +++ b/end-to-end-tests/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow = { workspace = true, features = ["backtrace"] } async-trait.workspace = true diff --git a/gateway-cli/Cargo.toml b/gateway-cli/Cargo.toml index 2412bf950f..22aa09fe92 100644 --- a/gateway-cli/Cargo.toml +++ b/gateway-cli/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true clap.workspace = true diff --git a/gateway-test-utils/Cargo.toml b/gateway-test-utils/Cargo.toml index 81b7686eb2..08e22228fe 100644 --- a/gateway-test-utils/Cargo.toml +++ b/gateway-test-utils/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] camino.workspace = true dropshot.workspace = true diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index 450c4b445e..2ddd9421b7 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true base64.workspace = true diff --git a/illumos-utils/Cargo.toml b/illumos-utils/Cargo.toml index cd13e4a8a6..fa50dd2822 100644 --- a/illumos-utils/Cargo.toml +++ b/illumos-utils/Cargo.toml @@ -5,6 +5,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-trait.workspace = true diff --git a/installinator-artifactd/Cargo.toml b/installinator-artifactd/Cargo.toml index e9ddc222cd..236ea7a51c 100644 --- a/installinator-artifactd/Cargo.toml +++ b/installinator-artifactd/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-trait.workspace = true diff --git a/installinator-common/Cargo.toml b/installinator-common/Cargo.toml index dd8540c6f8..4c5560148f 100644 --- a/installinator-common/Cargo.toml +++ b/installinator-common/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true camino.workspace = true diff --git a/installinator/Cargo.toml b/installinator/Cargo.toml index abfcc5e892..ebdb6269b7 100644 --- a/installinator/Cargo.toml +++ b/installinator/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-trait.workspace = true diff --git a/internal-dns-cli/Cargo.toml b/internal-dns-cli/Cargo.toml index dab92c6d7c..dae0af0280 100644 --- a/internal-dns-cli/Cargo.toml +++ b/internal-dns-cli/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true clap.workspace = true diff --git a/internal-dns/Cargo.toml b/internal-dns/Cargo.toml index 4f504c5b49..c08cc012c1 100644 --- a/internal-dns/Cargo.toml +++ b/internal-dns/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true chrono.workspace = true diff --git a/ipcc/Cargo.toml b/ipcc/Cargo.toml index 98a781ab86..a9278349e1 100644 --- a/ipcc/Cargo.toml +++ b/ipcc/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] ciborium.workspace = true libc.workspace = true diff --git a/key-manager/Cargo.toml b/key-manager/Cargo.toml index c44ec61ea4..3e00758c9e 100644 --- a/key-manager/Cargo.toml +++ b/key-manager/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] async-trait.workspace = true hkdf.workspace = true diff --git a/nexus-config/Cargo.toml b/nexus-config/Cargo.toml index af7eb70f62..9d23be302f 100644 --- a/nexus-config/Cargo.toml +++ b/nexus-config/Cargo.toml @@ -3,6 +3,9 @@ name = "nexus-config" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [dependencies] anyhow.workspace = true camino.workspace = true diff --git a/nexus/Cargo.toml b/nexus/Cargo.toml index 5222d104c3..2c1a3b21fe 100644 --- a/nexus/Cargo.toml +++ b/nexus/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [build-dependencies] omicron-rpaths.workspace = true diff --git a/nexus/authz-macros/Cargo.toml b/nexus/authz-macros/Cargo.toml index 4d2640abee..beba0a3cf6 100644 --- a/nexus/authz-macros/Cargo.toml +++ b/nexus/authz-macros/Cargo.toml @@ -7,6 +7,9 @@ license = "MPL-2.0" [lib] proc-macro = true +[lints] +workspace = true + [dependencies] heck.workspace = true nexus-macros-common.workspace = true diff --git a/nexus/db-macros/Cargo.toml b/nexus/db-macros/Cargo.toml index 8032ba814d..fa477c1f00 100644 --- a/nexus/db-macros/Cargo.toml +++ b/nexus/db-macros/Cargo.toml @@ -8,6 +8,9 @@ license = "MPL-2.0" [lib] proc-macro = true +[lints] +workspace = true + [dependencies] heck.workspace = true nexus-macros-common.workspace = true diff --git a/nexus/db-model/Cargo.toml b/nexus/db-model/Cargo.toml index bfe75377c5..1118b7c9bd 100644 --- a/nexus/db-model/Cargo.toml +++ b/nexus/db-model/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [build-dependencies] omicron-rpaths.workspace = true diff --git a/nexus/db-queries/Cargo.toml b/nexus/db-queries/Cargo.toml index 354a2b0ac0..0754f7389f 100644 --- a/nexus/db-queries/Cargo.toml +++ b/nexus/db-queries/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [build-dependencies] omicron-rpaths.workspace = true diff --git a/nexus/defaults/Cargo.toml b/nexus/defaults/Cargo.toml index 535b78054b..d6f8e54220 100644 --- a/nexus/defaults/Cargo.toml +++ b/nexus/defaults/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] ipnetwork.workspace = true once_cell.workspace = true diff --git a/nexus/inventory/Cargo.toml b/nexus/inventory/Cargo.toml index 52c7b6975b..e185808caa 100644 --- a/nexus/inventory/Cargo.toml +++ b/nexus/inventory/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true base64.workspace = true diff --git a/nexus/macros-common/Cargo.toml b/nexus/macros-common/Cargo.toml index 9d4390a6d2..6f7266a5a6 100644 --- a/nexus/macros-common/Cargo.toml +++ b/nexus/macros-common/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] proc-macro2.workspace = true syn = { workspace = true, features = ["extra-traits"] } diff --git a/nexus/metrics-producer-gc/Cargo.toml b/nexus/metrics-producer-gc/Cargo.toml index 9daa52b543..74d94e8d95 100644 --- a/nexus/metrics-producer-gc/Cargo.toml +++ b/nexus/metrics-producer-gc/Cargo.toml @@ -3,6 +3,9 @@ name = "nexus-metrics-producer-gc" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [build-dependencies] omicron-rpaths.workspace = true diff --git a/nexus/networking/Cargo.toml b/nexus/networking/Cargo.toml index 11f6d83993..db163d5aa6 100644 --- a/nexus/networking/Cargo.toml +++ b/nexus/networking/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] futures.workspace = true ipnetwork.workspace = true diff --git a/nexus/reconfigurator/execution/Cargo.toml b/nexus/reconfigurator/execution/Cargo.toml index 2ea39d5a3e..137cde9255 100644 --- a/nexus/reconfigurator/execution/Cargo.toml +++ b/nexus/reconfigurator/execution/Cargo.toml @@ -3,6 +3,9 @@ name = "nexus-reconfigurator-execution" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [build-dependencies] omicron-rpaths.workspace = true diff --git a/nexus/reconfigurator/planning/Cargo.toml b/nexus/reconfigurator/planning/Cargo.toml index d31832482d..ba935bdba0 100644 --- a/nexus/reconfigurator/planning/Cargo.toml +++ b/nexus/reconfigurator/planning/Cargo.toml @@ -3,6 +3,9 @@ name = "nexus-reconfigurator-planning" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [dependencies] anyhow.workspace = true chrono.workspace = true diff --git a/nexus/reconfigurator/preparation/Cargo.toml b/nexus/reconfigurator/preparation/Cargo.toml index 4d9c087240..d7a6d07a5d 100644 --- a/nexus/reconfigurator/preparation/Cargo.toml +++ b/nexus/reconfigurator/preparation/Cargo.toml @@ -3,6 +3,9 @@ name = "nexus-reconfigurator-preparation" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [dependencies] anyhow.workspace = true futures.workspace = true diff --git a/nexus/src/app/background/common.rs b/nexus/src/app/background/common.rs index e0d8f32316..0fbfa9938d 100644 --- a/nexus/src/app/background/common.rs +++ b/nexus/src/app/background/common.rs @@ -376,7 +376,7 @@ impl TaskExec { self.activate(ActivationReason::Signaled).await; } - _ = dependencies.next(), if dependencies.len() > 0 => { + _ = dependencies.next(), if !dependencies.is_empty() => { self.activate(ActivationReason::Dependency).await; } } diff --git a/nexus/src/app/instance_network.rs b/nexus/src/app/instance_network.rs index 2c258c8064..30bea98cc6 100644 --- a/nexus/src/app/instance_network.rs +++ b/nexus/src/app/instance_network.rs @@ -1147,7 +1147,7 @@ pub(crate) async fn probe_delete_dpd_config( }; } - if let Some(e) = errors.into_iter().nth(0) { + if let Some(e) = errors.into_iter().next() { return Err(e); } diff --git a/nexus/src/external_api/console_api.rs b/nexus/src/external_api/console_api.rs index daaf6a986d..d49e7f3be4 100644 --- a/nexus/src/external_api/console_api.rs +++ b/nexus/src/external_api/console_api.rs @@ -8,6 +8,19 @@ //! external API, but in order to avoid CORS issues for now, we are serving //! these routes directly from the external API. +// `HeaderName` and `HeaderValue` contain `bytes::Bytes`, which trips +// the `declare_interior_mutable_const` lint. But in a `const fn` +// context, the `AtomicPtr` that is used in `Bytes` only ever points +// to a `&'static str`, so does not have interior mutability in that +// context. +// +// A Clippy bug means that even if you ignore interior mutability of +// `Bytes` (the default behavior), it will still not ignore it for types +// where the only interior mutability is through `Bytes`. This is fixed +// in rust-lang/rust-clippy#12691, which should land in the Rust 1.80 +// toolchain; we can remove this attribute then. +#![allow(clippy::declare_interior_mutable_const)] + use crate::ServerContext; use anyhow::Context; use camino::{Utf8Path, Utf8PathBuf}; diff --git a/nexus/src/lib.rs b/nexus/src/lib.rs index 4dfb91c4e0..e34b694e52 100644 --- a/nexus/src/lib.rs +++ b/nexus/src/lib.rs @@ -9,8 +9,6 @@ #![allow(rustdoc::private_intra_doc_links)] // TODO(#40): Remove this exception once resolved. #![allow(clippy::unnecessary_wraps)] -// Clippy's style lints are useful, but not worth running automatically. -#![allow(clippy::style)] pub mod app; // Public for documentation examples mod cidata; diff --git a/nexus/test-interface/Cargo.toml b/nexus/test-interface/Cargo.toml index 004ce28545..03e38d3687 100644 --- a/nexus/test-interface/Cargo.toml +++ b/nexus/test-interface/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] async-trait.workspace = true nexus-config.workspace = true diff --git a/nexus/test-utils-macros/Cargo.toml b/nexus/test-utils-macros/Cargo.toml index 5ed57b9c4a..d5094f84eb 100644 --- a/nexus/test-utils-macros/Cargo.toml +++ b/nexus/test-utils-macros/Cargo.toml @@ -7,6 +7,9 @@ license = "MPL-2.0" [lib] proc-macro = true +[lints] +workspace = true + [dependencies] quote.workspace = true syn = { workspace = true, features = [ "fold", "parsing" ] } diff --git a/nexus/test-utils/Cargo.toml b/nexus/test-utils/Cargo.toml index bd066cc4df..0eab038f91 100644 --- a/nexus/test-utils/Cargo.toml +++ b/nexus/test-utils/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true bytes.workspace = true diff --git a/nexus/types/Cargo.toml b/nexus/types/Cargo.toml index a67b639197..372cee858a 100644 --- a/nexus/types/Cargo.toml +++ b/nexus/types/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true chrono.workspace = true diff --git a/oximeter/collector/Cargo.toml b/oximeter/collector/Cargo.toml index b7dac716c6..01f484f5f4 100644 --- a/oximeter/collector/Cargo.toml +++ b/oximeter/collector/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" description = "The oximeter metric collection server" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true camino.workspace = true diff --git a/oximeter/db/Cargo.toml b/oximeter/db/Cargo.toml index c86060b909..b1c394b219 100644 --- a/oximeter/db/Cargo.toml +++ b/oximeter/db/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" description = "Tools for interacting with the Oxide control plane telemetry database" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-recursion = "1.1.0" diff --git a/oximeter/instruments/Cargo.toml b/oximeter/instruments/Cargo.toml index c49d3b976e..a04e26fdaa 100644 --- a/oximeter/instruments/Cargo.toml +++ b/oximeter/instruments/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] cfg-if = { workspace = true, optional = true } chrono = { workspace = true, optional = true } diff --git a/oximeter/oximeter-macro-impl/Cargo.toml b/oximeter/oximeter-macro-impl/Cargo.toml index df9ed547ed..d0a8c5f566 100644 --- a/oximeter/oximeter-macro-impl/Cargo.toml +++ b/oximeter/oximeter-macro-impl/Cargo.toml @@ -8,6 +8,9 @@ license = "MPL-2.0" [lib] proc-macro = true +[lints] +workspace = true + [dependencies] proc-macro2.workspace = true quote.workspace = true diff --git a/oximeter/oximeter/Cargo.toml b/oximeter/oximeter/Cargo.toml index b545c697de..2445e0483a 100644 --- a/oximeter/oximeter/Cargo.toml +++ b/oximeter/oximeter/Cargo.toml @@ -5,6 +5,9 @@ authors = ["Benjamin Naecker "] edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] bytes = { workspace = true, features = [ "serde" ] } chrono.workspace = true diff --git a/oximeter/producer/Cargo.toml b/oximeter/producer/Cargo.toml index b0df929c3b..dfac555a49 100644 --- a/oximeter/producer/Cargo.toml +++ b/oximeter/producer/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" description = "Crate for producing metric data to be collected by the Oxide control plane" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] chrono.workspace = true dropshot.workspace = true diff --git a/package/Cargo.toml b/package/Cargo.toml index 8067473aa0..4632e66731 100644 --- a/package/Cargo.toml +++ b/package/Cargo.toml @@ -5,6 +5,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true camino.workspace = true diff --git a/passwords/Cargo.toml b/passwords/Cargo.toml index bb411a9449..eda3a020dc 100644 --- a/passwords/Cargo.toml +++ b/passwords/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] argon2 = { version = "0.5.3", features = ["alloc", "password-hash", "rand", "std"] } rand.workspace = true diff --git a/rpaths/Cargo.toml b/rpaths/Cargo.toml index 45e6c9b925..5e54e9e87b 100644 --- a/rpaths/Cargo.toml +++ b/rpaths/Cargo.toml @@ -4,5 +4,8 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] omicron-workspace-hack.workspace = true diff --git a/sled-agent/Cargo.toml b/sled-agent/Cargo.toml index 998d83725a..52533016dc 100644 --- a/sled-agent/Cargo.toml +++ b/sled-agent/Cargo.toml @@ -5,6 +5,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-trait.workspace = true diff --git a/sled-agent/src/lib.rs b/sled-agent/src/lib.rs index a4686bdb88..989f011ed8 100644 --- a/sled-agent/src/lib.rs +++ b/sled-agent/src/lib.rs @@ -7,8 +7,6 @@ // We only use rustdoc for internal documentation, including private items, so // it's expected that we'll have links to private items in the docs. #![allow(rustdoc::private_intra_doc_links)] -// Clippy's style lints are useful, but not worth running automatically. -#![allow(clippy::style)] // Module for executing the simulated sled agent. pub mod sim; diff --git a/sled-agent/src/params.rs b/sled-agent/src/params.rs index a51443af70..2ed7ca5528 100644 --- a/sled-agent/src/params.rs +++ b/sled-agent/src/params.rs @@ -610,7 +610,7 @@ impl From for sled_agent_client::types::OmicronZoneType { domain, ntp_servers, snat_cfg, - nic: nic, + nic, }, OmicronZoneType::Clickhouse { address, dataset } => { Other::Clickhouse { @@ -646,7 +646,7 @@ impl From for sled_agent_client::types::OmicronZoneType { dataset: dataset.into(), http_address: http_address.to_string(), dns_address: dns_address.to_string(), - nic: nic, + nic, }, OmicronZoneType::InternalDns { dataset, @@ -683,7 +683,7 @@ impl From for sled_agent_client::types::OmicronZoneType { external_ip, external_tls, internal_address: internal_address.to_string(), - nic: nic, + nic, }, OmicronZoneType::Oximeter { address } => { Other::Oximeter { address: address.to_string() } diff --git a/sled-agent/src/rack_setup/config.rs b/sled-agent/src/rack_setup/config.rs index 91cdc5c9b5..9fe62d3582 100644 --- a/sled-agent/src/rack_setup/config.rs +++ b/sled-agent/src/rack_setup/config.rs @@ -233,7 +233,7 @@ mod test { let read_cfg = SetupServiceConfig::from_file(&cfg_path) .expect("failed to read generated config with certificate"); assert_eq!(read_cfg.external_certificates.len(), 1); - let cert = read_cfg.external_certificates.iter().next().unwrap(); + let cert = read_cfg.external_certificates.first().unwrap(); let _ = rcgen::KeyPair::from_pem(&cert.key) .expect("generated PEM did not parse as KeyPair"); } diff --git a/sled-agent/src/rack_setup/service.rs b/sled-agent/src/rack_setup/service.rs index 2a3e7b2de8..529fe833ff 100644 --- a/sled-agent/src/rack_setup/service.rs +++ b/sled-agent/src/rack_setup/service.rs @@ -531,7 +531,7 @@ impl ServiceInner { } }) .collect(); - if dns_addrs.len() > 0 { + if !dns_addrs.is_empty() { Some(dns_addrs) } else { None diff --git a/sled-agent/src/swap_device.rs b/sled-agent/src/swap_device.rs index 6a00b42672..7dadf62434 100644 --- a/sled-agent/src/swap_device.rs +++ b/sled-agent/src/swap_device.rs @@ -62,7 +62,7 @@ pub(crate) fn ensure_swap_device( assert!(size_gb > 0); let devs = swapctl::list_swap_devices()?; - if devs.len() > 0 { + if !devs.is_empty() { if devs.len() > 1 { // This should really never happen unless we've made a mistake, but it's // probably fine to have more than one swap device. Thus, don't panic @@ -450,7 +450,7 @@ mod swapctl { let path = String::from_utf8_lossy(p.to_bytes()).to_string(); devices.push(SwapDevice { - path: path, + path, start: e.ste_start as u64, length: e.ste_length as u64, total_pages: e.ste_pages as u64, @@ -473,8 +473,8 @@ mod swapctl { SwapDeviceError::AddDevice { msg: format!("could not convert path to CString: {}", e,), path: path_cp.clone(), - start: start, - length: length, + start, + length, } })?; @@ -490,8 +490,8 @@ mod swapctl { SwapDeviceError::AddDevice { msg: e.to_string(), path: path_cp, - start: start, - length: length, + start, + length, } })? }; diff --git a/sled-hardware/Cargo.toml b/sled-hardware/Cargo.toml index e36f1f0914..df2eb36071 100644 --- a/sled-hardware/Cargo.toml +++ b/sled-hardware/Cargo.toml @@ -5,6 +5,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true camino.workspace = true diff --git a/sled-hardware/types/Cargo.toml b/sled-hardware/types/Cargo.toml index d6eefa49ac..3b73728ca5 100644 --- a/sled-hardware/types/Cargo.toml +++ b/sled-hardware/types/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] illumos-utils.workspace = true omicron-common.workspace = true diff --git a/sled-storage/Cargo.toml b/sled-storage/Cargo.toml index e0e4712330..2439c52aa7 100644 --- a/sled-storage/Cargo.toml +++ b/sled-storage/Cargo.toml @@ -3,6 +3,9 @@ name = "sled-storage" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-trait.workspace = true diff --git a/sp-sim/Cargo.toml b/sp-sim/Cargo.toml index 07d956e41e..35cb791f4c 100644 --- a/sp-sim/Cargo.toml +++ b/sp-sim/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-trait.workspace = true diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 56e3be2efd..f63de32e2e 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true atomicwrites.workspace = true diff --git a/tufaceous-lib/Cargo.toml b/tufaceous-lib/Cargo.toml index 7f67d21f35..e448ed6db5 100644 --- a/tufaceous-lib/Cargo.toml +++ b/tufaceous-lib/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" license = "MPL-2.0" publish = false +[lints] +workspace = true + [dependencies] anyhow = { workspace = true, features = ["backtrace"] } async-trait.workspace = true diff --git a/tufaceous/Cargo.toml b/tufaceous/Cargo.toml index b911c85b81..5b36daf113 100644 --- a/tufaceous/Cargo.toml +++ b/tufaceous/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" license = "MPL-2.0" publish = false +[lints] +workspace = true + [dependencies] anyhow = { workspace = true, features = ["backtrace"] } camino.workspace = true diff --git a/typed-rng/Cargo.toml b/typed-rng/Cargo.toml index c6f5270489..ee0a292116 100644 --- a/typed-rng/Cargo.toml +++ b/typed-rng/Cargo.toml @@ -3,6 +3,9 @@ name = "typed-rng" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [dependencies] newtype-uuid.workspace = true omicron-workspace-hack.workspace = true diff --git a/update-common/Cargo.toml b/update-common/Cargo.toml index 37542baa8f..96675d47d7 100644 --- a/update-common/Cargo.toml +++ b/update-common/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true bytes.workspace = true diff --git a/update-engine/Cargo.toml b/update-engine/Cargo.toml index 5bc3672f54..5c8343a432 100644 --- a/update-engine/Cargo.toml +++ b/update-engine/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true cancel-safe-futures.workspace = true diff --git a/uuid-kinds/Cargo.toml b/uuid-kinds/Cargo.toml index bbe3fd3eea..e39017c2bf 100644 --- a/uuid-kinds/Cargo.toml +++ b/uuid-kinds/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + # The dependencies and features are written so as to make it easy for no-std # code to import omicron-uuid-kinds. All the features below are turned on # within omicron. diff --git a/wicket-common/Cargo.toml b/wicket-common/Cargo.toml index 385cd5ab0a..39efc2ce20 100644 --- a/wicket-common/Cargo.toml +++ b/wicket-common/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true omicron-common.workspace = true diff --git a/wicket-dbg/Cargo.toml b/wicket-dbg/Cargo.toml index f42ed335c8..5ea39dab37 100644 --- a/wicket-dbg/Cargo.toml +++ b/wicket-dbg/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true bytes.workspace = true diff --git a/wicket/Cargo.toml b/wicket/Cargo.toml index 96689e359a..a443232aeb 100644 --- a/wicket/Cargo.toml +++ b/wicket/Cargo.toml @@ -6,6 +6,9 @@ edition = "2021" license = "MPL-2.0" default-run = "wicket" +[lints] +workspace = true + [dependencies] anyhow.workspace = true buf-list.workspace = true diff --git a/wicketd/Cargo.toml b/wicketd/Cargo.toml index c440a73397..fe0fa27e15 100644 --- a/wicketd/Cargo.toml +++ b/wicketd/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-trait.workspace = true diff --git a/workspace-hack/Cargo.toml b/workspace-hack/Cargo.toml index 4222d6141a..d15a2242be 100644 --- a/workspace-hack/Cargo.toml +++ b/workspace-hack/Cargo.toml @@ -9,6 +9,9 @@ description = "workspace-hack package, managed by hakari" # You can choose to publish this crate: see https://docs.rs/cargo-hakari/latest/cargo_hakari/publishing. publish = false +[lints] +workspace = true + # The parts of the file between the BEGIN HAKARI SECTION and END HAKARI SECTION comments # are managed by hakari. diff --git a/zone-setup/Cargo.toml b/zone-setup/Cargo.toml index 6ee89e5302..dec4f87900 100644 --- a/zone-setup/Cargo.toml +++ b/zone-setup/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true clap.workspace = true