From dd10f428bc17f4f01dc3a35d4865c62cb6df7ca8 Mon Sep 17 00:00:00 2001 From: Tiago Castro Date: Wed, 17 Jul 2024 11:38:26 +0100 Subject: [PATCH 1/2] chore: run new fmt Signed-off-by: Tiago Castro --- .github/workflows/pr-rust-lint.yaml | 4 ++-- composer/src/composer.rs | 10 +++++----- nix/sources.json | 14 +++++++------- shell.nix | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/pr-rust-lint.yaml b/.github/workflows/pr-rust-lint.yaml index f5d3b30..d2180b9 100644 --- a/.github/workflows/pr-rust-lint.yaml +++ b/.github/workflows/pr-rust-lint.yaml @@ -12,10 +12,10 @@ jobs: submodules: 'recursive' - uses: cachix/install-nix-action@v26 with: - nix_path: nixpkgs=channel:nixos-23.11 + nix_path: nixpkgs=channel:nixos-24.05 - name: nix-shell run: nix-shell --pure --run exit - name: cargo-clippy run: nix-shell --pure --run ./scripts/rust/linter.sh - name: cargo-fmt - run: nix-shell --pure --run ./scripts/rust/style.sh + run: nix-shell --pure --run "FMT_OPTS=--check ./scripts/rust/style.sh" diff --git a/composer/src/composer.rs b/composer/src/composer.rs index fe2ecc3..fdc79fe 100644 --- a/composer/src/composer.rs +++ b/composer/src/composer.rs @@ -698,13 +698,13 @@ impl Builder { /// the name to be used as labels and network name pub fn name(mut self, name: &str) -> Builder { - self.name = name.to_owned(); + self.name = name.to_string(); self } /// set different label prefix for the network label pub fn label_prefix(mut self, prefix: &str) -> Builder { - self.label_prefix = prefix.to_owned(); + self.label_prefix = prefix.to_string(); self } @@ -727,7 +727,7 @@ impl Builder { /// check if a container exists pub fn container_exists(&self, name: &str) -> bool { self.containers.iter().any(|(c, _)| c.name == name) - || self.existing_containers.get(name).is_some() + || self.existing_containers.contains_key(name) } /// add a generic container which runs a local binary @@ -1103,7 +1103,7 @@ impl ComposeTest { for k in &containers { let name = k.id.clone().unwrap(); tracing::trace!("Lookup container for removal: {:?}", k.names); - if prune || (self.prune_matching && self.containers.get(&name).is_some()) { + if prune || (self.prune_matching && self.containers.contains_key(&name)) { prune_containers.push(async move { let remove = self.remove_container(&name).await; if remove.is_ok() { @@ -1671,7 +1671,7 @@ impl ComposeTest { .await .unwrap_or_default(); - self.containers.get(name).is_some() + self.containers.contains_key(name) || containers.iter().any(|c| { c.names .clone() diff --git a/nix/sources.json b/nix/sources.json index 4fd1236..4ea869a 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -1,14 +1,14 @@ { "nixpkgs": { - "branch": "release-23.05", + "branch": "release-24.05", "description": "Nix Packages collection", "homepage": "", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9a333eaa80901efe01df07eade2c16d183761fa3", - "sha256": "0xhqjli4m9wkzv7xhs6fr1iajdjbv7xnj0bwvwldq9s6arlwkhj3", + "rev": "35f9f5784eb50cabac4db09c8c11035dacf36411", + "sha256": "1gq4ajsmg2f5jdmbdhdavcnlg32bzynvvidvb4648pk4gdcnr49h", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/9a333eaa80901efe01df07eade2c16d183761fa3.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/35f9f5784eb50cabac4db09c8c11035dacf36411.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "rust-overlay": { @@ -17,10 +17,10 @@ "homepage": "", "owner": "oxalica", "repo": "rust-overlay", - "rev": "8dfbe2dffc28c1a18a29ffa34d5d0b269622b158", - "sha256": "0ddii9h5bwbihn4lwijbzknkbzdb11nglwdwrxdx8bf1blvcy199", + "rev": "d064703dc0657a49a17671c74b1a15ea7433e753", + "sha256": "06g1c1ys8ihd3vsjswqrkl8nv9lypizzgivbvwz1aycm34i3ib4z", "type": "tarball", - "url": "https://github.com/oxalica/rust-overlay/archive/8dfbe2dffc28c1a18a29ffa34d5d0b269622b158.tar.gz", + "url": "https://github.com/oxalica/rust-overlay/archive/d064703dc0657a49a17671c74b1a15ea7433e753.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } diff --git a/shell.nix b/shell.nix index fc7936c..5a86389 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,4 @@ -{ profile ? "nightly", date ? "2024-02-06" }: +{ profile ? "nightly", version ? "2024-02-06" }: let sources = import ./nix/sources.nix; pkgs = import sources.nixpkgs { @@ -8,7 +8,7 @@ let in let rust-bin = - (rust.rust-bin.${profile}.${date}.default.override { + (rust.rust-bin.${profile}.${version}.default.override { extensions = [ "rust-src" ]; }); in From 65712dc462a8da8814ad6a6a0c9ffcff3a561335 Mon Sep 17 00:00:00 2001 From: Tiago Castro Date: Wed, 17 Jul 2024 17:42:48 +0100 Subject: [PATCH 2/2] ci: don't use breaking serde Signed-off-by: Tiago Castro --- apis/events/Cargo.toml | 6 ++++++ apis/io-engine/Cargo.toml | 6 ++++++ composer/Cargo.toml | 6 ++++++ event-publisher/Cargo.toml | 6 ++++++ prost-extend/Cargo.toml | 6 ++++++ 5 files changed, 30 insertions(+) diff --git a/apis/events/Cargo.toml b/apis/events/Cargo.toml index 93145e8..24571ad 100644 --- a/apis/events/Cargo.toml +++ b/apis/events/Cargo.toml @@ -23,3 +23,9 @@ prost = "0.12.1" chrono = "0.4.31" once_cell = "1.18.0" prost-extend = { path = "../../prost-extend" } + +[dev-dependencies.serde] +# v1.0.198 introduces a breaking change by making use of unstable feature saturating_int_impl! +# Let's ensure we don't use v.1.0.198 or newer until we upgrade the compiler! +# https://github.com/serde-rs/serde/issues/2734 +version = ">=1.0.188,<1.0.198" \ No newline at end of file diff --git a/apis/io-engine/Cargo.toml b/apis/io-engine/Cargo.toml index 9ff69cd..a04120b 100644 --- a/apis/io-engine/Cargo.toml +++ b/apis/io-engine/Cargo.toml @@ -17,3 +17,9 @@ prost-types = "0.12.1" serde = { version = "1.0.188", features = ["derive"] } serde_derive = "1.0.188" serde_json = "1.0.107" + +[dev-dependencies.serde] +# v1.0.198 introduces a breaking change by making use of unstable feature saturating_int_impl! +# Let's ensure we don't use v.1.0.198 or newer until we upgrade the compiler! +# https://github.com/serde-rs/serde/issues/2734 +version = ">=1.0.188,<1.0.198" \ No newline at end of file diff --git a/composer/Cargo.toml b/composer/Cargo.toml index 8b391de..da71730 100644 --- a/composer/Cargo.toml +++ b/composer/Cargo.toml @@ -13,3 +13,9 @@ tracing = "0.1.37" once_cell = "1.18.0" ipnetwork = "0.20.0" bollard = "0.15.0" + +[dev-dependencies.serde] +# v1.0.198 introduces a breaking change by making use of unstable feature saturating_int_impl! +# Let's ensure we don't use v.1.0.198 or newer until we upgrade the compiler! +# https://github.com/serde-rs/serde/issues/2734 +version = ">=1.0.188,<1.0.198" \ No newline at end of file diff --git a/event-publisher/Cargo.toml b/event-publisher/Cargo.toml index 536b67a..232f752 100644 --- a/event-publisher/Cargo.toml +++ b/event-publisher/Cargo.toml @@ -9,3 +9,9 @@ tokio = { version = "1.32.0"} tracing = "0.1.37" serde_json = "1.0.107" events-api = { path = "../apis/events" } + +[dev-dependencies.serde] +# v1.0.198 introduces a breaking change by making use of unstable feature saturating_int_impl! +# Let's ensure we don't use v.1.0.198 or newer until we upgrade the compiler! +# https://github.com/serde-rs/serde/issues/2734 +version = ">=1.0.188,<1.0.198" \ No newline at end of file diff --git a/prost-extend/Cargo.toml b/prost-extend/Cargo.toml index 2eb9750..206c104 100644 --- a/prost-extend/Cargo.toml +++ b/prost-extend/Cargo.toml @@ -12,3 +12,9 @@ tonic-build = "0.10.2" chrono = "0.4.26" serde = { version = "1.0.183", features = [ "derive" ] } prost = "0.12.1" + +[dev-dependencies.serde] +# v1.0.198 introduces a breaking change by making use of unstable feature saturating_int_impl! +# Let's ensure we don't use v.1.0.198 or newer until we upgrade the compiler! +# https://github.com/serde-rs/serde/issues/2734 +version = ">=1.0.188,<1.0.198" \ No newline at end of file