Take rustfmt's defaults
The code was hand-formatted -- close to rustfmt's output but not it, mostly in keeping chains and call arguments on one line where the formatter would break them. That is a per-line decision every future change has to make again, and reproducing it would mean a config whose only job is to preserve how the code already looks. So this is `cargo fmt` at its defaults, with no rustfmt.toml, which is where the sibling dev-updater checkout already sits: it is clean at the defaults today, so the two repos now agree on layout without either of them configuring it. Formatting only -- no behaviour, no renames, nothing reordered. Verified after: cargo test (35 pass), cargo clippy --all-targets clean, cargo fmt --check clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017xn8nHw1tw1R6PtiY1eEtw
This commit is contained in:
1 parent
f014094fcd
commit
c12ab7f098
13 files changed
+557
-190
No files matched your search
+25
-6
@@ -63,7 +63,10 @@ pub(crate) mod format {
|
||||
/// one silently mangled. `parse` round-trips either way, since a
|
||||
/// wrapped body parses the same as an unwrapped one re-wrapped.
|
||||
fn unwrap_outer(text: &str) -> String {
|
||||
let Some(body) = text.strip_prefix("(\n").and_then(|rest| rest.strip_suffix("\n)")) else {
|
||||
let Some(body) = text
|
||||
.strip_prefix("(\n")
|
||||
.and_then(|rest| rest.strip_suffix("\n)"))
|
||||
else {
|
||||
return text.to_string();
|
||||
};
|
||||
let mut out: String = body
|
||||
@@ -305,7 +308,10 @@ mod tests {
|
||||
assert!(first_run.tokens.is_empty());
|
||||
assert!(first_run.sessions.is_empty());
|
||||
assert_eq!(first_run.providers().len(), 1);
|
||||
assert_eq!(first_run.provider(ECHO_PROVIDER).expect("built-in").kind, DriverKind::Echo);
|
||||
assert_eq!(
|
||||
first_run.provider(ECHO_PROVIDER).expect("built-in").kind,
|
||||
DriverKind::Echo
|
||||
);
|
||||
|
||||
let config = Config {
|
||||
tokens: vec![TokenEntry {
|
||||
@@ -347,7 +353,11 @@ mod tests {
|
||||
// Built-in echo plus the configured one; any provider can run on
|
||||
// any host, so they are listed independently.
|
||||
assert_eq!(
|
||||
loaded.providers().iter().map(|p| p.name.clone()).collect::<Vec<_>>(),
|
||||
loaded
|
||||
.providers()
|
||||
.iter()
|
||||
.map(|p| p.name.clone())
|
||||
.collect::<Vec<_>>(),
|
||||
["echo", "claude-cli"],
|
||||
);
|
||||
|
||||
@@ -361,8 +371,14 @@ mod tests {
|
||||
// and only `skip_serializing_if` keeps this from writing it back.
|
||||
let text = std::fs::read_to_string(&path).expect("read back");
|
||||
assert!(!text.trim_start().starts_with('('), "outer parens: {text}");
|
||||
assert!(text.starts_with("tokens: ["), "top level should sit at column 0: {text}");
|
||||
assert!(text.contains("port: 2222"), "optional written long-hand: {text}");
|
||||
assert!(
|
||||
text.starts_with("tokens: ["),
|
||||
"top level should sit at column 0: {text}"
|
||||
);
|
||||
assert!(
|
||||
text.contains("port: 2222"),
|
||||
"optional written long-hand: {text}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -378,6 +394,9 @@ mod tests {
|
||||
};
|
||||
// One entry, not two: the built-in is skipped rather than shadowed.
|
||||
assert_eq!(config.providers().len(), 1);
|
||||
assert_eq!(config.provider(ECHO_PROVIDER).expect("provider").kind, DriverKind::ClaudeCli);
|
||||
assert_eq!(
|
||||
config.provider(ECHO_PROVIDER).expect("provider").kind,
|
||||
DriverKind::ClaudeCli
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user