diff --git a/src/database.rs b/src/database.rs index ebf3ac4..2e06e7c 100644 --- a/src/database.rs +++ b/src/database.rs @@ -41,7 +41,7 @@ pub fn indexed_paths(connection: &sqlite::Connection) -> Result> { let result: Vec = connection .prepare(query)? .into_iter() - .map(|row_result| row_result.unwrap()) + .filter_map(|row_result| row_result.ok()) .map(|row| { let path = row.read::<&str, _>("file_identifier").to_string(); let hash = row.read::("hash").to_string(); @@ -52,7 +52,7 @@ pub fn indexed_paths(connection: &sqlite::Connection) -> Result> { Ok(result) } -pub fn duplicate_hashes(connection: &sqlite::Connection, path: &String) -> Result> { +pub fn duplicate_hashes(connection: &sqlite::Connection, path: &str) -> Result> { let query = format!( " SELECT a.* FROM files a @@ -70,7 +70,7 @@ pub fn duplicate_hashes(connection: &sqlite::Connection, path: &String) -> Resul let result: Vec = connection .prepare(query)? .into_iter() - .map(|row_result| row_result.unwrap()) + .filter_map(|row_result| row_result.ok()) .map(|row| { let path = row.read::<&str, _>("file_identifier").to_string(); let hash = row.read::("hash").to_string();