mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
cli: pass Io without option to get_io(), since even when running in-memory we get a default Io from Clap. Also remove last pesky Io::clone()
This commit is contained in:
parent
486389d6ff
commit
aca38031a4
1 changed files with 6 additions and 10 deletions
16
cli/app.rs
16
cli/app.rs
|
@ -255,11 +255,10 @@ impl Limbo {
|
|||
.as_ref()
|
||||
.map_or(":memory:".to_string(), |p| p.to_string_lossy().to_string());
|
||||
|
||||
let io_choice = opts.io.clone();
|
||||
let io = {
|
||||
match db_file.as_str() {
|
||||
":memory:" => get_io(DbLocation::Memory, None)?,
|
||||
_path => get_io(DbLocation::Path, Some(io_choice))?,
|
||||
":memory:" => get_io(DbLocation::Memory, opts.io)?,
|
||||
_path => get_io(DbLocation::Path, opts.io)?,
|
||||
}
|
||||
};
|
||||
let db = Database::open_file(io.clone(), &db_file)?;
|
||||
|
@ -349,8 +348,8 @@ impl Limbo {
|
|||
self.conn.close()?;
|
||||
let io = {
|
||||
match path {
|
||||
":memory:" => get_io(DbLocation::Memory, None)?,
|
||||
_path => get_io(DbLocation::Path, Some(self.opts.io))?,
|
||||
":memory:" => get_io(DbLocation::Memory, self.opts.io)?,
|
||||
_path => get_io(DbLocation::Path, self.opts.io)?,
|
||||
}
|
||||
};
|
||||
self.io = Arc::clone(&io);
|
||||
|
@ -787,14 +786,11 @@ fn get_writer(output: &str) -> Box<dyn Write> {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_io(
|
||||
db_location: DbLocation,
|
||||
io_choice: Option<Io>,
|
||||
) -> anyhow::Result<Arc<dyn limbo_core::IO>> {
|
||||
fn get_io(db_location: DbLocation, io_choice: Io) -> anyhow::Result<Arc<dyn limbo_core::IO>> {
|
||||
Ok(match db_location {
|
||||
DbLocation::Memory => Arc::new(limbo_core::MemoryIO::new()?),
|
||||
DbLocation::Path => {
|
||||
match io_choice.unwrap() {
|
||||
match io_choice {
|
||||
Io::Syscall => {
|
||||
// We are building for Linux/macOS and syscall backend has been selected
|
||||
#[cfg(target_family = "unix")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue