Skip to content

Lifetime parameter in generics seems to be missing #2

@TheVeryDarkness

Description

@TheVeryDarkness

Hello, thanks for your crate, but I've come across a compile error when using this crate. An example is given below:

use skippable_partialeq::SkippablePartialEq;

#[derive(Debug, SkippablePartialEq)]
#[exclude_suffix(at)]
pub struct Post<'i> {
    pub id: i64,
    pub content: &'i str,
    pub author: i32,
    pub created_at: f64,
    pub updated_at: Option<f64>,
}

The error is something like:

error[E0726]: implicit elided lifetime not allowed here

Generated codes PartialEq implementation (with cargo expand):

impl PartialEq for Post {
    fn eq(&self, other: &Self) -> bool {
        &self.id == &other.id && &self.content == &other.content
            && &self.author == &other.author && self.updated_at.is_none()
            && other.updated_at.is_none()
            || self.updated_at.is_some() && other.updated_at.is_some()
    }
}

And the lifetime parameter of Post seems to be missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions