Skip to content

Inline construct method, unexpected contains type lifetime param #19349

@A4-Tacks

Description

@A4-Tacks

rust-analyzer version: rust-analyzer 1.84.0-nightly (798fb83 2024-10-16)

rustc version: rustc 1.84.0-nightly (798fb83 2024-10-16)

editor or extension: Vim9.1 [email protected]

code snippet to reproduce:

pub struct Foo<'a>(pub &'a ());
impl<'a> Default for Foo<'a> {
    fn default() -> Self {
        Self(&())
    }
}
impl<'a> Foo<'a> {
    pub fn new() -> Self {
        Self::default()
    }
}

on Self::default use action Inline `Self::default`:

pub struct Foo<'a>(pub &'a ());
impl<'a> Default for Foo<'a> {
    fn default() -> Self {
        Self(&())
    }
}
impl<'a> Foo<'a> {
    pub fn new() -> Self {
        Foo<'a>(&())
    }
}

expect output:

pub struct Foo<'a>(pub &'a ());
impl<'a> Default for Foo<'a> {
    fn default() -> Self {
        Self(&())
    }
}
impl<'a> Foo<'a> {
    pub fn new() -> Self {
        Foo(&())
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions