Skip to content

Commit 1a907dd

Browse files
committed
style: apply cargo fmt across all sources
Run `cargo fmt --all` to satisfy the `cargo fmt --check` step in CI. Reflows long function signatures, struct literals, and macro arguments to fit rustfmt's default column width, and expands single-line if/else and let-else bindings into block form. No behavioral changes.
1 parent 2a40c66 commit 1a907dd

5 files changed

Lines changed: 46 additions & 19 deletions

File tree

src/https.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,7 @@ static JOB_TX: LazyLock<Sender<Job>> = LazyLock::new(|| {
6868
});
6969

7070
/// Submits a request. Falls back to a one-off thread if the worker pool is saturated.
71-
pub fn start_request(
72-
index: i32,
73-
method: String,
74-
url: String,
75-
body: BodyPayload,
76-
callback: String,
77-
) {
71+
pub fn start_request(index: i32, method: String, url: String, body: BodyPayload, callback: String) {
7872
let headers: Vec<(String, String)> = state::snapshot_headers().into_iter().collect();
7973
let job = Job {
8074
index,
@@ -222,7 +216,13 @@ fn run_job(job: Job) {
222216

223217
if method == "HEAD" {
224218
let resp_headers = extract_response_headers(&resp);
225-
finish_ok(index, &callback, String::new(), status.as_u16() as i32, resp_headers);
219+
finish_ok(
220+
index,
221+
&callback,
222+
String::new(),
223+
status.as_u16() as i32,
224+
resp_headers,
225+
);
226226
return;
227227
}
228228

src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ pub struct Plugin {
1818

1919
impl Plugin {
2020
fn new() -> Self {
21-
Self { amx_list: Vec::new() }
21+
Self {
22+
amx_list: Vec::new(),
23+
}
2224
}
2325
}
2426

src/natives.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,10 @@ impl Plugin {
206206
key: &AmxString,
207207
value: &AmxString,
208208
) -> AmxResult<bool> {
209-
Ok(state::add_multipart_text(key.to_string(), value.to_string()))
209+
Ok(state::add_multipart_text(
210+
key.to_string(),
211+
value.to_string(),
212+
))
210213
}
211214

212215
/// Appends a file field to the multipart/form-data builder. The file is

src/state.rs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,14 @@ pub fn enqueue_response(
9898
if q.len() >= MAX_QUEUE {
9999
q.pop_front();
100100
}
101-
q.push_back(HttpsResponse { index, callback, response, status, error, headers });
101+
q.push_back(HttpsResponse {
102+
index,
103+
callback,
104+
response,
105+
status,
106+
error,
107+
headers,
108+
});
102109
}
103110
}
104111

@@ -155,7 +162,11 @@ pub fn set_timeout_once(total_ms: u64) {
155162

156163
pub fn take_timeout_once() -> Option<Duration> {
157164
let ms = PENDING_TIMEOUT_MS.swap(0, Ordering::AcqRel);
158-
if ms == 0 { None } else { Some(Duration::from_millis(ms)) }
165+
if ms == 0 {
166+
None
167+
} else {
168+
Some(Duration::from_millis(ms))
169+
}
159170
}
160171

161172
// ============================================================================
@@ -330,7 +341,10 @@ static COOKIE_JAR: LazyLock<Mutex<Arc<Jar>>> =
330341
LazyLock::new(|| Mutex::new(Arc::new(Jar::default())));
331342

332343
fn cookie_jar() -> Arc<Jar> {
333-
COOKIE_JAR.lock().map(|j| j.clone()).unwrap_or_else(|_| Arc::new(Jar::default()))
344+
COOKIE_JAR
345+
.lock()
346+
.map(|j| j.clone())
347+
.unwrap_or_else(|_| Arc::new(Jar::default()))
334348
}
335349

336350
pub fn set_cookies_enabled(enabled: bool) {
@@ -386,9 +400,10 @@ fn rebuild_active_client() {
386400
}
387401

388402
pub fn active_client() -> Arc<Client> {
389-
ACTIVE_CLIENT.lock().map(|c| c.clone()).unwrap_or_else(|_| {
390-
Arc::new(build_client(None, false).expect("fallback default client"))
391-
})
403+
ACTIVE_CLIENT
404+
.lock()
405+
.map(|c| c.clone())
406+
.unwrap_or_else(|_| Arc::new(build_client(None, false).expect("fallback default client")))
392407
}
393408

394409
pub fn set_mtls_identity_pem(pem: &[u8]) -> bool {

src/util.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ pub fn print_banner() {
2424
samp::log::info!("");
2525
samp::log::info!(" | {} {} | {}", name, version, build_year);
2626
samp::log::info!(" |-------------------------------");
27-
samp::log::info!(" | Author and maintainer: {}", value_or(authors, "Unknown"));
27+
samp::log::info!(
28+
" | Author and maintainer: {}",
29+
value_or(authors, "Unknown")
30+
);
2831
samp::log::info!("");
2932
samp::log::info!(" | Compiled: {} at {}", build_date, build_time);
3033
samp::log::info!(" |-------------------------------");
@@ -65,10 +68,14 @@ fn dispatch_one(amx_list: &[AmxIdent], item: HttpsResponse) {
6568
let mut delivered = false;
6669
for ident in amx_list {
6770
let Some(amx) = get_amx(*ident) else { continue };
68-
let Ok(func) = amx.find_public(&item.callback) else { continue };
71+
let Ok(func) = amx.find_public(&item.callback) else {
72+
continue;
73+
};
6974

7075
let allocator = amx.allocator();
71-
let Ok(amx_str) = allocator.allot_string(&item.response) else { continue };
76+
let Ok(amx_str) = allocator.allot_string(&item.response) else {
77+
continue;
78+
};
7279

7380
if amx.push(item.error).is_err()
7481
|| amx.push(item.status).is_err()

0 commit comments

Comments
 (0)