mirror of
https://github.com/adoyle0/thaw.git
synced 2025-01-23 06:19:22 -05:00
pref: cargo clippy
This commit is contained in:
parent
8bdbda33a0
commit
706ca144c6
7 changed files with 15 additions and 31 deletions
|
@ -75,13 +75,10 @@ pub fn Alert(
|
||||||
css_vars
|
css_vars
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let icon = create_memo(move |_| {
|
let icon = create_memo(move |_| match variant.get() {
|
||||||
match variant.get() {
|
AlertVariant::Success => icondata::AiCheckCircleFilled,
|
||||||
AlertVariant::Success => icondata::AiCheckCircleFilled,
|
AlertVariant::Warning => icondata::AiExclamationCircleFilled,
|
||||||
AlertVariant::Warning => icondata::AiExclamationCircleFilled,
|
AlertVariant::Error => icondata::AiCloseCircleFilled,
|
||||||
AlertVariant::Error => icondata::AiCloseCircleFilled,
|
|
||||||
}
|
|
||||||
.into()
|
|
||||||
});
|
});
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
|
|
|
@ -23,10 +23,8 @@ pub fn CheckboxItem(
|
||||||
if !checked.get_untracked() {
|
if !checked.get_untracked() {
|
||||||
checked.set(true);
|
checked.set(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else if checked.get_untracked() {
|
||||||
if checked.get_untracked() {
|
checked.set(false);
|
||||||
checked.set(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -18,13 +18,9 @@ pub fn CollapseItem(
|
||||||
let content_ref = create_node_ref::<html::Div>();
|
let content_ref = create_node_ref::<html::Div>();
|
||||||
|
|
||||||
let is_show_content = create_memo(move |_| {
|
let is_show_content = create_memo(move |_| {
|
||||||
collapse.value.with(|keys| {
|
collapse
|
||||||
if key.with(|key| keys.contains(key)) {
|
.value
|
||||||
true
|
.with(|keys| key.with(|key| keys.contains(key)))
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let on_click = move |_| {
|
let on_click = move |_| {
|
||||||
|
|
|
@ -144,7 +144,7 @@ pub fn Input(
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
{
|
{
|
||||||
const INNER_ATTRS: [&'static str; 4] = ["type", "class", "disabled", "placeholder"];
|
const INNER_ATTRS: [&str; 4] = ["type", "class", "disabled", "placeholder"];
|
||||||
attrs.iter().for_each(|attr| {
|
attrs.iter().for_each(|attr| {
|
||||||
if INNER_ATTRS.contains(&attr.0) {
|
if INNER_ATTRS.contains(&attr.0) {
|
||||||
logging::warn!(
|
logging::warn!(
|
||||||
|
|
|
@ -92,7 +92,7 @@ pub fn TextArea(
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
{
|
{
|
||||||
const INNER_ATTRS: [&'static str; 3] = ["class", "disabled", "placeholder"];
|
const INNER_ATTRS: [&str; 3] = ["class", "disabled", "placeholder"];
|
||||||
attrs.iter().for_each(|attr| {
|
attrs.iter().for_each(|attr| {
|
||||||
if INNER_ATTRS.contains(&attr.0) {
|
if INNER_ATTRS.contains(&attr.0) {
|
||||||
logging::warn!(
|
logging::warn!(
|
||||||
|
|
|
@ -20,11 +20,7 @@ impl<T: Default> Default for Model<T> {
|
||||||
|
|
||||||
impl<T> Clone for Model<T> {
|
impl<T> Clone for Model<T> {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
*self
|
||||||
read: self.read.clone(),
|
|
||||||
write: self.write.clone(),
|
|
||||||
on_write: self.on_write.clone(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +33,7 @@ impl<T> Model<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn signal(&self) -> Signal<T> {
|
pub fn signal(&self) -> Signal<T> {
|
||||||
self.read.clone()
|
self.read
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +155,7 @@ impl<T> From<(Memo<T>, WriteSignal<T>)> for Model<T> {
|
||||||
impl<T: Default> From<(Option<T>, WriteSignal<T>)> for Model<T> {
|
impl<T: Default> From<(Option<T>, WriteSignal<T>)> for Model<T> {
|
||||||
fn from((read, write): (Option<T>, WriteSignal<T>)) -> Self {
|
fn from((read, write): (Option<T>, WriteSignal<T>)) -> Self {
|
||||||
let mut model = Self::new(read.unwrap_or_default());
|
let mut model = Self::new(read.unwrap_or_default());
|
||||||
model.on_write = Some(write.into());
|
model.on_write = Some(write);
|
||||||
model
|
model
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,7 @@ impl<T> OptionalProp<T> {
|
||||||
where
|
where
|
||||||
F: FnOnce(T) -> U,
|
F: FnOnce(T) -> U,
|
||||||
{
|
{
|
||||||
match self.0 {
|
self.0.map(f)
|
||||||
Some(x) => Some(f(x)),
|
|
||||||
None => None,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn into_option(self) -> Option<T> {
|
pub fn into_option(self) -> Option<T> {
|
||||||
|
|
Loading…
Add table
Reference in a new issue