diff --git a/src/cache/mod.rs b/src/cache/mod.rs index 63e84f0..69e7872 100644 --- a/src/cache/mod.rs +++ b/src/cache/mod.rs @@ -284,23 +284,20 @@ pub struct Migrator<'a> { } impl<'a> Migrator<'a> { - pub fn open<'b>(file: &'b Path) -> Result { + pub fn open(file: &Path) -> Result { Self::open_(file, LATEST_VERSION) } #[cfg(any(test, feature = "bench"))] - pub fn open_with_target<'b>( - file: &'b Path, + pub fn open_with_target( + file: &Path, target: VersionId, ) -> Result { Self::open_(file, target) } // We don't try to find multi step migrations. - fn open_<'b>( - file: &'b Path, - target: VersionId, - ) -> Result { + fn open_(file: &Path, target: VersionId) -> Result { let mut conn = Connection::open(file)?; conn.pragma_update(None, "journal_mode", "WAL")?; conn.pragma_update(None, "synchronous", "NORMAL")?; diff --git a/src/cache/tests.rs b/src/cache/tests.rs index f747f34..47248af 100644 --- a/src/cache/tests.rs +++ b/src/cache/tests.rs @@ -5,7 +5,7 @@ use rusqlite::Connection; use scopeguard::defer; use uuid::Uuid; -use super::{determine_version, get_tables, LATEST_VERSION, MIGRATIONS}; +use super::{determine_version, get_tables, LATEST_VERSION}; use crate::cache::{ filetree::{InsertError, SizeTree}, Cache, Migrator, VersionId, @@ -383,7 +383,7 @@ fn test_migrate_v0_to_v1() { let marks = ["/foo", "/bar/wat", "foo/a/b/c", "something"]; let file = populate_v0(marks).unwrap(); - let mut cache = + let cache = Migrator::open_with_target(&file, 1).unwrap().migrate().unwrap(); assert_tables(&cache.conn, &[ diff --git a/src/ui.rs b/src/ui.rs index d10a3fb..b242a6c 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -175,10 +175,11 @@ impl App { fn right(&mut self) -> Action { if !self.entries.is_empty() { let entry = &self.entries[self.selected]; - Action::GetEntries(Some(entry.path_id)) - } else { - Action::Nothing + if entry.is_dir { + return Action::GetEntries(Some(entry.path_id)); + } } + Action::Nothing } fn move_selection(&mut self, delta: isize, wrap: bool) -> Action {