Skip to content

Commit

Permalink
Merge pull request #14 from BoxyUwU/fix_implied_bounds_entailment_lint
Browse files Browse the repository at this point in the history
fix `implied_bounds_entailment` future compat lint
  • Loading branch information
aclueless authored Jan 13, 2023
2 parents 6340edf + 2de07f2 commit 26b8bc3
Show file tree
Hide file tree
Showing 21 changed files with 185 additions and 162 deletions.
2 changes: 1 addition & 1 deletion src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ macro_rules! create_events {
$($EventName:ident => $event_name:literal $event_method_name:ident,)+
}
)+) => {
pub trait MethodsForEvents<C: crate::component::Component>: Sized + crate::render::base::ElementUpdaterMut<C> {
pub trait MethodsForEvents<'er, C: crate::component::Component>: Sized + crate::render::base::ElementUpdaterMut<'er, C> {
$(
create_methods_for_event_trait! {
$($event_method_name $EventName,)+
Expand Down
10 changes: 5 additions & 5 deletions src/render/base/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ use crate::{
},
};

pub trait ElementUpdaterMut<C: Component> {
pub trait ElementUpdaterMut<'er, C: Component> {
fn element_updater(&self) -> &ElementUpdater<C>;
fn element_updater_mut(&mut self) -> &mut ElementUpdater<C>;
fn element_updater_mut(&mut self) -> &mut ElementUpdater<'er, C>;
}

impl<C, T> ElementUpdaterMut<C> for &mut T
impl<'er, C, T> ElementUpdaterMut<'er, C> for &mut T
where
C: Component,
T: ElementUpdaterMut<C>,
T: ElementUpdaterMut<'er, C>,
{
fn element_updater(&self) -> &ElementUpdater<C> {
(**self).element_updater()
}
fn element_updater_mut(&mut self) -> &mut ElementUpdater<C> {
fn element_updater_mut(&mut self) -> &mut ElementUpdater<'er, C> {
(**self).element_updater_mut()
}
}
Expand Down
9 changes: 7 additions & 2 deletions src/render/base/events.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
use super::MethodsForEvents;

impl<C: crate::component::Component, T> StateHelperMethods<C> for T where T: MethodsForEvents<C> {}
impl<'er, C: crate::component::Component, T> StateHelperMethods<'er, C> for T where
T: MethodsForEvents<'er, C>
{
}

pub trait StateHelperMethods<C: crate::component::Component>: MethodsForEvents<C> {
pub trait StateHelperMethods<'er, C: crate::component::Component>:
MethodsForEvents<'er, C>
{
fn on_input_value(
self,
comp: &crate::Comp<C>,
Expand Down
4 changes: 2 additions & 2 deletions src/render/base/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::{
};
use wasm_bindgen::UnwrapThrowExt;

pub trait NodesUpdaterMut<C: Component> {
fn nodes_updater_mut(&mut self) -> &mut NodesUpdater<C>;
pub trait NodesUpdaterMut<'n, C: Component> {
fn nodes_updater_mut(&mut self) -> &mut NodesUpdater<'n, C>;
}

pub struct NodesUpdater<'a, C: Component> {
Expand Down
68 changes: 37 additions & 31 deletions src/render/html/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ make_traits_for_property_values! {
/// with attribute value to help handle the issue. But this trait alone
/// can not sovle the issue. We also need HtmlElementUpdater and
/// HtmlNodesUpdater.
pub trait MethodsForSelectedValueSelectedIndex<C: Component>:
Sized + HtmlElementUpdaterMut<C>
pub trait MethodsForSelectedValueSelectedIndex<'er, C: Component>:
Sized + HtmlElementUpdaterMut<'er, C>
{
fn value(mut self, value: impl PropertyValue<C>) -> Self {
value.render(self.html_element_updater_mut());
Expand Down Expand Up @@ -135,8 +135,8 @@ make_traits_for_property_values! {
}
}

pub trait HamsHandMade<C: Component>:
Sized + ElementUpdaterMut<C> + HamsForDistinctNames<C>
pub trait HamsHandMade<'er, C: Component>:
Sized + ElementUpdaterMut<'er, C> + HamsForDistinctNames<'er, C>
{
fn done(self) {}

Expand Down Expand Up @@ -384,64 +384,70 @@ impl<'er, C: Component> StaticAttributes<'er, C> {
}
}

impl<'er, C: Component> ElementUpdaterMut<C> for AttributesOnly<'er, C> {
impl<'er, C: Component> ElementUpdaterMut<'er, C> for AttributesOnly<'er, C> {
fn element_updater(&self) -> &ElementUpdater<C> {
self.0.element_updater()
}
fn element_updater_mut(&mut self) -> &mut ElementUpdater<C> {
fn element_updater_mut(&mut self) -> &mut ElementUpdater<'er, C> {
self.0.element_updater_mut()
}
}
impl<'er, C: Component> HtmlElementUpdaterMut<C> for AttributesOnly<'er, C> {
fn html_element_updater_mut(&mut self) -> &'er mut HtmlElementUpdater<C> {
impl<'er, C: Component> HtmlElementUpdaterMut<'er, C> for AttributesOnly<'er, C> {
fn html_element_updater_mut(&mut self) -> &mut HtmlElementUpdater<'er, C> {
&mut self.0
}
}

impl<'er, C: Component> ElementUpdaterMut<C> for StaticAttributesOnly<'er, C> {
impl<'er, C: Component> ElementUpdaterMut<'er, C> for StaticAttributesOnly<'er, C> {
fn element_updater(&self) -> &ElementUpdater<C> {
self.0.element_updater()
}
fn element_updater_mut(&mut self) -> &mut ElementUpdater<C> {
fn element_updater_mut(&mut self) -> &mut ElementUpdater<'er, C> {
self.0.element_updater_mut()
}
}
impl<'er, C: Component> HtmlElementUpdaterMut<C> for StaticAttributesOnly<'er, C> {
fn html_element_updater_mut(&mut self) -> &'er mut HtmlElementUpdater<C> {
impl<'er, C: Component> HtmlElementUpdaterMut<'er, C> for StaticAttributesOnly<'er, C> {
fn html_element_updater_mut(&mut self) -> &mut HtmlElementUpdater<'er, C> {
&mut self.0
}
}

impl<'er, C: Component> ElementUpdaterMut<C> for StaticAttributes<'er, C> {
impl<'er, C: Component> ElementUpdaterMut<'er, C> for StaticAttributes<'er, C> {
fn element_updater(&self) -> &ElementUpdater<C> {
self.0.element_updater()
}
fn element_updater_mut(&mut self) -> &mut ElementUpdater<C> {
fn element_updater_mut(&mut self) -> &mut ElementUpdater<'er, C> {
self.0.element_updater_mut()
}
}
impl<'er, C: Component> HtmlElementUpdaterMut<C> for StaticAttributes<'er, C> {
fn html_element_updater_mut(&mut self) -> &'er mut HtmlElementUpdater<C> {
impl<'er, C: Component> HtmlElementUpdaterMut<'er, C> for StaticAttributes<'er, C> {
fn html_element_updater_mut(&mut self) -> &mut HtmlElementUpdater<'er, C> {
&mut self.0
}
}

impl<'er, C: Component> MethodsForSelectedValueSelectedIndex<C> for HtmlElementUpdater<'er, C> {}
impl<'er, C: Component> HamsHandMade<C> for HtmlElementUpdater<'er, C> {}
impl<'er, C: Component> HamsForDistinctNames<C> for HtmlElementUpdater<'er, C> {}
impl<'er, C: Component> MethodsForSelectedValueSelectedIndex<'er, C>
for HtmlElementUpdater<'er, C>
{
}
impl<'er, C: Component> HamsHandMade<'er, C> for HtmlElementUpdater<'er, C> {}
impl<'er, C: Component> HamsForDistinctNames<'er, C> for HtmlElementUpdater<'er, C> {}

impl<'er, C: Component> MethodsForSelectedValueSelectedIndex<C> for StaticAttributes<'er, C> {}
impl<'er, C: Component> HamsHandMade<C> for StaticAttributes<'er, C> {}
impl<'er, C: Component> HamsForDistinctNames<C> for StaticAttributes<'er, C> {}
impl<'er, C: Component> MethodsForSelectedValueSelectedIndex<'er, C> for StaticAttributes<'er, C> {}
impl<'er, C: Component> HamsHandMade<'er, C> for StaticAttributes<'er, C> {}
impl<'er, C: Component> HamsForDistinctNames<'er, C> for StaticAttributes<'er, C> {}

impl<'er, C: Component> MethodsForSelectedValueSelectedIndex<C> for AttributesOnly<'er, C> {}
impl<'er, C: Component> HamsHandMade<C> for AttributesOnly<'er, C> {}
impl<'er, C: Component> HamsForDistinctNames<C> for AttributesOnly<'er, C> {}
impl<'er, C: Component> MethodsForSelectedValueSelectedIndex<'er, C> for AttributesOnly<'er, C> {}
impl<'er, C: Component> HamsHandMade<'er, C> for AttributesOnly<'er, C> {}
impl<'er, C: Component> HamsForDistinctNames<'er, C> for AttributesOnly<'er, C> {}

impl<'er, C: Component> MethodsForSelectedValueSelectedIndex<C> for StaticAttributesOnly<'er, C> {}
impl<'er, C: Component> HamsHandMade<C> for StaticAttributesOnly<'er, C> {}
impl<'er, C: Component> HamsForDistinctNames<C> for StaticAttributesOnly<'er, C> {}
impl<'er, C: Component> MethodsForSelectedValueSelectedIndex<'er, C>
for StaticAttributesOnly<'er, C>
{
}
impl<'er, C: Component> HamsHandMade<'er, C> for StaticAttributesOnly<'er, C> {}
impl<'er, C: Component> HamsForDistinctNames<'er, C> for StaticAttributesOnly<'er, C> {}

impl<'er, C: Component> MethodsForEvents<C> for StaticAttributes<'er, C> {}
impl<'er, C: Component> MethodsForEvents<C> for StaticAttributesOnly<'er, C> {}
impl<'er, C: Component> MethodsForEvents<C> for AttributesOnly<'er, C> {}
impl<'er, C: Component> MethodsForEvents<'er, C> for StaticAttributes<'er, C> {}
impl<'er, C: Component> MethodsForEvents<'er, C> for StaticAttributesOnly<'er, C> {}
impl<'er, C: Component> MethodsForEvents<'er, C> for AttributesOnly<'er, C> {}
12 changes: 6 additions & 6 deletions src/render/html/attributes_elements_with_ambiguous_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ make_trait_for_same_name_attribute_and_element_methods! {
impl<'er, C: Component> HemsHamsAmbiguous for HtmlElementUpdater<'er, C> {}
impl<'er, C: Component> HemsHamsAmbiguous for StaticAttributes<'er, C> {}

impl<'er, C: Component> HamsForAmbiguousNames<C> for AttributesOnly<'er, C> {}
impl<'er, C: Component> HamsForAmbiguousNames<C> for StaticAttributesOnly<'er, C> {}
impl<'er, C: Component> HamsForAmbiguousNames<'er, C> for AttributesOnly<'er, C> {}
impl<'er, C: Component> HamsForAmbiguousNames<'er, C> for StaticAttributesOnly<'er, C> {}

impl<'n, C: Component> HemsForAmbiguousNames<C> for StaticNodesOwned<'n, C> {
impl<'n, C: Component> HemsForAmbiguousNames<'n, C> for StaticNodesOwned<'n, C> {
type Output = Self;
}
impl<'n, C: Component> HemsForAmbiguousNames<C> for NodesOwned<'n, C> {
impl<'n, C: Component> HemsForAmbiguousNames<'n, C> for NodesOwned<'n, C> {
type Output = Self;
}
impl<'h, 'n: 'h, C: Component> HemsForAmbiguousNames<C> for StaticNodes<'h, 'n, C> {
impl<'h, 'n: 'h, C: Component> HemsForAmbiguousNames<'n, C> for StaticNodes<'h, 'n, C> {
type Output = Self;
}
impl<'h, 'n: 'h, C: Component> HemsForAmbiguousNames<C> for Nodes<'h, 'n, C> {
impl<'h, 'n: 'h, C: Component> HemsForAmbiguousNames<'n, C> for Nodes<'h, 'n, C> {
type Output = Self;
}
8 changes: 4 additions & 4 deletions src/render/html/attributes_with_predefined_values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ TraitName: HamsWithPredefinedValues
}
}

impl<'er, C: Component> HamsWithPredefinedValues<C> for HtmlElementUpdater<'er, C> {}
impl<'er, C: Component> HamsWithPredefinedValues<C> for StaticAttributes<'er, C> {}
impl<'er, C: Component> HamsWithPredefinedValues<C> for AttributesOnly<'er, C> {}
impl<'er, C: Component> HamsWithPredefinedValues<C> for StaticAttributesOnly<'er, C> {}
impl<'er, C: Component> HamsWithPredefinedValues<'er, C> for HtmlElementUpdater<'er, C> {}
impl<'er, C: Component> HamsWithPredefinedValues<'er, C> for StaticAttributes<'er, C> {}
impl<'er, C: Component> HamsWithPredefinedValues<'er, C> for AttributesOnly<'er, C> {}
impl<'er, C: Component> HamsWithPredefinedValues<'er, C> for StaticAttributesOnly<'er, C> {}
14 changes: 7 additions & 7 deletions src/render/html/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ impl Drop for SelectElementValueManager {
}
}

pub trait HtmlElementUpdaterMut<C: Component> {
fn html_element_updater_mut(&mut self) -> &mut HtmlElementUpdater<C>;
pub trait HtmlElementUpdaterMut<'er, C: Component> {
fn html_element_updater_mut(&mut self) -> &mut HtmlElementUpdater<'er, C>;
}

/// This struct helps rendering the element's attributes and its child nodes.
Expand All @@ -72,18 +72,18 @@ pub struct HtmlElementUpdater<'er, C: Component> {
select_element_value_manager: Option<SelectElementValueManager>,
}

impl<'er, C: Component> ElementUpdaterMut<C> for HtmlElementUpdater<'er, C> {
impl<'er, C: Component> ElementUpdaterMut<'er, C> for HtmlElementUpdater<'er, C> {
fn element_updater(&self) -> &ElementUpdater<C> {
&self.element_updater
}

fn element_updater_mut(&mut self) -> &'er mut ElementUpdater<C> {
fn element_updater_mut(&mut self) -> &mut ElementUpdater<'er, C> {
&mut self.element_updater
}
}

impl<'er, C: Component> HtmlElementUpdaterMut<C> for HtmlElementUpdater<'er, C> {
fn html_element_updater_mut(&mut self) -> &'er mut HtmlElementUpdater<C> {
impl<'er, C: Component> HtmlElementUpdaterMut<'er, C> for HtmlElementUpdater<'er, C> {
fn html_element_updater_mut(&mut self) -> &mut HtmlElementUpdater<'er, C> {
self
}
}
Expand Down Expand Up @@ -221,4 +221,4 @@ impl<'er, C: Component> HtmlElementUpdater<'er, C> {
}
}

impl<'er, C: Component> MethodsForEvents<C> for HtmlElementUpdater<'er, C> {}
impl<'er, C: Component> MethodsForEvents<'er, C> for HtmlElementUpdater<'er, C> {}
2 changes: 1 addition & 1 deletion src/render/html/keyed_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
};

pub trait HemsForKeyedList<'a, C: Component>:
Sized + ElementUpdaterMut<C> + MakeNodesExtensions<'a>
Sized + ElementUpdaterMut<'a, C> + MakeNodesExtensions<'a>
{
fn keyed_list_with_render<I, II, G, K, R>(
mut self,
Expand Down
2 changes: 1 addition & 1 deletion src/render/html/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
};

pub trait HemsForList<'a, C: Component>:
Sized + ElementUpdaterMut<C> + MakeNodesExtensions<'a>
Sized + ElementUpdaterMut<'a, C> + MakeNodesExtensions<'a>
{
fn list_with_render<I, II, R>(
mut self,
Expand Down
Loading

0 comments on commit 26b8bc3

Please sign in to comment.