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
|
||||
}
|
||||
});
|
||||
let icon = create_memo(move |_| {
|
||||
match variant.get() {
|
||||
let icon = create_memo(move |_| match variant.get() {
|
||||
AlertVariant::Success => icondata::AiCheckCircleFilled,
|
||||
AlertVariant::Warning => icondata::AiExclamationCircleFilled,
|
||||
AlertVariant::Error => icondata::AiCloseCircleFilled,
|
||||
}
|
||||
.into()
|
||||
});
|
||||
|
||||
view! {
|
||||
|
|
|
@ -23,11 +23,9 @@ pub fn CheckboxItem(
|
|||
if !checked.get_untracked() {
|
||||
checked.set(true);
|
||||
}
|
||||
} else {
|
||||
if checked.get_untracked() {
|
||||
} else if checked.get_untracked() {
|
||||
checked.set(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
_ = checked.watch(move |checked| {
|
||||
|
|
|
@ -18,13 +18,9 @@ pub fn CollapseItem(
|
|||
let content_ref = create_node_ref::<html::Div>();
|
||||
|
||||
let is_show_content = create_memo(move |_| {
|
||||
collapse.value.with(|keys| {
|
||||
if key.with(|key| keys.contains(key)) {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
})
|
||||
collapse
|
||||
.value
|
||||
.with(|keys| key.with(|key| keys.contains(key)))
|
||||
});
|
||||
|
||||
let on_click = move |_| {
|
||||
|
|
|
@ -144,7 +144,7 @@ pub fn Input(
|
|||
|
||||
#[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| {
|
||||
if INNER_ATTRS.contains(&attr.0) {
|
||||
logging::warn!(
|
||||
|
|
|
@ -92,7 +92,7 @@ pub fn TextArea(
|
|||
|
||||
#[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| {
|
||||
if INNER_ATTRS.contains(&attr.0) {
|
||||
logging::warn!(
|
||||
|
|
|
@ -20,11 +20,7 @@ impl<T: Default> Default for Model<T> {
|
|||
|
||||
impl<T> Clone for Model<T> {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
read: self.read.clone(),
|
||||
write: self.write.clone(),
|
||||
on_write: self.on_write.clone(),
|
||||
}
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,7 +33,7 @@ impl<T> Model<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> {
|
||||
fn from((read, write): (Option<T>, WriteSignal<T>)) -> Self {
|
||||
let mut model = Self::new(read.unwrap_or_default());
|
||||
model.on_write = Some(write.into());
|
||||
model.on_write = Some(write);
|
||||
model
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,10 +20,7 @@ impl<T> OptionalProp<T> {
|
|||
where
|
||||
F: FnOnce(T) -> U,
|
||||
{
|
||||
match self.0 {
|
||||
Some(x) => Some(f(x)),
|
||||
None => None,
|
||||
}
|
||||
self.0.map(f)
|
||||
}
|
||||
|
||||
pub fn into_option(self) -> Option<T> {
|
||||
|
|
Loading…
Add table
Reference in a new issue