style: clean use for question_mark

- remove useless `Ok` enclosing with `?`
lint message: enclosing `Ok` and `?` operator are unneeded
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_question_mark
- use question mark instead of manual implementation
lint message: this `match` expression can be replaced with `?`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#question_mark
This commit is contained in:
Gwen Lg
2025-12-13 22:37:15 +01:00
parent 21db7a4d4b
commit f2f6669bf0
6 changed files with 8 additions and 12 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ impl RequestHandler for GetKeyInfoRequest {
} }
}; };
Ok(key_info_results(garage, key, self.show_secret_key).await?) key_info_results(garage, key, self.show_secret_key).await
} }
} }
+2 -2
View File
@@ -61,7 +61,7 @@ pub async fn handle_read_batch(
resps.push(resp?); resps.push(resp?);
} }
Ok(json_ok_response(&resps)?) json_ok_response(&resps)
} }
async fn handle_read_batch_query( async fn handle_read_batch_query(
@@ -155,7 +155,7 @@ pub async fn handle_delete_batch(
resps.push(resp?); resps.push(resp?);
} }
Ok(json_ok_response(&resps)?) json_ok_response(&resps)
} }
async fn handle_delete_batch_query( async fn handle_delete_batch_query(
+1 -4
View File
@@ -725,10 +725,7 @@ impl<K: std::cmp::Ord, V> Accumulator<K, V> {
let object = objects.peek().expect("This iterator can not be empty as it is checked earlier in the code. This is a logic bug, please report it."); let object = objects.peek().expect("This iterator can not be empty as it is checked earlier in the code. This is a logic bug, please report it.");
// Check if this is a common prefix (requires a passed delimiter and its value in the key) // Check if this is a common prefix (requires a passed delimiter and its value in the key)
let pfx = match common_prefix(object, query) { let pfx = common_prefix(object, query)?;
Some(p) => p,
None => return None,
};
assert!(pfx.starts_with(&query.prefix)); assert!(pfx.starts_with(&query.prefix));
// Try to register this prefix // Try to register this prefix
+2 -3
View File
@@ -105,12 +105,11 @@ impl IDb for FjallDb {
} }
fn list_trees(&self) -> Result<Vec<String>> { fn list_trees(&self) -> Result<Vec<String>> {
Ok(self self.keyspace
.keyspace
.list_partitions() .list_partitions()
.iter() .iter()
.map(|n| decode_name(n)) .map(|n| decode_name(n))
.collect::<Result<Vec<_>>>()?) .collect::<Result<Vec<_>>>()
} }
fn snapshot(&self, base_path: &Path) -> Result<()> { fn snapshot(&self, base_path: &Path) -> Result<()> {
+1 -1
View File
@@ -23,7 +23,7 @@ pub use rusqlite;
pub(crate) fn open_db(path: &PathBuf, opt: &OpenOpt) -> Result<Db> { pub(crate) fn open_db(path: &PathBuf, opt: &OpenOpt) -> Result<Db> {
info!("Opening Sqlite database at: {}", path.display()); info!("Opening Sqlite database at: {}", path.display());
let manager = r2d2_sqlite::SqliteConnectionManager::file(path); let manager = r2d2_sqlite::SqliteConnectionManager::file(path);
Ok(SqliteDb::new(manager, opt.fsync)?) SqliteDb::new(manager, opt.fsync)
} }
// ---- // ----
+1 -1
View File
@@ -98,7 +98,7 @@ pub fn block_ref_recount_fn(
.upgrade() .upgrade()
.ok_or_message("cannot upgrade weak ptr to block_ref_table") .ok_or_message("cannot upgrade weak ptr to block_ref_table")
.map_err(db::TxError::Abort)?; .map_err(db::TxError::Abort)?;
Ok(calculate_refcount(&table, tx, block)?) calculate_refcount(&table, tx, block)
}) })
} }