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:
@@ -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_with_index(db: &Database, r: &tokio::runtime::Runtime) -> String {
|
||||
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![],
|
||||
@@ -75,7 +77,10 @@ fn drop_index_removes_an_existing_index_and_shows_the_table() {
|
||||
match out {
|
||||
DropIndexOutcome::Dropped(desc) => {
|
||||
assert_eq!(desc.name, "T");
|
||||
assert!(desc.indexes.is_empty(), "the index is gone from the structure");
|
||||
assert!(
|
||||
desc.indexes.is_empty(),
|
||||
"the index is gone from the structure"
|
||||
);
|
||||
}
|
||||
DropIndexOutcome::Skipped => panic!("expected Dropped, got Skipped"),
|
||||
}
|
||||
@@ -105,7 +110,10 @@ fn plain_drop_of_an_absent_index_errors() {
|
||||
false,
|
||||
Some("drop index ghost_idx".to_string()),
|
||||
));
|
||||
assert!(res.is_err(), "plain DROP INDEX on an absent index errors (no IF EXISTS)");
|
||||
assert!(
|
||||
res.is_err(),
|
||||
"plain DROP INDEX on an absent index errors (no IF EXISTS)"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -113,11 +121,18 @@ fn drop_index_is_one_undo_step_and_restores_the_index() {
|
||||
let (_p, db, _d) = open(true); // undo enabled
|
||||
let r = rt();
|
||||
let name = make_t_with_index(&db, &r);
|
||||
r.block_on(db.sql_drop_index(name.clone(), false, Some("drop index T_email_idx".to_string())))
|
||||
.expect("drop index");
|
||||
r.block_on(db.sql_drop_index(
|
||||
name.clone(),
|
||||
false,
|
||||
Some("drop index T_email_idx".to_string()),
|
||||
))
|
||||
.expect("drop index");
|
||||
assert!(index_names(&db, &r).is_empty());
|
||||
|
||||
// One undo brings the index back.
|
||||
assert!(r.block_on(db.undo()).expect("undo").is_some(), "the drop was one undo step");
|
||||
assert!(
|
||||
r.block_on(db.undo()).expect("undo").is_some(),
|
||||
"the drop was one undo step"
|
||||
);
|
||||
assert_eq!(index_names(&db, &r), vec![name], "undo restored the index");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user