mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-12-18 00:23:07 +00:00
Remove unneeded lifetimes
This makes clippy (and me) happy
This commit is contained in:
parent
7550731a96
commit
a8be789761
3 changed files with 8 additions and 11 deletions
|
@ -60,7 +60,7 @@ impl<T> ProvidedStateInner<T> {
|
|||
///
|
||||
///
|
||||
///
|
||||
pub fn use_context<'a, T: 'static>(cx: &'a ScopeState) -> Option<UseSharedState<'a, T>> {
|
||||
pub fn use_context<T: 'static>(cx: &ScopeState) -> Option<UseSharedState<T>> {
|
||||
let state = cx.use_hook(|_| {
|
||||
let scope_id = cx.scope_id();
|
||||
let root = cx.consume_context::<ProvidedState<T>>();
|
||||
|
|
|
@ -110,10 +110,7 @@ use std::{
|
|||
/// }
|
||||
/// })
|
||||
/// ```
|
||||
pub fn use_ref<'a, T: 'static>(
|
||||
cx: &'a ScopeState,
|
||||
initialize_refcell: impl FnOnce() -> T,
|
||||
) -> &'a UseRef<T> {
|
||||
pub fn use_ref<T: 'static>(cx: &ScopeState, initialize_refcell: impl FnOnce() -> T) -> &UseRef<T> {
|
||||
let hook = cx.use_hook(|_| UseRef {
|
||||
update: cx.schedule_update(),
|
||||
value: Rc::new(RefCell::new(initialize_refcell())),
|
||||
|
|
|
@ -30,10 +30,10 @@ use std::{
|
|||
/// ))
|
||||
/// }
|
||||
/// ```
|
||||
pub fn use_state<'a, T: 'static>(
|
||||
cx: &'a ScopeState,
|
||||
pub fn use_state<T: 'static>(
|
||||
cx: &ScopeState,
|
||||
initial_state_fn: impl FnOnce() -> T,
|
||||
) -> &'a UseState<T> {
|
||||
) -> &UseState<T> {
|
||||
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<T: 'static> Clone for UseState<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, T: 'static + Display> std::fmt::Display for UseState<T> {
|
||||
impl<T: 'static + Display> std::fmt::Display for UseState<T> {
|
||||
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<T> {
|
||||
impl<T: std::fmt::Binary> std::fmt::Binary for UseState<T> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{:b}", self.current_val.as_ref())
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ impl<T: Debug> Debug for UseState<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, T> std::ops::Deref for UseState<T> {
|
||||
impl<T> std::ops::Deref for UseState<T> {
|
||||
type Target = T;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
|
|
Loading…
Reference in a new issue