chore: make clippy happy

This commit is contained in:
Jonathan Kelley committed 2022-07-02 23:45:32 -04:00
1 parent fcbd260f1a
commit 2884d72b08
10 files changed
+42 -50

No files matched your search

+2 -2
View File
@@ -2,11 +2,11 @@ use crate::{use_atom_root, AtomId, AtomRoot, Readable};
use dioxus_core::{ScopeId, ScopeState};
use std::rc::Rc;
pub fn use_read<'a, V: 'static>(cx: &'a ScopeState, f: impl Readable<V>) -> &'a V {
pub fn use_read<V: 'static>(cx: &ScopeState, f: impl Readable<V>) -> &V {
use_read_rc(cx, f).as_ref()
}
pub fn use_read_rc<'a, V: 'static>(cx: &'a ScopeState, f: impl Readable<V>) -> &'a Rc<V> {
pub fn use_read_rc<V: 'static>(cx: &ScopeState, f: impl Readable<V>) -> &Rc<V> {
let root = use_atom_root(cx);
struct UseReadInner<V> {
+1 -1
View File
@@ -2,7 +2,7 @@ use crate::{use_atom_root, Writable};
use dioxus_core::ScopeState;
use std::rc::Rc;
pub fn use_set<'a, T: 'static>(cx: &'a ScopeState, f: impl Writable<T>) -> &'a Rc<dyn Fn(T)> {
pub fn use_set<T: 'static>(cx: &ScopeState, f: impl Writable<T>) -> &Rc<dyn Fn(T)> {
let root = use_atom_root(cx);
cx.use_hook(|_| {
let id = f.unique_id();
+4 -4
View File
@@ -30,7 +30,7 @@ use std::{
/// ))
/// }
/// ```
pub fn use_atom_state<'a, T: 'static>(cx: &'a ScopeState, f: impl Writable<T>) -> &'a AtomState<T> {
pub fn use_atom_state<T: 'static>(cx: &ScopeState, f: impl Writable<T>) -> &AtomState<T> {
let root = crate::use_atom_root(cx);
let inner = cx.use_hook(|_| AtomState {
@@ -279,13 +279,13 @@ impl<T: 'static> Clone for AtomState<T> {
}
}
impl<'a, T: 'static + Display> std::fmt::Display for AtomState<T> {
impl<T: 'static + Display> std::fmt::Display for AtomState<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.value.as_ref().unwrap())
}
}
impl<'a, T: std::fmt::Binary> std::fmt::Binary for AtomState<T> {
impl<T: std::fmt::Binary> std::fmt::Binary for AtomState<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:b}", self.value.as_ref().unwrap().as_ref())
}
@@ -316,7 +316,7 @@ impl<T: Debug> Debug for AtomState<T> {
}
}
impl<'a, T> std::ops::Deref for AtomState<T> {
impl<T> std::ops::Deref for AtomState<T> {
type Target = T;
fn deref(&self) -> &Self::Target {