Skip to content

Commit 0b818c4

Browse files
axpnetaeroftp[bot]claude
committed
style: apply cargo fmt across the crate
Pre-existing repo-wide rustfmt drift (~44 files, not CI-gated). Pure cargo fmt normalisation: AST-preserving, no behaviour change. Kept out of the PD-CLI-CONV-B functional slice on purpose; landed as a dedicated, separately-approved style commit. Co-Authored-By: aeroftp[bot] <aeroftp[bot]@users.noreply.github.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2365ab2 commit 0b818c4

44 files changed

Lines changed: 878 additions & 802 deletions

Some content is hidden

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

src-tauri/src/aerorsync/delta_transport_impl.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ use tokio::io::{AsyncSeekExt, AsyncWriteExt};
6666
use crate::aerorsync::engine_adapter::{
6767
BaselineSource, CurrentDeltaSyncBridge, FileBaseline, MemoryBaseline,
6868
};
69-
use crate::aerorsync::fallback_policy::{FallbackVerdict, classify_fallback};
69+
use crate::aerorsync::fallback_policy::{classify_fallback, FallbackVerdict};
7070
use crate::aerorsync::native_driver::{AerorsyncDriver, PreambleProfile};
7171
use crate::aerorsync::real_wire::FileListEntry;
7272
use crate::aerorsync::remote_command::RemoteCommandSpec;
@@ -167,10 +167,7 @@ impl AerorsyncDeltaTransport {
167167
// resolves SSH_AUTH_SOCK at connect time. `prefers_russh_leg`
168168
// then routes probe + single-shot through russh (libssh2 is
169169
// pubkey-file-only).
170-
auth_agent: matches!(
171-
cfg.auth_method,
172-
crate::rsync_over_ssh::AuthMethod::Agent
173-
),
170+
auth_agent: matches!(cfg.auth_method, crate::rsync_over_ssh::AuthMethod::Agent),
174171
// B.1/B.4: probe stock `rsync --version` on the remote. The
175172
// parser in `parse_probe_protocol` extracts the numeric
176173
// protocol version from the multi-line banner. A missing
@@ -1828,8 +1825,15 @@ mod tests {
18281825
.expect("sparse write");
18291826

18301827
let back = std::fs::read(&target).unwrap();
1831-
assert_eq!(back.len(), data.len(), "size must match (set_len fixed trailing hole)");
1832-
assert_eq!(back, data, "sparse output must be byte-identical (holes read as zeros)");
1828+
assert_eq!(
1829+
back.len(),
1830+
data.len(),
1831+
"size must match (set_len fixed trailing hole)"
1832+
);
1833+
assert_eq!(
1834+
back, data,
1835+
"sparse output must be byte-identical (holes read as zeros)"
1836+
);
18331837
}
18341838

18351839
#[cfg(unix)]
@@ -1856,7 +1860,10 @@ mod tests {
18561860
.expect("sparse write");
18571861

18581862
// Logical content identical.
1859-
assert_eq!(std::fs::read(&dense).unwrap(), std::fs::read(&sparse).unwrap());
1863+
assert_eq!(
1864+
std::fs::read(&dense).unwrap(),
1865+
std::fs::read(&sparse).unwrap()
1866+
);
18601867

18611868
let dense_blocks = std::fs::metadata(&dense).unwrap().blocks();
18621869
let sparse_blocks = std::fs::metadata(&sparse).unwrap().blocks();

src-tauri/src/aerorsync/engine_adapter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use crate::aerorsync::protocol::{
2626
DeltaInstruction as ProtocolDeltaInstruction, SignatureBlock as ProtocolSignatureBlock,
2727
};
2828
use crate::delta_sync;
29-
use crate::delta_sync::{RollingChecksum, strong_hash};
29+
use crate::delta_sync::{strong_hash, RollingChecksum};
3030

3131
#[derive(Debug, Clone, PartialEq, Eq)]
3232
pub struct EngineSignatureBlock {

src-tauri/src/aerorsync/local_transport.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,12 @@ impl LocalDeltaTransport {
112112
// Apply the plan to the baseline to reconstruct the target bytes.
113113
// For an identical baseline this is purely CopyBlock ops and the
114114
// output equals `source`.
115-
let reconstructed = delta_sync::apply_delta(&baseline, &ops, block_size)
116-
.map_err(|e| RsyncError::TransferFailed {
115+
let reconstructed = delta_sync::apply_delta(&baseline, &ops, block_size).map_err(|e| {
116+
RsyncError::TransferFailed {
117117
exit: 0,
118118
stderr: format!("local delta apply failed: {e}"),
119-
})?;
119+
}
120+
})?;
120121

121122
// Account literal bytes for the speedup metric: this is the byte
122123
// count that would have travelled on the wire in a real delta sync.
@@ -209,13 +210,10 @@ impl DeltaTransport for LocalDeltaTransport {
209210
Ok(())
210211
}
211212

212-
async fn upload(
213-
&self,
214-
local_path: &Path,
215-
remote_path: &str,
216-
) -> Result<RsyncStats, RsyncError> {
213+
async fn upload(&self, local_path: &Path, remote_path: &str) -> Result<RsyncStats, RsyncError> {
217214
// `remote_path` is interpreted as a local filesystem path.
218-
self.transfer_inner(local_path, Path::new(remote_path)).await
215+
self.transfer_inner(local_path, Path::new(remote_path))
216+
.await
219217
}
220218

221219
async fn download(
@@ -224,7 +222,8 @@ impl DeltaTransport for LocalDeltaTransport {
224222
local_path: &Path,
225223
) -> Result<RsyncStats, RsyncError> {
226224
// Inverted direction: `remote_path` is the source on the local fs.
227-
self.transfer_inner(Path::new(remote_path), local_path).await
225+
self.transfer_inner(Path::new(remote_path), local_path)
226+
.await
228227
}
229228
}
230229

@@ -478,7 +477,9 @@ mod tests {
478477
let dir = tmp_dir();
479478
let src = dir.path().join("src.bin");
480479
let dst = dir.path().join("dst.bin");
481-
tokio::fs::write(&src, vec![0u8; 1024 * 1024 + 1]).await.unwrap();
480+
tokio::fs::write(&src, vec![0u8; 1024 * 1024 + 1])
481+
.await
482+
.unwrap();
482483
let perms = std::fs::Permissions::from_mode(0o640);
483484
std::fs::set_permissions(&src, perms).unwrap();
484485

src-tauri/src/aerorsync/native_driver.rs

Lines changed: 29 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,25 @@
4747
//! checkpoint doc.
4848
4949
use crate::aerorsync::engine_adapter::{
50-
BaselineSource, DeltaEngineAdapter, DeltaPlanProducer, EngineDeltaOp, EngineSignatureBlock,
51-
RollingDeltaPlanProducer, apply_delta_streaming,
50+
apply_delta_streaming, BaselineSource, DeltaEngineAdapter, DeltaPlanProducer, EngineDeltaOp,
51+
EngineSignatureBlock, RollingDeltaPlanProducer,
5252
};
5353
use crate::aerorsync::events::EventSink;
5454
use crate::aerorsync::real_wire::{
55-
ClientPreamble, DeltaOp, DeltaStreamReport, FileListDecodeOptions, FileListDecodeOutcome,
56-
FileListEntry, MAX_DELTA_LITERAL_LEN, MuxHeader, MuxPoll, MuxStreamReader, MuxTag, NDX_DONE,
57-
NDX_FLIST_EOF, NdxState, RealWireError, SumBlock, SumHead, SummaryFrame,
5855
compress_zstd_literal_stream, decode_delta_stream, decode_file_list_entry, decode_item_flags,
5956
decode_ndx, decode_server_preamble, decode_sum_block, decode_sum_head, decode_summary_frame,
6057
decompress_zstd_literal_stream_boundaries, encode_client_preamble, encode_delta_stream,
6158
encode_file_list_entry, encode_file_list_terminator, encode_item_flags, encode_ndx,
62-
encode_sum_block, encode_sum_head, encode_summary_frame,
59+
encode_sum_block, encode_sum_head, encode_summary_frame, ClientPreamble, DeltaOp,
60+
DeltaStreamReport, FileListDecodeOptions, FileListDecodeOutcome, FileListEntry, MuxHeader,
61+
MuxPoll, MuxStreamReader, MuxTag, NdxState, RealWireError, SumBlock, SumHead, SummaryFrame,
62+
MAX_DELTA_LITERAL_LEN, NDX_DONE, NDX_FLIST_EOF,
6363
};
6464
use crate::aerorsync::remote_command::{RemoteCommandFlavor, RemoteCommandSpec};
6565
use crate::aerorsync::transport::{CancelHandle, RawByteStream, RawRemoteShellTransport};
6666
use crate::aerorsync::types::{AerorsyncError, AerorsyncErrorKind, SessionRole, SessionStats};
6767
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite};
68-
use xxhash_rust::xxh3::{Xxh3Default, xxh3_128, xxh3_128_with_seed};
68+
use xxhash_rust::xxh3::{xxh3_128, xxh3_128_with_seed, Xxh3Default};
6969

7070
/// Compute the 16-byte file-level strong checksum rsync verifies at the
7171
/// end of the delta stream when `xxh128` is the negotiated algo.
@@ -317,7 +317,11 @@ fn wire_dump_append(file: &str, header: &str, bytes: &[u8]) {
317317
let _ = write!(
318318
out,
319319
"{}",
320-
if (0x20..0x7f).contains(&c) { c as char } else { '.' }
320+
if (0x20..0x7f).contains(&c) {
321+
c as char
322+
} else {
323+
'.'
324+
}
321325
);
322326
}
323327
let _ = writeln!(out, "|");
@@ -1071,10 +1075,7 @@ impl<T: RawRemoteShellTransport> AerorsyncDriver<T> {
10711075
})?;
10721076
let chunk = stream.read_bytes(RAW_READ_CHUNK).await?;
10731077
if chunk.is_empty() {
1074-
wire_dump_server_response(
1075-
&scratch,
1076-
"remote-closed-before-server-preamble",
1077-
);
1078+
wire_dump_server_response(&scratch, "remote-closed-before-server-preamble");
10781079
return Err(AerorsyncError::transport(
10791080
"perform_preamble_exchange: remote closed before server preamble",
10801081
));
@@ -2027,34 +2028,23 @@ impl<T: RawRemoteShellTransport> AerorsyncDriver<T> {
20272028
// loop-top would. An empty `buf` here is a genuine
20282029
// no-payload no-op (keep the local baseline).
20292030
if !buf.is_empty() {
2030-
match decode_delta_stream(
2031-
&buf,
2032-
A2_3_FILE_CHECKSUM_LEN,
2033-
sum_head_count,
2034-
) {
2031+
match decode_delta_stream(&buf, A2_3_FILE_CHECKSUM_LEN, sum_head_count) {
20352032
Ok((report, consumed)) => {
2036-
self.stash_post_delta_into_summary_seed(
2037-
&buf[consumed..],
2038-
);
2039-
self.received_file_checksum =
2040-
Some(report.file_checksum.clone());
2033+
self.stash_post_delta_into_summary_seed(&buf[consumed..]);
2034+
self.received_file_checksum = Some(report.file_checksum.clone());
20412035
self.install_reconstructed_from_wire(
20422036
destination_data,
20432037
adapter,
20442038
report.ops,
20452039
)?;
2046-
self.phase =
2047-
AerorsyncSessionPhase::DeltaReceived;
2040+
self.phase = AerorsyncSessionPhase::DeltaReceived;
20482041
return Ok(());
20492042
}
20502043
Err(RealWireError::DeltaTokenTruncated { .. }) => {
20512044
return Err(e);
20522045
}
20532046
Err(other) => {
2054-
return Err(map_realwire_error(
2055-
other,
2056-
"delta stream",
2057-
));
2047+
return Err(map_realwire_error(other, "delta stream"));
20582048
}
20592049
}
20602050
}
@@ -2175,17 +2165,10 @@ impl<T: RawRemoteShellTransport> AerorsyncDriver<T> {
21752165
// loop-top would. An empty `buf` here is a genuine
21762166
// no-payload no-op (keep the local baseline).
21772167
if !buf.is_empty() {
2178-
match decode_delta_stream(
2179-
&buf,
2180-
A2_3_FILE_CHECKSUM_LEN,
2181-
sum_head_count,
2182-
) {
2168+
match decode_delta_stream(&buf, A2_3_FILE_CHECKSUM_LEN, sum_head_count) {
21832169
Ok((report, consumed)) => {
2184-
self.stash_post_delta_into_summary_seed(
2185-
&buf[consumed..],
2186-
);
2187-
self.received_file_checksum =
2188-
Some(report.file_checksum.clone());
2170+
self.stash_post_delta_into_summary_seed(&buf[consumed..]);
2171+
self.received_file_checksum = Some(report.file_checksum.clone());
21892172
self.install_reconstructed_from_wire_streaming(
21902173
baseline, writer, adapter, report.ops,
21912174
)
@@ -2200,10 +2183,7 @@ impl<T: RawRemoteShellTransport> AerorsyncDriver<T> {
22002183
return Err(e);
22012184
}
22022185
Err(other) => {
2203-
return Err(map_realwire_error(
2204-
other,
2205-
"delta stream",
2206-
));
2186+
return Err(map_realwire_error(other, "delta stream"));
22072187
}
22082188
}
22092189
}
@@ -2294,9 +2274,9 @@ impl<T: RawRemoteShellTransport> AerorsyncDriver<T> {
22942274
let zstd_on = self.zstd_negotiated();
22952275
let engine_ops = self.delta_wire_to_engine_ops(&wire_ops, zstd_on)?;
22962276
let _ = adapter; // adapter is unused on the streaming path -
2297-
// engine ops carry everything apply_delta_streaming needs.
2298-
// Kept in the signature for parity with the bulk twin and
2299-
// to leave room for future adapter-driven dispatch.
2277+
// engine ops carry everything apply_delta_streaming needs.
2278+
// Kept in the signature for parity with the bulk twin and
2279+
// to leave room for future adapter-driven dispatch.
23002280
let block_size = self
23012281
.sent_sum_head
23022282
.as_ref()
@@ -2963,11 +2943,11 @@ mod tests {
29632943
use crate::aerorsync::engine_adapter::{
29642944
DeltaEngineAdapter, EngineDeltaOp, EngineDeltaPlan, EngineSignatureBlock,
29652945
};
2966-
use crate::aerorsync::events::{AerorsyncEvent, CollectingSink, classify_oob_frame};
2946+
use crate::aerorsync::events::{classify_oob_frame, AerorsyncEvent, CollectingSink};
29672947
use crate::aerorsync::fixtures::RealRsyncBaselineByteTranscript;
29682948
use crate::aerorsync::mock::{MockRemoteShellTransport, MockTransportConfig};
29692949
use crate::aerorsync::real_wire::{
2970-
ServerPreamble, decode_client_preamble, encode_server_preamble, reassemble_msg_data,
2950+
decode_client_preamble, encode_server_preamble, reassemble_msg_data, ServerPreamble,
29712951
};
29722952

29732953
/// Mock adapter used by A2.2/A2.3 tests. Returns a configurable
@@ -3080,7 +3060,7 @@ mod tests {
30803060
blocks: &[SumBlock],
30813061
) -> Vec<u8> {
30823062
use crate::aerorsync::real_wire::{
3083-
NdxState, encode_item_flags, encode_ndx, encode_sum_block, encode_sum_head,
3063+
encode_item_flags, encode_ndx, encode_sum_block, encode_sum_head, NdxState,
30843064
};
30853065
let mut st = NdxState::new();
30863066
let mut out = Vec::new();
@@ -3138,8 +3118,8 @@ mod tests {
31383118
block_len,
31393119
}
31403120
}
3141-
use std::sync::Arc;
31423121
use std::sync::atomic::{AtomicBool, Ordering};
3122+
use std::sync::Arc;
31433123

31443124
// ---- helpers ---------------------------------------------------------
31453125

src-tauri/src/aerorsync/real_wire.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3217,7 +3217,11 @@ mod tests {
32173217

32183218
let err = decode_server_preamble(&buf).unwrap_err();
32193219
match err {
3220-
RealWireError::TruncatedBuffer { at, needed, available } => {
3220+
RealWireError::TruncatedBuffer {
3221+
at,
3222+
needed,
3223+
available,
3224+
} => {
32213225
assert_eq!(at, "server_checksum_algos");
32223226
assert_eq!(needed, 25); // 1 len byte + 24 declared bytes
32233227
assert!(
@@ -3247,7 +3251,11 @@ mod tests {
32473251

32483252
let err = decode_server_preamble(&buf).unwrap_err();
32493253
match err {
3250-
RealWireError::TruncatedBuffer { at, needed, available } => {
3254+
RealWireError::TruncatedBuffer {
3255+
at,
3256+
needed,
3257+
available,
3258+
} => {
32513259
assert_eq!(at, "server_compression_algos");
32523260
assert_eq!(needed, 25);
32533261
assert!(available < needed);
@@ -5306,7 +5314,10 @@ mod tests {
53065314
let (outcome, _) = decode_file_list_entry(&reg_bytes, &opts).unwrap();
53075315
match outcome {
53085316
FileListDecodeOutcome::Entry(d) => {
5309-
assert!(d.symlink_target.is_none(), "regular file must have no symlink target");
5317+
assert!(
5318+
d.symlink_target.is_none(),
5319+
"regular file must have no symlink target"
5320+
);
53105321
}
53115322
other => panic!("expected Entry, got {other:?}"),
53125323
}

src-tauri/src/aerorsync/russh_session_transport.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use russh::keys::{self, Algorithm, EcdsaCurve, HashAlg, PrivateKeyWithHashAlg, P
1717
use russh::Preferred;
1818
use russh::{Channel, ChannelMsg};
1919
use secrecy::ExposeSecret;
20-
use std::borrow::Cow;
2120
use sha2::{Digest, Sha256};
21+
use std::borrow::Cow;
2222
use tokio::sync::Mutex as AsyncMutex;
2323

2424
use crate::aerorsync::ssh_transport::{parse_probe_protocol, SshHostKeyPolicy, SshTransportConfig};
@@ -208,9 +208,10 @@ async fn authenticate_agent(
208208
"ssh-agent connect (SSH_AUTH_SOCK): {e}; is an agent running and SSH_AUTH_SOCK set?"
209209
))
210210
})?;
211-
let identities = agent.request_identities().await.map_err(|e| {
212-
AerorsyncError::transport(format!("ssh-agent request_identities: {e}"))
213-
})?;
211+
let identities = agent
212+
.request_identities()
213+
.await
214+
.map_err(|e| AerorsyncError::transport(format!("ssh-agent request_identities: {e}")))?;
214215
if identities.is_empty() {
215216
return Err(AerorsyncError::transport(
216217
"ssh-agent has no identities loaded (run `ssh-add` first)",
@@ -1065,9 +1066,9 @@ mod tests {
10651066
let before = transport.handshake_count();
10661067
match transport.reconnect().await {
10671068
Err(_) => {}
1068-
Ok(_) => panic!(
1069-
"reconnect to port 1 should not succeed in CI: see connect_refuses_port_1"
1070-
),
1069+
Ok(_) => {
1070+
panic!("reconnect to port 1 should not succeed in CI: see connect_refuses_port_1")
1071+
}
10711072
}
10721073
assert_eq!(
10731074
transport.handshake_count(),

src-tauri/src/aerovault_v2.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,11 @@ pub async fn vault_v2_add_files(
155155
let paths: Vec<std::path::PathBuf> = file_paths.iter().map(std::path::PathBuf::from).collect();
156156
report.step(format!(
157157
"encrypt+seal: AES-256-GCM-SIV{} over 64KiB chunks, rebuild container",
158-
if cascade { " + ChaCha20-Poly1305 cascade" } else { "" }
158+
if cascade {
159+
" + ChaCha20-Poly1305 cascade"
160+
} else {
161+
""
162+
}
159163
));
160164
let added = vault.add_files(&paths).map_err(|e| e.to_string())?;
161165
let total = vault.list().map_err(|e| e.to_string())?.len();
@@ -171,8 +175,7 @@ pub async fn vault_v2_add_files(
171175
report.encrypted_bytes = size_after.saturating_sub(size_before);
172176
report.step(format!(
173177
"done: {} file(s) added, container grew {} byte(s)",
174-
added,
175-
report.encrypted_bytes
178+
added, report.encrypted_bytes
176179
));
177180
report.finish(started.elapsed().as_millis() as u64);
178181

0 commit comments

Comments
 (0)