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:
claude@clouddev1
2026-06-17 21:39:19 +00:00
parent e9606b5f6d
commit 41b7e9a049
102 changed files with 8017 additions and 4975 deletions
+48 -14
View File
@@ -21,8 +21,7 @@ fn rt() -> tokio::runtime::Runtime {
fn open(undo: bool) -> (project::Project, Database, tempfile::TempDir) {
let dir = tempfile::tempdir().expect("create tempdir");
let project =
project::open_or_create(None, Some(dir.path())).expect("open or create project");
let project = project::open_or_create(None, Some(dir.path())).expect("open or create project");
let persistence = Persistence::new(project.path().to_path_buf());
let db = Database::open_with_persistence_and_undo(project.db_path(), persistence, undo)
.expect("open db with persistence");
@@ -33,7 +32,10 @@ fn open(undo: bool) -> (project::Project, Database, tempfile::TempDir) {
fn make_t(db: &Database, r: &tokio::runtime::Runtime) {
r.block_on(db.sql_create_table(
"T".to_string(),
vec![ColumnSpec::new("id", Type::Int), ColumnSpec::new("email", Type::Text)],
vec![
ColumnSpec::new("id", Type::Int),
ColumnSpec::new("email", Type::Text),
],
vec!["id".to_string()],
vec![],
vec![],
@@ -48,8 +50,13 @@ fn insert_row(db: &Database, r: &tokio::runtime::Runtime, id: i64, email: &str)
r.block_on(db.insert(
"T".to_string(),
Some(vec!["id".to_string(), "email".to_string()]),
vec![Value::Number(id.to_string()), Value::Text(email.to_string())],
Some(format!("insert into T (id, email) values ({id}, '{email}')")),
vec![
Value::Number(id.to_string()),
Value::Text(email.to_string()),
],
Some(format!(
"insert into T (id, email) values ({id}, '{email}')"
)),
))
.is_ok()
}
@@ -79,7 +86,10 @@ fn create_plain_index() {
))
.expect("create index");
assert!(matches!(out, CreateIndexOutcome::Created(_)));
assert_eq!(index(&db, &r, "ix"), Some((vec!["email".to_string()], false)));
assert_eq!(
index(&db, &r, "ix"),
Some((vec!["email".to_string()], false))
);
}
#[test]
@@ -97,14 +107,20 @@ fn create_unique_index_round_trips_and_survives_rebuild_and_enforces() {
))
.expect("create unique index");
// Reported as unique.
assert_eq!(index(&db, &r, "ux"), Some((vec!["email".to_string()], true)));
assert_eq!(
index(&db, &r, "ux"),
Some((vec!["email".to_string()], true))
);
// Persisted to project.yaml as a unique index.
let yaml = std::fs::read_to_string(p.path().join("project.yaml")).expect("read project.yaml");
assert!(yaml.contains("unique: true"), "project.yaml:\n{yaml}");
// Uniqueness is enforced by the engine.
assert!(insert_row(&db, &r, 1, "a@x"));
assert!(!insert_row(&db, &r, 2, "a@x"), "duplicate email refused by the unique index");
assert!(
!insert_row(&db, &r, 2, "a@x"),
"duplicate email refused by the unique index"
);
// Rebuild from the text artifacts: the index comes back UNIQUE
// (the rebuild re-emits CREATE UNIQUE INDEX), not demoted to plain.
@@ -116,7 +132,10 @@ fn create_unique_index_round_trips_and_survives_rebuild_and_enforces() {
"the unique flag survived rebuild"
);
// Still enforced after rebuild.
assert!(!insert_row(&db, &r, 3, "a@x"), "uniqueness enforced after rebuild too");
assert!(
!insert_row(&db, &r, 3, "a@x"),
"uniqueness enforced after rebuild too"
);
}
#[test]
@@ -264,7 +283,10 @@ fn plain_duplicate_name_errors() {
false,
Some("create index ix on T (id)".to_string()),
));
assert!(res.is_err(), "duplicate index name without IF NOT EXISTS errors");
assert!(
res.is_err(),
"duplicate index name without IF NOT EXISTS errors"
);
}
#[test]
@@ -307,7 +329,10 @@ fn plain_and_unique_over_the_same_columns_are_not_duplicates() {
false,
Some("create index ix_plain2 on T (email)".to_string()),
));
assert!(res.is_err(), "a second plain index over the same columns is redundant");
assert!(
res.is_err(),
"a second plain index over the same columns is redundant"
);
}
#[test]
@@ -328,7 +353,10 @@ fn create_index_on_an_internal_table_is_refused_on_both_surfaces() {
false,
Some("create index bad on __rdbms_playground_columns (table_name)".to_string()),
));
assert!(sql.is_err(), "SQL CREATE INDEX on an internal table is refused");
assert!(
sql.is_err(),
"SQL CREATE INDEX on an internal table is refused"
);
// Simple `add index` on an internal table → error (same guard).
let dsl = r.block_on(db.add_index(
Some("bad2".to_string()),
@@ -336,7 +364,10 @@ fn create_index_on_an_internal_table_is_refused_on_both_surfaces() {
vec!["table_name".to_string()],
Some("add index as bad2 on __rdbms_playground_columns (table_name)".to_string()),
));
assert!(dsl.is_err(), "simple add index on an internal table is refused");
assert!(
dsl.is_err(),
"simple add index on an internal table is refused"
);
}
#[test]
@@ -355,6 +386,9 @@ fn create_index_is_one_undo_step() {
.expect("create index");
assert!(index(&db, &r, "ix").is_some());
// One undo removes the index.
assert!(r.block_on(db.undo()).expect("undo").is_some(), "the create was one undo step");
assert!(
r.block_on(db.undo()).expect("undo").is_some(),
"the create was one undo step"
);
assert!(index(&db, &r, "ix").is_none(), "undo removed the index");
}