use OpenFlags::default to avoid maintaining explicit defaults

This commit is contained in:
Dustin J. Mitchell
2022-12-18 16:41:57 +00:00
committed by Tomas Babej
parent 015e8eac25
commit e4987ea7e0

View File

@@ -87,11 +87,11 @@ impl SqliteStorage {
// Open (or create) database
let db_file = directory.as_ref().join("taskchampion.sqlite3");
let mut flags = OpenFlags::SQLITE_OPEN_READ_WRITE
| OpenFlags::SQLITE_OPEN_NO_MUTEX
| OpenFlags::SQLITE_OPEN_URI;
if create_if_missing {
flags |= OpenFlags::SQLITE_OPEN_CREATE;
let mut flags = OpenFlags::default();
// default contains SQLITE_OPEN_CREATE, so remove it if we are not to
// create a DB when missing.
if !create_if_missing {
flags.remove(OpenFlags::SQLITE_OPEN_CREATE);
}
let con = Connection::open_with_flags(db_file, flags)?;