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
-25
@@ -55,10 +55,9 @@ pub enum ParseError {
|
||||
impl std::fmt::Display for ParseError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Invalid { message, .. } => f.write_str(&crate::t!(
|
||||
"parse.error_wrapper",
|
||||
detail = message,
|
||||
)),
|
||||
Self::Invalid { message, .. } => {
|
||||
f.write_str(&crate::t!("parse.error_wrapper", detail = message,))
|
||||
}
|
||||
Self::Empty => f.write_str(&crate::t!("parse.empty")),
|
||||
}
|
||||
}
|
||||
@@ -125,10 +124,7 @@ pub fn parse_command_with_schema(
|
||||
/// Schemaless, mode-aware parse (ADR-0030 §2). In `Mode::Simple`
|
||||
/// the walker gates SQL-only commands and produces the
|
||||
/// "this is SQL" hint instead of executing them.
|
||||
pub fn parse_command_in_mode(
|
||||
input: &str,
|
||||
mode: Mode,
|
||||
) -> Result<Command, ParseError> {
|
||||
pub fn parse_command_in_mode(input: &str, mode: Mode) -> Result<Command, ParseError> {
|
||||
parse_command_inner(input, None, mode)
|
||||
}
|
||||
|
||||
@@ -185,10 +181,8 @@ fn unknown_command_error(source: &str) -> ParseError {
|
||||
.collect();
|
||||
let joined = oxford_join(&entries);
|
||||
let start = skip_whitespace(source, 0);
|
||||
let (position, found_word) = consume_ident(source, start).map_or_else(
|
||||
|| (start, None),
|
||||
|(s, e)| (s, Some(&source[s..e])),
|
||||
);
|
||||
let (position, found_word) = consume_ident(source, start)
|
||||
.map_or_else(|| (start, None), |(s, e)| (s, Some(&source[s..e])));
|
||||
let message = found_word.map_or_else(
|
||||
|| format!("expected one of {joined}"),
|
||||
|w| format!("expected one of {joined}, found `{w}`"),
|
||||
@@ -1034,19 +1028,22 @@ mod tests {
|
||||
false,
|
||||
);
|
||||
assert_eq!(
|
||||
ok("add 1:n relationship from Customers.Id to Orders.CustId on delete cascade on update set null"),
|
||||
ok(
|
||||
"add 1:n relationship from Customers.Id to Orders.CustId on delete cascade on update set null"
|
||||
),
|
||||
expected
|
||||
);
|
||||
assert_eq!(
|
||||
ok("add 1:n relationship from Customers.Id to Orders.CustId on update set null on delete cascade"),
|
||||
ok(
|
||||
"add 1:n relationship from Customers.Id to Orders.CustId on update set null on delete cascade"
|
||||
),
|
||||
expected
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn add_relationship_repeated_clause_errors() {
|
||||
let e =
|
||||
err("add 1:n relationship from C.id to O.cid on delete cascade on delete restrict");
|
||||
let e = err("add 1:n relationship from C.id to O.cid on delete cascade on delete restrict");
|
||||
match e {
|
||||
ParseError::Invalid { message, .. } => {
|
||||
assert!(message.contains("specified twice"), "{message}");
|
||||
@@ -1073,7 +1070,9 @@ mod tests {
|
||||
#[test]
|
||||
fn add_relationship_with_name_actions_and_flag() {
|
||||
assert_eq!(
|
||||
ok("add 1:n relationship as cust_orders from Customers.Id to Orders.CustId on delete cascade on update no action --create-fk"),
|
||||
ok(
|
||||
"add 1:n relationship as cust_orders from Customers.Id to Orders.CustId on delete cascade on update no action --create-fk"
|
||||
),
|
||||
rel(
|
||||
Some("cust_orders"),
|
||||
("Customers", "Id"),
|
||||
@@ -1300,10 +1299,7 @@ mod tests {
|
||||
#[test]
|
||||
fn advanced_ambiguous_update_routes_to_sql() {
|
||||
assert!(matches!(
|
||||
parse_command_in_mode(
|
||||
"update Orders set total = 0 where id = 1",
|
||||
Mode::Advanced,
|
||||
),
|
||||
parse_command_in_mode("update Orders set total = 0 where id = 1", Mode::Advanced,),
|
||||
Ok(Command::SqlUpdate { .. })
|
||||
));
|
||||
}
|
||||
@@ -1399,10 +1395,7 @@ mod tests {
|
||||
// in advanced mode)" pointer is added at the hint layer
|
||||
// (input_render), not in the parsed command/error here.
|
||||
assert!(matches!(
|
||||
parse_command_in_mode(
|
||||
"delete from Orders where id = 1 returning *",
|
||||
Mode::Simple,
|
||||
),
|
||||
parse_command_in_mode("delete from Orders where id = 1 returning *", Mode::Simple,),
|
||||
Err(ParseError::Invalid { .. })
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user