Reduce again the number of match calls (#7815)

- Reduce the number of match calls (see commit messages)
- A few miscellaneous improvements
This commit is contained in:
Hofer-Julian
2023-01-24 12:23:42 +01:00
committed by GitHub
parent 0bb2e47c98
commit 41306aa7e0
49 changed files with 467 additions and 634 deletions

View File

@ -107,12 +107,7 @@ impl SQLiteDatabase {
}
pub fn open_connection(&self) -> Result<Connection, rusqlite::Error> {
let conn = match Connection::open(&self.path) {
Ok(conn) => conn,
Err(err) => return Err(err),
};
Ok(conn)
Connection::open(&self.path)
}
pub fn get_tables(&self, conn: &Connection) -> Result<Vec<DbTable>, rusqlite::Error> {
@ -582,18 +577,13 @@ mod test {
}
pub fn open_connection_in_memory() -> Result<Connection, ShellError> {
let db = match Connection::open_in_memory() {
Ok(conn) => conn,
Err(err) => {
return Err(ShellError::GenericError(
"Failed to open SQLite connection in memory".into(),
err.to_string(),
Some(Span::test_data()),
None,
Vec::new(),
))
}
};
Ok(db)
Connection::open_in_memory().map_err(|err| {
ShellError::GenericError(
"Failed to open SQLite connection in memory".into(),
err.to_string(),
Some(Span::test_data()),
None,
Vec::new(),
)
})
}