style: format the whole tree with cargo fmt (stock defaults, #35)
One-time, mechanical reformat — no functional changes. The tree was not rustfmt-clean (~1800 hunks across ~100 files); this brings it to stock `cargo fmt` defaults so a `cargo fmt --check` CI gate can follow. Behaviour-preserving: 2509 pass / 0 fail / 1 ignored (unchanged baseline), clippy clean. A .git-blame-ignore-revs entry follows so `git blame` skips this commit.
This commit is contained in:
+18
-21
@@ -87,9 +87,7 @@ pub fn static_refusal(src: Type, target: Type) -> Option<String> {
|
||||
}
|
||||
|
||||
const fn is_in_matrix(src: Type, target: Type) -> bool {
|
||||
use Type::{
|
||||
Bool, Date, DateTime, Decimal, Int, Real, Serial, ShortId, Text,
|
||||
};
|
||||
use Type::{Bool, Date, DateTime, Decimal, Int, Real, Serial, ShortId, Text};
|
||||
matches!(
|
||||
(src, target),
|
||||
// Always-clean transformers
|
||||
@@ -130,9 +128,7 @@ pub fn transform_cell(src: Type, target: Type, value: &Value) -> CellOutcome {
|
||||
if matches!(value, Value::Null) {
|
||||
return CellOutcome::Clean(Value::Null);
|
||||
}
|
||||
use Type::{
|
||||
Bool, Date, DateTime, Decimal, Int, Real, Serial, ShortId, Text,
|
||||
};
|
||||
use Type::{Bool, Date, DateTime, Decimal, Int, Real, Serial, ShortId, Text};
|
||||
match (src, target) {
|
||||
// ---- Always-clean: int / serial source ----
|
||||
(Int | Serial, Real) => match value {
|
||||
@@ -179,9 +175,11 @@ pub fn transform_cell(src: Type, target: Type, value: &Value) -> CellOutcome {
|
||||
(Bool, Text) => match value {
|
||||
// "true" / "false" matches the DSL boolean grammar
|
||||
// (ADR-0014 §5), not raw 0/1 stringification.
|
||||
Value::Integer(i) => CellOutcome::Clean(Value::Text(
|
||||
if *i == 0 { "false".into() } else { "true".into() },
|
||||
)),
|
||||
Value::Integer(i) => CellOutcome::Clean(Value::Text(if *i == 0 {
|
||||
"false".into()
|
||||
} else {
|
||||
"true".into()
|
||||
})),
|
||||
other => unexpected_storage("bool", other),
|
||||
},
|
||||
|
||||
@@ -369,9 +367,7 @@ pub fn transform_cell(src: Type, target: Type, value: &Value) -> CellOutcome {
|
||||
}
|
||||
} else {
|
||||
CellOutcome::Incompatible {
|
||||
reason: format!(
|
||||
"`{s}` is not a datetime in `YYYY-MM-DDTHH:MM:SS` form"
|
||||
),
|
||||
reason: format!("`{s}` is not a datetime in `YYYY-MM-DDTHH:MM:SS` form"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -450,10 +446,7 @@ fn real_to_int(r: f64) -> CellOutcome {
|
||||
let discarded = r - r.trunc();
|
||||
CellOutcome::Lossy {
|
||||
new: Value::Integer(truncated),
|
||||
reason: format!(
|
||||
"truncated; would discard {}",
|
||||
format_real(discarded)
|
||||
),
|
||||
reason: format!("truncated; would discard {}", format_real(discarded)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -555,9 +548,7 @@ fn format_real(r: f64) -> String {
|
||||
|
||||
fn unexpected_storage(label: &str, value: &Value) -> CellOutcome {
|
||||
CellOutcome::Incompatible {
|
||||
reason: format!(
|
||||
"internal: cell stored unexpectedly for `{label}` source ({value:?})"
|
||||
),
|
||||
reason: format!("internal: cell stored unexpectedly for `{label}` source ({value:?})"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -638,7 +629,10 @@ mod tests {
|
||||
(Type::Date, Type::Int),
|
||||
(Type::ShortId, Type::Int),
|
||||
] {
|
||||
assert!(static_refusal(src, target).is_some(), "{src:?} -> {target:?}");
|
||||
assert!(
|
||||
static_refusal(src, target).is_some(),
|
||||
"{src:?} -> {target:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -672,7 +666,10 @@ mod tests {
|
||||
(Type::Bool, Type::Real),
|
||||
];
|
||||
for (s, t) in pairs {
|
||||
assert_eq!(transform_cell(s, t, &Value::Null), CellOutcome::Clean(Value::Null));
|
||||
assert_eq!(
|
||||
transform_cell(s, t, &Value::Null),
|
||||
CellOutcome::Clean(Value::Null)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user