Skip to content

Commit bab27f3

Browse files
committed
chore: Apply 2024 formatting
1 parent f5eed77 commit bab27f3

File tree

50 files changed

+177
-197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+177
-197
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ repos:
2020
- repo: https://github.com/doublify/pre-commit-rust
2121
rev: eeee35a89e69d5772bdee97db1a6a898467b686e # 1.0
2222
hooks:
23-
- id: fmt
24-
args: ["--all", "--", "--check"]
2523
- id: clippy
2624
args: ["--all-targets", "--all-features", "--", "-D", "warnings"]
2725

@@ -101,3 +99,11 @@ repos:
10199
entry: make regenerate-nix
102100
stages: [pre-commit, pre-merge-commit, manual]
103101
pass_filenames: false
102+
103+
- id: cargo-rustfmt
104+
name: cargo-rustfmt
105+
language: system
106+
# Pinning to a specific rustc version, so that we get consistent formatting
107+
entry: cargo +nightly-2025-01-15 fmt --all -- --check
108+
stages: [pre-commit]
109+
pass_filenames: false

.vscode/settings.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
{
2-
"rust-analyzer.showUnlinkedFileNotification": false
2+
"rust-analyzer.showUnlinkedFileNotification": false,
3+
"rust-analyzer.cargo.features": "all",
4+
"rust-analyzer.rustfmt.overrideCommand": [
5+
"rustfmt",
6+
"+nightly-2025-01-15",
7+
"--edition",
8+
"2024",
9+
"--"
10+
],
311
}

rust/helm-sys/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
77

8-
use std::ffi::{c_char, CStr, CString};
8+
use std::ffi::{CStr, CString, c_char};
99

1010
pub const HELM_ERROR_PREFIX: &str = "ERROR:";
1111

rust/stackable-cockpit/src/common/manifest.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use serde::{Deserialize, Serialize};
2-
32
#[cfg(feature = "openapi")]
43
use utoipa::ToSchema;
54

rust/stackable-cockpit/src/engine/kind/mod.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::process::Stdio;
22

3-
use snafu::{ensure, OptionExt, ResultExt, Snafu};
3+
use snafu::{OptionExt, ResultExt, Snafu, ensure};
44
use tokio::{io::AsyncWriteExt, process::Command};
55
use tracing::{debug, info, instrument};
66

@@ -141,12 +141,9 @@ impl Cluster {
141141
.await
142142
.context(CommandFailedToRunSnafu)?;
143143

144-
ensure!(
145-
output.status.success(),
146-
CommandErroredOutSnafu {
147-
error: String::from_utf8_lossy(&output.stderr)
148-
}
149-
);
144+
ensure!(output.status.success(), CommandErroredOutSnafu {
145+
error: String::from_utf8_lossy(&output.stderr)
146+
});
150147

151148
let output = String::from_utf8_lossy(&output.stdout);
152149
Ok(output.lines().any(|name| name == cluster_name))

rust/stackable-cockpit/src/helm.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ pub enum InstallReleaseError {
7474
/// This error indicates that the Helm release is already installed at a
7575
/// different version than requested. Installation is skipped. Existing
7676
/// releases should be uninstalled with 'stackablectl op un \<NAME\>'.
77-
#[snafu(display("release {name} ({current_version}) already installed, skipping requested version {requested_version}"))]
77+
#[snafu(display(
78+
"release {name} ({current_version}) already installed, skipping requested version {requested_version}"
79+
))]
7880
ReleaseAlreadyInstalled {
7981
name: String,
8082
current_version: String,
@@ -130,8 +132,7 @@ impl Display for InstallReleaseStatus {
130132
write!(
131133
f,
132134
"The release {} ({}) is already installed and no specific version was requested, skipping.",
133-
release_name,
134-
current_version
135+
release_name, current_version
135136
)
136137
}
137138
InstallReleaseStatus::Installed(release_name) => {
@@ -230,7 +231,7 @@ pub fn install_release_from_repo_or_registry(
230231
return Ok(InstallReleaseStatus::ReleaseAlreadyInstalledUnspecified {
231232
release_name: release_name.to_string(),
232233
current_version,
233-
})
234+
});
234235
}
235236
}
236237
}

rust/stackable-cockpit/src/oci.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,9 @@ pub async fn get_oci_index<'a>() -> Result<HashMap<&'a str, ChartSourceMetadata>
128128
HELM_REPO_NAME_TEST,
129129
HELM_REPO_NAME_DEV,
130130
] {
131-
source_index_files.insert(
132-
repo_name,
133-
ChartSourceMetadata {
134-
entries: HashMap::new(),
135-
},
136-
);
131+
source_index_files.insert(repo_name, ChartSourceMetadata {
132+
entries: HashMap::new(),
133+
});
137134
}
138135
let base_url = format!("https://{HELM_OCI_BASE}/api/v2.0");
139136

rust/stackable-cockpit/src/platform/cluster/resource_request.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
use std::fmt::Display;
22

3-
#[cfg(feature = "openapi")]
4-
use utoipa::ToSchema;
5-
63
use k8s_openapi::apimachinery::pkg::api::resource::Quantity;
74
use serde::{Deserialize, Serialize};
85
use snafu::{ResultExt, Snafu};
96
use stackable_operator::{cpu::CpuQuantity, memory::MemoryQuantity};
7+
#[cfg(feature = "openapi")]
8+
use utoipa::ToSchema;
109

1110
use crate::utils::k8s::{Client, Error};
1211

rust/stackable-cockpit/src/platform/credentials.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::fmt::Display;
22

3-
use kube::{core::DynamicObject, ResourceExt};
3+
use kube::{ResourceExt, core::DynamicObject};
44
use serde::Serialize;
55
use snafu::{OptionExt, ResultExt, Snafu};
66

rust/stackable-cockpit/src/platform/demo/spec.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use serde::{Deserialize, Serialize};
22
use snafu::{OptionExt, ResultExt, Snafu};
33
use tracing::{debug, info, instrument, warn};
4-
54
#[cfg(feature = "openapi")]
65
use utoipa::ToSchema;
76

0 commit comments

Comments
 (0)