Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
cecton committed Jul 29, 2023
1 parent d16690c commit 6ce5afa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/yew/src/functional/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ where
};

Self {
_never: std::marker::PhantomData::default(),
_never: std::marker::PhantomData,
hook_ctx: HookContext::new(
scope,
re_render,
Expand Down
17 changes: 4 additions & 13 deletions packages/yew/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,25 @@ pub struct NodeSeq<IN, OUT>(Vec<OUT>, PhantomData<IN>);

impl<IN: Into<OUT>, OUT> From<IN> for NodeSeq<IN, OUT> {
fn from(val: IN) -> Self {
Self(vec![val.into()], PhantomData::default())
Self(vec![val.into()], PhantomData)
}
}

impl<IN: Into<OUT>, OUT> From<Option<IN>> for NodeSeq<IN, OUT> {
fn from(val: Option<IN>) -> Self {
Self(
val.map(|s| vec![s.into()]).unwrap_or_default(),
PhantomData::default(),
)
Self(val.map(|s| vec![s.into()]).unwrap_or_default(), PhantomData)
}
}

impl<IN: Into<OUT>, OUT> From<Vec<IN>> for NodeSeq<IN, OUT> {
fn from(val: Vec<IN>) -> Self {
Self(
val.into_iter().map(|x| x.into()).collect(),
PhantomData::default(),
)
Self(val.into_iter().map(|x| x.into()).collect(), PhantomData)
}
}

impl<IN: Into<OUT> + Clone, OUT> From<&ChildrenRenderer<IN>> for NodeSeq<IN, OUT> {
fn from(val: &ChildrenRenderer<IN>) -> Self {
Self(
val.iter().map(|x| x.into()).collect(),
PhantomData::default(),
)
Self(val.iter().map(|x| x.into()).collect(), PhantomData)
}
}

Expand Down

0 comments on commit 6ce5afa

Please sign in to comment.