Simplify some iterator combinators

This commit is contained in:
Michael Goulet 2022-12-10 20:31:01 +00:00
parent 2d09c9bc94
commit 26c010c941
2 changed files with 2 additions and 2 deletions

View file

@ -1244,7 +1244,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
) -> RValue<'gcc> { ) -> RValue<'gcc> {
// FIXME(antoyo): remove when having a proper API. // FIXME(antoyo): remove when having a proper API.
let gcc_func = unsafe { std::mem::transmute(func) }; let gcc_func = unsafe { std::mem::transmute(func) };
let call = if self.functions.borrow().values().find(|value| **value == gcc_func).is_some() { let call = if self.functions.borrow().values().any(|value| *value == gcc_func) {
self.function_call(func, args, funclet) self.function_call(func, args, funclet)
} }
else { else {

View file

@ -253,7 +253,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
pub fn rvalue_as_function(&self, value: RValue<'gcc>) -> Function<'gcc> { pub fn rvalue_as_function(&self, value: RValue<'gcc>) -> Function<'gcc> {
let function: Function<'gcc> = unsafe { std::mem::transmute(value) }; let function: Function<'gcc> = unsafe { std::mem::transmute(value) };
debug_assert!(self.functions.borrow().values().find(|value| **value == function).is_some(), debug_assert!(self.functions.borrow().values().any(|value| *value == function),
"{:?} ({:?}) is not a function", value, value.get_type()); "{:?} ({:?}) is not a function", value, value.get_type());
function function
} }