diff --git a/Cargo.toml b/Cargo.toml index 1dcc09ad17..c0095b6533 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -323,6 +323,9 @@ default-members = [ ] resolver = "3" +[workspace.package] +edition = "2024" + # # Tree-wide lint configuration. # https://doc.rust-lang.org/stable/cargo/reference/manifest.html#the-lints-section diff --git a/api_identity/Cargo.toml b/api_identity/Cargo.toml index 6d53ee12c9..832d50d979 100644 --- a/api_identity/Cargo.toml +++ b/api_identity/Cargo.toml @@ -3,7 +3,7 @@ name = "api_identity" description = "macro used for Oxide control plane resources with an identity" version = "0.1.0" authors = ["David Pacheco "] -edition = "2021" +edition.workspace = true repository = "https://github.com/oxidecomputer/omicron/" license = "MPL-2.0" diff --git a/bootstore/Cargo.toml b/bootstore/Cargo.toml index 0f11f2e32d..278dcf6c36 100644 --- a/bootstore/Cargo.toml +++ b/bootstore/Cargo.toml @@ -2,7 +2,7 @@ name = "bootstore" description = "Storage required for rack unlock" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [build-dependencies] diff --git a/certificates/Cargo.toml b/certificates/Cargo.toml index 51e4a2e421..850993426e 100644 --- a/certificates/Cargo.toml +++ b/certificates/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-certificates" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/certificates/src/openssl_ext.rs b/certificates/src/openssl_ext.rs index a20aa205ad..e3a323292e 100644 --- a/certificates/src/openssl_ext.rs +++ b/certificates/src/openssl_ext.rs @@ -16,7 +16,7 @@ use std::ffi::c_int; use std::ffi::c_uint; use std::ptr; -extern "C" { +unsafe extern "C" { // `X509_check_host()` is only exported by `openssl-sys` if the `bindgen` // feature is enabled // (https://github.com/sfackler/rust-openssl/issues/2041). For now, we'll diff --git a/clickhouse-admin/Cargo.toml b/clickhouse-admin/Cargo.toml index 6025d0d145..16b74df7c7 100644 --- a/clickhouse-admin/Cargo.toml +++ b/clickhouse-admin/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-clickhouse-admin" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [dependencies] diff --git a/clickhouse-admin/api/Cargo.toml b/clickhouse-admin/api/Cargo.toml index 764899d04d..51270d03e3 100644 --- a/clickhouse-admin/api/Cargo.toml +++ b/clickhouse-admin/api/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clickhouse-admin-api" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/clickhouse-admin/src/context.rs b/clickhouse-admin/src/context.rs index 307111647d..2fbe30d1c1 100644 --- a/clickhouse-admin/src/context.rs +++ b/clickhouse-admin/src/context.rs @@ -50,8 +50,8 @@ impl KeeperServerContext { // If there is already a configuration file with a generation number we'll // use that. Otherwise, we set the generation number to None. - let gen = read_generation_from_file(config_path)?; - let (generation_tx, generation_rx) = watch::channel(gen); + let generation = read_generation_from_file(config_path)?; + let (generation_tx, generation_rx) = watch::channel(generation); // We only want to handle one in flight request at a time. Reconfigurator execution will retry // again later anyway. We use flume bounded channels with a size of 0 to act as a rendezvous channel. @@ -137,8 +137,8 @@ impl ServerContext { // If there is already a configuration file with a generation number we'll // use that. Otherwise, we set the generation number to None. - let gen = read_generation_from_file(config_path)?; - let (generation_tx, generation_rx) = watch::channel(gen); + let generation = read_generation_from_file(config_path)?; + let (generation_tx, generation_rx) = watch::channel(generation); // We only want to handle one in flight request at a time. Reconfigurator execution will retry // again later anyway. We use flume bounded channels with a size of 0 to act as a rendezvous channel. @@ -499,9 +499,9 @@ fn read_generation_from_file(path: Utf8PathBuf) -> Result> { ) })?; - let gen = Generation::try_from(gen_u64)?; + let generation = Generation::try_from(gen_u64)?; - Ok(Some(gen)) + Ok(Some(generation)) } #[cfg(test)] diff --git a/clickhouse-admin/src/http_entrypoints.rs b/clickhouse-admin/src/http_entrypoints.rs index 0014be7ac7..ff8118d876 100644 --- a/clickhouse-admin/src/http_entrypoints.rs +++ b/clickhouse-admin/src/http_entrypoints.rs @@ -54,7 +54,7 @@ impl ClickhouseAdminServerApi for ClickhouseAdminServerImpl { rqctx: RequestContext, ) -> Result, HttpError> { let ctx = rqctx.context(); - let gen = match ctx.generation() { + let generation = match ctx.generation() { Some(g) => g, None => { return Err(HttpError::for_client_error( @@ -64,7 +64,7 @@ impl ClickhouseAdminServerApi for ClickhouseAdminServerImpl { )); } }; - Ok(HttpResponseOk(gen)) + Ok(HttpResponseOk(generation)) } async fn distributed_ddl_queue( @@ -120,7 +120,7 @@ impl ClickhouseAdminKeeperApi for ClickhouseAdminKeeperImpl { rqctx: RequestContext, ) -> Result, HttpError> { let ctx = rqctx.context(); - let gen = match ctx.generation() { + let generation = match ctx.generation() { Some(g) => g, None => { return Err(HttpError::for_client_error( @@ -130,7 +130,7 @@ impl ClickhouseAdminKeeperApi for ClickhouseAdminKeeperImpl { )); } }; - Ok(HttpResponseOk(gen)) + Ok(HttpResponseOk(generation)) } async fn lgif( diff --git a/clickhouse-admin/test-utils/Cargo.toml b/clickhouse-admin/test-utils/Cargo.toml index 8ce2966206..c02b0a70e8 100644 --- a/clickhouse-admin/test-utils/Cargo.toml +++ b/clickhouse-admin/test-utils/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clickhouse-admin-test-utils" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/clickhouse-admin/types/Cargo.toml b/clickhouse-admin/types/Cargo.toml index c4e770bed9..f8aab17a28 100644 --- a/clickhouse-admin/types/Cargo.toml +++ b/clickhouse-admin/types/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clickhouse-admin-types" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/clickhouse-admin/types/src/lib.rs b/clickhouse-admin/types/src/lib.rs index a059fc9c0d..8eda5ce1ee 100644 --- a/clickhouse-admin/types/src/lib.rs +++ b/clickhouse-admin/types/src/lib.rs @@ -12,7 +12,7 @@ use itertools::Itertools; use omicron_common::api::external::Generation; use schemars::{ JsonSchema, - gen::SchemaGenerator, + r#gen::SchemaGenerator, schema::{Schema, SchemaObject}, }; use serde::{Deserialize, Serialize}; @@ -41,8 +41,8 @@ pub const OXIMETER_CLUSTER: &str = "oximeter_cluster"; // Used for schemars to be able to be used with camino: // See https://github.com/camino-rs/camino/issues/91#issuecomment-2027908513 -pub fn path_schema(gen: &mut SchemaGenerator) -> Schema { - let mut schema: SchemaObject = ::json_schema(gen).into(); +pub fn path_schema(generator: &mut SchemaGenerator) -> Schema { + let mut schema: SchemaObject = ::json_schema(generator).into(); schema.format = Some("Utf8PathBuf".to_owned()); schema.into() } diff --git a/clients/bootstrap-agent-client/Cargo.toml b/clients/bootstrap-agent-client/Cargo.toml index e152e31966..6671907294 100644 --- a/clients/bootstrap-agent-client/Cargo.toml +++ b/clients/bootstrap-agent-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bootstrap-agent-client" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/clients/clickhouse-admin-keeper-client/Cargo.toml b/clients/clickhouse-admin-keeper-client/Cargo.toml index 1b8839ae64..3cfe10d825 100644 --- a/clients/clickhouse-admin-keeper-client/Cargo.toml +++ b/clients/clickhouse-admin-keeper-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clickhouse-admin-keeper-client" version = "0.1.0" -edition = "2021" +edition.workspace = true [dependencies] chrono.workspace = true diff --git a/clients/clickhouse-admin-server-client/Cargo.toml b/clients/clickhouse-admin-server-client/Cargo.toml index 61142f8a7b..95f9160746 100644 --- a/clients/clickhouse-admin-server-client/Cargo.toml +++ b/clients/clickhouse-admin-server-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clickhouse-admin-server-client" version = "0.1.0" -edition = "2021" +edition.workspace = true [dependencies] chrono.workspace = true diff --git a/clients/clickhouse-admin-single-client/Cargo.toml b/clients/clickhouse-admin-single-client/Cargo.toml index e8b2abf860..828944f759 100644 --- a/clients/clickhouse-admin-single-client/Cargo.toml +++ b/clients/clickhouse-admin-single-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clickhouse-admin-single-client" version = "0.1.0" -edition = "2021" +edition.workspace = true [dependencies] chrono.workspace = true diff --git a/clients/cockroach-admin-client/Cargo.toml b/clients/cockroach-admin-client/Cargo.toml index cbf81c708f..01089bdd14 100644 --- a/clients/cockroach-admin-client/Cargo.toml +++ b/clients/cockroach-admin-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cockroach-admin-client" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/clients/ddm-admin-client/Cargo.toml b/clients/ddm-admin-client/Cargo.toml index c43b85fd2a..57ea1551d9 100644 --- a/clients/ddm-admin-client/Cargo.toml +++ b/clients/ddm-admin-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-ddm-admin-client" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/clients/ddm-admin-client/src/lib.rs b/clients/ddm-admin-client/src/lib.rs index 6a6f63375a..f310b1582a 100644 --- a/clients/ddm-admin-client/src/lib.rs +++ b/clients/ddm-admin-client/src/lib.rs @@ -112,7 +112,7 @@ impl Client { pub async fn derive_bootstrap_addrs_from_prefixes<'a>( &self, interfaces: &'a [BootstrapInterface], - ) -> Result + 'a, DdmError> { + ) -> Result + 'a + use<'a>, DdmError> { let prefixes = self.inner.get_prefixes().await?.into_inner(); Ok(prefixes.into_iter().flat_map(|(_, prefixes)| { prefixes.into_iter().flat_map(|prefix| { diff --git a/clients/dns-service-client/Cargo.toml b/clients/dns-service-client/Cargo.toml index d6fde92315..c8ab267888 100644 --- a/clients/dns-service-client/Cargo.toml +++ b/clients/dns-service-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dns-service-client" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/clients/gateway-client/Cargo.toml b/clients/gateway-client/Cargo.toml index 8617fda5fa..0ebc8b0477 100644 --- a/clients/gateway-client/Cargo.toml +++ b/clients/gateway-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "gateway-client" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/clients/installinator-client/Cargo.toml b/clients/installinator-client/Cargo.toml index 33728bbb57..3081fbbcad 100644 --- a/clients/installinator-client/Cargo.toml +++ b/clients/installinator-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "installinator-client" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/clients/nexus-client/Cargo.toml b/clients/nexus-client/Cargo.toml index 27feec25b7..a7dd1018fd 100644 --- a/clients/nexus-client/Cargo.toml +++ b/clients/nexus-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-client" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/clients/nexus-client/src/lib.rs b/clients/nexus-client/src/lib.rs index d5c73f5a0c..cd8cb8a57b 100644 --- a/clients/nexus-client/src/lib.rs +++ b/clients/nexus-client/src/lib.rs @@ -108,7 +108,11 @@ impl From for types::VmmRuntimeState { fn from(s: omicron_common::api::internal::nexus::VmmRuntimeState) -> Self { - Self { gen: s.gen, state: s.state.into(), time_updated: s.time_updated } + Self { + r#gen: s.generation, + state: s.state.into(), + time_updated: s.time_updated, + } } } @@ -133,7 +137,7 @@ impl From Self { migration_id: s.migration_id, state: s.state.into(), - gen: s.gen, + r#gen: s.generation, time_updated: s.time_updated, } } @@ -159,7 +163,7 @@ impl From fn from(s: omicron_common::api::internal::nexus::DiskRuntimeState) -> Self { Self { disk_state: s.disk_state.into(), - gen: s.gen, + r#gen: s.generation, time_updated: s.time_updated, } } diff --git a/clients/nexus-lockstep-client/Cargo.toml b/clients/nexus-lockstep-client/Cargo.toml index 0b7620dcc2..c5bb3d47be 100644 --- a/clients/nexus-lockstep-client/Cargo.toml +++ b/clients/nexus-lockstep-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-lockstep-client" version = "0.1.0" -edition = "2024" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/clients/ntp-admin-client/Cargo.toml b/clients/ntp-admin-client/Cargo.toml index 9c2ebe1e21..0209c1476a 100644 --- a/clients/ntp-admin-client/Cargo.toml +++ b/clients/ntp-admin-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ntp-admin-client" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/clients/oxide-client/Cargo.toml b/clients/oxide-client/Cargo.toml index 0b85129ed1..cf70e81952 100644 --- a/clients/oxide-client/Cargo.toml +++ b/clients/oxide-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "oxide-client" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/clients/oximeter-client/Cargo.toml b/clients/oximeter-client/Cargo.toml index dadf6d8c4d..1e51af65cf 100644 --- a/clients/oximeter-client/Cargo.toml +++ b/clients/oximeter-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "oximeter-client" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/clients/repo-depot-client/Cargo.toml b/clients/repo-depot-client/Cargo.toml index 858c75632f..b8f8a9130c 100644 --- a/clients/repo-depot-client/Cargo.toml +++ b/clients/repo-depot-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "repo-depot-client" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/clients/sled-agent-client/Cargo.toml b/clients/sled-agent-client/Cargo.toml index 4a0394b585..421b49243d 100644 --- a/clients/sled-agent-client/Cargo.toml +++ b/clients/sled-agent-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sled-agent-client" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/clients/sled-agent-client/src/lib.rs b/clients/sled-agent-client/src/lib.rs index 7825b1a5cb..341fde5c74 100644 --- a/clients/sled-agent-client/src/lib.rs +++ b/clients/sled-agent-client/src/lib.rs @@ -134,7 +134,11 @@ impl From for omicron_common::api::internal::nexus::VmmRuntimeState { fn from(s: types::VmmRuntimeState) -> Self { - Self { state: s.state.into(), gen: s.gen, time_updated: s.time_updated } + Self { + state: s.state.into(), + generation: s.r#gen, + time_updated: s.time_updated, + } } } @@ -157,7 +161,7 @@ impl From Self { migration_id: s.migration_id, state: s.state.into(), - gen: s.gen, + generation: s.r#gen, time_updated: s.time_updated, } } @@ -183,7 +187,7 @@ impl From fn from(s: omicron_common::api::internal::nexus::DiskRuntimeState) -> Self { Self { disk_state: s.disk_state.into(), - gen: s.gen, + r#gen: s.generation, time_updated: s.time_updated, } } @@ -215,7 +219,7 @@ impl From fn from(s: types::DiskRuntimeState) -> Self { Self { disk_state: s.disk_state.into(), - gen: s.gen, + generation: s.r#gen, time_updated: s.time_updated, } } diff --git a/clients/wicketd-client/Cargo.toml b/clients/wicketd-client/Cargo.toml index 06fc8c696a..c013397411 100644 --- a/clients/wicketd-client/Cargo.toml +++ b/clients/wicketd-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wicketd-client" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/cockroach-admin/Cargo.toml b/cockroach-admin/Cargo.toml index 9703536f77..614198974a 100644 --- a/cockroach-admin/Cargo.toml +++ b/cockroach-admin/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-cockroach-admin" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [build-dependencies] diff --git a/cockroach-admin/api/Cargo.toml b/cockroach-admin/api/Cargo.toml index 5b89d53746..8ca2515e67 100644 --- a/cockroach-admin/api/Cargo.toml +++ b/cockroach-admin/api/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cockroach-admin-api" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/cockroach-admin/types/Cargo.toml b/cockroach-admin/types/Cargo.toml index 68e5f961ca..0f4953e446 100644 --- a/cockroach-admin/types/Cargo.toml +++ b/cockroach-admin/types/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cockroach-admin-types" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/cockroach-metrics/Cargo.toml b/cockroach-metrics/Cargo.toml index 19e98fb810..9da4a3a5bd 100644 --- a/cockroach-metrics/Cargo.toml +++ b/cockroach-metrics/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-cockroach-metrics" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [dependencies] diff --git a/cockroach-metrics/src/lib.rs b/cockroach-metrics/src/lib.rs index 50303274ca..8fc03e9136 100644 --- a/cockroach-metrics/src/lib.rs +++ b/cockroach-metrics/src/lib.rs @@ -670,7 +670,7 @@ impl PrometheusMetrics { mut entry, ) => { if let MetricValue::Histogram( - ref mut buckets, + buckets, ) = entry.get_mut() { buckets.push(bucket); @@ -704,7 +704,7 @@ impl PrometheusMetrics { // Sort histogram buckets by their upper bound for consistent ordering for (_, metric_value) in metrics.iter_mut() { - if let MetricValue::Histogram(ref mut buckets) = metric_value { + if let MetricValue::Histogram(buckets) = metric_value { buckets.sort_by(|a, b| { a.le.partial_cmp(&b.le).unwrap_or(std::cmp::Ordering::Equal) }); diff --git a/common/Cargo.toml b/common/Cargo.toml index 0c7cddcf06..54c8fbc640 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-common" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/common/src/address.rs b/common/src/address.rs index 2cc89deee3..29d72a978a 100644 --- a/common/src/address.rs +++ b/common/src/address.rs @@ -446,18 +446,18 @@ impl JsonSchema for IpRange { } fn json_schema( - gen: &mut schemars::gen::SchemaGenerator, + generator: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { schemars::schema::SchemaObject { subschemas: Some(Box::new(schemars::schema::SubschemaValidation { one_of: Some(vec![ external::label_schema( "v4", - gen.subschema_for::(), + generator.subschema_for::(), ), external::label_schema( "v6", - gen.subschema_for::(), + generator.subschema_for::(), ), ]), ..Default::default() diff --git a/common/src/api/external/mod.rs b/common/src/api/external/mod.rs index 59933c5fe2..55bdb3d435 100644 --- a/common/src/api/external/mod.rs +++ b/common/src/api/external/mod.rs @@ -320,7 +320,7 @@ impl JsonSchema for Name { "Name".to_string() } fn json_schema( - _: &mut schemars::gen::SchemaGenerator, + _: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { name_schema(schemars::schema::Metadata { title: Some( @@ -401,13 +401,13 @@ impl JsonSchema for NameOrId { } fn json_schema( - gen: &mut schemars::gen::SchemaGenerator, + generator: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { schemars::schema::SchemaObject { subschemas: Some(Box::new(schemars::schema::SubschemaValidation { one_of: Some(vec![ - label_schema("id", gen.subschema_for::()), - label_schema("name", gen.subschema_for::()), + label_schema("id", generator.subschema_for::()), + label_schema("name", generator.subschema_for::()), ]), ..Default::default() })), @@ -453,7 +453,7 @@ impl JsonSchema for UserId { } fn json_schema( - _: &mut schemars::gen::SchemaGenerator, + _: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { name_schema(schemars::schema::Metadata { title: Some("A username for a local-only user".to_string()), @@ -877,7 +877,7 @@ impl JsonSchema for Hostname { } fn json_schema( - _: &mut schemars::gen::SchemaGenerator, + _: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { schemars::schema::Schema::Object(schemars::schema::SchemaObject { metadata: Some(Box::new(schemars::schema::Metadata { @@ -2174,7 +2174,7 @@ impl JsonSchema for L4PortRange { } fn json_schema( - _: &mut schemars::gen::SchemaGenerator, + _: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { schemars::schema::SchemaObject { metadata: Some(Box::new(schemars::schema::Metadata { @@ -2294,7 +2294,7 @@ impl JsonSchema for IcmpParamRange { } fn json_schema( - _: &mut schemars::gen::SchemaGenerator, + _: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { schemars::schema::SchemaObject { metadata: Some(Box::new(schemars::schema::Metadata { @@ -2466,7 +2466,7 @@ impl JsonSchema for MacAddr { } fn json_schema( - _: &mut schemars::gen::SchemaGenerator, + _: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { schemars::schema::SchemaObject { metadata: Some(Box::new(schemars::schema::Metadata { @@ -3333,12 +3333,12 @@ impl BgpMessageHistory { impl JsonSchema for BgpMessageHistory { fn json_schema( - gen: &mut schemars::gen::SchemaGenerator, + generator: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { let obj = schemars::schema::Schema::Object( schemars::schema::SchemaObject::default(), ); - gen.definitions_mut().insert(Self::schema_name(), obj.clone()); + generator.definitions_mut().insert(Self::schema_name(), obj.clone()); obj } diff --git a/common/src/api/internal/nexus.rs b/common/src/api/internal/nexus.rs index fe1c924334..5139e7f347 100644 --- a/common/src/api/internal/nexus.rs +++ b/common/src/api/internal/nexus.rs @@ -41,7 +41,8 @@ pub struct DiskRuntimeState { /// runtime state of the Disk pub disk_state: DiskState, /// generation number for this state - pub gen: Generation, + #[serde(rename = "gen")] + pub generation: Generation, /// timestamp for this information pub time_updated: DateTime, } @@ -98,7 +99,8 @@ pub struct VmmRuntimeState { /// The last state reported by this VMM. pub state: VmmState, /// The generation number for this VMM's state. - pub gen: Generation, + #[serde(rename = "gen")] + pub generation: Generation, /// Timestamp for the VMM's state. pub time_updated: DateTime, } @@ -143,7 +145,8 @@ impl SledVmmState { pub struct MigrationRuntimeState { pub migration_id: Uuid, pub state: MigrationState, - pub gen: Generation, + #[serde(rename = "gen")] + pub generation: Generation, /// Timestamp for the migration state update. pub time_updated: DateTime, diff --git a/common/src/api/internal/shared.rs b/common/src/api/internal/shared.rs index ebc9f6a46c..83492a8469 100644 --- a/common/src/api/internal/shared.rs +++ b/common/src/api/internal/shared.rs @@ -970,12 +970,12 @@ impl JsonSchema for DatasetKind { } fn json_schema( - gen: &mut schemars::gen::SchemaGenerator, + generator: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { // The schema is a bit more complicated than this -- it's either one of // the fixed values or a string starting with "zone/" -- but this is // good enough for now. - let mut schema = ::json_schema(gen).into_object(); + let mut schema = ::json_schema(generator).into_object(); schema.metadata().description = Some( "The kind of dataset. See the `DatasetKind` enum \ in omicron-common for possible values." diff --git a/common/src/lib.rs b/common/src/lib.rs index 04907d405b..97b3ee3f10 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -84,12 +84,12 @@ impl std::fmt::Debug for NoDebug { } pub fn hex_schema( - gen: &mut schemars::SchemaGenerator, + generator: &mut schemars::SchemaGenerator, ) -> schemars::schema::Schema { use schemars::JsonSchema; let mut schema: schemars::schema::SchemaObject = - ::json_schema(gen).into(); + ::json_schema(generator).into(); schema.format = Some(format!("hex string ({N} bytes)")); schema.into() } diff --git a/common/src/zpool_name.rs b/common/src/zpool_name.rs index 2fc29e3210..66c9d7b25f 100644 --- a/common/src/zpool_name.rs +++ b/common/src/zpool_name.rs @@ -59,7 +59,7 @@ impl JsonSchema for ZpoolName { "ZpoolName".to_string() } fn json_schema( - _: &mut schemars::gen::SchemaGenerator, + _: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { schemars::schema::SchemaObject { metadata: Some(Box::new(schemars::schema::Metadata { diff --git a/dev-tools/cert-dev/Cargo.toml b/dev-tools/cert-dev/Cargo.toml index 104c7ca9de..eb25b11305 100644 --- a/dev-tools/cert-dev/Cargo.toml +++ b/dev-tools/cert-dev/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cert-dev" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dev-tools/ch-dev/Cargo.toml b/dev-tools/ch-dev/Cargo.toml index 22c4995ad2..acc9acd4c8 100644 --- a/dev-tools/ch-dev/Cargo.toml +++ b/dev-tools/ch-dev/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ch-dev" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dev-tools/clickana/Cargo.toml b/dev-tools/clickana/Cargo.toml index faf18ee205..cf4b1e17e1 100644 --- a/dev-tools/clickana/Cargo.toml +++ b/dev-tools/clickana/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clickana" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [dependencies] diff --git a/dev-tools/clickhouse-cluster-dev/Cargo.toml b/dev-tools/clickhouse-cluster-dev/Cargo.toml index f7e2aeeb34..6922146f27 100644 --- a/dev-tools/clickhouse-cluster-dev/Cargo.toml +++ b/dev-tools/clickhouse-cluster-dev/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clickhouse-cluster-dev" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" readme = "README.md" diff --git a/dev-tools/common/Cargo.toml b/dev-tools/common/Cargo.toml index c0418c60d0..f6e2a49d15 100644 --- a/dev-tools/common/Cargo.toml +++ b/dev-tools/common/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dev-tools-common" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dev-tools/crdb-seed/Cargo.toml b/dev-tools/crdb-seed/Cargo.toml index 778a65b4b5..551e5a6c88 100644 --- a/dev-tools/crdb-seed/Cargo.toml +++ b/dev-tools/crdb-seed/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "crdb-seed" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" readme = "README.md" diff --git a/dev-tools/db-dev/Cargo.toml b/dev-tools/db-dev/Cargo.toml index 3215e4d6ee..ea92a36bb6 100644 --- a/dev-tools/db-dev/Cargo.toml +++ b/dev-tools/db-dev/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "db-dev" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dev-tools/downloader/Cargo.toml b/dev-tools/downloader/Cargo.toml index 95adffc281..ba43455bee 100644 --- a/dev-tools/downloader/Cargo.toml +++ b/dev-tools/downloader/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "xtask-downloader" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dev-tools/dropshot-apis/Cargo.toml b/dev-tools/dropshot-apis/Cargo.toml index 3f4ff0815d..1b19bab5ad 100644 --- a/dev-tools/dropshot-apis/Cargo.toml +++ b/dev-tools/dropshot-apis/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-dropshot-apis" version = "0.1.0" -edition = "2021" +edition.workspace = true [dependencies] anyhow.workspace = true diff --git a/dev-tools/ls-apis/Cargo.toml b/dev-tools/ls-apis/Cargo.toml index 9a5f3197ea..7f34eef3fc 100644 --- a/dev-tools/ls-apis/Cargo.toml +++ b/dev-tools/ls-apis/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-ls-apis" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dev-tools/ls-apis/src/system_apis.rs b/dev-tools/ls-apis/src/system_apis.rs index d867fc96f2..7dec541cd6 100644 --- a/dev-tools/ls-apis/src/system_apis.rs +++ b/dev-tools/ls-apis/src/system_apis.rs @@ -206,7 +206,7 @@ impl SystemApis { pub fn deployment_unit_servers( &self, unit: &DeploymentUnitName, - ) -> Result> { + ) -> Result + use<'_>> { Ok(self .unit_server_components .get(unit) @@ -224,7 +224,9 @@ impl SystemApis { &self, server_component: &ServerComponentName, filter: ApiDependencyFilter, - ) -> Result + '_> { + ) -> Result< + impl Iterator + '_ + use<'_>, + > { let mut rv = Vec::new(); let Some(apis_consumed) = self.apis_consumed.get(server_component) else { @@ -257,7 +259,8 @@ impl SystemApis { pub fn api_producers<'apis>( &'apis self, client: &ClientPackageName, - ) -> impl Iterator + 'apis { + ) -> impl Iterator + 'apis + use<'apis> + { self.api_producers .get(client) .into_iter() @@ -271,8 +274,9 @@ impl SystemApis { &self, client: &ClientPackageName, filter: ApiDependencyFilter, - ) -> Result)> + '_> - { + ) -> Result< + impl Iterator)> + '_ + use<'_>, + > { let mut rv = Vec::new(); let Some(api_consumers) = self.api_consumers.get(client) else { diff --git a/dev-tools/mgs-dev/Cargo.toml b/dev-tools/mgs-dev/Cargo.toml index 8a38d9d26c..3d7ad70829 100644 --- a/dev-tools/mgs-dev/Cargo.toml +++ b/dev-tools/mgs-dev/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "mgs-dev" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dev-tools/omdb/Cargo.toml b/dev-tools/omdb/Cargo.toml index 936d6c8786..ce376d4b67 100644 --- a/dev-tools/omdb/Cargo.toml +++ b/dev-tools/omdb/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-omdb" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dev-tools/omdb/src/bin/omdb/db.rs b/dev-tools/omdb/src/bin/omdb/db.rs index fe9d81cfce..8d24782968 100644 --- a/dev-tools/omdb/src/bin/omdb/db.rs +++ b/dev-tools/omdb/src/bin/omdb/db.rs @@ -2615,7 +2615,7 @@ async fn cmd_db_physical_disks( // SERVICES // Snapshots -fn format_snapshot(state: &SnapshotState) -> impl Display { +fn format_snapshot(state: &SnapshotState) -> impl Display + use<> { match state { SnapshotState::Creating => "creating".to_string(), SnapshotState::Ready => "ready".to_string(), @@ -2989,7 +2989,7 @@ fn print_vcr(vcr: VolumeConstructionRequest, pad: usize) { bs: String, bpe: u64, ec: u32, - gen: u64, + generation: u64, read_only: bool, } @@ -3035,7 +3035,7 @@ fn print_vcr(vcr: VolumeConstructionRequest, pad: usize) { block_size, blocks_per_extent, extent_count, - gen, + r#gen, opts, } => { let row = VCRRegion { @@ -3043,7 +3043,7 @@ fn print_vcr(vcr: VolumeConstructionRequest, pad: usize) { bs: block_size.to_string(), bpe: blocks_per_extent, ec: extent_count, - gen, + generation: r#gen, read_only: opts.read_only, }; let table = tabled::Table::new(&[row]) @@ -4481,7 +4481,7 @@ async fn cmd_db_instance_info( dst_propolis_id, migration_id, nexus_state, - r#gen, + generation, time_last_auto_restarted, } = instance.runtime_state; println!(" {STATE:>WIDTH$}: {nexus_state:?}"); @@ -4495,7 +4495,7 @@ async fn cmd_db_instance_info( println!(" {INTENDED_STATE:>WIDTH$}: {}", instance.intended_state); println!( " {LAST_UPDATED:>WIDTH$}: {time_updated:?} (generation {})", - r#gen.0 + generation.0 ); // Reincarnation status @@ -4808,7 +4808,7 @@ async fn cmd_db_instance_info( runtime: db::model::VmmRuntimeState { time_state_updated: _, - r#gen, + generation, state, }, } = vmm; @@ -4816,7 +4816,7 @@ async fn cmd_db_instance_info( state: VmmStateRow { id, state, - generation: r#gen.0.into(), + generation: generation.0.into(), }, sled_id: sled_id.into(), time_created, @@ -6732,7 +6732,7 @@ fn print_name( } } -fn format_record(record: &DnsRecord) -> impl Display { +fn format_record(record: &DnsRecord) -> impl Display + use<> { match record { DnsRecord::A(addr) => format!("A {}", addr), DnsRecord::Aaaa(addr) => format!("AAAA {}", addr), @@ -7443,7 +7443,8 @@ fn prettyprint_vmm( propolis_ip, propolis_port, cpu_platform, - runtime: db::model::VmmRuntimeState { state, r#gen, time_state_updated }, + runtime: + db::model::VmmRuntimeState { state, generation, time_state_updated }, } = vmm; println!("{indent}{ID:>width$}: {id}"); @@ -7455,7 +7456,7 @@ fn prettyprint_vmm( println!("{indent}{DELETED:width$}: {deleted}"); } println!("{indent}{STATE:>width$}: {state}"); - let g = u64::from(r#gen.0); + let g = u64::from(generation.0); println!( "{indent}{UPDATED:>width$}: {time_state_updated:?} (generation {g})" ); @@ -7536,7 +7537,7 @@ async fn cmd_db_vmm_list( } impl<'a> From<&'a (Vmm, Option)> for VmmRow<'a> { - fn from((ref vmm, ref sled): &'a (Vmm, Option)) -> Self { + fn from((vmm, sled): &'a (Vmm, Option)) -> Self { let &Vmm { id, time_created: _, @@ -7549,7 +7550,7 @@ async fn cmd_db_vmm_list( runtime: db::model::VmmRuntimeState { state, - r#gen, + generation, time_state_updated: _, }, } = vmm; @@ -7562,7 +7563,11 @@ async fn cmd_db_vmm_list( }; VmmRow { instance_id, - state: VmmStateRow { id, state, generation: r#gen.0.into() }, + state: VmmStateRow { + id, + state, + generation: generation.0.into(), + }, sled, } } diff --git a/dev-tools/omdb/src/bin/omdb/db/alert.rs b/dev-tools/omdb/src/bin/omdb/db/alert.rs index f9810c7fb0..1e019a3e2d 100644 --- a/dev-tools/omdb/src/bin/omdb/db/alert.rs +++ b/dev-tools/omdb/src/bin/omdb/db/alert.rs @@ -535,7 +535,7 @@ async fn cmd_db_webhook_delivery_list( query = query.filter(delivery_dsl::time_created.gt(after)); } - if let Some(ref receiver) = receiver { + if let Some(receiver) = receiver { let rx = lookup_webhook_rx(datastore, receiver).await?.ok_or_else(|| { anyhow::anyhow!("no webhook receiver {receiver} found") @@ -688,7 +688,7 @@ async fn lookup_webhook_rx( .get_result_async(&*conn) .await } - NameOrId::Name(ref name) => { + NameOrId::Name(name) => { dsl::alert_receiver .filter(dsl::name.eq(name.to_string())) .limit(1) diff --git a/dev-tools/omdb/src/bin/omdb/db/db_metadata.rs b/dev-tools/omdb/src/bin/omdb/db/db_metadata.rs index bf2fb50dbe..a86b512b52 100644 --- a/dev-tools/omdb/src/bin/omdb/db/db_metadata.rs +++ b/dev-tools/omdb/src/bin/omdb/db/db_metadata.rs @@ -93,14 +93,14 @@ fn get_intended_nexus_state( bp_nexus_generation_by_zone: &BTreeMap, id: OmicronZoneUuid, ) -> Option { - let Some(gen) = bp_nexus_generation_by_zone.get(&id) else { + let Some(generation) = bp_nexus_generation_by_zone.get(&id) else { return None; }; - Some(if *gen < bp_nexus_generation { + Some(if *generation < bp_nexus_generation { // This Nexus is either quiescing, or has already quiesced DbMetadataNexusState::Quiesced - } else if *gen == bp_nexus_generation { + } else if *generation == bp_nexus_generation { // This Nexus is either active, or will become active once // the prior generation has quiesced DbMetadataNexusState::Active @@ -222,13 +222,13 @@ pub async fn cmd_db_metadata_force_mark_nexus_quiesced( } }); - let Some(gen) = nexus_generation else { + let Some(generation) = nexus_generation else { bail!("Nexus {} not found in blueprint", args.id); }; let bp_gen = current_target_blueprint.nexus_generation; - if bp_gen <= gen { + if bp_gen <= generation { bail!( - "Nexus {} not ready to quiesce (nexus generation {gen} >= blueprint gen {bp_gen})", + "Nexus {} not ready to quiesce (nexus generation {generation} >= blueprint gen {bp_gen})", args.id ); } diff --git a/dev-tools/omdb/src/bin/omdb/mgs/sensors.rs b/dev-tools/omdb/src/bin/omdb/mgs/sensors.rs index d0bdf8be5f..280a288095 100644 --- a/dev-tools/omdb/src/bin/omdb/mgs/sensors.rs +++ b/dev-tools/omdb/src/bin/omdb/mgs/sensors.rs @@ -235,7 +235,7 @@ pub(crate) enum DeviceIdentifier { impl DeviceIdentifier { fn device(&self) -> &String { match self { - Self::Device(ref device) => device, + Self::Device(device) => device, _ => panic!(), } } @@ -577,7 +577,7 @@ pub(crate) async fn sensor_metadata( .map(|named| named.into_iter().collect::>()); let info = match input { - SensorInput::MgsClient(ref mgs_client) => { + &mut SensorInput::MgsClient(ref mgs_client) => { sp_info_mgs(mgs_client, args).await? } SensorInput::CsvReader(reader, position) => { @@ -804,7 +804,7 @@ pub(crate) async fn sensor_data( metadata: &Arc, ) -> Result { match input { - SensorInput::MgsClient(ref mgs_client) => { + &mut SensorInput::MgsClient(ref mgs_client) => { sp_data_mgs(mgs_client, metadata).await } SensorInput::CsvReader(reader, position) => { diff --git a/dev-tools/omdb/src/bin/omdb/nexus.rs b/dev-tools/omdb/src/bin/omdb/nexus.rs index 23b0cf0701..490dcd9072 100644 --- a/dev-tools/omdb/src/bin/omdb/nexus.rs +++ b/dev-tools/omdb/src/bin/omdb/nexus.rs @@ -4323,7 +4323,9 @@ async fn support_bundle_download_range( client: &nexus_lockstep_client::Client, id: SupportBundleUuid, range: (u64, u64), -) -> anyhow::Result>> { +) -> anyhow::Result< + impl futures::Stream> + use<>, +> { let range = format!("bytes={}-{}", range.0, range.1); Ok(client .support_bundle_download(id.as_untyped_uuid(), Some(&range)) diff --git a/dev-tools/omdb/tests/test_all_output.rs b/dev-tools/omdb/tests/test_all_output.rs index 61208f00a9..1a57badcea 100644 --- a/dev-tools/omdb/tests/test_all_output.rs +++ b/dev-tools/omdb/tests/test_all_output.rs @@ -679,6 +679,7 @@ fn clear_omdb_env() { for (env_var, _) in std::env::vars().filter(|(k, _)| k.starts_with("OMDB_")) { eprintln!("removing {:?} from environment", env_var); - std::env::remove_var(env_var); + // TODO: Audit that the environment access only happens in single-threaded code. + unsafe { std::env::remove_var(env_var) }; } } diff --git a/dev-tools/omicron-dev-lib/Cargo.toml b/dev-tools/omicron-dev-lib/Cargo.toml index 4d32ddb65b..3bf6429ba0 100644 --- a/dev-tools/omicron-dev-lib/Cargo.toml +++ b/dev-tools/omicron-dev-lib/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-dev-lib" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dev-tools/omicron-dev/Cargo.toml b/dev-tools/omicron-dev/Cargo.toml index 17c5b89096..21a4bc7210 100644 --- a/dev-tools/omicron-dev/Cargo.toml +++ b/dev-tools/omicron-dev/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-dev" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dev-tools/oxlog/Cargo.toml b/dev-tools/oxlog/Cargo.toml index 62ffa87ec4..25cf15e595 100644 --- a/dev-tools/oxlog/Cargo.toml +++ b/dev-tools/oxlog/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "oxlog" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dev-tools/pins/Cargo.toml b/dev-tools/pins/Cargo.toml index 227c7f1b28..d09418ce42 100644 --- a/dev-tools/pins/Cargo.toml +++ b/dev-tools/pins/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-pins" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [dependencies] diff --git a/dev-tools/reconfigurator-cli/Cargo.toml b/dev-tools/reconfigurator-cli/Cargo.toml index a75851890b..927b721cbb 100644 --- a/dev-tools/reconfigurator-cli/Cargo.toml +++ b/dev-tools/reconfigurator-cli/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "reconfigurator-cli" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dev-tools/reconfigurator-cli/src/lib.rs b/dev-tools/reconfigurator-cli/src/lib.rs index ad5ff37f31..fbf42fee28 100644 --- a/dev-tools/reconfigurator-cli/src/lib.rs +++ b/dev-tools/reconfigurator-cli/src/lib.rs @@ -1258,7 +1258,7 @@ enum SetArgs { NumNexus { num_nexus: u16 }, /// specify the generation of Nexus zones that are considered active when /// running the blueprint planner - ActiveNexusGen { gen: Generation }, + ActiveNexusGen { r#gen: Generation }, /// Control the set of Nexus zones seen as input to the planner NexusZones { #[clap(long, conflicts_with = "active")] @@ -2955,10 +2955,10 @@ fn cmd_set( .set_target_nexus_zone_count(usize::from(num_nexus)); rv } - SetArgs::ActiveNexusGen { gen } => { + SetArgs::ActiveNexusGen { r#gen } => { let rv = format!("will use active Nexus zones from generation {gen}"); - state.config_mut().set_active_nexus_zone_generation(gen); + state.config_mut().set_active_nexus_zone_generation(r#gen); rv } SetArgs::NexusZones { diff --git a/dev-tools/reconfigurator-exec-unsafe/Cargo.toml b/dev-tools/reconfigurator-exec-unsafe/Cargo.toml index 19fcf8749a..98906498b8 100644 --- a/dev-tools/reconfigurator-exec-unsafe/Cargo.toml +++ b/dev-tools/reconfigurator-exec-unsafe/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-reconfigurator-exec-unsafe" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dev-tools/reconfigurator-sp-updater/Cargo.toml b/dev-tools/reconfigurator-sp-updater/Cargo.toml index dd99f93f5d..7f3008253c 100644 --- a/dev-tools/reconfigurator-sp-updater/Cargo.toml +++ b/dev-tools/reconfigurator-sp-updater/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "reconfigurator-sp-updater" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dev-tools/releng/Cargo.toml b/dev-tools/releng/Cargo.toml index b1f19fda81..909bfd177a 100644 --- a/dev-tools/releng/Cargo.toml +++ b/dev-tools/releng/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-releng" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [dependencies] diff --git a/dev-tools/repl-utils/Cargo.toml b/dev-tools/repl-utils/Cargo.toml index b7623e1324..8d87edce39 100644 --- a/dev-tools/repl-utils/Cargo.toml +++ b/dev-tools/repl-utils/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-repl-utils" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dev-tools/repo-depot-standalone/Cargo.toml b/dev-tools/repo-depot-standalone/Cargo.toml index ee8be48efe..c08a53beaf 100644 --- a/dev-tools/repo-depot-standalone/Cargo.toml +++ b/dev-tools/repo-depot-standalone/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-repo-depot-standalone" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dev-tools/repo-depot-standalone/src/main.rs b/dev-tools/repo-depot-standalone/src/main.rs index 852f1f9535..dd1799de32 100644 --- a/dev-tools/repo-depot-standalone/src/main.rs +++ b/dev-tools/repo-depot-standalone/src/main.rs @@ -188,7 +188,7 @@ impl RepoMetadata { pub async fn data_for_hash( &self, requested_sha: &ArtifactHash, - ) -> Option>> { + ) -> Option>>> { let (repo_index, artifact_hash_id) = self.targets_by_hash.get(requested_sha)?; let repo = &self.repos[*repo_index]; diff --git a/dev-tools/xtask/Cargo.toml b/dev-tools/xtask/Cargo.toml index 8d8be94ea5..5d58f60686 100644 --- a/dev-tools/xtask/Cargo.toml +++ b/dev-tools/xtask/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "xtask" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dns-server-api/Cargo.toml b/dns-server-api/Cargo.toml index cfc0e10b73..f374b314d4 100644 --- a/dns-server-api/Cargo.toml +++ b/dns-server-api/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dns-server-api" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dns-server/Cargo.toml b/dns-server/Cargo.toml index 4e1e1d2f63..864746d49e 100644 --- a/dns-server/Cargo.toml +++ b/dns-server/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dns-server" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/dns-server/src/storage.rs b/dns-server/src/storage.rs index 3b0d8c6829..e2ace3b341 100644 --- a/dns-server/src/storage.rs +++ b/dns-server/src/storage.rs @@ -681,7 +681,9 @@ impl Store { self.prune_trees(trees_to_prune, "too new"); } - fn all_name_trees(&self) -> impl Iterator { + fn all_name_trees( + &self, + ) -> impl Iterator + use<> { self.db.tree_names().into_iter().filter_map(|tree_name_bytes| { let tree_name = std::str::from_utf8(&tree_name_bytes).ok()?; let parts = tree_name.splitn(4, '_').collect::>(); @@ -1098,7 +1100,7 @@ mod test { fn generations_with_trees(store: &Store) -> Vec { store .all_name_trees() - .map(|(gen, _)| gen) + .map(|(r#gen, _)| r#gen) .collect::>() .into_iter() .collect() diff --git a/docs/adding-or-modifying-smf-services.adoc b/docs/adding-or-modifying-smf-services.adoc index 0ee051a26e..7ca83364c6 100644 --- a/docs/adding-or-modifying-smf-services.adoc +++ b/docs/adding-or-modifying-smf-services.adoc @@ -35,7 +35,7 @@ omdb Cargo.toml file: [package] name = "omicron-omdb" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" ``` diff --git a/end-to-end-tests/Cargo.toml b/end-to-end-tests/Cargo.toml index 1854484a85..0386c3934c 100644 --- a/end-to-end-tests/Cargo.toml +++ b/end-to-end-tests/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "end-to-end-tests" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/ereport/types/Cargo.toml b/ereport/types/Cargo.toml index 94d1f1b92d..be416e1d6e 100644 --- a/ereport/types/Cargo.toml +++ b/ereport/types/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ereport-types" version = "0.1.0" -edition = "2024" +edition.workspace = true [dependencies] dropshot.workspace = true diff --git a/gateway-api/Cargo.toml b/gateway-api/Cargo.toml index f41d17f01c..4011cf6ed0 100644 --- a/gateway-api/Cargo.toml +++ b/gateway-api/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "gateway-api" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/gateway-cli/Cargo.toml b/gateway-cli/Cargo.toml index 1e754449a1..2a04545700 100644 --- a/gateway-cli/Cargo.toml +++ b/gateway-cli/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "gateway-cli" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/gateway-test-utils/Cargo.toml b/gateway-test-utils/Cargo.toml index b32e7cd06f..d835a65f3a 100644 --- a/gateway-test-utils/Cargo.toml +++ b/gateway-test-utils/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "gateway-test-utils" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/gateway-types/Cargo.toml b/gateway-types/Cargo.toml index 85d69de745..77326fa19b 100644 --- a/gateway-types/Cargo.toml +++ b/gateway-types/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "gateway-types" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index 7e234d7965..ece16b8b73 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-gateway" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/id-map/Cargo.toml b/id-map/Cargo.toml index 77ad3d3e89..4a597c7f6f 100644 --- a/id-map/Cargo.toml +++ b/id-map/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "id-map" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [dependencies] diff --git a/illumos-utils/Cargo.toml b/illumos-utils/Cargo.toml index e565401402..c526fe4ed0 100644 --- a/illumos-utils/Cargo.toml +++ b/illumos-utils/Cargo.toml @@ -2,7 +2,7 @@ name = "illumos-utils" description = "Utilities/wrappers for illumos" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/illumos-utils/src/running_zone.rs b/illumos-utils/src/running_zone.rs index 4cb80c2449..7ab6bc1e1a 100644 --- a/illumos-utils/src/running_zone.rs +++ b/illumos-utils/src/running_zone.rs @@ -140,7 +140,7 @@ mod zenter { type ct_evthdl_t = *mut c_void; #[link(name = "contract")] - extern "C" { + unsafe extern "C" { fn ct_tmpl_set_critical(fd: c_int, events: c_uint) -> c_int; fn ct_tmpl_set_informative(fd: c_int, events: c_uint) -> c_int; fn ct_pr_tmpl_set_fatal(fd: c_int, events: c_uint) -> c_int; @@ -155,7 +155,7 @@ mod zenter { } #[link(name = "c")] - extern "C" { + unsafe extern "C" { pub fn zone_enter(zid: zoneid_t) -> c_int; } diff --git a/installinator-api/Cargo.toml b/installinator-api/Cargo.toml index d142379b2e..c515027461 100644 --- a/installinator-api/Cargo.toml +++ b/installinator-api/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "installinator-api" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/installinator-common/Cargo.toml b/installinator-common/Cargo.toml index 039304c9de..51dde7aeec 100644 --- a/installinator-common/Cargo.toml +++ b/installinator-common/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "installinator-common" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/installinator-common/src/progress.rs b/installinator-common/src/progress.rs index 43188b321e..761d5772a5 100644 --- a/installinator-common/src/progress.rs +++ b/installinator-common/src/progress.rs @@ -9,7 +9,7 @@ use illumos_utils::zpool; use omicron_common::disk::M2Slot; use schemars::{ JsonSchema, - gen::SchemaGenerator, + r#gen::SchemaGenerator, schema::{Schema, SchemaObject}, }; use serde::{Deserialize, Serialize}; @@ -311,14 +311,15 @@ pub enum ControlPlaneZonesStepId { Unknown, } -fn path_schema(gen: &mut SchemaGenerator) -> Schema { - let mut schema: SchemaObject = ::json_schema(gen).into(); +fn path_schema(generator: &mut SchemaGenerator) -> Schema { + let mut schema: SchemaObject = ::json_schema(generator).into(); schema.format = Some("Utf8PathBuf".to_owned()); schema.into() } -fn path_schema_opt(gen: &mut SchemaGenerator) -> Schema { - let mut schema: SchemaObject = >::json_schema(gen).into(); +fn path_schema_opt(generator: &mut SchemaGenerator) -> Schema { + let mut schema: SchemaObject = + >::json_schema(generator).into(); schema.format = Some("Utf8PathBuf".to_owned()); schema.into() } diff --git a/installinator/Cargo.toml b/installinator/Cargo.toml index ca2626acb9..a436b10551 100644 --- a/installinator/Cargo.toml +++ b/installinator/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "installinator" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/installinator/src/dispatch.rs b/installinator/src/dispatch.rs index b3e1dca7c4..ac2a274d97 100644 --- a/installinator/src/dispatch.rs +++ b/installinator/src/dispatch.rs @@ -643,7 +643,7 @@ async fn fetch_artifact( pub(crate) fn stderr_env_drain( env_var: &str, -) -> impl Drain { +) -> impl Drain + use<> { let stderr_decorator = slog_term::TermDecorator::new().build(); let stderr_drain = slog_term::FullFormat::new(stderr_decorator).build().fuse(); diff --git a/installinator/src/peers.rs b/installinator/src/peers.rs index 041275457f..e485b87db2 100644 --- a/installinator/src/peers.rs +++ b/installinator/src/peers.rs @@ -115,7 +115,7 @@ impl PeerAddresses { self.peers.len() } - pub(crate) fn display(&self) -> impl fmt::Display { + pub(crate) fn display(&self) -> impl fmt::Display + use<> { self.peers().iter().join(", ") } } diff --git a/internal-dns/cli/Cargo.toml b/internal-dns/cli/Cargo.toml index 9744ffd5c7..6061045b63 100644 --- a/internal-dns/cli/Cargo.toml +++ b/internal-dns/cli/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "internal-dns-cli" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/internal-dns/resolver/Cargo.toml b/internal-dns/resolver/Cargo.toml index 2542b927d7..465b126c9e 100644 --- a/internal-dns/resolver/Cargo.toml +++ b/internal-dns/resolver/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "internal-dns-resolver" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/internal-dns/resolver/src/resolver.rs b/internal-dns/resolver/src/resolver.rs index 86a7eafbad..a416bac213 100644 --- a/internal-dns/resolver/src/resolver.rs +++ b/internal-dns/resolver/src/resolver.rs @@ -385,7 +385,7 @@ impl Resolver { async fn lookup_service_targets( &self, service_lookup: SrvLookup, - ) -> impl Iterator + Send { + ) -> impl Iterator + Send + use<> { let futures = std::iter::repeat((self.log.clone(), self.resolver.clone())) .zip(service_lookup.into_iter()) diff --git a/internal-dns/types/Cargo.toml b/internal-dns/types/Cargo.toml index 612aafde04..bebb3c1fc9 100644 --- a/internal-dns/types/Cargo.toml +++ b/internal-dns/types/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "internal-dns-types" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/ipcc/Cargo.toml b/ipcc/Cargo.toml index 8008aa5c4f..d9aaab6e47 100644 --- a/ipcc/Cargo.toml +++ b/ipcc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ipcc" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/key-manager/Cargo.toml b/key-manager/Cargo.toml index 3e00758c9e..a2bf5dcfc0 100644 --- a/key-manager/Cargo.toml +++ b/key-manager/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "key-manager" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/live-tests/Cargo.toml b/live-tests/Cargo.toml index 184e0c6af2..3db7886b66 100644 --- a/live-tests/Cargo.toml +++ b/live-tests/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-live-tests" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [build-dependencies] diff --git a/live-tests/macros/Cargo.toml b/live-tests/macros/Cargo.toml index 81d094d926..43851b987a 100644 --- a/live-tests/macros/Cargo.toml +++ b/live-tests/macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "live-tests-macros" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lib] diff --git a/nexus-config/Cargo.toml b/nexus-config/Cargo.toml index d76b736b55..09b6ea90eb 100644 --- a/nexus-config/Cargo.toml +++ b/nexus-config/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-config" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/nexus-sled-agent-shared/Cargo.toml b/nexus-sled-agent-shared/Cargo.toml index 666143546a..b776e8175b 100644 --- a/nexus-sled-agent-shared/Cargo.toml +++ b/nexus-sled-agent-shared/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-sled-agent-shared" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/nexus/Cargo.toml b/nexus/Cargo.toml index 98a8a1c21a..b4e4c208a1 100644 --- a/nexus/Cargo.toml +++ b/nexus/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-nexus" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/auth/Cargo.toml b/nexus/auth/Cargo.toml index ceef298ae9..c465856c9f 100644 --- a/nexus/auth/Cargo.toml +++ b/nexus/auth/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-auth" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/authz-macros/Cargo.toml b/nexus/authz-macros/Cargo.toml index beba0a3cf6..7444f0a877 100644 --- a/nexus/authz-macros/Cargo.toml +++ b/nexus/authz-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "authz-macros" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lib] diff --git a/nexus/background-task-interface/Cargo.toml b/nexus/background-task-interface/Cargo.toml index b91bba0a00..ee15fbff04 100644 --- a/nexus/background-task-interface/Cargo.toml +++ b/nexus/background-task-interface/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-background-task-interface" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/db-errors/Cargo.toml b/nexus/db-errors/Cargo.toml index a664288a4f..230580b698 100644 --- a/nexus/db-errors/Cargo.toml +++ b/nexus/db-errors/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-db-errors" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/db-fixed-data/Cargo.toml b/nexus/db-fixed-data/Cargo.toml index c9d9c9c851..33cbd81c4b 100644 --- a/nexus/db-fixed-data/Cargo.toml +++ b/nexus/db-fixed-data/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-db-fixed-data" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" description = "Hard-coded database data, including defaults and built-ins" diff --git a/nexus/db-lookup/Cargo.toml b/nexus/db-lookup/Cargo.toml index bd9bf43e21..9bc55dd428 100644 --- a/nexus/db-lookup/Cargo.toml +++ b/nexus/db-lookup/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-db-lookup" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/db-macros/Cargo.toml b/nexus/db-macros/Cargo.toml index fa477c1f00..c03aea99ab 100644 --- a/nexus/db-macros/Cargo.toml +++ b/nexus/db-macros/Cargo.toml @@ -2,7 +2,7 @@ name = "db-macros" version = "0.1.0" authors = ["Sean Klein "] -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lib] diff --git a/nexus/db-macros/outputs/project.txt b/nexus/db-macros/outputs/project.txt index 1db94b5834..8f4333b63e 100644 --- a/nexus/db-macros/outputs/project.txt +++ b/nexus/db-macros/outputs/project.txt @@ -45,9 +45,10 @@ impl<'a> Project<'a> { let lookup = self.lookup_root(); let opctx = &lookup.opctx; let datastore = lookup.datastore; - match &self { + match self { Project::Error(_, error) => Err(error.clone()), - Project::Name(parent, &ref name) | Project::OwnedName(parent, ref name) => { + &Project::Name(ref parent, &ref name) + | &Project::OwnedName(ref parent, ref name) => { let (authz_silo,) = parent.lookup().await?; let (authz_project, db_row) = Self::fetch_by_name_for( opctx, @@ -64,7 +65,7 @@ impl<'a> Project<'a> { } } .and_then(|input| { - let (ref authz_silo, .., ref authz_project, ref _db_row) = &input; + let &(ref authz_silo, .., ref authz_project, ref _db_row) = &input; Self::silo_check(opctx, authz_silo, authz_project)?; Ok(input) }) @@ -99,7 +100,7 @@ impl<'a> Project<'a> { opctx.authorize(action, &authz_project).await?; Ok((authz_silo, authz_project)) .and_then(|input| { - let (ref authz_silo, .., ref authz_project) = &input; + let &(ref authz_silo, .., ref authz_project) = &input; Self::silo_check(opctx, authz_silo, authz_project)?; Ok(input) }) @@ -125,9 +126,10 @@ impl<'a> Project<'a> { let lookup = self.lookup_root(); let opctx = &lookup.opctx; let datastore = lookup.datastore; - match &self { + match self { Project::Error(_, error) => Err(error.clone()), - Project::Name(parent, &ref name) | Project::OwnedName(parent, ref name) => { + &Project::Name(ref parent, &ref name) + | &Project::OwnedName(ref parent, ref name) => { let (authz_silo,) = parent.lookup().await?; let (authz_project, _) = Self::lookup_by_name_no_authz( opctx, diff --git a/nexus/db-macros/outputs/silo_user.txt b/nexus/db-macros/outputs/silo_user.txt index 690ec1ce62..ad6416691f 100644 --- a/nexus/db-macros/outputs/silo_user.txt +++ b/nexus/db-macros/outputs/silo_user.txt @@ -40,7 +40,7 @@ impl<'a> SiloUser<'a> { let lookup = self.lookup_root(); let opctx = &lookup.opctx; let datastore = lookup.datastore; - match &self { + match self { SiloUser::Error(_, error) => Err(error.clone()), SiloUser::PrimaryKey(_, v0) => { Self::fetch_by_id_for(opctx, datastore, v0, action).await @@ -98,7 +98,7 @@ impl<'a> SiloUser<'a> { let lookup = self.lookup_root(); let opctx = &lookup.opctx; let datastore = lookup.datastore; - match &self { + match self { SiloUser::Error(_, error) => Err(error.clone()), SiloUser::PrimaryKey(_, v0) => { let (authz_silo_user, _) = Self::lookup_by_id_no_authz( diff --git a/nexus/db-macros/outputs/sled.txt b/nexus/db-macros/outputs/sled.txt index f7173a01eb..3ba62db451 100644 --- a/nexus/db-macros/outputs/sled.txt +++ b/nexus/db-macros/outputs/sled.txt @@ -41,7 +41,7 @@ impl<'a> Sled<'a> { let lookup = self.lookup_root(); let opctx = &lookup.opctx; let datastore = lookup.datastore; - match &self { + match self { Sled::Error(_, error) => Err(error.clone()), Sled::PrimaryKey(_, v0) => { Self::fetch_by_id_for(opctx, datastore, v0, action).await @@ -99,7 +99,7 @@ impl<'a> Sled<'a> { let lookup = self.lookup_root(); let opctx = &lookup.opctx; let datastore = lookup.datastore; - match &self { + match self { Sled::Error(_, error) => Err(error.clone()), Sled::PrimaryKey(_, v0) => { let (authz_sled, _) = Self::lookup_by_id_no_authz(opctx, datastore, v0) diff --git a/nexus/db-macros/outputs/update_artifact.txt b/nexus/db-macros/outputs/update_artifact.txt index 4da34360b0..933b1dff54 100644 --- a/nexus/db-macros/outputs/update_artifact.txt +++ b/nexus/db-macros/outputs/update_artifact.txt @@ -40,7 +40,7 @@ impl<'a> UpdateArtifact<'a> { let lookup = self.lookup_root(); let opctx = &lookup.opctx; let datastore = lookup.datastore; - match &self { + match self { UpdateArtifact::Error(_, error) => Err(error.clone()), UpdateArtifact::PrimaryKey(_, v0, v1, v2) => { Self::fetch_by_id_for(opctx, datastore, v0, v1, v2, action).await @@ -98,7 +98,7 @@ impl<'a> UpdateArtifact<'a> { let lookup = self.lookup_root(); let opctx = &lookup.opctx; let datastore = lookup.datastore; - match &self { + match self { UpdateArtifact::Error(_, error) => Err(error.clone()), UpdateArtifact::PrimaryKey(_, v0, v1, v2) => { let (authz_update_artifact, _) = Self::lookup_by_id_no_authz( diff --git a/nexus/db-macros/src/lookup.rs b/nexus/db-macros/src/lookup.rs index def92875e1..d9a718933a 100644 --- a/nexus/db-macros/src/lookup.rs +++ b/nexus/db-macros/src/lookup.rs @@ -516,8 +516,8 @@ fn generate_lookup_methods(config: &Config) -> TokenStream { // Generate the by-name branch of the match arm in "fetch_for()" let fetch_for_name_variant = if config.lookup_by_name { quote! { - #resource_name::Name(parent, &ref name) - | #resource_name::OwnedName(parent, ref name) => { + &#resource_name::Name(ref parent, &ref name) + | &#resource_name::OwnedName(ref parent, ref name) => { #ancestors_authz_names_assign let (#resource_authz_name, db_row) = Self::fetch_by_name_for( opctx, @@ -536,8 +536,8 @@ fn generate_lookup_methods(config: &Config) -> TokenStream { // Generate the by-name branch of the match arm in "lookup()" let lookup_name_variant = if config.lookup_by_name { quote! { - #resource_name::Name(parent, &ref name) - | #resource_name::OwnedName(parent, ref name) => { + &#resource_name::Name(ref parent, &ref name) + | &#resource_name::OwnedName(ref parent, ref name) => { // When doing a by-name lookup, we have to look up the // parent first. Since this is recursive, we wind up // hitting the database once for each item in the path, @@ -568,7 +568,7 @@ fn generate_lookup_methods(config: &Config) -> TokenStream { ( quote! { .and_then(|input| { - let ( + let &( ref authz_silo, .., ref #resource_authz_name, @@ -579,7 +579,7 @@ fn generate_lookup_methods(config: &Config) -> TokenStream { }, quote! { .and_then(|input| { - let ( + let &( ref authz_silo, .., ref #resource_authz_name, @@ -628,7 +628,7 @@ fn generate_lookup_methods(config: &Config) -> TokenStream { let opctx = &lookup.opctx; let datastore = lookup.datastore; - match &self { + match self { #resource_name::Error(_, error) => Err(error.clone()), #fetch_for_name_variant @@ -719,7 +719,7 @@ fn generate_lookup_methods(config: &Config) -> TokenStream { let opctx = &lookup.opctx; let datastore = lookup.datastore; - match &self { + match self { #resource_name::Error(_, error) => Err(error.clone()), #lookup_name_variant diff --git a/nexus/db-model/Cargo.toml b/nexus/db-model/Cargo.toml index 7965a6ff76..0c9855b357 100644 --- a/nexus/db-model/Cargo.toml +++ b/nexus/db-model/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-db-model" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/db-model/src/disk.rs b/nexus/db-model/src/disk.rs index 0be30b3e1c..6a11029742 100644 --- a/nexus/db-model/src/disk.rs +++ b/nexus/db-model/src/disk.rs @@ -176,7 +176,8 @@ pub struct DiskRuntimeState { pub attach_instance_id: Option, /// generation number for this state #[diesel(column_name = state_generation)] - pub gen: Generation, + #[serde(rename = "gen")] + pub generation: Generation, /// timestamp for this information #[diesel(column_name = time_state_updated)] pub time_updated: DateTime, @@ -187,7 +188,7 @@ impl DiskRuntimeState { Self { disk_state: external::DiskState::Creating.label().to_string(), attach_instance_id: None, - gen: external::Generation::new().into(), + generation: external::Generation::new().into(), time_updated: Utc::now(), } } @@ -198,7 +199,7 @@ impl DiskRuntimeState { .label() .to_string(), attach_instance_id: Some(instance_id), - gen: self.gen.next().into(), + generation: self.generation.next().into(), time_updated: Utc::now(), } } @@ -207,7 +208,7 @@ impl DiskRuntimeState { Self { disk_state: external::DiskState::Detached.label().to_string(), attach_instance_id: None, - gen: self.gen.next().into(), + generation: self.generation.next().into(), time_updated: Utc::now(), } } @@ -216,7 +217,7 @@ impl DiskRuntimeState { Self { disk_state: external::DiskState::Maintenance.label().to_string(), attach_instance_id: None, - gen: self.gen.next().into(), + generation: self.generation.next().into(), time_updated: Utc::now(), } } @@ -225,7 +226,7 @@ impl DiskRuntimeState { Self { disk_state: external::DiskState::ImportReady.label().to_string(), attach_instance_id: None, - gen: self.gen.next().into(), + generation: self.generation.next().into(), time_updated: Utc::now(), } } @@ -236,7 +237,7 @@ impl DiskRuntimeState { .label() .to_string(), attach_instance_id: None, - gen: self.gen.next().into(), + generation: self.generation.next().into(), time_updated: Utc::now(), } } @@ -247,7 +248,7 @@ impl DiskRuntimeState { .label() .to_string(), attach_instance_id: None, - gen: self.gen.next().into(), + generation: self.generation.next().into(), time_updated: Utc::now(), } } @@ -256,7 +257,7 @@ impl DiskRuntimeState { Self { disk_state: external::DiskState::Finalizing.label().to_string(), attach_instance_id: None, - gen: self.gen.next().into(), + generation: self.generation.next().into(), time_updated: Utc::now(), } } @@ -277,7 +278,7 @@ impl DiskRuntimeState { Self { disk_state: external::DiskState::Faulted.label().to_string(), attach_instance_id: None, - gen: self.gen.next().into(), + generation: self.generation.next().into(), time_updated: Utc::now(), } } @@ -292,7 +293,7 @@ impl From for DiskRuntimeState { .disk_state .attached_instance_id() .map(|id| *id), - gen: runtime.gen.into(), + generation: runtime.generation.into(), time_updated: runtime.time_updated, } } @@ -303,7 +304,7 @@ impl Into for DiskRuntimeState { fn into(self) -> internal::nexus::DiskRuntimeState { internal::nexus::DiskRuntimeState { disk_state: self.state().into(), - gen: self.gen.into(), + generation: self.generation.into(), time_updated: self.time_updated, } } diff --git a/nexus/db-model/src/instance.rs b/nexus/db-model/src/instance.rs index 2ac9ec800b..f8c8f41b97 100644 --- a/nexus/db-model/src/instance.rs +++ b/nexus/db-model/src/instance.rs @@ -254,7 +254,8 @@ pub struct InstanceRuntimeState { /// including the fallback state, the instance's active Propolis ID, and its /// migration IDs. #[diesel(column_name = state_generation)] - pub gen: Generation, + #[serde(rename = "gen")] + pub generation: Generation, /// The ID of the Propolis server hosting the current incarnation of this /// instance, or None if the instance has no active VMM. @@ -301,7 +302,7 @@ impl InstanceRuntimeState { propolis_id: None, dst_propolis_id: None, migration_id: None, - gen: Generation::new(), + generation: Generation::new(), time_last_auto_restarted: None, } } diff --git a/nexus/db-model/src/nat_entry.rs b/nexus/db-model/src/nat_entry.rs index d5252ed6d8..93d33ea697 100644 --- a/nexus/db-model/src/nat_entry.rs +++ b/nexus/db-model/src/nat_entry.rs @@ -87,7 +87,7 @@ impl From for NatEntryView { sled_address: value.sled_address.addr(), vni: value.vni.0, mac: *value.mac, - gen: value.version, + generation: value.version, deleted: value.deleted, } } diff --git a/nexus/db-model/src/snapshot.rs b/nexus/db-model/src/snapshot.rs index d61c4385eb..ec73aef2be 100644 --- a/nexus/db-model/src/snapshot.rs +++ b/nexus/db-model/src/snapshot.rs @@ -50,7 +50,9 @@ pub struct Snapshot { // destination of all snapshot blocks pub destination_volume_id: DbTypedUuid, - pub gen: Generation, + #[diesel(column_name = "gen")] + #[serde(rename = "gen")] + pub generation: Generation, pub state: SnapshotState, pub block_size: BlockSize, diff --git a/nexus/db-model/src/vmm.rs b/nexus/db-model/src/vmm.rs index bf83c3b5c0..b7ae771bc7 100644 --- a/nexus/db-model/src/vmm.rs +++ b/nexus/db-model/src/vmm.rs @@ -93,7 +93,7 @@ impl Vmm { runtime: VmmRuntimeState { state: VmmState::Creating, time_state_updated: now, - gen: Generation::new(), + generation: Generation::new(), }, } } @@ -122,7 +122,8 @@ pub struct VmmRuntimeState { /// The generation number protecting this VMM's state and update time. #[diesel(column_name = state_generation)] - pub gen: Generation, + #[serde(rename = "gen")] + pub generation: Generation, /// The state of this VMM. If this VMM is the active VMM for a given /// instance, this state is the instance's logical state. @@ -138,7 +139,7 @@ impl From Self { state: value.state.into(), time_state_updated: value.time_updated, - gen: value.gen.into(), + generation: value.generation.into(), } } } @@ -146,7 +147,7 @@ impl From impl From for sled_agent_client::types::VmmRuntimeState { fn from(s: Vmm) -> Self { Self { - gen: s.runtime.gen.into(), + r#gen: s.runtime.generation.into(), state: s.runtime.state.into(), time_updated: s.runtime.time_state_updated, } diff --git a/nexus/db-queries/Cargo.toml b/nexus/db-queries/Cargo.toml index 93b12059e1..8f9b706e59 100644 --- a/nexus/db-queries/Cargo.toml +++ b/nexus/db-queries/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-db-queries" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/db-queries/src/db/datastore/deployment/external_networking.rs b/nexus/db-queries/src/db/datastore/deployment/external_networking.rs index 567e5fcfc5..d13ffb939c 100644 --- a/nexus/db-queries/src/db/datastore/deployment/external_networking.rs +++ b/nexus/db-queries/src/db/datastore/deployment/external_networking.rs @@ -1076,9 +1076,7 @@ mod tests { (&|zones: &mut [BlueprintZoneConfig]| { for zone in zones { if let BlueprintZoneType::Nexus( - blueprint_zone_type::Nexus { - ref mut external_ip, .. - }, + blueprint_zone_type::Nexus { external_ip, .. }, ) = &mut zone.zone_type { external_ip.ip = bogus_ip; @@ -1096,8 +1094,7 @@ mod tests { for zone in zones { if let BlueprintZoneType::ExternalDns( blueprint_zone_type::ExternalDns { - ref mut dns_address, - .. + dns_address, .. }, ) = &mut zone.zone_type { @@ -1115,8 +1112,7 @@ mod tests { for zone in zones { if let BlueprintZoneType::BoundaryNtp( blueprint_zone_type::BoundaryNtp { - ref mut external_ip, - .. + external_ip, .. }, ) = &mut zone.zone_type { @@ -1200,7 +1196,7 @@ mod tests { let mut mutated_zones = zones.clone(); for zone in &mut mutated_zones { if let BlueprintZoneType::Nexus(blueprint_zone_type::Nexus { - ref mut nic, + nic, .. }) = &mut zone.zone_type { @@ -1227,7 +1223,7 @@ mod tests { let mut mutated_zones = zones.clone(); for zone in &mut mutated_zones { if let BlueprintZoneType::ExternalDns( - blueprint_zone_type::ExternalDns { ref mut nic, .. }, + blueprint_zone_type::ExternalDns { nic, .. }, ) = &mut zone.zone_type { let expected_error = mutate_nic_fn(zone.id, nic); @@ -1253,7 +1249,7 @@ mod tests { let mut mutated_zones = zones.clone(); for zone in &mut mutated_zones { if let BlueprintZoneType::BoundaryNtp( - blueprint_zone_type::BoundaryNtp { ref mut nic, .. }, + blueprint_zone_type::BoundaryNtp { nic, .. }, ) = &mut zone.zone_type { let expected_error = mutate_nic_fn(zone.id, nic); diff --git a/nexus/db-queries/src/db/datastore/disk.rs b/nexus/db-queries/src/db/datastore/disk.rs index 3f98aef0f2..9746b0619d 100644 --- a/nexus/db-queries/src/db/datastore/disk.rs +++ b/nexus/db-queries/src/db/datastore/disk.rs @@ -91,7 +91,7 @@ impl DataStore { opctx.authorize(authz::Action::CreateChild, authz_project).await?; - let gen = disk.runtime().gen; + let generation = disk.runtime().generation; let name = disk.name().clone(); let project_id = disk.project_id; @@ -122,9 +122,9 @@ impl DataStore { runtime.disk_state ); bail_unless!( - runtime.gen == gen, + runtime.generation == generation, "newly-created Disk has unexpected generation: {:?}", - runtime.gen + runtime.generation ); Ok(disk) } @@ -470,7 +470,7 @@ impl DataStore { let updated = diesel::update(dsl::disk) .filter(dsl::time_deleted.is_null()) .filter(dsl::id.eq(disk_id)) - .filter(dsl::state_generation.lt(new_runtime.gen)) + .filter(dsl::state_generation.lt(new_runtime.generation)) .set(new_runtime.clone()) .check_if_exists::(disk_id) .execute_and_check(&*self.pool_connection_authorized(opctx).await?) diff --git a/nexus/db-queries/src/db/datastore/instance.rs b/nexus/db-queries/src/db/datastore/instance.rs index 941c2e0e75..e6d1c8c3e5 100644 --- a/nexus/db-queries/src/db/datastore/instance.rs +++ b/nexus/db-queries/src/db/datastore/instance.rs @@ -358,7 +358,7 @@ impl DataStore { opctx.authorize(authz::Action::CreateChild, authz_project).await?; - let gen = instance.runtime().gen; + let generation = instance.runtime().generation; let name = instance.name().clone(); let project_id = instance.project_id; @@ -389,9 +389,9 @@ impl DataStore { instance.runtime().nexus_state ); bail_unless!( - instance.runtime().gen == gen, + instance.runtime().generation == generation, "newly-created Instance has unexpected generation: {:?}", - instance.runtime().gen + instance.runtime().generation ); Ok(instance) } @@ -759,7 +759,7 @@ impl DataStore { // - the active Propolis ID will not change, the state generation // increased, and the Propolis generation will not change, or // - the Propolis generation increased. - .filter(dsl::state_generation.lt(new_runtime.gen)) + .filter(dsl::state_generation.lt(new_runtime.generation)) .set(new_runtime.clone()) .check_if_exists::(instance_id.into_untyped_uuid()) .execute_and_check(&*self.pool_connection_unauthorized().await?) @@ -2010,7 +2010,7 @@ impl DataStore { // - the provided updater generation matches the current updater // generation. .filter(dsl::updater_gen.eq(locked_gen)) - .filter(dsl::state_generation.lt(new_runtime.r#gen)) + .filter(dsl::state_generation.lt(new_runtime.generation)) .set(( dsl::updater_gen.eq(Generation(locked_gen.0.next())), dsl::updater_id.eq(None::), @@ -2032,7 +2032,8 @@ impl DataStore { // The expected state generation number of the instance record *before* // applying the update. - let prev_state_gen = u64::from(new_runtime.r#gen.0).saturating_sub(1); + let prev_state_gen = + u64::from(new_runtime.generation.0).saturating_sub(1); match result { // If we updated the record, the lock has been released! Return // `Ok(true)` to indicate that we released the lock successfully. @@ -2063,7 +2064,8 @@ impl DataStore { // another execution of the same saga action has already updated the // instance record. UpdateAndQueryResult { ref found, .. } - if u64::from(found.runtime().r#gen.0) != prev_state_gen + if u64::from(found.runtime().generation.0) + != prev_state_gen && found.updater_gen != locked_gen => { debug_assert_ne!(found.updater_id, Some(updater_id)); @@ -2073,8 +2075,8 @@ impl DataStore { and lock generation have advanced: the required updates \ have probably already been committed."; "instance_id" => %instance_id, - "expected_state_gen" => ?new_runtime.r#gen, - "actual_state_gen" => ?found.runtime().r#gen, + "expected_state_gen" => ?new_runtime.generation, + "actual_state_gen" => ?found.runtime().generation, "updater_id" => %updater_id, "updater_gen" => ?locked_gen, "actual_updater_gen" => ?found.updater_gen, @@ -2087,7 +2089,8 @@ impl DataStore { // longer update the instance, as its state has changed, potentially // invalidating the updates. We need to unwind. UpdateAndQueryResult { ref found, .. } - if u64::from(found.runtime().r#gen.0) != prev_state_gen + if u64::from(found.runtime().generation.0) + != prev_state_gen && found.updater_gen == locked_gen && found.updater_id == Some(updater_id) => { @@ -2096,8 +2099,8 @@ impl DataStore { "cannot commit instance update, as the state generation \ has advanced, potentially invalidating the update"; "instance_id" => %instance_id, - "expected_state_gen" => ?new_runtime.r#gen, - "actual_state_gen" => ?found.runtime().r#gen, + "expected_state_gen" => ?new_runtime.generation, + "actual_state_gen" => ?found.runtime().generation, ); Err(Error::conflict("instance state has changed")) } @@ -2542,7 +2545,7 @@ mod tests { &InstanceUuid::from_untyped_uuid(authz_instance.id()), &InstanceRuntimeState { time_updated: Utc::now(), - r#gen: Generation(external::Generation::from_u32(2)), + generation: Generation(external::Generation::from_u32(2)), propolis_id: None, dst_propolis_id: None, migration_id: None, @@ -2590,7 +2593,7 @@ mod tests { &InstanceUuid::from_untyped_uuid(authz_instance.id()), &InstanceRuntimeState { time_updated: Utc::now(), - r#gen: Generation(external::Generation::from_u32(2)), + generation: Generation(external::Generation::from_u32(2)), propolis_id: None, dst_propolis_id: None, migration_id: None, @@ -2652,7 +2655,7 @@ mod tests { .expect("instance should be locked"); let new_runtime = &InstanceRuntimeState { time_updated: Utc::now(), - r#gen: Generation(external::Generation::from_u32(2)), + generation: Generation(external::Generation::from_u32(2)), propolis_id: Some(Uuid::new_v4()), dst_propolis_id: None, migration_id: None, @@ -2692,7 +2695,7 @@ mod tests { dbg!(datastore.instance_refetch(&opctx, &authz_instance).await) .expect("instance should exist"); assert_eq!(instance.runtime().propolis_id, new_runtime.propolis_id); - assert_eq!(instance.runtime().r#gen, new_runtime.r#gen); + assert_eq!(instance.runtime().generation, new_runtime.generation); // Doing it again at the same generation with a *different* state // shouldn't change the instance at all. @@ -2720,7 +2723,7 @@ mod tests { assert_eq!(instance.runtime().propolis_id, new_runtime.propolis_id); assert_eq!(instance.runtime().dst_propolis_id, None); assert_eq!(instance.runtime().migration_id, None); - assert_eq!(instance.runtime().r#gen, new_runtime.r#gen); + assert_eq!(instance.runtime().generation, new_runtime.generation); // Clean up. db.terminate().await; @@ -2757,7 +2760,7 @@ mod tests { // acquired. let new_runtime = &InstanceRuntimeState { time_updated: Utc::now(), - r#gen: Generation(external::Generation::from_u32(2)), + generation: Generation(external::Generation::from_u32(2)), propolis_id: Some(Uuid::new_v4()), dst_propolis_id: Some(Uuid::new_v4()), migration_id: Some(Uuid::new_v4()), @@ -2786,7 +2789,9 @@ mod tests { &lock, &InstanceRuntimeState { time_updated: Utc::now(), - r#gen: Generation(external::Generation::from_u32(2)), + generation: Generation(external::Generation::from_u32( + 2 + )), propolis_id: None, dst_propolis_id: None, migration_id: None, @@ -2871,7 +2876,7 @@ mod tests { cpu_platform: VmmCpuPlatform::SledDefault, runtime: VmmRuntimeState { time_state_updated: Utc::now(), - gen: Generation::new(), + generation: Generation::new(), state: VmmState::Running, }, }, @@ -2885,8 +2890,8 @@ mod tests { &instance_id, &InstanceRuntimeState { time_updated: Utc::now(), - gen: Generation( - snapshot.instance.runtime_state.gen.0.next(), + generation: Generation( + snapshot.instance.runtime_state.generation.0.next(), ), nexus_state: InstanceState::Vmm, propolis_id: Some(active_vmm.id), @@ -2934,7 +2939,7 @@ mod tests { cpu_platform: VmmCpuPlatform::SledDefault, runtime: VmmRuntimeState { time_state_updated: Utc::now(), - gen: Generation::new(), + generation: Generation::new(), state: VmmState::Running, }, }, @@ -2958,8 +2963,8 @@ mod tests { &instance_id, &InstanceRuntimeState { time_updated: Utc::now(), - gen: Generation( - snapshot.instance.runtime_state.gen.0.next(), + generation: Generation( + snapshot.instance.runtime_state.generation.0.next(), ), nexus_state: InstanceState::Vmm, propolis_id: Some(active_vmm.id), @@ -3032,7 +3037,7 @@ mod tests { cpu_platform: VmmCpuPlatform::SledDefault, runtime: VmmRuntimeState { time_state_updated: Utc::now(), - r#gen: Generation::new(), + generation: Generation::new(), state: VmmState::Stopped, }, }, @@ -3050,7 +3055,9 @@ mod tests { &instance_id, &InstanceRuntimeState { time_updated: Utc::now(), - r#gen: Generation(instance.runtime_state.gen.0.next()), + generation: Generation( + instance.runtime_state.generation.0.next(), + ), nexus_state: InstanceState::Vmm, propolis_id: Some(vmm1.id), ..instance.runtime_state.clone() @@ -3073,7 +3080,7 @@ mod tests { cpu_platform: VmmCpuPlatform::SledDefault, runtime: VmmRuntimeState { time_state_updated: Utc::now(), - r#gen: Generation::new(), + generation: Generation::new(), state: VmmState::Running, }, }, @@ -3112,7 +3119,9 @@ mod tests { &PropolisUuid::from_untyped_uuid(vmm1.id), &VmmRuntimeState { time_state_updated: Utc::now(), - r#gen: Generation(vmm2.runtime.r#gen.0.next()), + generation: Generation( + vmm2.runtime.generation.0.next() + ), state: VmmState::Running, }, ) @@ -3176,7 +3185,7 @@ mod tests { cpu_platform: VmmCpuPlatform::SledDefault, runtime: VmmRuntimeState { time_state_updated: Utc::now(), - r#gen: Generation::new(), + generation: Generation::new(), state: VmmState::Running, }, }, @@ -3213,7 +3222,9 @@ mod tests { &PropolisUuid::from_untyped_uuid(vmm2.id), &VmmRuntimeState { time_state_updated: Utc::now(), - r#gen: Generation(vmm2.runtime.r#gen.0.next().next()), + generation: Generation( + vmm2.runtime.generation.0.next().next() + ), state: VmmState::SagaUnwound, }, ) @@ -3323,7 +3334,7 @@ mod tests { cpu_platform: VmmCpuPlatform::SledDefault, runtime: VmmRuntimeState { time_state_updated: Utc::now(), - r#gen: Generation::new(), + generation: Generation::new(), state: VmmState::Running, }, }, @@ -3336,7 +3347,7 @@ mod tests { &InstanceUuid::from_untyped_uuid(instance_id), &InstanceRuntimeState { time_updated: Utc::now(), - gen: Generation(Generation::new().next()), + generation: Generation(Generation::new().next()), nexus_state: InstanceState::Vmm, propolis_id: Some(vmm_id), dst_propolis_id: None, diff --git a/nexus/db-queries/src/db/datastore/migration.rs b/nexus/db-queries/src/db/datastore/migration.rs index 8981ab9bf3..a489033f14 100644 --- a/nexus/db-queries/src/db/datastore/migration.rs +++ b/nexus/db-queries/src/db/datastore/migration.rs @@ -135,7 +135,7 @@ impl DataStore { vmm_id: &PropolisUuid, migration: &nexus::MigrationRuntimeState, ) -> Result, diesel::result::Error> { - let generation = Generation(migration.r#gen); + let generation = Generation(migration.generation); diesel::update(dsl::migration) .filter(dsl::id.eq(migration.migration_id)) .filter(dsl::time_deleted.is_null()) @@ -157,7 +157,7 @@ impl DataStore { vmm_id: &PropolisUuid, migration: &nexus::MigrationRuntimeState, ) -> Result, diesel::result::Error> { - let generation = Generation(migration.r#gen); + let generation = Generation(migration.generation); diesel::update(dsl::migration) .filter(dsl::id.eq(migration.migration_id)) .filter(dsl::time_deleted.is_null()) diff --git a/nexus/db-queries/src/db/datastore/nat_entry.rs b/nexus/db-queries/src/db/datastore/nat_entry.rs index 5300ba38ae..5681ae8f49 100644 --- a/nexus/db-queries/src/db/datastore/nat_entry.rs +++ b/nexus/db-queries/src/db/datastore/nat_entry.rs @@ -847,9 +847,9 @@ mod test { while !changes.is_empty() { // check ordering assert!( - changes - .windows(2) - .all(|entries| entries[0].gen < entries[1].gen) + changes.windows(2).all( + |entries| entries[0].generation < entries[1].generation + ) ); // check deleted status and version numbers @@ -858,7 +858,7 @@ mod test { // version should match a deleted entry let deleted_nat = db_records .iter() - .find(|entry| entry.version_removed == Some(change.gen)) + .find(|entry| entry.version_removed == Some(change.generation)) .expect("did not find a deleted nat entry with a matching version number"); assert_eq!( @@ -881,7 +881,7 @@ mod test { // version should match an active nat entry let added_nat = db_records .iter() - .find(|entry| entry.version_added == change.gen) + .find(|entry| entry.version_added == change.generation) .expect("did not find an active nat entry with a matching version number"); assert!(added_nat.version_removed.is_none()); @@ -904,7 +904,7 @@ mod test { // bump the count of changes seen total_changes += changes.len(); - version = changes.last().unwrap().gen; + version = changes.last().unwrap().generation; changes = datastore.nat_changeset(&opctx, version, limit).await.unwrap(); } diff --git a/nexus/db-queries/src/db/datastore/role.rs b/nexus/db-queries/src/db/datastore/role.rs index 1d0801fc03..a058938758 100644 --- a/nexus/db-queries/src/db/datastore/role.rs +++ b/nexus/db-queries/src/db/datastore/role.rs @@ -175,8 +175,8 @@ impl DataStore { new_assignments: &[shared::RoleAssignment], ) -> Result< ( - impl RunnableQueryNoReturn, - impl RunnableQuery, + impl RunnableQueryNoReturn + use, + impl RunnableQuery + use, ), Error, > diff --git a/nexus/db-queries/src/db/datastore/silo.rs b/nexus/db-queries/src/db/datastore/silo.rs index 1dfdf3f2cc..91804aea8c 100644 --- a/nexus/db-queries/src/db/datastore/silo.rs +++ b/nexus/db-queries/src/db/datastore/silo.rs @@ -116,7 +116,7 @@ impl DataStore { async fn silo_create_query( opctx: &OpContext, silo: Silo, - ) -> Result, Error> { + ) -> Result + use<>, Error> { opctx.authorize(authz::Action::CreateChild, &authz::FLEET).await?; // If the new Silo has configuration mapping its roles to Fleet-level diff --git a/nexus/db-queries/src/db/datastore/silo_group.rs b/nexus/db-queries/src/db/datastore/silo_group.rs index 1b58e720d5..8026b163dc 100644 --- a/nexus/db-queries/src/db/datastore/silo_group.rs +++ b/nexus/db-queries/src/db/datastore/silo_group.rs @@ -349,7 +349,7 @@ impl DataStore { opctx: &OpContext, authz_silo: &authz::Silo, silo_group: model::SiloGroup, - ) -> Result { + ) -> Result, Error> { opctx.authorize(authz::Action::CreateChild, authz_silo).await?; use nexus_db_schema::schema::silo_group::dsl; diff --git a/nexus/db-queries/src/db/datastore/snapshot.rs b/nexus/db-queries/src/db/datastore/snapshot.rs index ed76565986..615dee74df 100644 --- a/nexus/db-queries/src/db/datastore/snapshot.rs +++ b/nexus/db-queries/src/db/datastore/snapshot.rs @@ -47,7 +47,7 @@ impl DataStore { authz_project: &authz::Project, snapshot: Snapshot, ) -> CreateResult { - let gen = snapshot.gen; + let generation = snapshot.generation; opctx.authorize(authz::Action::CreateChild, authz_project).await?; let project_id = snapshot.project_id; @@ -153,9 +153,9 @@ impl DataStore { snapshot.state ); bail_unless!( - snapshot.gen == gen, + snapshot.generation == generation, "newly-created Snapshot has unexpected generation: {:?}", - snapshot.gen + snapshot.generation ); Ok(snapshot) @@ -177,8 +177,8 @@ impl DataStore { diesel::update(dsl::snapshot) .filter(dsl::id.eq(authz_snapshot.id())) .filter(dsl::time_deleted.is_null()) - .filter(dsl::gen.eq(old_gen)) - .set((dsl::state.eq(new_state), dsl::gen.eq(next_gen))) + .filter(dsl::r#gen.eq(old_gen)) + .set((dsl::state.eq(new_state), dsl::r#gen.eq(next_gen))) .returning(Snapshot::as_returning()) .get_result_async(&*self.pool_connection_authorized(opctx).await?) .await @@ -236,13 +236,13 @@ impl DataStore { // then it was already deleted. let snapshot_id = authz_snapshot.id(); - let gen = db_snapshot.gen; + let r#gen = db_snapshot.generation; use nexus_db_schema::schema::snapshot::dsl; let result = diesel::update(dsl::snapshot) .filter(dsl::time_deleted.is_null()) - .filter(dsl::gen.eq(gen)) + .filter(dsl::r#gen.eq(r#gen)) .filter(dsl::id.eq(snapshot_id)) .filter(dsl::state.eq_any(ok_to_delete_states.clone())) .set(( @@ -284,10 +284,10 @@ impl DataStore { "snapshot cannot be deleted in state {:?}", snapshot.state, ))) - } else if snapshot.gen != gen { + } else if snapshot.generation != r#gen { Err(Error::invalid_request(&format!( "snapshot cannot be deleted: mismatched generation {:?} != {:?}", - gen, snapshot.gen, + r#gen, snapshot.generation, ))) } else { error!( diff --git a/nexus/db-queries/src/db/datastore/test_utils.rs b/nexus/db-queries/src/db/datastore/test_utils.rs index 6a1735ff75..310607f99a 100644 --- a/nexus/db-queries/src/db/datastore/test_utils.rs +++ b/nexus/db-queries/src/db/datastore/test_utils.rs @@ -47,7 +47,7 @@ pub(super) struct IneligibleSleds { impl IneligibleSleds { pub(super) fn iter( &self, - ) -> impl Iterator { + ) -> impl Iterator + use<> { [ (IneligibleSledKind::NonProvisionable, self.non_provisionable), (IneligibleSledKind::Expunged, self.expunged), diff --git a/nexus/db-queries/src/db/datastore/vmm.rs b/nexus/db-queries/src/db/datastore/vmm.rs index 5b66a8294d..8fb33b2fcf 100644 --- a/nexus/db-queries/src/db/datastore/vmm.rs +++ b/nexus/db-queries/src/db/datastore/vmm.rs @@ -166,7 +166,7 @@ impl DataStore { diesel::update(dsl::vmm) .filter(dsl::time_deleted.is_null()) .filter(dsl::id.eq(vmm_id.into_untyped_uuid())) - .filter(dsl::state_generation.lt(new_runtime.gen)) + .filter(dsl::state_generation.lt(new_runtime.generation)) .set(new_runtime.clone()) .check_if_exists::(vmm_id.into_untyped_uuid()) .execute_and_check(conn) @@ -475,7 +475,7 @@ mod tests { cpu_platform: VmmCpuPlatform::SledDefault, runtime: VmmRuntimeState { time_state_updated: Utc::now(), - r#gen: Generation::new(), + generation: Generation::new(), state: VmmState::Running, }, }, @@ -497,7 +497,7 @@ mod tests { cpu_platform: VmmCpuPlatform::SledDefault, runtime: VmmRuntimeState { time_state_updated: Utc::now(), - r#gen: Generation::new(), + generation: Generation::new(), state: VmmState::Running, }, }, @@ -524,7 +524,7 @@ mod tests { let vmm1_migration_out = nexus::MigrationRuntimeState { migration_id: migration1.id, state: nexus::MigrationState::Completed, - r#gen: Generation::new().0.next(), + generation: Generation::new().0.next(), time_updated: Utc::now(), }; datastore @@ -533,7 +533,7 @@ mod tests { PropolisUuid::from_untyped_uuid(vmm1.id), &VmmRuntimeState { time_state_updated: Utc::now(), - r#gen: Generation(vmm1.runtime.r#gen.0.next()), + generation: Generation(vmm1.runtime.generation.0.next()), state: VmmState::Stopping, }, Migrations { @@ -546,7 +546,7 @@ mod tests { let vmm2_migration_in = nexus::MigrationRuntimeState { migration_id: migration1.id, state: nexus::MigrationState::Completed, - r#gen: Generation::new().0.next(), + generation: Generation::new().0.next(), time_updated: Utc::now(), }; datastore @@ -555,7 +555,7 @@ mod tests { PropolisUuid::from_untyped_uuid(vmm2.id), &VmmRuntimeState { time_state_updated: Utc::now(), - r#gen: Generation(vmm2.runtime.r#gen.0.next()), + generation: Generation(vmm2.runtime.generation.0.next()), state: VmmState::Running, }, Migrations { @@ -608,7 +608,7 @@ mod tests { cpu_platform: VmmCpuPlatform::SledDefault, runtime: VmmRuntimeState { time_state_updated: Utc::now(), - r#gen: Generation::new(), + generation: Generation::new(), state: VmmState::Running, }, }, @@ -634,7 +634,7 @@ mod tests { let vmm2_migration_out = nexus::MigrationRuntimeState { migration_id: migration2.id, state: nexus::MigrationState::Completed, - r#gen: Generation::new().0.next(), + generation: Generation::new().0.next(), time_updated: Utc::now(), }; datastore @@ -643,7 +643,7 @@ mod tests { PropolisUuid::from_untyped_uuid(vmm2.id), &VmmRuntimeState { time_state_updated: Utc::now(), - r#gen: Generation(vmm2.runtime.r#gen.0.next()), + generation: Generation(vmm2.runtime.generation.0.next()), state: VmmState::Destroyed, }, Migrations { @@ -658,7 +658,7 @@ mod tests { migration_id: migration2.id, // Let's make this fail, just for fun... state: nexus::MigrationState::Failed, - r#gen: Generation::new().0.next(), + generation: Generation::new().0.next(), time_updated: Utc::now(), }; datastore @@ -667,7 +667,7 @@ mod tests { PropolisUuid::from_untyped_uuid(vmm3.id), &VmmRuntimeState { time_state_updated: Utc::now(), - r#gen: Generation(vmm3.runtime.r#gen.0.next()), + generation: Generation(vmm3.runtime.generation.0.next()), state: VmmState::Destroyed, }, Migrations { diff --git a/nexus/db-queries/src/db/datastore/volume.rs b/nexus/db-queries/src/db/datastore/volume.rs index b7a4ccf856..3ff8eb5c46 100644 --- a/nexus/db-queries/src/db/datastore/volume.rs +++ b/nexus/db-queries/src/db/datastore/volume.rs @@ -930,7 +930,7 @@ impl DataStore { blocks_per_extent, extent_count, opts, - gen, + r#gen, } => { update_needed = true; new_sv.push(VolumeConstructionRequest::Region { @@ -938,7 +938,7 @@ impl DataStore { blocks_per_extent, extent_count, opts, - gen: gen + 1, + r#gen: r#gen + 1, }); } _ => { @@ -988,7 +988,7 @@ impl DataStore { blocks_per_extent: _, extent_count: _, opts: _, - gen: _, + r#gen: _, } => { // We don't support a pure Region VCR at the volume level in the // database, so this choice should never be encountered, but I @@ -3208,7 +3208,7 @@ impl DataStore { block_size: 512, blocks_per_extent: 1, extent_count: 1, - gen: 1, + r#gen: 1, opts: sled_agent_client::CrucibleOpts { id: *volume_to_delete_id.0.as_untyped_uuid(), target: vec![existing.0.into()], @@ -3629,7 +3629,7 @@ fn replace_region_in_vcr( // nothing required } - VolumeConstructionRequest::Region { opts, gen, .. } => { + VolumeConstructionRequest::Region { opts, r#gen, .. } => { for target in &mut opts.target { if let SocketAddr::V6(target) = target { if *target == old_region { @@ -3640,7 +3640,7 @@ fn replace_region_in_vcr( } // Bump generation number, otherwise update will be rejected - *gen = *gen + 1; + *r#gen = *r#gen + 1; } VolumeConstructionRequest::File { .. } => { @@ -4758,7 +4758,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: *volume_id.as_untyped_uuid(), target: vec![ @@ -4820,7 +4820,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 2, // generation number bumped + r#gen: 2, // generation number bumped opts: CrucibleOpts { id: *volume_id.as_untyped_uuid(), target: vec![ @@ -4878,7 +4878,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 3, // generation number bumped + r#gen: 3, // generation number bumped opts: CrucibleOpts { id: *volume_id.as_untyped_uuid(), target: vec![ @@ -5045,7 +5045,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: *volume_id.as_untyped_uuid(), target: vec![ @@ -5068,7 +5068,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: rop_id, target: vec![ @@ -5166,7 +5166,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: *volume_id.as_untyped_uuid(), target: vec![ @@ -5189,7 +5189,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: rop_id, target: vec![ @@ -5231,7 +5231,7 @@ mod tests { block_size: 512, blocks_per_extent: 1, extent_count: 1, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: *volume_to_delete_id.as_untyped_uuid(), target: vec![ @@ -5322,7 +5322,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: *volume_id.as_untyped_uuid(), target: vec![ @@ -5345,7 +5345,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: *rop_id.as_untyped_uuid(), target: vec![ @@ -5387,7 +5387,7 @@ mod tests { block_size: 512, blocks_per_extent: 1, extent_count: 1, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: *volume_to_delete_id.as_untyped_uuid(), target: vec![ @@ -5504,7 +5504,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![ @@ -5565,7 +5565,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![ @@ -5603,7 +5603,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![ @@ -5644,7 +5644,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![ @@ -5688,7 +5688,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: volume_id, target: vec![ @@ -5730,7 +5730,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: volume_id, target: vec![ @@ -5765,7 +5765,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: volume_id, target: vec![ @@ -5788,7 +5788,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: volume_id, target: vec![ @@ -5813,7 +5813,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: volume_id, target: vec![ @@ -5856,7 +5856,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: volume_id, target: vec![ @@ -5879,7 +5879,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: volume_id, target: vec![ @@ -5908,7 +5908,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: volume_id, target: vec![ @@ -5938,7 +5938,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: volume_id, target: vec![ @@ -5967,7 +5967,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: volume_id, target: vec![ @@ -6005,7 +6005,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: volume_id, target: vec![ @@ -6036,7 +6036,7 @@ mod tests { block_size: 512, blocks_per_extent: 10, extent_count: 10, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: volume_id, target: vec![ diff --git a/nexus/db-queries/src/db/datastore/webhook_delivery.rs b/nexus/db-queries/src/db/datastore/webhook_delivery.rs index 54430e1a08..7fec81761d 100644 --- a/nexus/db-queries/src/db/datastore/webhook_delivery.rs +++ b/nexus/db-queries/src/db/datastore/webhook_delivery.rs @@ -191,8 +191,10 @@ impl DataStore { opctx: &OpContext, rx_id: &AlertReceiverUuid, cfg: &DeliveryConfig, - ) -> Result + 'static, Error> - { + ) -> Result< + impl ExactSizeIterator + 'static + use<>, + Error, + > { let conn = self.pool_connection_authorized(opctx).await?; let now = diesel::dsl::now.into_sql::(); diff --git a/nexus/db-queries/src/db/pub_test_utils/helpers.rs b/nexus/db-queries/src/db/pub_test_utils/helpers.rs index 2fda16ef2a..081d9809aa 100644 --- a/nexus/db-queries/src/db/pub_test_utils/helpers.rs +++ b/nexus/db-queries/src/db/pub_test_utils/helpers.rs @@ -268,7 +268,7 @@ pub async fn create_stopped_instance_record( propolis_id: None, migration_id: None, dst_propolis_id: None, - gen: Generation::from(Generation::new().0.next()), + generation: Generation::from(Generation::new().0.next()), time_last_auto_restarted: None, }, ) @@ -452,7 +452,7 @@ pub async fn create_project_snapshot( volume_id: VolumeUuid::new_v4().into(), destination_volume_id: VolumeUuid::new_v4().into(), - gen: Generation::new(), + generation: Generation::new(), state: SnapshotState::Creating, block_size: BlockSize::AdvancedFormat, @@ -552,7 +552,9 @@ pub async fn attach_instance_to_vmm( propolis_id: Some(vmm_id.into_untyped_uuid()), dst_propolis_id: None, migration_id: None, - gen: Generation::from(instance.runtime().gen.next()), + generation: Generation::from( + instance.runtime().generation.next(), + ), time_updated: Utc::now(), time_last_auto_restarted: None, }, diff --git a/nexus/db-queries/src/db/queries/network_interface.rs b/nexus/db-queries/src/db/queries/network_interface.rs index 0881f5d056..175c5782cf 100644 --- a/nexus/db-queries/src/db/queries/network_interface.rs +++ b/nexus/db-queries/src/db/queries/network_interface.rs @@ -2061,7 +2061,7 @@ mod tests { let new_runtime = model::InstanceRuntimeState { nexus_state: state, propolis_id, - r#gen: instance.runtime_state.gen.next().into(), + generation: instance.runtime_state.generation.next().into(), ..instance.runtime_state.clone() }; let res = db_datastore diff --git a/nexus/db-schema/Cargo.toml b/nexus/db-schema/Cargo.toml index 11fbf6cbfb..a586eacd94 100644 --- a/nexus/db-schema/Cargo.toml +++ b/nexus/db-schema/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-db-schema" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/db-schema/src/schema.rs b/nexus/db-schema/src/schema.rs index ae62b1a327..1c47252243 100644 --- a/nexus/db-schema/src/schema.rs +++ b/nexus/db-schema/src/schema.rs @@ -401,7 +401,7 @@ table! { destination_volume_id -> Uuid, - gen -> Int8, + r#gen -> Int8, state -> crate::enums::SnapshotStateEnum, block_size -> crate::enums::BlockSizeEnum, size_bytes -> Int8, diff --git a/nexus/defaults/Cargo.toml b/nexus/defaults/Cargo.toml index 96197d248a..ec98b4f196 100644 --- a/nexus/defaults/Cargo.toml +++ b/nexus/defaults/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-defaults" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/external-api/Cargo.toml b/nexus/external-api/Cargo.toml index 77147af469..a9e283f1d6 100644 --- a/nexus/external-api/Cargo.toml +++ b/nexus/external-api/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-external-api" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/internal-api/Cargo.toml b/nexus/internal-api/Cargo.toml index dd23f5451f..901f7f832f 100644 --- a/nexus/internal-api/Cargo.toml +++ b/nexus/internal-api/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-internal-api" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/inventory/Cargo.toml b/nexus/inventory/Cargo.toml index a9ebbce70c..af6a8bd6ae 100644 --- a/nexus/inventory/Cargo.toml +++ b/nexus/inventory/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-inventory" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/lockstep-api/Cargo.toml b/nexus/lockstep-api/Cargo.toml index 1ec8dffb5b..57b3d26a8e 100644 --- a/nexus/lockstep-api/Cargo.toml +++ b/nexus/lockstep-api/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-lockstep-api" version = "0.1.0" -edition = "2024" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/macros-common/Cargo.toml b/nexus/macros-common/Cargo.toml index 6f7266a5a6..8d33f370be 100644 --- a/nexus/macros-common/Cargo.toml +++ b/nexus/macros-common/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-macros-common" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/metrics-producer-gc/Cargo.toml b/nexus/metrics-producer-gc/Cargo.toml index fcde33bf01..b211ea685d 100644 --- a/nexus/metrics-producer-gc/Cargo.toml +++ b/nexus/metrics-producer-gc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-metrics-producer-gc" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/nexus/mgs-updates/Cargo.toml b/nexus/mgs-updates/Cargo.toml index 8a7f8a4258..08dca0d960 100644 --- a/nexus/mgs-updates/Cargo.toml +++ b/nexus/mgs-updates/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-mgs-updates" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/nexus/networking/Cargo.toml b/nexus/networking/Cargo.toml index 26c0bc8d03..b972a8a202 100644 --- a/nexus/networking/Cargo.toml +++ b/nexus/networking/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-networking" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/reconfigurator/blippy/Cargo.toml b/nexus/reconfigurator/blippy/Cargo.toml index a5a02a65c1..293970aede 100644 --- a/nexus/reconfigurator/blippy/Cargo.toml +++ b/nexus/reconfigurator/blippy/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-reconfigurator-blippy" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/nexus/reconfigurator/blippy/src/blippy.rs b/nexus/reconfigurator/blippy/src/blippy.rs index af38933622..9ec27767fe 100644 --- a/nexus/reconfigurator/blippy/src/blippy.rs +++ b/nexus/reconfigurator/blippy/src/blippy.rs @@ -110,7 +110,7 @@ pub enum BlueprintKind { impl fmt::Display for BlueprintKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - BlueprintKind::NoZonesWithActiveNexusGeneration(gen) => { + BlueprintKind::NoZonesWithActiveNexusGeneration(r#gen) => { write!(f, "No zones with active nexus generation @ {gen}",) } } diff --git a/nexus/reconfigurator/cli-integration-tests/Cargo.toml b/nexus/reconfigurator/cli-integration-tests/Cargo.toml index 30c824a22f..960cf94c95 100644 --- a/nexus/reconfigurator/cli-integration-tests/Cargo.toml +++ b/nexus/reconfigurator/cli-integration-tests/Cargo.toml @@ -2,7 +2,7 @@ name = "nexus-reconfigurator-cli-integration-tests" description = "Integration tests for reconfigurator-cli with Nexus" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/reconfigurator/execution/Cargo.toml b/nexus/reconfigurator/execution/Cargo.toml index 1ed22ffa34..1e25f17497 100644 --- a/nexus/reconfigurator/execution/Cargo.toml +++ b/nexus/reconfigurator/execution/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-reconfigurator-execution" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/nexus/reconfigurator/planning/Cargo.toml b/nexus/reconfigurator/planning/Cargo.toml index ed54003c58..753269ed80 100644 --- a/nexus/reconfigurator/planning/Cargo.toml +++ b/nexus/reconfigurator/planning/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-reconfigurator-planning" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/nexus/reconfigurator/planning/src/blueprint_builder/builder.rs b/nexus/reconfigurator/planning/src/blueprint_builder/builder.rs index 5a31605b2e..8ecce44f80 100644 --- a/nexus/reconfigurator/planning/src/blueprint_builder/builder.rs +++ b/nexus/reconfigurator/planning/src/blueprint_builder/builder.rs @@ -697,7 +697,7 @@ impl<'a> BlueprintBuilder<'a> { pub fn available_internal_dns_subnets( &self, - ) -> Result, Error> { + ) -> Result + use<>, Error> { // TODO-multirack We need the rack subnet to know what the reserved // internal DNS subnets are. Pick any sled; this isn't right in // multirack (either DNS will be on a wider subnet or we need to pick a diff --git a/nexus/reconfigurator/planning/src/blueprint_builder/clickhouse.rs b/nexus/reconfigurator/planning/src/blueprint_builder/clickhouse.rs index 172f6b6043..d2e424f6d0 100644 --- a/nexus/reconfigurator/planning/src/blueprint_builder/clickhouse.rs +++ b/nexus/reconfigurator/planning/src/blueprint_builder/clickhouse.rs @@ -209,7 +209,7 @@ impl ClickhouseAllocator { .parent_config .keepers .iter() - .find(|(_, &keeper_id)| keeper_id == added_keeper_id) + .find(|&(_, &keeper_id)| keeper_id == added_keeper_id) .unwrap(); // Let's ensure that this zone has not been expunged yet. If it has that means @@ -664,7 +664,7 @@ pub mod test { .parent_config .keepers .iter() - .find(|(_, &keeper_id)| keeper_id == keeper_to_expunge) + .find(|&(_, &keeper_id)| keeper_id == keeper_to_expunge) .map(|(zone_id, _)| *zone_id) .unwrap(); active_clickhouse_zones.keepers.remove(&zone_to_expunge); @@ -757,7 +757,7 @@ pub mod test { let zone_to_expunge = new_config .keepers .iter() - .find(|(_, &keeper_id)| keeper_id == 5.into()) + .find(|&(_, &keeper_id)| keeper_id == 5.into()) .map(|(zone_id, _)| *zone_id) .unwrap(); allocator.parent_config = new_config; diff --git a/nexus/reconfigurator/planning/src/planner.rs b/nexus/reconfigurator/planning/src/planner.rs index 6c59470b11..b4f885bfe5 100644 --- a/nexus/reconfigurator/planning/src/planner.rs +++ b/nexus/reconfigurator/planning/src/planner.rs @@ -1360,10 +1360,10 @@ impl<'a> Planner<'a> { // If the image matches exactly, use it. same_image_nexus_generation = Some(nexus.nexus_generation); break; - } else if let Some(gen) = highest_seen_generation { + } else if let Some(generation) = highest_seen_generation { // Otherwise, use the generation number if it's the highest // we've seen - if nexus.nexus_generation > gen { + if nexus.nexus_generation > generation { highest_seen_generation = Some(nexus.nexus_generation); } } else { @@ -1374,15 +1374,15 @@ impl<'a> Planner<'a> { } let determined_generation = match same_image_nexus_generation { - Some(gen) => Some(gen), - None => highest_seen_generation.map(|gen| gen.next()), + Some(generation) => Some(generation), + None => highest_seen_generation.map(|r#gen| r#gen.next()), }; - let Some(gen) = determined_generation else { + let Some(r#gen) = determined_generation else { return Err(Error::NoNexusZonesInParentBlueprint); }; - Ok(gen) + Ok(r#gen) } /// Update at most one MGS-managed device (SP, RoT, etc.), if any are out of diff --git a/nexus/reconfigurator/preparation/Cargo.toml b/nexus/reconfigurator/preparation/Cargo.toml index d7a6d07a5d..aabbd64502 100644 --- a/nexus/reconfigurator/preparation/Cargo.toml +++ b/nexus/reconfigurator/preparation/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-reconfigurator-preparation" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/nexus/reconfigurator/preparation/src/lib.rs b/nexus/reconfigurator/preparation/src/lib.rs index 3330832b3b..5785e414a5 100644 --- a/nexus/reconfigurator/preparation/src/lib.rs +++ b/nexus/reconfigurator/preparation/src/lib.rs @@ -550,14 +550,14 @@ pub async fn reconfigurator_state_load( .chain(std::iter::once(*latest_version.version)) .collect(); let mut rv = BTreeMap::new(); - for gen in dns_generations_needed { + for r#gen in dns_generations_needed { let config = datastore - .dns_config_read_version(&opctx, dns_group, gen) + .dns_config_read_version(&opctx, dns_group, r#gen) .await .with_context(|| { - format!("reading {:?} DNS version {}", dns_group, gen) + format!("reading {:?} DNS version {}", dns_group, r#gen) })?; - rv.insert(gen, config); + rv.insert(r#gen, config); } Ok::, anyhow::Error>(rv) diff --git a/nexus/reconfigurator/rendezvous/Cargo.toml b/nexus/reconfigurator/rendezvous/Cargo.toml index 6e7d8df3dc..ffd6400c0b 100644 --- a/nexus/reconfigurator/rendezvous/Cargo.toml +++ b/nexus/reconfigurator/rendezvous/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-reconfigurator-rendezvous" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/nexus/reconfigurator/simulation/Cargo.toml b/nexus/reconfigurator/simulation/Cargo.toml index 2e3234c5c1..6cd4752ca3 100644 --- a/nexus/reconfigurator/simulation/Cargo.toml +++ b/nexus/reconfigurator/simulation/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-reconfigurator-simulation" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/nexus/reconfigurator/simulation/src/config.rs b/nexus/reconfigurator/simulation/src/config.rs index ba680052a2..1b46be7b27 100644 --- a/nexus/reconfigurator/simulation/src/config.rs +++ b/nexus/reconfigurator/simulation/src/config.rs @@ -202,9 +202,10 @@ impl SimConfigBuilder { self.log.push(SimConfigLogEntry::SetNumNexus(num_nexus)); } - pub fn set_active_nexus_zone_generation(&mut self, gen: Generation) { - self.inner.set_active_nexus_zone_generation(gen); - self.log.push(SimConfigLogEntry::SetActiveNexusZoneGeneration(gen)); + pub fn set_active_nexus_zone_generation(&mut self, generation: Generation) { + self.inner.set_active_nexus_zone_generation(generation); + self.log + .push(SimConfigLogEntry::SetActiveNexusZoneGeneration(generation)); } pub fn set_explicit_active_nexus_zones( @@ -377,8 +378,8 @@ impl SimConfigBuilderInner { self.config.num_nexus = Some(num_nexus); } - fn set_active_nexus_zone_generation(&mut self, gen: Generation) { - self.config.active_nexus_zone_generation = gen; + fn set_active_nexus_zone_generation(&mut self, generation: Generation) { + self.config.active_nexus_zone_generation = generation; } fn set_explicit_active_nexus_zones( diff --git a/nexus/saga-recovery/Cargo.toml b/nexus/saga-recovery/Cargo.toml index c35a5c7b5f..7154496580 100644 --- a/nexus/saga-recovery/Cargo.toml +++ b/nexus/saga-recovery/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-saga-recovery" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/nexus/src/app/background/tasks/abandoned_vmm_reaper.rs b/nexus/src/app/background/tasks/abandoned_vmm_reaper.rs index 13d3ac0e63..cc93af086d 100644 --- a/nexus/src/app/background/tasks/abandoned_vmm_reaper.rs +++ b/nexus/src/app/background/tasks/abandoned_vmm_reaper.rs @@ -251,7 +251,7 @@ mod tests { runtime: VmmRuntimeState { state: VmmState::Destroyed, time_state_updated: Utc::now(), - gen: Generation::new(), + generation: Generation::new(), } }), ) diff --git a/nexus/src/app/background/tasks/ereport_ingester.rs b/nexus/src/app/background/tasks/ereport_ingester.rs index 0289662714..a260e7cd31 100644 --- a/nexus/src/app/background/tasks/ereport_ingester.rs +++ b/nexus/src/app/background/tasks/ereport_ingester.rs @@ -372,7 +372,7 @@ impl Ingester { &self, opctx: &OpContext, clients: &[GatewayClient], - EreportQueryParams { ref committed_ena,ref start_ena, restart_id }: &EreportQueryParams, + EreportQueryParams { committed_ena,start_ena, restart_id }: &EreportQueryParams, sp_type: nexus_types::inventory::SpType, slot: u16, status: &mut Option, @@ -763,7 +763,7 @@ mod tests { class: impl Into>, mut json: serde_json::Value, ) -> ExpectedEreport { - if let serde_json::Value::Object(ref mut map) = &mut json { + if let serde_json::Value::Object(map) = &mut json { map.insert( "baseboard_part_number".to_string(), self.part.into(), diff --git a/nexus/src/app/background/tasks/instance_reincarnation.rs b/nexus/src/app/background/tasks/instance_reincarnation.rs index 7858676891..7bfc881ec1 100644 --- a/nexus/src/app/background/tasks/instance_reincarnation.rs +++ b/nexus/src/app/background/tasks/instance_reincarnation.rs @@ -443,7 +443,7 @@ mod test { cpu_platform: VmmCpuPlatform::SledDefault, runtime: VmmRuntimeState { time_state_updated: Utc::now(), - r#gen: Generation::new(), + generation: Generation::new(), state: VmmState::SagaUnwound, }, }, @@ -461,7 +461,7 @@ mod test { &instance_id, &InstanceRuntimeState { time_updated: Utc::now(), - r#gen: Generation(prev_state.r#gen.next()), + generation: Generation(prev_state.generation.next()), nexus_state: InstanceState::Vmm, propolis_id: Some(vmm_id), ..prev_state @@ -509,7 +509,7 @@ mod test { time_updated: Utc::now(), nexus_state: state, propolis_id, - r#gen: Generation(prev_state.r#gen.next()), + generation: Generation(prev_state.generation.next()), ..prev_state }, ) diff --git a/nexus/src/app/background/tasks/instance_watcher.rs b/nexus/src/app/background/tasks/instance_watcher.rs index 054ee9b32e..bab4451d28 100644 --- a/nexus/src/app/background/tasks/instance_watcher.rs +++ b/nexus/src/app/background/tasks/instance_watcher.rs @@ -89,7 +89,7 @@ impl InstanceWatcher { target: VirtualMachine, vmm: Vmm, sled: Sled, - ) -> impl Future + Send + 'static { + ) -> impl Future + Send + 'static + use<> { let datastore = self.datastore.clone(); let sagas = self.sagas.clone(); @@ -130,7 +130,7 @@ impl InstanceWatcher { // code path as `mark_instance_failed`... SledVmmState { vmm_state: nexus::VmmRuntimeState { - r#gen: vmm.runtime.r#gen.0.next(), + generation: vmm.runtime.generation.0.next(), state: nexus::VmmState::Failed, time_updated: chrono::Utc::now(), }, @@ -169,7 +169,7 @@ impl InstanceWatcher { // code path as `mark_instance_failed`... SledVmmState { vmm_state: nexus::VmmRuntimeState { - r#gen: vmm.runtime.r#gen.0.next(), + generation: vmm.runtime.generation.0.next(), state: nexus::VmmState::Failed, time_updated: chrono::Utc::now(), }, diff --git a/nexus/src/app/background/tasks/nat_cleanup.rs b/nexus/src/app/background/tasks/nat_cleanup.rs index 9c9a41d179..9efe1c7506 100644 --- a/nexus/src/app/background/tasks/nat_cleanup.rs +++ b/nexus/src/app/background/tasks/nat_cleanup.rs @@ -46,7 +46,7 @@ impl BackgroundTask for Ipv4NatGarbageCollector { let result = self.datastore.nat_current_version(opctx).await; let mut min_gen = match result { - Ok(gen) => gen, + Ok(r#gen) => r#gen, Err(error) => { warn!( &log, @@ -94,7 +94,7 @@ impl BackgroundTask for Ipv4NatGarbageCollector { for client in dpd_clients.values() { let response = client.ipv4_nat_generation().await; match response { - Ok(gen) => min_gen = std::cmp::min(min_gen, *gen), + Ok(r#gen) => min_gen = std::cmp::min(min_gen, *r#gen), Err(error) => { warn!( &log, diff --git a/nexus/src/app/background/tasks/read_only_region_replacement_start.rs b/nexus/src/app/background/tasks/read_only_region_replacement_start.rs index 1ffc4e55c4..9f3b769dc6 100644 --- a/nexus/src/app/background/tasks/read_only_region_replacement_start.rs +++ b/nexus/src/app/background/tasks/read_only_region_replacement_start.rs @@ -298,7 +298,7 @@ mod test { volume_id: volume_id.into(), destination_volume_id: VolumeUuid::new_v4().into(), - gen: Generation::new(), + generation: Generation::new(), state: SnapshotState::Creating, block_size: BlockSize::Traditional, diff --git a/nexus/src/app/background/tasks/region_replacement.rs b/nexus/src/app/background/tasks/region_replacement.rs index 558de4d4b7..ff31c798d8 100644 --- a/nexus/src/app/background/tasks/region_replacement.rs +++ b/nexus/src/app/background/tasks/region_replacement.rs @@ -363,7 +363,7 @@ mod test { block_size: 0, blocks_per_extent: 0, extent_count: 0, - gen: 0, + r#gen: 0, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![ diff --git a/nexus/src/app/background/tasks/region_snapshot_replacement_start.rs b/nexus/src/app/background/tasks/region_snapshot_replacement_start.rs index 7438a5429f..3f89540ae0 100644 --- a/nexus/src/app/background/tasks/region_snapshot_replacement_start.rs +++ b/nexus/src/app/background/tasks/region_snapshot_replacement_start.rs @@ -519,7 +519,7 @@ mod test { volume_id: volume_id.into(), destination_volume_id: VolumeUuid::new_v4().into(), - gen: Generation::new(), + generation: Generation::new(), state: SnapshotState::Creating, block_size: BlockSize::AdvancedFormat, @@ -679,7 +679,7 @@ mod test { block_size: 512, blocks_per_extent: 1, extent_count: 1, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec!["[::1]:12345".parse().unwrap()], diff --git a/nexus/src/app/background/tasks/region_snapshot_replacement_step.rs b/nexus/src/app/background/tasks/region_snapshot_replacement_step.rs index a2287026b8..34807760e3 100644 --- a/nexus/src/app/background/tasks/region_snapshot_replacement_step.rs +++ b/nexus/src/app/background/tasks/region_snapshot_replacement_step.rs @@ -703,7 +703,7 @@ mod test { block_size: 0, blocks_per_extent: 0, extent_count: 0, - gen: 0, + r#gen: 0, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![snapshot_addr.into()], diff --git a/nexus/src/app/instance.rs b/nexus/src/app/instance.rs index 38a648472d..31889f9245 100644 --- a/nexus/src/app/instance.rs +++ b/nexus/src/app/instance.rs @@ -956,7 +956,11 @@ impl super::Nexus { InstanceStateChangeRequestAction::UpdateRuntime( db::model::InstanceRuntimeState { time_updated: chrono::Utc::now(), - r#gen: prev_runtime.r#gen.0.next().into(), + generation: prev_runtime + .generation + .0 + .next() + .into(), nexus_state: db::model::InstanceState::NoVmm, ..prev_runtime.clone() }, @@ -1305,7 +1309,7 @@ impl super::Nexus { // state. let vmm_runtime = sled_agent_client::types::VmmRuntimeState { time_updated: chrono::Utc::now(), - r#gen: initial_vmm.runtime.gen.next(), + r#gen: initial_vmm.runtime.generation.next(), state: match operation { InstanceRegisterReason::Migrate { .. } => { sled_agent_client::types::VmmState::Migrating @@ -1393,7 +1397,7 @@ impl super::Nexus { let new_runtime = VmmRuntimeState { state: db::model::VmmState::Failed, time_state_updated: chrono::Utc::now(), - r#gen: db::model::Generation(vmm.runtime.r#gen.next()), + generation: db::model::Generation(vmm.runtime.generation.next()), }; match self.db_datastore.vmm_update_runtime(&vmm_id, &new_runtime).await @@ -2080,7 +2084,7 @@ impl super::Nexus { log: &slog::Logger, saga: steno::SagaDag, instance_id: InstanceUuid, - ) -> impl std::future::Future + Send { + ) -> impl std::future::Future + Send + use<> { let sagas = self.sagas.clone(); let task_instance_updater = self.background_tasks.task_instance_updater.clone(); diff --git a/nexus/src/app/sagas/demo.rs b/nexus/src/app/sagas/demo.rs index d76a48688d..4750ed8167 100644 --- a/nexus/src/app/sagas/demo.rs +++ b/nexus/src/app/sagas/demo.rs @@ -58,7 +58,7 @@ impl CompletingDemoSagas { pub fn subscribe( &mut self, id: DemoSagaUuid, - ) -> impl Future> { + ) -> impl Future> + use<> { let sem = self.sagas.entry(id).or_insert_with(|| Arc::new(Semaphore::new(0))); let sem_clone = sem.clone(); diff --git a/nexus/src/app/sagas/disk_create.rs b/nexus/src/app/sagas/disk_create.rs index 7483452e0f..690d50f578 100644 --- a/nexus/src/app/sagas/disk_create.rs +++ b/nexus/src/app/sagas/disk_create.rs @@ -489,7 +489,7 @@ async fn sdc_regions_ensure( block_size, blocks_per_extent, extent_count, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: disk_id, target: datasets_and_regions diff --git a/nexus/src/app/sagas/finalize_disk.rs b/nexus/src/app/sagas/finalize_disk.rs index ae418903d3..d10bc6ab99 100644 --- a/nexus/src/app/sagas/finalize_disk.rs +++ b/nexus/src/app/sagas/finalize_disk.rs @@ -174,7 +174,7 @@ async fn sfd_set_finalizing_state( .await .map_err(ActionError::action_failed)?; - Ok(db_disk.runtime().gen) + Ok(db_disk.runtime().generation) } _ => Err(ActionError::action_failed(Error::invalid_request(&format!( @@ -211,7 +211,7 @@ async fn sfd_set_finalizing_state_undo( // import_read. Another saga racing with this one may have transitioned the disk to // finalizing - only set this disk to import_ready if the generation number matches this // saga. - if expected_disk_generation_number == db_disk.runtime().gen { + if expected_disk_generation_number == db_disk.runtime().generation { info!( log, "undo: setting disk {} state from finalizing to import_ready", @@ -232,7 +232,7 @@ async fn sfd_set_finalizing_state_undo( log, "disk {} has generation number {:?}, which doesn't match the expected {:?}: skip setting to import_ready", params.disk_id, - db_disk.runtime().gen, + db_disk.runtime().generation, expected_disk_generation_number, ); } @@ -362,7 +362,7 @@ async fn sfd_set_detached_state( match db_disk.state().into() { external::DiskState::Finalizing => { - if expected_disk_generation_number == db_disk.runtime().gen { + if expected_disk_generation_number == db_disk.runtime().generation { info!( log, "setting disk {} state from finalizing to detached", @@ -383,7 +383,7 @@ async fn sfd_set_detached_state( log, "disk {} has generation number {:?}, which doesn't match the expected {:?}: skip setting to detached", params.disk_id, - db_disk.runtime().gen, + db_disk.runtime().generation, expected_disk_generation_number, ); } diff --git a/nexus/src/app/sagas/instance_create.rs b/nexus/src/app/sagas/instance_create.rs index 1058f9797d..a8752873e8 100644 --- a/nexus/src/app/sagas/instance_create.rs +++ b/nexus/src/app/sagas/instance_create.rs @@ -492,21 +492,21 @@ async fn sic_create_network_interface( ) .await } - params::InstanceNetworkInterfaceAttachment::Create( - ref create_params, - ) => match create_params.get(nic_index) { - None => Ok(()), - Some(ref prs) => { - create_custom_network_interface( - &sagactx, - &saga_params, - instance_id, - interface_id, - prs, - ) - .await + params::InstanceNetworkInterfaceAttachment::Create(create_params) => { + match create_params.get(nic_index) { + None => Ok(()), + Some(ref prs) => { + create_custom_network_interface( + &sagactx, + &saga_params, + instance_id, + interface_id, + prs, + ) + .await + } } - }, + } } } @@ -1267,8 +1267,8 @@ async fn sic_move_to_stopped( // of date. let new_state = db::model::InstanceRuntimeState { nexus_state: db::model::InstanceState::NoVmm, - gen: db::model::Generation::from( - instance_record.runtime_state.gen.next(), + generation: db::model::Generation::from( + instance_record.runtime_state.generation.next(), ), ..instance_record.runtime_state }; diff --git a/nexus/src/app/sagas/instance_start.rs b/nexus/src/app/sagas/instance_start.rs index 881ee8c4e3..d350b247b1 100644 --- a/nexus/src/app/sagas/instance_start.rs +++ b/nexus/src/app/sagas/instance_start.rs @@ -397,7 +397,7 @@ async fn sis_move_to_starting( db::model::InstanceRuntimeState { nexus_state: db::model::InstanceState::Vmm, propolis_id: Some(propolis_id.into_untyped_uuid()), - r#gen: db_instance.runtime().r#gen.next().into(), + generation: db_instance.runtime().generation.next().into(), time_last_auto_restarted, ..db_instance.runtime_state } @@ -439,7 +439,7 @@ async fn sis_move_to_starting_undo( let new_runtime = db::model::InstanceRuntimeState { nexus_state: db::model::InstanceState::NoVmm, propolis_id: None, - gen: db_instance.runtime_state.gen.next().into(), + generation: db_instance.runtime_state.generation.next().into(), ..db_instance.runtime_state }; diff --git a/nexus/src/app/sagas/instance_update/mod.rs b/nexus/src/app/sagas/instance_update/mod.rs index af4d0c528b..73d7e72d07 100644 --- a/nexus/src/app/sagas/instance_update/mod.rs +++ b/nexus/src/app/sagas/instance_update/mod.rs @@ -513,7 +513,7 @@ impl UpdatesRequired { snapshot: &InstanceGestalt, ) -> Option { let mut new_runtime = snapshot.instance.runtime().clone(); - new_runtime.gen = Generation(new_runtime.gen.next()); + new_runtime.generation = Generation(new_runtime.generation.next()); new_runtime.time_updated = Utc::now(); let mut new_intent = None; let instance_id = snapshot.instance.id(); @@ -1692,7 +1692,9 @@ mod test { &instance_id, &InstanceRuntimeState { time_updated: Utc::now(), - gen: Generation(instance.runtime().gen.0.next()), + generation: Generation( + instance.runtime().generation.0.next(), + ), propolis_id: None, dst_propolis_id: None, migration_id: None, @@ -1918,7 +1920,7 @@ mod test { &vmm_id, &VmmRuntimeState { time_state_updated: Utc::now(), - gen: Generation(vmm.runtime.gen.0.next()), + generation: Generation(vmm.runtime.generation.0.next()), state: VmmState::Destroyed, }, ) @@ -2578,7 +2580,7 @@ mod test { let vmm_id = PropolisUuid::from_untyped_uuid(src_vmm.id); let new_runtime = nexus_db_model::VmmRuntimeState { time_state_updated: Utc::now(), - gen: Generation(src_vmm.runtime.gen.0.next()), + generation: Generation(src_vmm.runtime.generation.0.next()), state: vmm_state, }; @@ -2590,7 +2592,7 @@ mod test { let migration_out = MigrationRuntimeState { migration_id: migration.id, state: migration_state, - gen: migration.source_gen.0.next(), + generation: migration.source_gen.0.next(), time_updated: Utc::now(), }; let migrations = Migrations { @@ -2635,7 +2637,7 @@ mod test { let vmm_id = PropolisUuid::from_untyped_uuid(target_vmm.id); let new_runtime = nexus_db_model::VmmRuntimeState { time_state_updated: Utc::now(), - gen: Generation(target_vmm.runtime.gen.0.next()), + generation: Generation(target_vmm.runtime.generation.0.next()), state: vmm_state, }; @@ -2647,7 +2649,7 @@ mod test { let migration_in = MigrationRuntimeState { migration_id: migration.id, state: migration_state, - gen: migration.target_gen.0.next(), + generation: migration.target_gen.0.next(), time_updated: Utc::now(), }; let migrations = Migrations { diff --git a/nexus/src/app/sagas/region_replacement_finish.rs b/nexus/src/app/sagas/region_replacement_finish.rs index e16ebf5220..23bc425121 100644 --- a/nexus/src/app/sagas/region_replacement_finish.rs +++ b/nexus/src/app/sagas/region_replacement_finish.rs @@ -274,7 +274,7 @@ pub(crate) mod test { block_size: 0, blocks_per_extent: 0, extent_count: 0, - gen: 0, + r#gen: 0, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![ diff --git a/nexus/src/app/sagas/region_replacement_start.rs b/nexus/src/app/sagas/region_replacement_start.rs index eb7701c96e..119d25f316 100644 --- a/nexus/src/app/sagas/region_replacement_start.rs +++ b/nexus/src/app/sagas/region_replacement_start.rs @@ -683,7 +683,7 @@ async fn srrs_create_fake_volume( block_size: 0, blocks_per_extent: 0, extent_count: 0, - gen: 0, + r#gen: 0, opts: CrucibleOpts { id: *new_volume_id.as_untyped_uuid(), target: vec![old_region_address.into()], @@ -1075,8 +1075,8 @@ pub(crate) mod test { } } - VolumeConstructionRequest::Region { gen, .. } => { - *gen = 0; + VolumeConstructionRequest::Region { r#gen, .. } => { + *r#gen = 0; } _ => {} diff --git a/nexus/src/app/sagas/region_snapshot_replacement_garbage_collect.rs b/nexus/src/app/sagas/region_snapshot_replacement_garbage_collect.rs index 1ffc55ff5e..c13399d7d8 100644 --- a/nexus/src/app/sagas/region_snapshot_replacement_garbage_collect.rs +++ b/nexus/src/app/sagas/region_snapshot_replacement_garbage_collect.rs @@ -249,7 +249,7 @@ pub(crate) mod test { block_size: 0, blocks_per_extent: 0, extent_count: 0, - gen: 0, + r#gen: 0, opts: CrucibleOpts { id: *old_snapshot_volume_id.as_untyped_uuid(), target: vec![ diff --git a/nexus/src/app/sagas/region_snapshot_replacement_start.rs b/nexus/src/app/sagas/region_snapshot_replacement_start.rs index d3cf05af79..690599b5dd 100644 --- a/nexus/src/app/sagas/region_snapshot_replacement_start.rs +++ b/nexus/src/app/sagas/region_snapshot_replacement_start.rs @@ -876,7 +876,7 @@ async fn rsrss_new_region_volume_create( block_size: 0, blocks_per_extent: 0, extent_count: 0, - gen: 0, + r#gen: 0, opts: CrucibleOpts { id: new_region_volume_id.into_untyped_uuid(), target: vec![new_region_address], @@ -967,7 +967,7 @@ async fn rsrss_create_fake_volume( block_size: 0, blocks_per_extent: 0, extent_count: 0, - gen: 0, + r#gen: 0, opts: CrucibleOpts { id: *new_volume_id.as_untyped_uuid(), // Do not put the new region ID here: it will be deleted during diff --git a/nexus/src/app/sagas/region_snapshot_replacement_step.rs b/nexus/src/app/sagas/region_snapshot_replacement_step.rs index f5cbd08b58..caf8b2c856 100644 --- a/nexus/src/app/sagas/region_snapshot_replacement_step.rs +++ b/nexus/src/app/sagas/region_snapshot_replacement_step.rs @@ -277,7 +277,7 @@ async fn rssrs_create_fake_volume( block_size: 0, blocks_per_extent: 0, extent_count: 0, - gen: 0, + r#gen: 0, opts: CrucibleOpts { id: *new_volume_id.as_untyped_uuid(), target: vec![], diff --git a/nexus/src/app/sagas/region_snapshot_replacement_step_garbage_collect.rs b/nexus/src/app/sagas/region_snapshot_replacement_step_garbage_collect.rs index 87fb9da9f2..65ffaeedab 100644 --- a/nexus/src/app/sagas/region_snapshot_replacement_step_garbage_collect.rs +++ b/nexus/src/app/sagas/region_snapshot_replacement_step_garbage_collect.rs @@ -160,7 +160,7 @@ pub(crate) mod test { block_size: 0, blocks_per_extent: 0, extent_count: 0, - gen: 0, + r#gen: 0, opts: CrucibleOpts { id: *old_snapshot_volume_id.as_untyped_uuid(), target: vec![ diff --git a/nexus/src/app/sagas/snapshot_create.rs b/nexus/src/app/sagas/snapshot_create.rs index b889eb4394..42c54d101d 100644 --- a/nexus/src/app/sagas/snapshot_create.rs +++ b/nexus/src/app/sagas/snapshot_create.rs @@ -527,7 +527,7 @@ async fn ssc_regions_ensure( block_size, blocks_per_extent, extent_count, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: *destination_volume_id.as_untyped_uuid(), target: datasets_and_regions @@ -679,7 +679,7 @@ async fn ssc_create_snapshot_record( volume_id: volume_id.into(), destination_volume_id: destination_volume_id.into(), - gen: db::model::Generation::new(), + generation: db::model::Generation::new(), state: db::model::SnapshotState::Creating, block_size: disk.block_size, size: disk.size, @@ -1034,7 +1034,7 @@ async fn ssc_attach_disk_to_pantry( .await .map_err(ActionError::action_failed)?; - Ok(db_disk.runtime().gen) + Ok(db_disk.runtime().generation) } async fn ssc_attach_disk_to_pantry_undo( @@ -1327,7 +1327,7 @@ async fn ssc_detach_disk_from_pantry( // this saga's execution. let expected_disk_generation_number = sagactx.lookup::("disk_generation_number")?; - if expected_disk_generation_number == db_disk.runtime().gen { + if expected_disk_generation_number == db_disk.runtime().generation { info!( log, "setting disk {} state from maintenance to detached", @@ -1348,7 +1348,7 @@ async fn ssc_detach_disk_from_pantry( log, "disk {} has generation number {:?}, which doesn't match the expected {:?}: skip setting to detach", params.disk_id, - db_disk.runtime().gen, + db_disk.runtime().generation, expected_disk_generation_number, ); } @@ -1626,7 +1626,7 @@ async fn ssc_finalize_snapshot_record( .project_snapshot_update_state( &opctx, &authz_snapshot, - db_snapshot.gen, + db_snapshot.generation, db::model::SnapshotState::Ready, ) .await @@ -1813,7 +1813,7 @@ mod test { block_size: 512, blocks_per_extent: 10, extent_count: 20, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: Uuid::new_v4(), key: Some("tkBksPOA519q11jvLCCX5P8t8+kCX4ZNzr+QP8M+TSg=".into()), @@ -1839,7 +1839,7 @@ mod test { block_size: 512, blocks_per_extent: 10, extent_count: 80, - gen: 100, + r#gen: 100, opts: CrucibleOpts { id: Uuid::new_v4(), key: Some("jVex5Zfm+avnFMyezI6nCVPRPs53EWwYMN844XETDBM=".into()), diff --git a/nexus/src/internal_api/http_entrypoints.rs b/nexus/src/internal_api/http_entrypoints.rs index db5cb0302b..bda2715094 100644 --- a/nexus/src/internal_api/http_entrypoints.rs +++ b/nexus/src/internal_api/http_entrypoints.rs @@ -428,7 +428,7 @@ impl NexusInternalApi for NexusInternalApiImpl { .datastore() .nat_changeset(&opctx, path.from_gen, query.limit) .await?; - changeset.sort_by_key(|e| e.gen); + changeset.sort_by_key(|e| e.generation); Ok(HttpResponseOk(changeset)) }; apictx diff --git a/nexus/test-interface/Cargo.toml b/nexus/test-interface/Cargo.toml index 837786d678..20455777f9 100644 --- a/nexus/test-interface/Cargo.toml +++ b/nexus/test-interface/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-test-interface" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/test-utils-macros/Cargo.toml b/nexus/test-utils-macros/Cargo.toml index d5094f84eb..a40e15fa8c 100644 --- a/nexus/test-utils-macros/Cargo.toml +++ b/nexus/test-utils-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-test-utils-macros" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lib] diff --git a/nexus/test-utils/Cargo.toml b/nexus/test-utils/Cargo.toml index 5c84ccff88..6a0da7d188 100644 --- a/nexus/test-utils/Cargo.toml +++ b/nexus/test-utils/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-test-utils" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/tests/integration_tests/metrics.rs b/nexus/tests/integration_tests/metrics.rs index effb5a7bd4..1664fd2eb5 100644 --- a/nexus/tests/integration_tests/metrics.rs +++ b/nexus/tests/integration_tests/metrics.rs @@ -297,7 +297,7 @@ async fn test_instance_watcher_metrics( ) } match timeseries.points.values(0) { - Some(ValueArray::Integer(ref vals)) => { + Some(ValueArray::Integer(vals)) => { Ok(vals.iter().filter_map(|&v| v).sum()) } x => panic!( diff --git a/nexus/tests/integration_tests/snapshots.rs b/nexus/tests/integration_tests/snapshots.rs index 80807a78eb..7db89aaf83 100644 --- a/nexus/tests/integration_tests/snapshots.rs +++ b/nexus/tests/integration_tests/snapshots.rs @@ -582,7 +582,7 @@ async fn test_reject_creating_disk_from_snapshot( volume_id: VolumeUuid::new_v4().into(), destination_volume_id: VolumeUuid::new_v4().into(), - gen: db::model::Generation::new(), + generation: db::model::Generation::new(), state: db::model::SnapshotState::Creating, block_size: db::model::BlockSize::AdvancedFormat, @@ -735,7 +735,7 @@ async fn test_reject_creating_disk_from_illegal_snapshot( volume_id: VolumeUuid::new_v4().into(), destination_volume_id: VolumeUuid::new_v4().into(), - gen: db::model::Generation::new(), + generation: db::model::Generation::new(), state: db::model::SnapshotState::Creating, block_size: db::model::BlockSize::AdvancedFormat, @@ -831,7 +831,7 @@ async fn test_reject_creating_disk_from_other_project_snapshot( volume_id: VolumeUuid::new_v4().into(), destination_volume_id: VolumeUuid::new_v4().into(), - gen: db::model::Generation::new(), + generation: db::model::Generation::new(), state: db::model::SnapshotState::Creating, block_size: db::model::BlockSize::AdvancedFormat, @@ -1049,7 +1049,7 @@ async fn test_create_snapshot_record_idempotent( volume_id: VolumeUuid::new_v4().into(), destination_volume_id: VolumeUuid::new_v4().into(), - gen: db::model::Generation::new(), + generation: db::model::Generation::new(), state: db::model::SnapshotState::Creating, block_size: db::model::BlockSize::Traditional, size: external::ByteCount::try_from(1024u32).unwrap().into(), @@ -1100,7 +1100,7 @@ async fn test_create_snapshot_record_idempotent( volume_id: VolumeUuid::new_v4().into(), destination_volume_id: VolumeUuid::new_v4().into(), - gen: db::model::Generation::new(), + generation: db::model::Generation::new(), state: db::model::SnapshotState::Creating, block_size: db::model::BlockSize::Traditional, size: external::ByteCount::try_from(1024u32).unwrap().into(), @@ -1127,7 +1127,7 @@ async fn test_create_snapshot_record_idempotent( .project_snapshot_update_state( &opctx, &authz_snapshot, - db_snapshot.gen, + db_snapshot.generation, db::model::SnapshotState::Ready, ) .await @@ -1201,7 +1201,7 @@ async fn test_create_snapshot_record_idempotent( volume_id: VolumeUuid::new_v4().into(), destination_volume_id: VolumeUuid::new_v4().into(), - gen: db::model::Generation::new(), + generation: db::model::Generation::new(), state: db::model::SnapshotState::Creating, block_size: db::model::BlockSize::Traditional, size: external::ByteCount::try_from(1024u32).unwrap().into(), diff --git a/nexus/tests/integration_tests/volume_management.rs b/nexus/tests/integration_tests/volume_management.rs index 806e1aa9d6..9758780346 100644 --- a/nexus/tests/integration_tests/volume_management.rs +++ b/nexus/tests/integration_tests/volume_management.rs @@ -2217,7 +2217,7 @@ async fn test_keep_your_targets_straight(cptestctx: &ControlPlaneTestContext) { block_size: 512, blocks_per_extent: 1, extent_count: 1, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![ @@ -2337,7 +2337,7 @@ async fn test_keep_your_targets_straight(cptestctx: &ControlPlaneTestContext) { block_size: 512, blocks_per_extent: 1, extent_count: 1, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![ @@ -2568,14 +2568,14 @@ async fn test_snapshot_create_saga_unwinds_correctly( // and UUID you passed in. fn create_region( block_size: u64, - gen: u64, + r#gen: u64, id: Uuid, ) -> VolumeConstructionRequest { VolumeConstructionRequest::Region { block_size, blocks_per_extent: 1, extent_count: 1, - gen, + r#gen, opts: CrucibleOpts { id, target: Vec::new(), @@ -2618,10 +2618,10 @@ fn volume_match_gen( block_size: _, blocks_per_extent: _, extent_count: _, - gen, + r#gen, opts: _, } => { - assert_eq!(*gen, expected_gen[index].unwrap()); + assert_eq!(*r#gen, expected_gen[index].unwrap()); } _ => { assert!(expected_gen[index].is_none()); @@ -3465,7 +3465,7 @@ impl TestReadOnlyRegionReferenceUsage { block_size: 512, blocks_per_extent: self.region.blocks_per_extent(), extent_count: self.region.extent_count() as u32, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![self.region_address.into()], @@ -3603,7 +3603,7 @@ impl TestReadOnlyRegionReferenceUsage { block_size: 512, blocks_per_extent: self.region.blocks_per_extent(), extent_count: self.region.extent_count() as u32, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![self.region_address.into()], @@ -3635,7 +3635,7 @@ impl TestReadOnlyRegionReferenceUsage { block_size: 512, blocks_per_extent: self.region.blocks_per_extent(), extent_count: self.region.extent_count() as u32, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![self.region_address.into()], @@ -3669,7 +3669,7 @@ impl TestReadOnlyRegionReferenceUsage { block_size: 512, blocks_per_extent: self.region.blocks_per_extent(), extent_count: self.region.extent_count() as u32, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![self.region_address.into()], @@ -5299,7 +5299,7 @@ async fn test_migrate_to_ref_count_with_records_region_snapshot_deleting( block_size: 512, blocks_per_extent: 1, extent_count: 1, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![ @@ -5336,7 +5336,7 @@ async fn test_migrate_to_ref_count_with_records_region_snapshot_deleting( block_size: 512, blocks_per_extent: 1, extent_count: 1, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![ @@ -5910,7 +5910,7 @@ async fn test_no_zombie_read_only_regions(cptestctx: &ControlPlaneTestContext) { block_size: 512, blocks_per_extent: 1, extent_count: 1, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![ @@ -6095,7 +6095,7 @@ async fn test_no_zombie_read_write_regions( block_size: 512, blocks_per_extent: 1, extent_count: 1, - gen: 1, + r#gen: 1, opts: CrucibleOpts { id: Uuid::new_v4(), target: vec![ diff --git a/nexus/tests/integration_tests/webhooks.rs b/nexus/tests/integration_tests/webhooks.rs index dab34a8d3e..33d7cfe235 100644 --- a/nexus/tests/integration_tests/webhooks.rs +++ b/nexus/tests/integration_tests/webhooks.rs @@ -259,7 +259,7 @@ async fn alert_receiver_send_probe( fn is_valid_for_webhook( webhook: &views::WebhookReceiver, -) -> impl FnOnce(httpmock::When) -> httpmock::When { +) -> impl FnOnce(httpmock::When) -> httpmock::When + use<> { let path = webhook.config.endpoint.path().to_string(); let id = webhook.identity.id.to_string(); move |when| { diff --git a/nexus/types/Cargo.toml b/nexus/types/Cargo.toml index 3218549670..713cc40799 100644 --- a/nexus/types/Cargo.toml +++ b/nexus/types/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nexus-types" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/nexus/types/src/deployment.rs b/nexus/types/src/deployment.rs index d1fb771927..867d994c9f 100644 --- a/nexus/types/src/deployment.rs +++ b/nexus/types/src/deployment.rs @@ -456,22 +456,22 @@ impl Blueprint { &self, nexus_zones: &BTreeSet, ) -> Result, anyhow::Error> { - let mut gen = None; + let mut r#gen = None; for (_, zone, nexus_zone) in self.all_nexus_zones(BlueprintZoneDisposition::is_in_service) { if nexus_zones.contains(&zone.id) { let found_gen = nexus_zone.nexus_generation; - if let Some(gen) = gen { - if found_gen != gen { + if let Some(r#gen) = r#gen { + if found_gen != r#gen { bail!("Multiple generations found for these zones"); } } - gen = Some(found_gen); + r#gen = Some(found_gen); } } - Ok(gen) + Ok(r#gen) } /// Returns the Nexus generation number for Nexus `nexus_id`, which is @@ -550,7 +550,7 @@ impl<'a> BlueprintHostPhase2TableData<'a> { fn diff_rows<'b>( diffs: &'b BlueprintHostPhase2DesiredSlotsDiff<'_>, - ) -> impl Iterator + 'b { + ) -> impl Iterator + 'b + use<'b> { [(M2Slot::A, &diffs.slot_a), (M2Slot::B, &diffs.slot_b)] .into_iter() .map(|(slot, diff)| { @@ -1063,7 +1063,7 @@ impl ZoneSortKey for OmicronZoneConfig { } } -fn zone_sort_key(z: &T) -> impl Ord { +fn zone_sort_key(z: &T) -> impl Ord + use { // First sort by kind, then by ID. This makes it so that zones of the same // kind (e.g. Crucible zones) are grouped together. (z.kind(), z.id()) diff --git a/nexus/types/src/deployment/blueprint_diff.rs b/nexus/types/src/deployment/blueprint_diff.rs index 55d36a4a89..8c58f38e6a 100644 --- a/nexus/types/src/deployment/blueprint_diff.rs +++ b/nexus/types/src/deployment/blueprint_diff.rs @@ -124,7 +124,9 @@ impl<'a> BlueprintDiffSummary<'a> { } /// All sled IDs present in the diff in any way - pub fn all_sled_ids(&self) -> impl Iterator + '_ { + pub fn all_sled_ids( + &self, + ) -> impl Iterator + '_ + use<'_> { self.diff .sleds .added @@ -1787,7 +1789,7 @@ impl<'diff, 'b> BlueprintDiffDisplay<'diff, 'b> { pub fn make_metadata_diff_tables( &self, - ) -> impl IntoIterator { + ) -> impl IntoIterator + use<> { macro_rules! diff_row { ($member:ident, $label:expr) => { diff_row!($member, $label, std::convert::identity) @@ -1848,7 +1850,7 @@ impl<'diff, 'b> BlueprintDiffDisplay<'diff, 'b> { pub fn make_oximeter_read_diff_tables( &self, - ) -> impl IntoIterator { + ) -> impl IntoIterator + use<> { macro_rules! diff_row { ($member:ident, $label:expr) => { diff_row!($member, $label, std::convert::identity) diff --git a/nexus/types/src/deployment/planning_report.rs b/nexus/types/src/deployment/planning_report.rs index 61b2d25497..fc7f374b42 100644 --- a/nexus/types/src/deployment/planning_report.rs +++ b/nexus/types/src/deployment/planning_report.rs @@ -1547,7 +1547,7 @@ impl fmt::Display for PlanningNexusGenerationBumpReport { why.as_str() )?; } - Self::BumpingGeneration(gen) => { + Self::BumpingGeneration(r#gen) => { writeln!(f, "* updating top-level nexus_generation to: {gen}")?; } // Nothing to report diff --git a/nexus/types/src/external_api/params.rs b/nexus/types/src/external_api/params.rs index a285d863d0..3a940b182b 100644 --- a/nexus/types/src/external_api/params.rs +++ b/nexus/types/src/external_api/params.rs @@ -565,7 +565,7 @@ impl JsonSchema for Password { } fn json_schema( - _: &mut schemars::gen::SchemaGenerator, + _: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { schemars::schema::SchemaObject { metadata: Some(Box::new(schemars::schema::Metadata { @@ -1419,7 +1419,7 @@ impl JsonSchema for UserData { } fn json_schema( - _: &mut schemars::gen::SchemaGenerator, + _: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { schemars::schema::SchemaObject { instance_type: Some(schemars::schema::InstanceType::String.into()), @@ -1656,7 +1656,7 @@ impl JsonSchema for BlockSize { } fn json_schema( - _: &mut schemars::gen::SchemaGenerator, + _: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { schemars::schema::Schema::Object(schemars::schema::SchemaObject { metadata: Some(Box::new(schemars::schema::Metadata { diff --git a/nexus/types/src/external_api/shared.rs b/nexus/types/src/external_api/shared.rs index 42a64b72c4..8baeedf774 100644 --- a/nexus/types/src/external_api/shared.rs +++ b/nexus/types/src/external_api/shared.rs @@ -441,12 +441,12 @@ impl SwitchLinkState { impl JsonSchema for SwitchLinkState { fn json_schema( - gen: &mut schemars::gen::SchemaGenerator, + r#gen: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { let obj = schemars::schema::Schema::Object( schemars::schema::SchemaObject::default(), ); - gen.definitions_mut().insert(Self::schema_name(), obj.clone()); + r#gen.definitions_mut().insert(Self::schema_name(), obj.clone()); obj } @@ -521,7 +521,7 @@ impl JsonSchema for AlertSubscription { } fn json_schema( - _: &mut schemars::gen::SchemaGenerator, + _: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { schemars::schema::SchemaObject { metadata: Some(Box::new(schemars::schema::Metadata { diff --git a/nexus/types/src/internal_api/views.rs b/nexus/types/src/internal_api/views.rs index c6b86db6a2..165e3b0f66 100644 --- a/nexus/types/src/internal_api/views.rs +++ b/nexus/types/src/internal_api/views.rs @@ -352,7 +352,8 @@ pub struct NatEntryView { pub sled_address: Ipv6Addr, pub vni: Vni, pub mac: MacAddr, - pub gen: i64, + #[serde(rename = "gen")] + pub generation: i64, pub deleted: bool, } diff --git a/ntp-admin/Cargo.toml b/ntp-admin/Cargo.toml index 5a6df68078..3d0a4aa3bd 100644 --- a/ntp-admin/Cargo.toml +++ b/ntp-admin/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-ntp-admin" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [build-dependencies] diff --git a/ntp-admin/api/Cargo.toml b/ntp-admin/api/Cargo.toml index 0438706050..9fa95e2e53 100644 --- a/ntp-admin/api/Cargo.toml +++ b/ntp-admin/api/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ntp-admin-api" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/ntp-admin/types/Cargo.toml b/ntp-admin/types/Cargo.toml index c60677e510..3c8cd84fce 100644 --- a/ntp-admin/types/Cargo.toml +++ b/ntp-admin/types/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ntp-admin-types" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/oximeter/api/Cargo.toml b/oximeter/api/Cargo.toml index 7de58d1c68..3a8649d59e 100644 --- a/oximeter/api/Cargo.toml +++ b/oximeter/api/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "oximeter-api" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/oximeter/collector/Cargo.toml b/oximeter/collector/Cargo.toml index a7c9183c82..70d74bc481 100644 --- a/oximeter/collector/Cargo.toml +++ b/oximeter/collector/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "oximeter-collector" version = "0.1.0" -edition = "2021" +edition.workspace = true description = "The oximeter metric collection server" license = "MPL-2.0" diff --git a/oximeter/db/Cargo.toml b/oximeter/db/Cargo.toml index 9e47a2df2b..8bb185195b 100644 --- a/oximeter/db/Cargo.toml +++ b/oximeter/db/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "oximeter-db" version = "0.1.0" -edition = "2021" +edition.workspace = true description = "Tools for interacting with the Oxide control plane telemetry database" license = "MPL-2.0" diff --git a/oximeter/db/src/client/mod.rs b/oximeter/db/src/client/mod.rs index 55be3d2d21..195769dedc 100644 --- a/oximeter/db/src/client/mod.rs +++ b/oximeter/db/src/client/mod.rs @@ -299,8 +299,8 @@ impl Client { limit: NonZeroU32, ) -> Result, Error> { let (params, offset) = match page { - WhichPage::First(ref params) => (params, 0), - WhichPage::Next(ref sel) => (&sel.params, sel.offset.get()), + WhichPage::First(params) => (params, 0), + WhichPage::Next(sel) => (&sel.params, sel.offset.get()), }; let schema = self .schema_for_timeseries(¶ms.timeseries_name) @@ -392,7 +392,7 @@ impl Client { limit.get(), ) } - WhichPage::Next(ref last_timeseries) => { + WhichPage::Next(last_timeseries) => { format!( concat!( "SELECT * FROM {}.timeseries_schema ", diff --git a/oximeter/db/src/model/measurements.rs b/oximeter/db/src/model/measurements.rs index 4b938c53c2..ca8c3529ee 100644 --- a/oximeter/db/src/model/measurements.rs +++ b/oximeter/db/src/model/measurements.rs @@ -246,7 +246,7 @@ fn insert_datum_columns(datum: &Datum, columns: &mut IndexMap) { /// Build the measurement columns for a missing datum. fn build_missing_measurement_columns( missing: &MissingDatum, -) -> impl Iterator { +) -> impl Iterator + use<> { let mut columns = IndexMap::new(); match missing.datum_type() { DatumType::Bool => { @@ -420,7 +420,7 @@ impl_convert_bin_type! {f64, DataType::Float64} /// counts array, which is always a `u64`. fn build_histogram_measurement_columns( hist: &Histogram, -) -> impl Iterator +) -> impl Iterator + use where T: ConvertBinType, { diff --git a/oximeter/db/src/query.rs b/oximeter/db/src/query.rs index df97bc13c6..9be6c0ff35 100644 --- a/oximeter/db/src/query.rs +++ b/oximeter/db/src/query.rs @@ -732,26 +732,26 @@ impl SelectQuery { // Format the value for use in a query to the database, e.g., `... WHERE field_value = {}`. fn field_as_db_str(value: &FieldValue) -> String { match value { - FieldValue::Bool(ref inner) => { + FieldValue::Bool(inner) => { format!("{}", if *inner { 1 } else { 0 }) } - FieldValue::I8(ref inner) => format!("{}", inner), - FieldValue::U8(ref inner) => format!("{}", inner), - FieldValue::I16(ref inner) => format!("{}", inner), - FieldValue::U16(ref inner) => format!("{}", inner), - FieldValue::I32(ref inner) => format!("{}", inner), - FieldValue::U32(ref inner) => format!("{}", inner), - FieldValue::I64(ref inner) => format!("{}", inner), - FieldValue::U64(ref inner) => format!("{}", inner), - FieldValue::IpAddr(ref inner) => { + FieldValue::I8(inner) => format!("{}", inner), + FieldValue::U8(inner) => format!("{}", inner), + FieldValue::I16(inner) => format!("{}", inner), + FieldValue::U16(inner) => format!("{}", inner), + FieldValue::I32(inner) => format!("{}", inner), + FieldValue::U32(inner) => format!("{}", inner), + FieldValue::I64(inner) => format!("{}", inner), + FieldValue::U64(inner) => format!("{}", inner), + FieldValue::IpAddr(inner) => { let addr = match inner { - IpAddr::V4(ref v4) => v4.to_ipv6_mapped(), - IpAddr::V6(ref v6) => *v6, + IpAddr::V4(v4) => v4.to_ipv6_mapped(), + IpAddr::V6(v6) => *v6, }; format!("'{}'", addr) } - FieldValue::String(ref inner) => format!("'{}'", inner), - FieldValue::Uuid(ref inner) => format!("'{}'", inner), + FieldValue::String(inner) => format!("'{}'", inner), + FieldValue::Uuid(inner) => format!("'{}'", inner), } } diff --git a/oximeter/db/src/sql/mod.rs b/oximeter/db/src/sql/mod.rs index 55dcc9341b..07c27876e5 100644 --- a/oximeter/db/src/sql/mod.rs +++ b/oximeter/db/src/sql/mod.rs @@ -837,7 +837,7 @@ impl RestrictedQuery { relation: &mut TableFactor, ) -> Result, OxdbError> { match relation { - TableFactor::Table { ref mut name, args, with_hints, .. } => { + TableFactor::Table { name, args, with_hints, .. } => { if args.is_some() || !with_hints.is_empty() { return unsupported!( "Table functions and hints are not supported" diff --git a/oximeter/instruments/Cargo.toml b/oximeter/instruments/Cargo.toml index 831f102c66..b0d5b35410 100644 --- a/oximeter/instruments/Cargo.toml +++ b/oximeter/instruments/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "oximeter-instruments" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/oximeter/instruments/src/http.rs b/oximeter/instruments/src/http.rs index c30a96a785..2f63e38b4b 100644 --- a/oximeter/instruments/src/http.rs +++ b/oximeter/instruments/src/http.rs @@ -174,7 +174,7 @@ impl LatencyTracker { let latency = start.elapsed(); let status_code = match &result { Ok(response) => response.status_code(), - Err(ref e) => e.status_code().as_status(), + Err(e) => e.status_code().as_status(), }; if let Err(e) = self.update(&context.endpoint.operation_id, status_code, latency) diff --git a/oximeter/oximeter-macro-impl/Cargo.toml b/oximeter/oximeter-macro-impl/Cargo.toml index d0a8c5f566..0ee8e4c771 100644 --- a/oximeter/oximeter-macro-impl/Cargo.toml +++ b/oximeter/oximeter-macro-impl/Cargo.toml @@ -2,7 +2,7 @@ name = "oximeter-macro-impl" version = "0.1.0" authors = ["Benjamin Naecker "] -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lib] diff --git a/oximeter/oximeter/Cargo.toml b/oximeter/oximeter/Cargo.toml index 63b370bee6..486922024e 100644 --- a/oximeter/oximeter/Cargo.toml +++ b/oximeter/oximeter/Cargo.toml @@ -2,7 +2,7 @@ name = "oximeter" version = "0.1.0" authors = ["Benjamin Naecker "] -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/oximeter/oxql-types/Cargo.toml b/oximeter/oxql-types/Cargo.toml index 6acfeacc50..387d24b8dd 100644 --- a/oximeter/oxql-types/Cargo.toml +++ b/oximeter/oxql-types/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "oxql-types" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/oximeter/producer/Cargo.toml b/oximeter/producer/Cargo.toml index cc1036a824..65c777c212 100644 --- a/oximeter/producer/Cargo.toml +++ b/oximeter/producer/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "oximeter-producer" version = "0.1.0" -edition = "2021" +edition.workspace = true description = "Crate for producing metric data to be collected by the Oxide control plane" license = "MPL-2.0" diff --git a/oximeter/schema/Cargo.toml b/oximeter/schema/Cargo.toml index fe2e28705a..a0a1058aac 100644 --- a/oximeter/schema/Cargo.toml +++ b/oximeter/schema/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "oximeter-schema" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/oximeter/test-utils/Cargo.toml b/oximeter/test-utils/Cargo.toml index adca1a51c8..67b0873471 100644 --- a/oximeter/test-utils/Cargo.toml +++ b/oximeter/test-utils/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "oximeter-test-utils" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/oximeter/timeseries-macro/Cargo.toml b/oximeter/timeseries-macro/Cargo.toml index 2fb8b8f312..ddca40a94d 100644 --- a/oximeter/timeseries-macro/Cargo.toml +++ b/oximeter/timeseries-macro/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "oximeter-timeseries-macro" version = "0.1.0" -edition = "2021" +edition.workspace = true [lib] proc-macro = true diff --git a/oximeter/types/Cargo.toml b/oximeter/types/Cargo.toml index 3f4ab66c2e..a8513ba9ce 100644 --- a/oximeter/types/Cargo.toml +++ b/oximeter/types/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "oximeter-types" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/oximeter/types/src/schema.rs b/oximeter/types/src/schema.rs index c51b4f102a..1e1bff265e 100644 --- a/oximeter/types/src/schema.rs +++ b/oximeter/types/src/schema.rs @@ -96,7 +96,7 @@ impl JsonSchema for TimeseriesName { } fn json_schema( - _: &mut schemars::gen::SchemaGenerator, + _: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { schemars::schema::SchemaObject { metadata: Some(Box::new(schemars::schema::Metadata { diff --git a/oximeter/types/src/types.rs b/oximeter/types/src/types.rs index 515e84ea9b..ffdd276e19 100644 --- a/oximeter/types/src/types.rs +++ b/oximeter/types/src/types.rs @@ -217,18 +217,18 @@ impl FieldValue { impl fmt::Display for FieldValue { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - FieldValue::String(ref inner) => write!(f, "{}", inner), - FieldValue::I8(ref inner) => write!(f, "{}", inner), - FieldValue::U8(ref inner) => write!(f, "{}", inner), - FieldValue::I16(ref inner) => write!(f, "{}", inner), - FieldValue::U16(ref inner) => write!(f, "{}", inner), - FieldValue::I32(ref inner) => write!(f, "{}", inner), - FieldValue::U32(ref inner) => write!(f, "{}", inner), - FieldValue::I64(ref inner) => write!(f, "{}", inner), - FieldValue::U64(ref inner) => write!(f, "{}", inner), - FieldValue::IpAddr(ref inner) => write!(f, "{}", inner), - FieldValue::Uuid(ref inner) => write!(f, "{}", inner), - FieldValue::Bool(ref inner) => write!(f, "{}", inner), + FieldValue::String(inner) => write!(f, "{}", inner), + FieldValue::I8(inner) => write!(f, "{}", inner), + FieldValue::U8(inner) => write!(f, "{}", inner), + FieldValue::I16(inner) => write!(f, "{}", inner), + FieldValue::U16(inner) => write!(f, "{}", inner), + FieldValue::I32(inner) => write!(f, "{}", inner), + FieldValue::U32(inner) => write!(f, "{}", inner), + FieldValue::I64(inner) => write!(f, "{}", inner), + FieldValue::U64(inner) => write!(f, "{}", inner), + FieldValue::IpAddr(inner) => write!(f, "{}", inner), + FieldValue::Uuid(inner) => write!(f, "{}", inner), + FieldValue::Bool(inner) => write!(f, "{}", inner), } } } @@ -456,7 +456,7 @@ impl Datum { Datum::HistogramU64(_) => DatumType::HistogramU64, Datum::HistogramF32(_) => DatumType::HistogramF32, Datum::HistogramF64(_) => DatumType::HistogramF64, - Datum::Missing(ref inner) => inner.datum_type(), + Datum::Missing(inner) => inner.datum_type(), } } @@ -481,21 +481,21 @@ impl Datum { | Datum::F64(_) | Datum::String(_) | Datum::Bytes(_) => None, - Datum::CumulativeI64(ref inner) => Some(inner.start_time()), - Datum::CumulativeU64(ref inner) => Some(inner.start_time()), - Datum::CumulativeF32(ref inner) => Some(inner.start_time()), - Datum::CumulativeF64(ref inner) => Some(inner.start_time()), - Datum::HistogramI8(ref inner) => Some(inner.start_time()), - Datum::HistogramU8(ref inner) => Some(inner.start_time()), - Datum::HistogramI16(ref inner) => Some(inner.start_time()), - Datum::HistogramU16(ref inner) => Some(inner.start_time()), - Datum::HistogramI32(ref inner) => Some(inner.start_time()), - Datum::HistogramU32(ref inner) => Some(inner.start_time()), - Datum::HistogramI64(ref inner) => Some(inner.start_time()), - Datum::HistogramU64(ref inner) => Some(inner.start_time()), - Datum::HistogramF32(ref inner) => Some(inner.start_time()), - Datum::HistogramF64(ref inner) => Some(inner.start_time()), - Datum::Missing(ref inner) => inner.start_time(), + Datum::CumulativeI64(inner) => Some(inner.start_time()), + Datum::CumulativeU64(inner) => Some(inner.start_time()), + Datum::CumulativeF32(inner) => Some(inner.start_time()), + Datum::CumulativeF64(inner) => Some(inner.start_time()), + Datum::HistogramI8(inner) => Some(inner.start_time()), + Datum::HistogramU8(inner) => Some(inner.start_time()), + Datum::HistogramI16(inner) => Some(inner.start_time()), + Datum::HistogramU16(inner) => Some(inner.start_time()), + Datum::HistogramI32(inner) => Some(inner.start_time()), + Datum::HistogramU32(inner) => Some(inner.start_time()), + Datum::HistogramI64(inner) => Some(inner.start_time()), + Datum::HistogramU64(inner) => Some(inner.start_time()), + Datum::HistogramF32(inner) => Some(inner.start_time()), + Datum::HistogramF64(inner) => Some(inner.start_time()), + Datum::Missing(inner) => inner.start_time(), } } diff --git a/package/Cargo.toml b/package/Cargo.toml index 0d73d80d9b..0e04c4f666 100644 --- a/package/Cargo.toml +++ b/package/Cargo.toml @@ -2,7 +2,7 @@ name = "omicron-package" description = "Tools for building and installing Omicron packages" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/parallel-task-set/Cargo.toml b/parallel-task-set/Cargo.toml index a53f1945fc..8e15efc6f4 100644 --- a/parallel-task-set/Cargo.toml +++ b/parallel-task-set/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "parallel-task-set" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [dependencies] diff --git a/passwords/Cargo.toml b/passwords/Cargo.toml index 413825196b..881bde7ed6 100644 --- a/passwords/Cargo.toml +++ b/passwords/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-passwords" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/passwords/src/lib.rs b/passwords/src/lib.rs index 93fa064464..70d14489d3 100644 --- a/passwords/src/lib.rs +++ b/passwords/src/lib.rs @@ -176,7 +176,7 @@ impl JsonSchema for NewPasswordHash { } fn json_schema( - _: &mut schemars::gen::SchemaGenerator, + _: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { schemars::schema::SchemaObject { metadata: Some(Box::new(schemars::schema::Metadata { diff --git a/range-requests/Cargo.toml b/range-requests/Cargo.toml index ab9972180d..3b9180e5ed 100644 --- a/range-requests/Cargo.toml +++ b/range-requests/Cargo.toml @@ -2,7 +2,7 @@ name = "range-requests" description = "Helpers for making and receiving range requests" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/rpaths/Cargo.toml b/rpaths/Cargo.toml index 5e54e9e87b..a3fdc56cb1 100644 --- a/rpaths/Cargo.toml +++ b/rpaths/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-rpaths" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/rustfmt.toml b/rustfmt.toml index 2a1f85b640..8a0aff38f4 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -3,5 +3,5 @@ # --------------------------------------------------------------------------- max_width = 80 use_small_heuristics = "max" -edition = "2021" +edition = "2024" style_edition = "2024" diff --git a/sled-agent/Cargo.toml b/sled-agent/Cargo.toml index 0d152763c8..df4a06941c 100644 --- a/sled-agent/Cargo.toml +++ b/sled-agent/Cargo.toml @@ -2,7 +2,7 @@ name = "omicron-sled-agent" description = "Services for managing sled-local resources" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/sled-agent/api/Cargo.toml b/sled-agent/api/Cargo.toml index 3dfdfd9b32..385b578b0a 100644 --- a/sled-agent/api/Cargo.toml +++ b/sled-agent/api/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sled-agent-api" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/sled-agent/bootstrap-agent-api/Cargo.toml b/sled-agent/bootstrap-agent-api/Cargo.toml index ce4d486311..fca38ae7f4 100644 --- a/sled-agent/bootstrap-agent-api/Cargo.toml +++ b/sled-agent/bootstrap-agent-api/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bootstrap-agent-api" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/sled-agent/config-reconciler/Cargo.toml b/sled-agent/config-reconciler/Cargo.toml index 4fb9b30818..13a3b709ac 100644 --- a/sled-agent/config-reconciler/Cargo.toml +++ b/sled-agent/config-reconciler/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sled-agent-config-reconciler" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/sled-agent/repo-depot-api/Cargo.toml b/sled-agent/repo-depot-api/Cargo.toml index c4a7ead2ee..637bee1167 100644 --- a/sled-agent/repo-depot-api/Cargo.toml +++ b/sled-agent/repo-depot-api/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "repo-depot-api" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/sled-agent/src/common/disk.rs b/sled-agent/src/common/disk.rs index ba50d0f7c1..cec63d745e 100644 --- a/sled-agent/src/common/disk.rs +++ b/sled-agent/src/common/disk.rs @@ -80,7 +80,7 @@ impl DiskStates { // TODO: Deal with no-op transition? self.current = DiskRuntimeState { disk_state: next, - gen: self.current.gen.next(), + generation: self.current.generation.next(), time_updated: Utc::now(), }; self.desired = desired; diff --git a/sled-agent/src/common/instance.rs b/sled-agent/src/common/instance.rs index af76d4cb0e..160cbe21db 100644 --- a/sled-agent/src/common/instance.rs +++ b/sled-agent/src/common/instance.rs @@ -178,7 +178,7 @@ impl InstanceStates { migration_id.map(|migration_id| MigrationRuntimeState { migration_id, state: MigrationState::Pending, - gen: Generation::new(), + generation: Generation::new(), time_updated: Utc::now(), }); InstanceStates { vmm, migration_in, migration_out: None } @@ -222,7 +222,7 @@ impl InstanceStates { ObservedMigrationState { id, state }: ObservedMigrationState, now: DateTime, ) { - if let Some(ref mut m) = current { + if let Some(m) = current { // Don't generate spurious state updates if the migration is already in // the state we're transitioning to. if m.migration_id == id && m.state == state { @@ -230,10 +230,10 @@ impl InstanceStates { } m.state = state; if m.migration_id == id { - m.gen = m.gen.next(); + m.generation = m.generation.next(); } else { m.migration_id = id; - m.gen = Generation::new().next(); + m.generation = Generation::new().next(); } m.time_updated = now; } else { @@ -245,7 +245,7 @@ impl InstanceStates { // to advance the initial generation once to be ahead of // what the generation in the database is when Nexus creates // the initial migration record at generation 1. - gen: Generation::new().next(), + generation: Generation::new().next(), state, time_updated: now, }); @@ -257,14 +257,14 @@ impl InstanceStates { now: DateTime, ) { if !migration.state.is_terminal() { - migration.gen = migration.gen.next(); + migration.generation = migration.generation.next(); migration.time_updated = now; migration.state = MigrationState::Failed; } } self.vmm.state = observed.vmm_state.into(); - self.vmm.gen = self.vmm.gen.next(); + self.vmm.generation = self.vmm.generation.next(); self.vmm.time_updated = observed.time; // Update the instance record to reflect the result of any completed @@ -296,7 +296,7 @@ impl InstanceStates { now: DateTime, ) { self.vmm.state = next.into(); - self.vmm.gen = self.vmm.gen.next(); + self.vmm.generation = self.vmm.generation.next(); self.vmm.time_updated = now; } @@ -345,7 +345,7 @@ mod test { let vmm = VmmRuntimeState { state: VmmState::Starting, - gen: Generation::new(), + generation: Generation::new(), time_updated: now, }; @@ -361,7 +361,7 @@ mod test { state: MigrationState::InProgress, // advance the generation once, since we are starting out in the // `InProgress` state. - gen: Generation::new().next(), + generation: Generation::new().next(), time_updated: Utc::now(), }); @@ -373,7 +373,7 @@ mod test { let vmm = VmmRuntimeState { state: VmmState::Migrating, - gen: Generation::new(), + generation: Generation::new(), time_updated: now, }; @@ -401,7 +401,7 @@ mod test { // Propolis is free to publish no-op VMM state updates (e.g. when an // in-progress migration's state changes but the migration is not yet // complete), so don't test the converse here. - if prev.vmm.gen == next.vmm.gen { + if prev.vmm.generation == next.vmm.generation { assert_eq!(prev.vmm.state, next.vmm.state); } } @@ -429,7 +429,7 @@ mod test { .migration_out .expect("state must have a migration"); assert_eq!(migration.state, MigrationState::Failed); - assert!(migration.gen > original_migration.gen); + assert!(migration.generation > original_migration.generation); } } @@ -446,7 +446,7 @@ mod test { .migration_in .expect("state must have a migration"); assert_eq!(migration.state, MigrationState::Failed); - assert!(migration.gen > original_migration.gen); + assert!(migration.generation > original_migration.generation); } } @@ -483,7 +483,7 @@ mod test { let prev_migration = prev.migration_out.expect("previous state must have a migration"); assert_eq!(migration.state, MigrationState::Completed); - assert!(migration.gen > prev_migration.gen); + assert!(migration.generation > prev_migration.generation); let prev_migration = migration; // Once a successful migration is observed, the VMM's state should @@ -499,7 +499,7 @@ mod test { // external viewers from perceiving that the instance is stopped before // the VMM is fully retired. assert_eq!(state.vmm.state, VmmState::Stopping); - assert!(state.vmm.gen > prev.vmm.gen); + assert!(state.vmm.generation > prev.vmm.generation); // Now that the migration has completed, it should not transition again. let migration = state @@ -507,7 +507,7 @@ mod test { .clone() .expect("instance must have a migration state"); assert_eq!(migration.state, MigrationState::Completed); - assert_eq!(migration.gen, prev_migration.gen); + assert_eq!(migration.generation, prev_migration.generation); let prev_migration = migration; let prev = state.clone(); @@ -516,14 +516,14 @@ mod test { assert!(state.vmm_is_halted()); assert_state_change_has_gen_change(&prev, &state); assert_eq!(state.vmm.state, VmmState::Destroyed); - assert!(state.vmm.gen > prev.vmm.gen); + assert!(state.vmm.generation > prev.vmm.generation); let migration = state .migration_out .clone() .expect("instance must have a migration state"); assert_eq!(migration.state, MigrationState::Completed); - assert_eq!(migration.gen, prev_migration.gen); + assert_eq!(migration.generation, prev_migration.generation); state.force_state_to_destroyed(); let migration = state @@ -531,7 +531,7 @@ mod test { .clone() .expect("instance must have a migration state"); assert_eq!(migration.state, MigrationState::Completed); - assert_eq!(migration.gen, prev_migration.gen); + assert_eq!(migration.generation, prev_migration.generation); } #[test] @@ -556,7 +556,7 @@ mod test { assert!(state.vmm_is_halted()); assert_state_change_has_gen_change(&prev, &state); assert_eq!(state.vmm.state, VmmState::Failed); - assert!(state.vmm.gen > prev.vmm.gen); + assert!(state.vmm.generation > prev.vmm.generation); // The migration state should transition. let migration = @@ -564,7 +564,7 @@ mod test { let prev_migration = prev.migration_in.expect("previous state must have a migration"); assert_eq!(migration.state, MigrationState::Failed); - assert!(migration.gen > prev_migration.gen); + assert!(migration.generation > prev_migration.generation); } // Verifies that rudely terminating a migration target causes any pending @@ -584,6 +584,6 @@ mod test { let prev_migration = prev.migration_in.expect("previous state must have a migration"); assert_eq!(migration.state, MigrationState::Failed); - assert!(migration.gen > prev_migration.gen); + assert!(migration.generation > prev_migration.generation); } } diff --git a/sled-agent/src/instance.rs b/sled-agent/src/instance.rs index 12e1c39adf..9078a39e50 100644 --- a/sled-agent/src/instance.rs +++ b/sled-agent/src/instance.rs @@ -568,7 +568,7 @@ impl InstanceRunner { async fn stop_timeout_completed( stop_timeout: &mut Option>>, ) { - if let Some(ref mut timeout) = stop_timeout { + if let Some(timeout) = stop_timeout { timeout.await } else { std::future::pending().await @@ -1433,7 +1433,7 @@ fn propolis_error_code( error: &PropolisClientError, ) -> Option { // Is this a structured error response from the Propolis server? - let propolis_client::Error::ErrorResponse(ref rv) = &error else { + let propolis_client::Error::ErrorResponse(rv) = &error else { return None; }; @@ -2499,7 +2499,7 @@ mod tests { local_config, vmm_runtime: VmmRuntimeState { state: VmmState::Starting, - gen: Generation::new(), + generation: Generation::new(), time_updated: Default::default(), }, propolis_addr, @@ -3206,7 +3206,7 @@ mod tests { .send(InstanceMonitorMessage { update: InstanceMonitorUpdate::State( InstanceStateMonitorResponse { - gen: 5, + r#gen: 5, migration: InstanceMigrateStatusResponse { migration_in: None, migration_out: None, diff --git a/sled-agent/src/sim/collection.rs b/sled-agent/src/sim/collection.rs index bf3c08f1e9..2c50eb8429 100644 --- a/sled-agent/src/sim/collection.rs +++ b/sled-agent/src/sim/collection.rs @@ -404,7 +404,7 @@ mod test { ) -> (SimObject, Receiver<()>) { let vmm_state = VmmRuntimeState { state: VmmState::Starting, - gen: Generation::new(), + generation: Generation::new(), time_updated: Utc::now(), }; @@ -421,7 +421,7 @@ mod test { let initial_runtime = { DiskRuntimeState { disk_state: initial_state, - gen: Generation::new(), + generation: Generation::new(), time_updated: Utc::now(), } }; @@ -437,7 +437,7 @@ mod test { info!(logctx.log, "new instance"; "state" => ?r1); assert_eq!(r1.vmm_state.state, VmmState::Starting); - assert_eq!(r1.vmm_state.gen, Generation::new()); + assert_eq!(r1.vmm_state.generation, Generation::new()); // There's no asynchronous transition going on yet so a // transition_finish() shouldn't change anything. @@ -447,7 +447,7 @@ mod test { assert!(instance.object.desired().is_none()); assert_eq!(r1.vmm_state.time_updated, rnext.vmm_state.time_updated); assert_eq!(rnext.vmm_state.state, rnext.vmm_state.state); - assert_eq!(r1.vmm_state.gen, rnext.vmm_state.gen); + assert_eq!(r1.vmm_state.generation, rnext.vmm_state.generation); assert!(rx.try_next().is_err()); // Stopping an instance that was never started synchronously destroys @@ -457,7 +457,7 @@ mod test { assert!(dropped.is_none()); assert!(instance.object.desired().is_none()); let rnext = instance.object.current(); - assert!(rnext.vmm_state.gen > rprev.vmm_state.gen); + assert!(rnext.vmm_state.generation > rprev.vmm_state.generation); assert!(rnext.vmm_state.time_updated >= rprev.vmm_state.time_updated); assert_eq!(rnext.vmm_state.state, VmmState::Destroyed); assert!(rx.try_next().is_err()); @@ -476,7 +476,7 @@ mod test { info!(logctx.log, "new instance"; "state" => ?r1); assert_eq!(r1.vmm_state.state, VmmState::Starting); - assert_eq!(r1.vmm_state.gen, Generation::new()); + assert_eq!(r1.vmm_state.generation, Generation::new()); // There's no asynchronous transition going on yet so a // transition_finish() shouldn't change anything. @@ -486,7 +486,7 @@ mod test { let rnext = instance.object.current(); assert_eq!(r1.vmm_state.time_updated, rnext.vmm_state.time_updated); assert_eq!(r1.vmm_state.state, rnext.vmm_state.state); - assert_eq!(r1.vmm_state.gen, rnext.vmm_state.gen); + assert_eq!(r1.vmm_state.generation, rnext.vmm_state.generation); assert!(rx.try_next().is_err()); // Set up a transition to Running. This has no immediate effect on the @@ -501,7 +501,7 @@ mod test { // The VMM should still be Starting and its generation should not have // changed (the transition to Running is queued but hasn't executed). let rnext = instance.object.current(); - assert_eq!(rnext.vmm_state.gen, rprev.vmm_state.gen); + assert_eq!(rnext.vmm_state.generation, rprev.vmm_state.generation); assert_eq!(rnext.vmm_state.time_updated, rprev.vmm_state.time_updated); assert_eq!(rnext.vmm_state.state, VmmState::Starting); rprev = rnext; @@ -509,19 +509,19 @@ mod test { // Now poke the instance. It should transition to Running. instance.transition_finish(); let rnext = instance.object.current(); - assert!(rnext.vmm_state.gen > rprev.vmm_state.gen); + assert!(rnext.vmm_state.generation > rprev.vmm_state.generation); assert!(rnext.vmm_state.time_updated >= rprev.vmm_state.time_updated); assert!(instance.object.desired().is_none()); assert!(rx.try_next().is_err()); assert_eq!(rprev.vmm_state.state, VmmState::Starting); assert_eq!(rnext.vmm_state.state, VmmState::Running); - assert!(rnext.vmm_state.gen > rprev.vmm_state.gen); + assert!(rnext.vmm_state.generation > rprev.vmm_state.generation); rprev = rnext; // There shouldn't be anything left on the queue now. instance.transition_finish(); let rnext = instance.object.current(); - assert_eq!(rprev.vmm_state.gen, rnext.vmm_state.gen); + assert_eq!(rprev.vmm_state.generation, rnext.vmm_state.generation); // If we transition again to "Running", the process should complete // immediately. @@ -530,7 +530,7 @@ mod test { assert!(instance.object.desired().is_none()); assert!(rx.try_next().is_err()); let rnext = instance.object.current(); - assert_eq!(rnext.vmm_state.gen, rprev.vmm_state.gen); + assert_eq!(rnext.vmm_state.generation, rprev.vmm_state.generation); assert_eq!(rnext.vmm_state.time_updated, rprev.vmm_state.time_updated); assert_eq!(rnext.vmm_state.state, rprev.vmm_state.state); rprev = rnext; @@ -542,7 +542,7 @@ mod test { assert!(dropped.is_none()); assert!(instance.object.desired().is_some()); let rnext = instance.object.current(); - assert!(rnext.vmm_state.gen > rprev.vmm_state.gen); + assert!(rnext.vmm_state.generation > rprev.vmm_state.generation); assert!(rnext.vmm_state.time_updated >= rprev.vmm_state.time_updated); assert_eq!(rnext.vmm_state.state, VmmState::Stopping); rprev = rnext; @@ -551,7 +551,7 @@ mod test { // Stopped. instance.transition_finish(); let rnext = instance.object.current(); - assert!(rnext.vmm_state.gen > rprev.vmm_state.gen); + assert!(rnext.vmm_state.generation > rprev.vmm_state.generation); assert!(rnext.vmm_state.time_updated >= rprev.vmm_state.time_updated); assert!(instance.object.desired().is_some()); assert_eq!(rprev.vmm_state.state, VmmState::Stopping); @@ -563,7 +563,7 @@ mod test { // it is ready to be started again. instance.transition_finish(); let rnext = instance.object.current(); - assert!(rnext.vmm_state.gen > rprev.vmm_state.gen); + assert!(rnext.vmm_state.generation > rprev.vmm_state.generation); assert!(rnext.vmm_state.time_updated >= rprev.vmm_state.time_updated); assert!(instance.object.desired().is_some()); assert_eq!(rprev.vmm_state.state, VmmState::Stopping); @@ -575,7 +575,7 @@ mod test { // Propolis ID. instance.transition_finish(); let rnext = instance.object.current(); - assert!(rnext.vmm_state.gen > rprev.vmm_state.gen); + assert!(rnext.vmm_state.generation > rprev.vmm_state.generation); assert!(rnext.vmm_state.time_updated >= rprev.vmm_state.time_updated); assert_eq!(rprev.vmm_state.state, VmmState::Stopping); assert_eq!(rnext.vmm_state.state, VmmState::Destroyed); @@ -593,7 +593,7 @@ mod test { info!(logctx.log, "new instance"; "state" => ?r1); assert_eq!(r1.vmm_state.state, VmmState::Starting); - assert_eq!(r1.vmm_state.gen, Generation::new()); + assert_eq!(r1.vmm_state.generation, Generation::new()); assert!( instance.transition(VmmStateRequested::Running).unwrap().is_none() ); @@ -605,7 +605,7 @@ mod test { std::thread::sleep(std::time::Duration::from_millis(100)); } - assert!(rnext.vmm_state.gen > rprev.vmm_state.gen); + assert!(rnext.vmm_state.generation > rprev.vmm_state.generation); // Now reboot the instance. This is dispatched to Propolis, which will // move to the Rebooting state and then back to Running. @@ -613,7 +613,7 @@ mod test { instance.transition(VmmStateRequested::Reboot).unwrap().is_none() ); let (rprev, rnext) = (rnext, instance.object.current()); - assert!(rnext.vmm_state.gen > rprev.vmm_state.gen); + assert!(rnext.vmm_state.generation > rprev.vmm_state.generation); assert!(rnext.vmm_state.time_updated > rprev.vmm_state.time_updated); assert_eq!(rnext.vmm_state.state, VmmState::Rebooting); instance.transition_finish(); @@ -624,7 +624,7 @@ mod test { std::thread::sleep(std::time::Duration::from_millis(100)); } - assert!(rnext.vmm_state.gen > rprev.vmm_state.gen); + assert!(rnext.vmm_state.generation > rprev.vmm_state.generation); assert!(rnext.vmm_state.time_updated > rprev.vmm_state.time_updated); assert_eq!(rnext.vmm_state.state, VmmState::Rebooting); assert!(instance.object.desired().is_some()); @@ -636,7 +636,7 @@ mod test { std::thread::sleep(std::time::Duration::from_millis(100)); } - assert!(rnext.vmm_state.gen > rprev.vmm_state.gen); + assert!(rnext.vmm_state.generation > rprev.vmm_state.generation); assert!(rnext.vmm_state.time_updated > rprev.vmm_state.time_updated); assert_eq!(rnext.vmm_state.state, VmmState::Running); logctx.cleanup_successful(); @@ -657,7 +657,7 @@ mod test { info!(logctx.log, "new disk"; "disk_state" => ?r1.disk_state); assert_eq!(r1.disk_state, DiskState::Creating); - assert_eq!(r1.gen, Generation::new()); + assert_eq!(r1.generation, Generation::new()); // Try transitioning to every other detached state. let detached_states = vec![ @@ -670,7 +670,7 @@ mod test { assert!(!rprev.disk_state.is_attached()); disk.transition(requested.clone()).unwrap(); let rnext = disk.object.current().clone(); - assert!(rnext.gen > rprev.gen); + assert!(rnext.generation > rprev.generation); assert!(rnext.time_updated >= rprev.time_updated); assert_eq!(rnext.disk_state, next); rprev = rnext; @@ -686,7 +686,7 @@ mod test { info!(logctx.log, "new disk"; "disk_state" => ?r1.disk_state); assert_eq!(r1.disk_state, DiskState::Creating); - assert_eq!(r1.gen, Generation::new()); + assert_eq!(r1.generation, Generation::new()); let id = uuid::Uuid::new_v4(); let rprev = r1; @@ -697,7 +697,7 @@ mod test { .is_none() ); let rnext = disk.object.current(); - assert!(rnext.gen > rprev.gen); + assert!(rnext.generation > rprev.generation); assert!(rnext.time_updated >= rprev.time_updated); assert_eq!(rnext.disk_state, DiskState::Attaching(id)); assert!(rnext.disk_state.is_attached()); @@ -707,13 +707,13 @@ mod test { disk.transition_finish(); let rnext = disk.object.current(); assert_eq!(rnext.disk_state, DiskState::Attached(id)); - assert!(rnext.gen > rprev.gen); + assert!(rnext.generation > rprev.generation); assert!(rnext.time_updated >= rprev.time_updated); let rprev = rnext; disk.transition_finish(); let rnext = disk.object.current(); - assert_eq!(rnext.gen, rprev.gen); + assert_eq!(rnext.generation, rprev.generation); assert_eq!(rnext.disk_state, DiskState::Attached(id)); assert!(rnext.disk_state.is_attached()); let rprev = rnext; @@ -725,7 +725,7 @@ mod test { .is_none() ); let rnext = disk.object.current(); - assert_eq!(rnext.gen, rprev.gen); + assert_eq!(rnext.generation, rprev.generation); let rprev = rnext; // It's illegal to go straight to attached to a different instance. @@ -739,14 +739,14 @@ mod test { panic!("unexpected error type"); } let rnext = disk.object.current(); - assert_eq!(rprev.gen, rnext.gen); + assert_eq!(rprev.generation, rnext.generation); let rprev = rnext; // If we go to a different detached state, we go through the async // transition again. disk.transition(DiskStateRequested::Detached).unwrap(); let rnext = disk.object.current(); - assert!(rnext.gen > rprev.gen); + assert!(rnext.generation > rprev.generation); assert_eq!(rnext.disk_state, DiskState::Detaching(id)); assert!(rnext.disk_state.is_attached()); let rprev = rnext; @@ -754,7 +754,7 @@ mod test { disk.transition_finish(); let rnext = disk.object.current(); assert_eq!(rnext.disk_state, DiskState::Detached); - assert!(rnext.gen > rprev.gen); + assert!(rnext.generation > rprev.generation); // Verify that it works fine to change directions in the middle of an // async transition. @@ -775,7 +775,7 @@ mod test { info!(logctx.log, "new disk"; "disk_state" => ?r1.disk_state); assert_eq!(r1.disk_state, DiskState::Creating); - assert_eq!(r1.gen, Generation::new()); + assert_eq!(r1.generation, Generation::new()); let id = uuid::Uuid::new_v4(); disk.transition(DiskStateRequested::Attached(id)).unwrap(); diff --git a/sled-agent/src/sim/disk.rs b/sled-agent/src/sim/disk.rs index 18d63cfb1c..027c971780 100644 --- a/sled-agent/src/sim/disk.rs +++ b/sled-agent/src/sim/disk.rs @@ -236,7 +236,7 @@ impl Simulatable for SimDisk { } fn generation(&self) -> Generation { - self.state.current().gen + self.state.current().generation } fn current(&self) -> Self::CurrentState { diff --git a/sled-agent/src/sim/instance.rs b/sled-agent/src/sim/instance.rs index 6f53694cce..9b4305ea0a 100644 --- a/sled-agent/src/sim/instance.rs +++ b/sled-agent/src/sim/instance.rs @@ -457,7 +457,7 @@ impl Simulatable for SimInstance { current.migration_in.map(|m| m.migration_id), ), last_response: InstanceStateMonitorResponse { - gen: 1, + r#gen: 1, state: PropolisInstanceState::Starting, migration: PropolisMigrateResponse { migration_in: None, @@ -490,7 +490,7 @@ impl Simulatable for SimInstance { } fn generation(&self) -> Generation { - self.inner.lock().unwrap().state.vmm().gen + self.inner.lock().unwrap().state.vmm().generation } fn current(&self) -> Self::CurrentState { diff --git a/sled-agent/src/sim/sled_agent.rs b/sled-agent/src/sim/sled_agent.rs index 4648490b2a..7e3596a246 100644 --- a/sled-agent/src/sim/sled_agent.rs +++ b/sled-agent/src/sim/sled_agent.rs @@ -232,7 +232,7 @@ impl SledAgent { disk_state: DiskState::Attached( instance_id.into_untyped_uuid(), ), - gen: omicron_common::api::external::Generation::new(), + generation: omicron_common::api::external::Generation::new(), time_updated: chrono::Utc::now(), }; @@ -310,7 +310,7 @@ impl SledAgent { migration_id.map(|migration_id| MigrationRuntimeState { migration_id, state: MigrationState::Pending, - gen: Generation::new(), + generation: Generation::new(), time_updated: chrono::Utc::now(), }); diff --git a/sled-agent/src/swap_device.rs b/sled-agent/src/swap_device.rs index 467d2a0af6..55f8bdf3bd 100644 --- a/sled-agent/src/swap_device.rs +++ b/sled-agent/src/swap_device.rs @@ -287,7 +287,7 @@ mod swapctl { // swapctl(2) #[cfg(target_os = "illumos")] - extern "C" { + unsafe extern "C" { fn swapctl(cmd: i32, arg: *mut libc::c_void) -> i32; } @@ -298,7 +298,7 @@ mod swapctl { // sled agent work on non-illumos targets. So for now, just stub out this // piece. #[cfg(not(target_os = "illumos"))] - fn swapctl(_cmd: i32, _arg: *mut libc::c_void) -> i32 { + unsafe fn swapctl(_cmd: i32, _arg: *mut libc::c_void) -> i32 { panic!("swapctl(2) only on illumos"); } @@ -381,7 +381,7 @@ mod swapctl { None => std::ptr::null_mut(), }; - let res = swapctl(cmd, ptr); + let res = unsafe { swapctl(cmd, ptr) }; if res == -1 { return Err(std::io::Error::last_os_error()); } diff --git a/sled-agent/types/Cargo.toml b/sled-agent/types/Cargo.toml index fb36c639ba..b55a719cf7 100644 --- a/sled-agent/types/Cargo.toml +++ b/sled-agent/types/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sled-agent-types" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/sled-agent/zone-images-examples/Cargo.toml b/sled-agent/zone-images-examples/Cargo.toml index 4faea0309f..e99994b763 100644 --- a/sled-agent/zone-images-examples/Cargo.toml +++ b/sled-agent/zone-images-examples/Cargo.toml @@ -2,7 +2,7 @@ name = "sled-agent-zone-images-examples" description = "Example values for sled-agent-zone-images types" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/sled-agent/zone-images/Cargo.toml b/sled-agent/zone-images/Cargo.toml index f459890452..312c20ca25 100644 --- a/sled-agent/zone-images/Cargo.toml +++ b/sled-agent/zone-images/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sled-agent-zone-images" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/sled-diagnostics/Cargo.toml b/sled-diagnostics/Cargo.toml index 12f4387b18..ffa899345d 100644 --- a/sled-diagnostics/Cargo.toml +++ b/sled-diagnostics/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sled-diagnostics" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/sled-diagnostics/src/contract.rs b/sled-diagnostics/src/contract.rs index 0f23c5926b..b22777d0a1 100644 --- a/sled-diagnostics/src/contract.rs +++ b/sled-diagnostics/src/contract.rs @@ -27,7 +27,7 @@ const CTD_ALL: i32 = 2; type ct_stathdl_t = *mut c_void; #[link(name = "contract")] -extern "C" { +unsafe extern "C" { fn ct_status_read( fd: c_int, detail: c_int, diff --git a/sled-hardware/Cargo.toml b/sled-hardware/Cargo.toml index de5dce2a5d..5793791c08 100644 --- a/sled-hardware/Cargo.toml +++ b/sled-hardware/Cargo.toml @@ -2,7 +2,7 @@ name = "sled-hardware" description = "Monitoring and managing sled-local hardware" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/sled-hardware/types/Cargo.toml b/sled-hardware/types/Cargo.toml index 3b73728ca5..cf8f8d6a18 100644 --- a/sled-hardware/types/Cargo.toml +++ b/sled-hardware/types/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sled-hardware-types" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/sled-storage/Cargo.toml b/sled-storage/Cargo.toml index 78e6bdf5c5..7f2ff24968 100644 --- a/sled-storage/Cargo.toml +++ b/sled-storage/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sled-storage" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/sled-storage/zfs-test-harness/Cargo.toml b/sled-storage/zfs-test-harness/Cargo.toml index 4c3fcd4e7a..0dd8e3bd2d 100644 --- a/sled-storage/zfs-test-harness/Cargo.toml +++ b/sled-storage/zfs-test-harness/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "zfs-test-harness" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/sp-sim/Cargo.toml b/sp-sim/Cargo.toml index 0f453d416c..f8d4e85d1e 100644 --- a/sp-sim/Cargo.toml +++ b/sp-sim/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sp-sim" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 015dbddd8d..a60ef06391 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-test-utils" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/test-utils/src/dev/db.rs b/test-utils/src/dev/db.rs index 28722e8b78..9398290c7a 100644 --- a/test-utils/src/dev/db.rs +++ b/test-utils/src/dev/db.rs @@ -307,7 +307,7 @@ impl CockroachStarter { } /// Returns a human-readable summary of the command line to be executed - pub fn cmdline(&self) -> impl fmt::Display { + pub fn cmdline(&self) -> impl fmt::Display + use<> { self.args.join(" ") } diff --git a/trust-quorum/Cargo.toml b/trust-quorum/Cargo.toml index a778dbe6da..b594a2231a 100644 --- a/trust-quorum/Cargo.toml +++ b/trust-quorum/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "trust-quorum" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" description = "trust quorum library for use by bootstrap agent" diff --git a/trust-quorum/gfss/Cargo.toml b/trust-quorum/gfss/Cargo.toml index 3b6ad9fdf1..e408929453 100644 --- a/trust-quorum/gfss/Cargo.toml +++ b/trust-quorum/gfss/Cargo.toml @@ -2,7 +2,7 @@ name = "gfss" version = "0.1.0" description = "Shamir secret sharing over GF(2^8)" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/trust-quorum/protocol/Cargo.toml b/trust-quorum/protocol/Cargo.toml index 9a5d42f7d9..443a334ee0 100644 --- a/trust-quorum/protocol/Cargo.toml +++ b/trust-quorum/protocol/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "trust-quorum-protocol" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" description = "sans-io trust quorum protocol implementation" diff --git a/trust-quorum/src/connection_manager.rs b/trust-quorum/src/connection_manager.rs index 48803e6f79..f080de6b44 100644 --- a/trust-quorum/src/connection_manager.rs +++ b/trust-quorum/src/connection_manager.rs @@ -821,19 +821,17 @@ impl ConnMgr { ); handle.abort(); None + } else if let Some(handle) = self.established.remove3(&addr) { + info!( + self.log, + "Deleting established connection"; + "peer_addr" => %addr, + "peer_id" => %handle.baseboard_id + ); + handle.abort(); + Some(handle.baseboard_id) } else { - if let Some(handle) = self.established.remove3(&addr) { - info!( - self.log, - "Deleting established connection"; - "peer_addr" => %addr, - "peer_id" => %handle.baseboard_id - ); - handle.abort(); - Some(handle.baseboard_id) - } else { - None - } + None } } diff --git a/trust-quorum/test-utils/Cargo.toml b/trust-quorum/test-utils/Cargo.toml index 853bdd464f..ca02834240 100644 --- a/trust-quorum/test-utils/Cargo.toml +++ b/trust-quorum/test-utils/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "trust-quorum-test-utils" version = "0.1.0" -edition = "2024" +edition.workspace = true [lints] workspace = true diff --git a/trust-quorum/tqdb/Cargo.toml b/trust-quorum/tqdb/Cargo.toml index 18242508aa..401f2a2cb3 100644 --- a/trust-quorum/tqdb/Cargo.toml +++ b/trust-quorum/tqdb/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tqdb" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/typed-rng/Cargo.toml b/typed-rng/Cargo.toml index ee0a292116..fe3c92c129 100644 --- a/typed-rng/Cargo.toml +++ b/typed-rng/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "typed-rng" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/update-common/Cargo.toml b/update-common/Cargo.toml index 490de6fb7a..89e08d816f 100644 --- a/update-common/Cargo.toml +++ b/update-common/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "update-common" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/update-common/src/artifacts/extracted_artifacts.rs b/update-common/src/artifacts/extracted_artifacts.rs index 798bb498b5..d9fa640c64 100644 --- a/update-common/src/artifacts/extracted_artifacts.rs +++ b/update-common/src/artifacts/extracted_artifacts.rs @@ -84,7 +84,7 @@ impl ExtractedArtifactDataHandle { /// removed the contents of our temporary directory). pub async fn reader_stream( &self, - ) -> anyhow::Result> { + ) -> anyhow::Result>> { Ok(ReaderStream::new(self.file().await?)) } } diff --git a/update-engine/Cargo.toml b/update-engine/Cargo.toml index 5a22ac66f5..42a2637444 100644 --- a/update-engine/Cargo.toml +++ b/update-engine/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "update-engine" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/update-engine/examples/update-engine-basic/spec.rs b/update-engine/examples/update-engine-basic/spec.rs index e454c8f6c4..205f6ff550 100644 --- a/update-engine/examples/update-engine-basic/spec.rs +++ b/update-engine/examples/update-engine-basic/spec.rs @@ -9,7 +9,7 @@ use std::fmt; use camino::Utf8PathBuf; use schemars::{ JsonSchema, - gen::SchemaGenerator, + r#gen::SchemaGenerator, schema::{Schema, SchemaObject}, }; use serde::{Deserialize, Serialize}; @@ -134,14 +134,14 @@ pub(crate) enum ExampleWriteStepId { }, } -fn path_schema(gen: &mut SchemaGenerator) -> Schema { - let mut schema: SchemaObject = ::json_schema(gen).into(); +fn path_schema(generator: &mut SchemaGenerator) -> Schema { + let mut schema: SchemaObject = ::json_schema(generator).into(); schema.format = Some("Utf8PathBuf".to_owned()); schema.into() } -fn paths_schema(gen: &mut SchemaGenerator) -> Schema { - let mut schema: SchemaObject = >::json_schema(gen).into(); +fn paths_schema(generator: &mut SchemaGenerator) -> Schema { + let mut schema: SchemaObject = >::json_schema(generator).into(); schema.format = Some("Vec".to_owned()); schema.into() } diff --git a/update-engine/src/spec.rs b/update-engine/src/spec.rs index 59afee0640..e4e709ebda 100644 --- a/update-engine/src/spec.rs +++ b/update-engine/src/spec.rs @@ -119,7 +119,7 @@ impl JsonSchema for GenericSpec { } fn json_schema( - _: &mut schemars::gen::SchemaGenerator, + _: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { // This means "accept any value here" -- this is irrelevant since we // only care about the schema name. diff --git a/uuid-kinds/Cargo.toml b/uuid-kinds/Cargo.toml index b1aef1ccd8..3cd981fa0c 100644 --- a/uuid-kinds/Cargo.toml +++ b/uuid-kinds/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "omicron-uuid-kinds" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/wicket-common/Cargo.toml b/wicket-common/Cargo.toml index e31b8f6c55..e887d33baf 100644 --- a/wicket-common/Cargo.toml +++ b/wicket-common/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wicket-common" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/wicket-common/src/rack_setup.rs b/wicket-common/src/rack_setup.rs index bbccad0811..b4da40cd9b 100644 --- a/wicket-common/src/rack_setup.rs +++ b/wicket-common/src/rack_setup.rs @@ -566,10 +566,10 @@ impl JsonSchema for UserSpecifiedImportExportPolicy { } fn json_schema( - gen: &mut schemars::gen::SchemaGenerator, + r#gen: &mut schemars::r#gen::SchemaGenerator, ) -> schemars::schema::Schema { // The above is equivalent to an Option>. - Option::>::json_schema(gen) + Option::>::json_schema(r#gen) } } diff --git a/wicket-dbg/Cargo.toml b/wicket-dbg/Cargo.toml index 09f3b05cd3..6bc2362b05 100644 --- a/wicket-dbg/Cargo.toml +++ b/wicket-dbg/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wicket-dbg" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/wicket-dbg/src/bin/wicket-dbg-server.rs b/wicket-dbg/src/bin/wicket-dbg-server.rs index 8d8ae50871..2bdf480531 100644 --- a/wicket-dbg/src/bin/wicket-dbg-server.rs +++ b/wicket-dbg/src/bin/wicket-dbg-server.rs @@ -114,7 +114,9 @@ fn log_path() -> Result { } } -fn stderr_env_drain(env_var: &str) -> impl Drain { +fn stderr_env_drain( + env_var: &str, +) -> impl Drain + use<> { let stderr_decorator = slog_term::TermDecorator::new().build(); let stderr_drain = slog_term::FullFormat::new(stderr_decorator).build().fuse(); diff --git a/wicket/Cargo.toml b/wicket/Cargo.toml index c9e4371630..500748c15f 100644 --- a/wicket/Cargo.toml +++ b/wicket/Cargo.toml @@ -2,7 +2,7 @@ name = "wicket" description = "Technician port TUI" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" default-run = "wicket" diff --git a/wicket/src/dispatch.rs b/wicket/src/dispatch.rs index 994c85eb28..215302e598 100644 --- a/wicket/src/dispatch.rs +++ b/wicket/src/dispatch.rs @@ -136,7 +136,7 @@ fn log_path() -> Result { fn stderr_env_drain( env_var: &str, use_color: bool, -) -> impl Drain { +) -> impl Drain + use<> { let mut builder = slog_term::TermDecorator::new(); if use_color { builder = builder.force_color(); diff --git a/wicketd-api/Cargo.toml b/wicketd-api/Cargo.toml index 5443db8593..c247300cce 100644 --- a/wicketd-api/Cargo.toml +++ b/wicketd-api/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wicketd-api" version = "0.1.0" -edition = "2021" +edition.workspace = true [lints] workspace = true diff --git a/wicketd/Cargo.toml b/wicketd/Cargo.toml index bd09ceaf11..9f091568fa 100644 --- a/wicketd/Cargo.toml +++ b/wicketd/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wicketd" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints] diff --git a/wicketd/src/bootstrap_addrs.rs b/wicketd/src/bootstrap_addrs.rs index 27efc89246..4bb3bcb48d 100644 --- a/wicketd/src/bootstrap_addrs.rs +++ b/wicketd/src/bootstrap_addrs.rs @@ -128,7 +128,7 @@ async fn scan_for_peers( async fn possible_sled_agent_addrs( ddm_client: &DdmAdminClient, log: &Logger, -) -> impl Iterator { +) -> impl Iterator + use<> { // We're talking to a service's admin interface on localhost within our own // switch zone, and we're only asking for its current state. We use a retry // in a loop instead of `backoff`. diff --git a/workspace-hack/Cargo.toml b/workspace-hack/Cargo.toml index abf375ace5..37baf6b594 100644 --- a/workspace-hack/Cargo.toml +++ b/workspace-hack/Cargo.toml @@ -5,7 +5,7 @@ [package] name = "omicron-workspace-hack" version = "0.1.0" -edition = "2021" +edition.workspace = true 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 diff --git a/zone-setup/Cargo.toml b/zone-setup/Cargo.toml index 869d74f051..0eaea34848 100644 --- a/zone-setup/Cargo.toml +++ b/zone-setup/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "zone-setup" version = "0.1.0" -edition = "2021" +edition.workspace = true license = "MPL-2.0" [lints]