Skip to content

Commit

Permalink
fixup: new lints from clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
WorldSEnder committed Mar 12, 2024
1 parent 2e6f17f commit 24d815d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion packages/yew/src/callback.rs
Expand Up @@ -25,7 +25,9 @@ macro_rules! generate_callback_impls {
}
}

#[allow(clippy::vtable_address_comparisons)]
// We are okay with comparisons from different compilation units to result in false
// not-equal results. This should only lead in the worst-case to some unneeded re-renders.
#[allow(ambiguous_wide_pointer_comparisons)]
impl<IN, OUT> PartialEq for $callback<IN, OUT> {
fn eq(&self, other: &$callback<IN, OUT>) -> bool {
let ($callback { cb }, $callback { cb: rhs_cb }) = (self, other);
Expand Down
1 change: 0 additions & 1 deletion packages/yew/src/dom_bundle/utils.rs
Expand Up @@ -50,7 +50,6 @@ mod feat_hydration {

#[cfg(feature = "hydration")]
pub(super) use feat_hydration::*;

#[cfg(test)]
// this is needed because clippy doesn't like the import not being used
#[allow(unused_imports)]
Expand Down
5 changes: 4 additions & 1 deletion packages/yew/src/functional/hooks/use_reducer.rs
Expand Up @@ -130,7 +130,10 @@ where
T: Reducible,
{
fn eq(&self, rhs: &Self) -> bool {
#[allow(clippy::vtable_address_comparisons)]
// We are okay with comparisons from different compilation units to result in false
// not-equal results. This should only lead in the worst-case to some unneeded
// re-renders.
#[allow(ambiguous_wide_pointer_comparisons)]
Rc::ptr_eq(&self.dispatch, &rhs.dispatch)
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/yew/src/suspense/suspension.rs
Expand Up @@ -105,7 +105,7 @@ impl Future for Suspension {

let waker = cx.waker().clone();
self.listen(Callback::from(move |_| {
waker.clone().wake();
waker.wake_by_ref();
}));

Poll::Pending
Expand Down
8 changes: 5 additions & 3 deletions packages/yew/src/virtual_dom/listeners.rs
Expand Up @@ -187,9 +187,11 @@ impl PartialEq for Listeners {
lhs.iter()
.zip(rhs.iter())
.all(|(lhs, rhs)| match (lhs, rhs) {
(Some(lhs), Some(rhs)) =>
{
#[allow(clippy::vtable_address_comparisons)]
(Some(lhs), Some(rhs)) => {
// We are okay with comparisons from different compilation units to
// result in false not-equal results. This should only lead in the
// worst-case to some unneeded re-renders.
#[allow(ambiguous_wide_pointer_comparisons)]
Rc::ptr_eq(lhs, rhs)
}
(None, None) => true,
Expand Down

0 comments on commit 24d815d

Please sign in to comment.