Skip to content

Commit

Permalink
Elide needless lifetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielleHuisman committed Oct 12, 2024
1 parent 87dda5a commit 94d3658
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 38 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/middleware/arrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl<'a, Element: Clone + 'static, Window: Clone> Arrow<'a, Element, Window> {
}
}

impl<'a, Element: Clone + 'static, Window: Clone> Clone for Arrow<'a, Element, Window> {
impl<Element: Clone + 'static, Window: Clone> Clone for Arrow<'_, Element, Window> {
fn clone(&self) -> Self {
Self {
options: self.options.clone(),
Expand Down Expand Up @@ -216,8 +216,8 @@ impl<Element: Clone + PartialEq, Window: Clone + PartialEq> Middleware<Element,
}
}

impl<'a, Element: Clone, Window: Clone>
MiddlewareWithOptions<Element, Window, ArrowOptions<Element>> for Arrow<'a, Element, Window>
impl<Element: Clone, Window: Clone> MiddlewareWithOptions<Element, Window, ArrowOptions<Element>>
for Arrow<'_, Element, Window>
{
fn options(&self) -> &Derivable<Element, Window, ArrowOptions<Element>> {
&self.options
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/middleware/auto_placement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ pub struct AutoPlacement<'a, Element: Clone + 'static, Window: Clone> {
options: Derivable<'a, Element, Window, AutoPlacementOptions<Element>>,
}

impl<'a, Element: Clone + 'static, Window: Clone> Clone for AutoPlacement<'a, Element, Window> {
impl<Element: Clone + 'static, Window: Clone> Clone for AutoPlacement<'_, Element, Window> {
fn clone(&self) -> Self {
Self {
options: self.options.clone(),
Expand Down Expand Up @@ -365,9 +365,9 @@ impl<Element: Clone + PartialEq, Window: Clone + PartialEq> Middleware<Element,
}
}

impl<'a, Element: Clone, Window: Clone>
impl<Element: Clone, Window: Clone>
MiddlewareWithOptions<Element, Window, AutoPlacementOptions<Element>>
for AutoPlacement<'a, Element, Window>
for AutoPlacement<'_, Element, Window>
{
fn options(&self) -> &Derivable<Element, Window, AutoPlacementOptions<Element>> {
&self.options
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/middleware/flip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl<'a, Element: Clone + 'static, Window: Clone> Flip<'a, Element, Window> {
}
}

impl<'a, Element: Clone + 'static, Window: Clone> Clone for Flip<'a, Element, Window> {
impl<Element: Clone + 'static, Window: Clone> Clone for Flip<'_, Element, Window> {
fn clone(&self) -> Self {
Self {
options: self.options.clone(),
Expand Down Expand Up @@ -367,8 +367,8 @@ impl<Element: Clone + PartialEq, Window: Clone + PartialEq> Middleware<Element,
}
}

impl<'a, Element: Clone, Window: Clone> MiddlewareWithOptions<Element, Window, FlipOptions<Element>>
for Flip<'a, Element, Window>
impl<Element: Clone, Window: Clone> MiddlewareWithOptions<Element, Window, FlipOptions<Element>>
for Flip<'_, Element, Window>
{
fn options(&self) -> &Derivable<Element, Window, FlipOptions<Element>> {
&self.options
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/middleware/hide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl<'a, Element: Clone, Window: Clone> Hide<'a, Element, Window> {
}
}

impl<'a, Element: Clone + 'static, Window: Clone> Clone for Hide<'a, Element, Window> {
impl<Element: Clone + 'static, Window: Clone> Clone for Hide<'_, Element, Window> {
fn clone(&self) -> Self {
Self {
options: self.options.clone(),
Expand Down Expand Up @@ -200,8 +200,8 @@ impl<Element: Clone + PartialEq, Window: Clone + PartialEq> Middleware<Element,
}
}

impl<'a, Element: Clone, Window: Clone> MiddlewareWithOptions<Element, Window, HideOptions<Element>>
for Hide<'a, Element, Window>
impl<Element: Clone, Window: Clone> MiddlewareWithOptions<Element, Window, HideOptions<Element>>
for Hide<'_, Element, Window>
{
fn options(&self) -> &Derivable<Element, Window, HideOptions<Element>> {
&self.options
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/middleware/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl<'a, Element: Clone + 'static, Window: Clone> Inline<'a, Element, Window> {
}
}

impl<'a, Element: Clone, Window: Clone> Clone for Inline<'a, Element, Window> {
impl<Element: Clone, Window: Clone> Clone for Inline<'_, Element, Window> {
fn clone(&self) -> Self {
Self {
options: self.options.clone(),
Expand Down Expand Up @@ -309,8 +309,8 @@ impl<Element: Clone + PartialEq + 'static, Window: Clone + PartialEq + 'static>
}
}

impl<'a, Element: Clone, Window: Clone> MiddlewareWithOptions<Element, Window, InlineOptions>
for Inline<'a, Element, Window>
impl<Element: Clone, Window: Clone> MiddlewareWithOptions<Element, Window, InlineOptions>
for Inline<'_, Element, Window>
{
fn options(&self) -> &Derivable<Element, Window, InlineOptions> {
&self.options
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/middleware/offset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl<'a, Element: Clone, Window: Clone> Offset<'a, Element, Window> {
}
}

impl<'a, Element: Clone + 'static, Window: Clone> Clone for Offset<'a, Element, Window> {
impl<Element: Clone + 'static, Window: Clone> Clone for Offset<'_, Element, Window> {
fn clone(&self) -> Self {
Self {
options: self.options.clone(),
Expand Down Expand Up @@ -223,8 +223,8 @@ impl<Element: Clone + PartialEq, Window: Clone + PartialEq> Middleware<Element,
}
}

impl<'a, Element: Clone, Window: Clone> MiddlewareWithOptions<Element, Window, OffsetOptions>
for Offset<'a, Element, Window>
impl<Element: Clone, Window: Clone> MiddlewareWithOptions<Element, Window, OffsetOptions>
for Offset<'_, Element, Window>
{
fn options(&self) -> &Derivable<Element, Window, OffsetOptions> {
&self.options
Expand Down
10 changes: 4 additions & 6 deletions packages/core/src/middleware/shift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl<'a, Element: Clone, Window: Clone> Shift<'a, Element, Window> {
}
}

impl<'a, Element: Clone, Window: Clone> Clone for Shift<'a, Element, Window> {
impl<Element: Clone, Window: Clone> Clone for Shift<'_, Element, Window> {
fn clone(&self) -> Self {
Self {
options: self.options.clone(),
Expand Down Expand Up @@ -248,9 +248,9 @@ impl<Element: Clone + PartialEq + 'static, Window: Clone + PartialEq + 'static>
}
}

impl<'a, Element: Clone, Window: Clone>
impl<Element: Clone, Window: Clone>
MiddlewareWithOptions<Element, Window, ShiftOptions<Element, Window>>
for Shift<'a, Element, Window>
for Shift<'_, Element, Window>
{
fn options(&self) -> &Derivable<Element, Window, ShiftOptions<Element, Window>> {
&self.options
Expand Down Expand Up @@ -355,9 +355,7 @@ impl<'a, Element: Clone, Window: Clone> LimitShiftOptions<'a, Element, Window> {
}
}

impl<'a, Element: Clone + 'static, Window: Clone> Default
for LimitShiftOptions<'a, Element, Window>
{
impl<Element: Clone + 'static, Window: Clone> Default for LimitShiftOptions<'_, Element, Window> {
fn default() -> Self {
Self {
offset: Default::default(),
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/middleware/size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl<'a, Element: Clone, Window: Clone> SizeOptions<'a, Element, Window> {
}
}

impl<'a, Element: Clone, Window: Clone> Default for SizeOptions<'a, Element, Window> {
impl<Element: Clone, Window: Clone> Default for SizeOptions<'_, Element, Window> {
fn default() -> Self {
Self {
detect_overflow: Default::default(),
Expand All @@ -66,8 +66,8 @@ impl<'a, Element: Clone, Window: Clone> Default for SizeOptions<'a, Element, Win
}
}

impl<'a, Element: Clone + PartialEq, Window: Clone + PartialEq> PartialEq
for SizeOptions<'a, Element, Window>
impl<Element: Clone + PartialEq, Window: Clone + PartialEq> PartialEq
for SizeOptions<'_, Element, Window>
{
fn eq(&self, other: &Self) -> bool {
self.detect_overflow == other.detect_overflow
Expand Down Expand Up @@ -115,7 +115,7 @@ impl<'a, Element: Clone + 'static, Window: Clone> Size<'a, Element, Window> {
}
}

impl<'a, Element: Clone, Window: Clone> Clone for Size<'a, Element, Window> {
impl<Element: Clone, Window: Clone> Clone for Size<'_, Element, Window> {
fn clone(&self) -> Self {
Self {
options: self.options.clone(),
Expand Down
14 changes: 7 additions & 7 deletions packages/core/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub enum Derivable<'a, Element: Clone + 'static, Window: Clone, T: Clone> {
Fn(DerivableFn<'a, Element, Window, T>),
}

impl<'a, Element: Clone, Window: Clone, T: Clone> Clone for Derivable<'a, Element, Window, T> {
impl<Element: Clone, Window: Clone, T: Clone> Clone for Derivable<'_, Element, Window, T> {
fn clone(&self) -> Self {
match self {
Self::Value(value) => Self::Value(value.clone()),
Expand All @@ -25,7 +25,7 @@ impl<'a, Element: Clone, Window: Clone, T: Clone> Clone for Derivable<'a, Elemen
}
}

impl<'a, Element: Clone, Window: Clone, T: Clone> Derivable<'a, Element, Window, T> {
impl<Element: Clone, Window: Clone, T: Clone> Derivable<'_, Element, Window, T> {
pub fn evaluate(&self, state: MiddlewareState<Element, Window>) -> T {
match self {
Derivable::Value(value) => value.clone(),
Expand All @@ -34,7 +34,7 @@ impl<'a, Element: Clone, Window: Clone, T: Clone> Derivable<'a, Element, Window,
}
}

impl<'a, Element: Clone, Window: Clone, T: Clone> From<T> for Derivable<'a, Element, Window, T> {
impl<Element: Clone, Window: Clone, T: Clone> From<T> for Derivable<'_, Element, Window, T> {
fn from(value: T) -> Self {
Derivable::Value(value)
}
Expand All @@ -48,8 +48,8 @@ impl<'a, Element: Clone, Window: Clone, T: Clone> From<DerivableFn<'a, Element,
}
}

impl<'a, Element: Clone, Window: Clone, T: Clone + PartialEq> PartialEq
for Derivable<'a, Element, Window, T>
impl<Element: Clone, Window: Clone, T: Clone + PartialEq> PartialEq
for Derivable<'_, Element, Window, T>
{
fn eq(&self, other: &Self) -> bool {
match (self, other) {
Expand Down Expand Up @@ -297,7 +297,7 @@ impl<'a, Element: Clone> Elements<'a, Element> {
}
}

impl<'a, Element: Clone> Clone for Elements<'a, Element> {
impl<Element: Clone> Clone for Elements<'_, Element> {
fn clone(&self) -> Self {
Self {
reference: self.reference.clone(),
Expand All @@ -319,7 +319,7 @@ pub struct MiddlewareState<'a, Element: Clone + 'static, Window: Clone> {
pub platform: &'a dyn Platform<Element, Window>,
}

impl<'a, Element: Clone, Window: Clone> Clone for MiddlewareState<'a, Element, Window> {
impl<Element: Clone, Window: Clone> Clone for MiddlewareState<'_, Element, Window> {
fn clone(&self) -> Self {
Self {
x: self.x,
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/dom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl<'a> From<&'a HtmlElement> for ElementOrCss<'a> {
}
}

impl<'a> From<CssStyleDeclaration> for ElementOrCss<'a> {
impl From<CssStyleDeclaration> for ElementOrCss<'_> {
fn from(value: CssStyleDeclaration) -> Self {
ElementOrCss::Css(value)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ pub enum ElementOrVirtual<'a, Element: Clone + 'static> {
VirtualElement(Box<dyn VirtualElement<Element>>),
}

impl<'a, Element: Clone + 'static> ElementOrVirtual<'a, Element> {
impl<Element: Clone + 'static> ElementOrVirtual<'_, Element> {
pub fn resolve(self) -> Option<Element> {
match self {
ElementOrVirtual::Element(element) => Some(element.clone()),
Expand All @@ -494,7 +494,7 @@ impl<'a, Element: Clone> From<&'a Element> for ElementOrVirtual<'a, Element> {
}
}

impl<'a, Element: Clone> From<Box<dyn VirtualElement<Element>>> for ElementOrVirtual<'a, Element> {
impl<Element: Clone> From<Box<dyn VirtualElement<Element>>> for ElementOrVirtual<'_, Element> {
fn from(value: Box<dyn VirtualElement<Element>>) -> Self {
ElementOrVirtual::VirtualElement(value)
}
Expand Down

0 comments on commit 94d3658

Please sign in to comment.