diff --git a/packages/hooks/src/use_shared_state.rs b/packages/hooks/src/use_shared_state.rs index 78ac671c1..2d9f9eb60 100644 --- a/packages/hooks/src/use_shared_state.rs +++ b/packages/hooks/src/use_shared_state.rs @@ -60,7 +60,7 @@ impl ProvidedStateInner { /// /// /// -pub fn use_context<'a, T: 'static>(cx: &'a ScopeState) -> Option> { +pub fn use_context(cx: &ScopeState) -> Option> { let state = cx.use_hook(|_| { let scope_id = cx.scope_id(); let root = cx.consume_context::>(); diff --git a/packages/hooks/src/useref.rs b/packages/hooks/src/useref.rs index 6a384a5ff..73ef99a59 100644 --- a/packages/hooks/src/useref.rs +++ b/packages/hooks/src/useref.rs @@ -110,10 +110,7 @@ use std::{ /// } /// }) /// ``` -pub fn use_ref<'a, T: 'static>( - cx: &'a ScopeState, - initialize_refcell: impl FnOnce() -> T, -) -> &'a UseRef { +pub fn use_ref(cx: &ScopeState, initialize_refcell: impl FnOnce() -> T) -> &UseRef { let hook = cx.use_hook(|_| UseRef { update: cx.schedule_update(), value: Rc::new(RefCell::new(initialize_refcell())), diff --git a/packages/hooks/src/usestate.rs b/packages/hooks/src/usestate.rs index 60dc172b3..68440ca52 100644 --- a/packages/hooks/src/usestate.rs +++ b/packages/hooks/src/usestate.rs @@ -30,10 +30,10 @@ use std::{ /// )) /// } /// ``` -pub fn use_state<'a, T: 'static>( - cx: &'a ScopeState, +pub fn use_state( + cx: &ScopeState, initial_state_fn: impl FnOnce() -> T, -) -> &'a UseState { +) -> &UseState { let hook = cx.use_hook(move |_| { let current_val = Rc::new(initial_state_fn()); let update_callback = cx.schedule_update(); @@ -304,13 +304,13 @@ impl Clone for UseState { } } -impl<'a, T: 'static + Display> std::fmt::Display for UseState { +impl std::fmt::Display for UseState { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.current_val) } } -impl<'a, T: std::fmt::Binary> std::fmt::Binary for UseState { +impl std::fmt::Binary for UseState { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{:b}", self.current_val.as_ref()) } @@ -341,7 +341,7 @@ impl Debug for UseState { } } -impl<'a, T> std::ops::Deref for UseState { +impl std::ops::Deref for UseState { type Target = T; fn deref(&self) -> &Self::Target {