mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-13 15:46:53 +00:00
refactor: rename method to avoid confusion
- rename SqliteDb::new to `_::open` as it's not return Self lint message: methods called `new` usually return `Self` help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#new_ret_no_self - rename method `add` to `add_calgorithm` The semantics of this has nothing to do with an `add` operation in the sense of the `Add` trait. And method `add` can be confused for the standard trait method std::ops::Add::add lint https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#should_implement_trait
This commit is contained in:
@@ -23,7 +23,7 @@ pub use rusqlite;
|
||||
pub(crate) fn open_db(path: &PathBuf, opt: &OpenOpt) -> Result<Db> {
|
||||
info!("Opening Sqlite database at: {}", path.display());
|
||||
let manager = r2d2_sqlite::SqliteConnectionManager::file(path);
|
||||
SqliteDb::new(manager, opt.fsync)
|
||||
SqliteDb::open(manager, opt.fsync)
|
||||
}
|
||||
|
||||
// ----
|
||||
@@ -62,7 +62,7 @@ pub struct SqliteDb {
|
||||
}
|
||||
|
||||
impl SqliteDb {
|
||||
pub fn new(manager: SqliteConnectionManager, sync_mode: bool) -> Result<Db> {
|
||||
pub fn open(manager: SqliteConnectionManager, sync_mode: bool) -> Result<Db> {
|
||||
let manager = manager.with_init(move |db| {
|
||||
db.pragma_update(None, "journal_mode", "WAL")?;
|
||||
if sync_mode {
|
||||
|
||||
Reference in New Issue
Block a user