Skip to content

Commit 6263f4e

Browse files
committed
chore: cargo fmt --all
Pure formatting changes across 6 files. No behavioral changes.
1 parent d63517b commit 6263f4e

6 files changed

Lines changed: 37 additions & 42 deletions

File tree

‎crates/aksh-conformance/src/main.rs‎

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
use std::path::PathBuf;
44
use std::process::Stdio;
55

6+
use aksh_gha_parser::{expand_jobs, parse_workflow};
67
use anyhow::{bail, Context};
78
use clap::{Parser, Subcommand};
8-
use aksh_gha_parser::{expand_jobs, parse_workflow};
99
use tokio::process::Command;
1010
use walkdir::WalkDir;
1111

@@ -153,11 +153,7 @@ fn looks_like_workflow(text: &str) -> bool {
153153
})
154154
}
155155

156-
async fn compare_command(
157-
upstream: String,
158-
aksh: String,
159-
args: Vec<String>,
160-
) -> anyhow::Result<()> {
156+
async fn compare_command(upstream: String, aksh: String, args: Vec<String>) -> anyhow::Result<()> {
161157
let upstream_output = Command::new(&upstream)
162158
.args(&args)
163159
.stdout(Stdio::piped())
@@ -202,7 +198,12 @@ async fn golden_compare(fixtures: PathBuf) -> anyhow::Result<()> {
202198
for entry in WalkDir::new(&fixtures)
203199
.into_iter()
204200
.filter_map(Result::ok)
205-
.filter(|e| e.file_type().is_file() && e.path().extension().is_some_and(|ext| ext == "yml" || ext == "yaml"))
201+
.filter(|e| {
202+
e.file_type().is_file()
203+
&& e.path()
204+
.extension()
205+
.is_some_and(|ext| ext == "yml" || ext == "yaml")
206+
})
206207
{
207208
let yaml_path = entry.path();
208209
let json_path = yaml_path.with_extension("json");
@@ -284,7 +285,10 @@ async fn replay_wire(fixtures: PathBuf) -> anyhow::Result<()> {
284285
eprintln!();
285286
eprintln!("To replay wire traffic:");
286287
eprintln!(" 1. Record traffic with 'aksh-conformance record'");
287-
eprintln!(" 2. Run 'aksh-conformance replay --fixtures {}'", fixtures.display());
288+
eprintln!(
289+
" 2. Run 'aksh-conformance replay --fixtures {}'",
290+
fixtures.display()
291+
);
288292
eprintln!(" 3. Each captured request/response is validated against our DTOs");
289293
Ok(())
290294
}
@@ -310,9 +314,8 @@ fn fuzz_parser(iterations: usize) -> anyhow::Result<()> {
310314
let yaml = generate_random_yaml(hash);
311315

312316
// Parse should never panic
313-
let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
314-
parse_workflow(&yaml)
315-
}));
317+
let result =
318+
std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| parse_workflow(&yaml)));
316319

317320
match result {
318321
Ok(_) => passed += 1,
@@ -334,7 +337,9 @@ fn fuzz_parser(iterations: usize) -> anyhow::Result<()> {
334337
fn generate_random_yaml(seed: u64) -> String {
335338
let mut s = seed;
336339
let mut next = || -> u64 {
337-
s = s.wrapping_mul(6364136223846793005).wrapping_add(1442695040888963407);
340+
s = s
341+
.wrapping_mul(6364136223846793005)
342+
.wrapping_add(1442695040888963407);
338343
s
339344
};
340345

@@ -352,7 +357,8 @@ fn generate_random_yaml(seed: u64) -> String {
352357
};
353358
let step_count = (next() % 5) + 1;
354359

355-
let mut yaml = format!("name: {name}\non: {event}\njobs:\n build:\n runs-on: [{label}]\n steps:\n");
360+
let mut yaml =
361+
format!("name: {name}\non: {event}\njobs:\n build:\n runs-on: [{label}]\n steps:\n");
356362
for _ in 0..step_count {
357363
let cmd = match next() % 3 {
358364
0 => "echo hello",

‎crates/aksh-gha-parser/src/eval.rs‎

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
1111
use std::collections::BTreeMap;
1212

13-
use indexmap::IndexMap;
1413
use aksh_gha_expressions::{eval_expression, Context};
14+
use indexmap::IndexMap;
1515
use serde_json::{Map, Value};
1616

1717
/// Resolve all `${{ }}` expressions in a string using the given context.
@@ -148,10 +148,8 @@ pub fn build_context(
148148
.collect();
149149
ctx.insert("vars", Value::Object(vars_value));
150150

151-
let matrix_value: Map<String, Value> = matrix
152-
.iter()
153-
.map(|(k, v)| (k.clone(), v.clone()))
154-
.collect();
151+
let matrix_value: Map<String, Value> =
152+
matrix.iter().map(|(k, v)| (k.clone(), v.clone())).collect();
155153
ctx.insert("matrix", Value::Object(matrix_value));
156154

157155
ctx.insert("strategy", strategy.clone());
@@ -184,10 +182,7 @@ mod tests {
184182
let mut env = Map::new();
185183
env.insert("MY_VAR".to_owned(), Value::String("hello".to_owned()));
186184
ctx.insert("env", Value::Object(env));
187-
ctx.insert(
188-
"matrix",
189-
json!({"os": "ubuntu-latest", "node": "18"}),
190-
);
185+
ctx.insert("matrix", json!({"os": "ubuntu-latest", "node": "18"}));
191186
ctx
192187
}
193188

@@ -236,10 +231,7 @@ mod tests {
236231
#[test]
237232
fn resolve_env_value() {
238233
let ctx = make_context();
239-
assert_eq!(
240-
resolve_string("${{ env.MY_VAR }}", &ctx).unwrap(),
241-
"hello"
242-
);
234+
assert_eq!(resolve_string("${{ env.MY_VAR }}", &ctx).unwrap(), "hello");
243235
}
244236

245237
#[test]

‎crates/aksh-gha-parser/src/lib.rs‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use std::collections::BTreeMap;
44
use std::path::{Path, PathBuf};
55

6-
use indexmap::IndexMap;
76
use aksh_gha_protocol::{JobId, JobPlan, StepPlan};
7+
use indexmap::IndexMap;
88

99
/// Expression evaluation for workflow fields.
1010
pub mod eval;
@@ -151,7 +151,9 @@ impl Trigger {
151151
}
152152
// paths filter
153153
if let Some(path_filters) = obj.get("paths") {
154-
if !paths.is_empty() && !paths.iter().any(|p| matches_filter(path_filters, p)) {
154+
if !paths.is_empty()
155+
&& !paths.iter().any(|p| matches_filter(path_filters, p))
156+
{
155157
return false;
156158
}
157159
}
@@ -216,9 +218,7 @@ fn glob_match(pattern: &str, value: &str) -> bool {
216218
return false;
217219
}
218220

219-
vi < value.len()
220-
&& pattern[pi] == value[vi]
221-
&& matches(pattern, value, pi + 1, vi + 1)
221+
vi < value.len() && pattern[pi] == value[vi] && matches(pattern, value, pi + 1, vi + 1)
222222
}
223223

224224
let pattern: Vec<char> = pattern.chars().collect();
@@ -773,10 +773,7 @@ fn object_entry_indexed(
773773
field,
774774
});
775775
};
776-
Ok(map
777-
.iter()
778-
.map(|(k, v)| (k.clone(), v.clone()))
779-
.collect())
776+
Ok(map.iter().map(|(k, v)| (k.clone(), v.clone())).collect())
780777
}
781778

782779
fn can_merge_include_indexed(
@@ -1006,4 +1003,3 @@ jobs:
10061003
assert!(jobs[0].secrets_inherit);
10071004
}
10081005
}
1009-

‎crates/aksh-gha-protocol/src/crypto.rs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
//! Source: `MessageListener.cs` → `GetMessageDecryptor()`
1212
//! Source: `AgentSessionController.cs` → session creation
1313
14+
use aes::cipher::{block_padding::Pkcs7, BlockDecryptMut, BlockEncryptMut, KeyIvInit};
1415
use base64::engine::general_purpose::{STANDARD as BASE64_STANDARD, URL_SAFE_NO_PAD};
1516
use base64::Engine;
16-
use aes::cipher::{block_padding::Pkcs7, BlockDecryptMut, BlockEncryptMut, KeyIvInit};
1717
use rsa::pkcs1::DecodeRsaPublicKey;
1818
use rsa::pkcs8::DecodePublicKey;
19-
use rsa::{BigUint, Oaep};
2019
use rsa::traits::PublicKeyParts;
20+
use rsa::{BigUint, Oaep};
2121
use sha1::Sha1;
2222

2323
type Aes256CbcEnc = cbc::Encryptor<aes::Aes256>;
@@ -55,7 +55,9 @@ impl AgentRsaPublicKey {
5555
rsa::RsaPublicKey::from_pkcs1_pem(trimmed)
5656
.map_err(|e| CryptoError::ParseKey(e.to_string()))?
5757
} else {
58-
return Err(CryptoError::ParseKey("unsupported public key format".to_owned()));
58+
return Err(CryptoError::ParseKey(
59+
"unsupported public key format".to_owned(),
60+
));
5961
};
6062

6163
Ok(Self { public_key })
@@ -171,7 +173,6 @@ impl AgentRsaKeypair {
171173
}
172174
}
173175

174-
175176
/// A session encryption context — holds the AES key for encrypting/decrypting
176177
/// message bodies within a session.
177178
pub struct SessionEncryption {

‎crates/aksh-runner-client/src/main.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
use std::collections::BTreeMap;
44
use std::path::PathBuf;
55

6+
use aksh_gha_protocol::RunId;
67
use anyhow::Context;
78
use clap::{Parser, Subcommand};
8-
use aksh_gha_protocol::RunId;
99
use reqwest::Url;
1010
use serde_json::Value;
1111

‎crates/aksh-runner-server/src/main.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use std::net::SocketAddr;
44
use std::path::PathBuf;
55

6-
use clap::{Parser, Subcommand};
76
use aksh_runner_server::{serve, ServerConfig};
7+
use clap::{Parser, Subcommand};
88

99
#[derive(Debug, Parser)]
1010
#[command(name = "aksh-server")]

0 commit comments

Comments
 (0)