Janitor: Fix clippy::needless_question_mark

This commit is contained in:
Tobias Hunger 2021-08-04 20:23:41 +02:00 committed by Olivier Goffart
parent 04a2df540a
commit 3c9451f94c
2 changed files with 9 additions and 10 deletions

View file

@ -35,15 +35,14 @@ fn run_scoped<'cx, T>(
) -> NeonResult<T> { ) -> NeonResult<T> {
let persistent_context = let persistent_context =
persistent_context::PersistentContext::from_object(cx, object_with_persistent_context)?; persistent_context::PersistentContext::from_object(cx, object_with_persistent_context)?;
Ok(cx cx.execute_scoped(|cx| {
.execute_scoped(|cx| { let cx = RefCell::new(cx);
let cx = RefCell::new(cx); let cx_fn = move |callback: &GlobalContextCallback| {
let cx_fn = move |callback: &GlobalContextCallback| { callback(&mut *cx.borrow_mut(), &persistent_context)
callback(&mut *cx.borrow_mut(), &persistent_context) };
}; GLOBAL_CONTEXT.set(&&cx_fn, functor)
GLOBAL_CONTEXT.set(&&cx_fn, functor) })
}) .or_else(|e| cx.throw_error(e))
.or_else(|e| cx.throw_error(e))?)
} }
fn run_with_global_context(f: &GlobalContextCallback) { fn run_with_global_context(f: &GlobalContextCallback) {

View file

@ -765,7 +765,7 @@ impl ComponentInstance {
pub fn invoke_callback(&self, name: &str, args: &[Value]) -> Result<Value, CallCallbackError> { pub fn invoke_callback(&self, name: &str, args: &[Value]) -> Result<Value, CallCallbackError> {
generativity::make_guard!(guard); generativity::make_guard!(guard);
let comp = self.inner.unerase(guard); let comp = self.inner.unerase(guard);
Ok(comp.description().invoke_callback(comp.borrow(), name, &args).map_err(|()| todo!())?) comp.description().invoke_callback(comp.borrow(), name, &args).map_err(|()| todo!())
} }
/// Marks the window of this component to be shown on the screen. This registers /// Marks the window of this component to be shown on the screen. This registers