summaryrefslogtreecommitdiff
path: root/crates/tor-dirmgr/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/tor-dirmgr/src')
-rw-r--r--crates/tor-dirmgr/src/storage/sqlite.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/tor-dirmgr/src/storage/sqlite.rs b/crates/tor-dirmgr/src/storage/sqlite.rs
index 398ff4d04..1011ea33e 100644
--- a/crates/tor-dirmgr/src/storage/sqlite.rs
+++ b/crates/tor-dirmgr/src/storage/sqlite.rs
@@ -538,7 +538,11 @@ impl Store for SqliteStore {
}
}
fn upgrade_to_readwrite(&mut self) -> Result<bool> {
- if self.is_readonly() && self.sql_path.is_some() {
+ let Some(sql_path) = self.sql_path.as_ref() else {
+ return Ok(true);
+ };
+
+ if self.is_readonly() {
let lf = self
.lockfile
.as_mut()
@@ -547,9 +551,7 @@ impl Store for SqliteStore {
// Somebody else has the lock.
return Ok(false);
}
- // Unwrap should be safe due to parent `.is_some()` check
- #[allow(clippy::unwrap_used)]
- match rusqlite::Connection::open(self.sql_path.as_ref().unwrap()) {
+ match rusqlite::Connection::open(sql_path) {
Ok(conn) => {
self.conn = conn;
}