refactor: Remove check_one_call

(cherry picked from commit 065f880e52c6d6cb44e4b857272176ebe2464eea)
This commit is contained in:
Robert Hensing 2024-06-15 14:51:26 +02:00
parent bf6dbd3f1e
commit 35803f4a30
5 changed files with 48 additions and 70 deletions

View file

@ -61,15 +61,6 @@ impl Context {
r
}
/// Run the function, and check the error, then reset the error.
/// Make at most one call to a Nix function in `f`.
/// Do not use if the context isn't fresh or cleared (e.g. with `check_err_and_clear`).
pub fn check_one_call<T, F: FnOnce(*mut raw::c_context) -> T>(&mut self, f: F) -> Result<T> {
let t = f(self.ptr());
self.check_err_and_clear()?;
Ok(t)
}
pub fn check_one_call_or_key_none<T, F: FnOnce(*mut raw::c_context) -> T>(
&mut self,
f: F,