Skip to content

Extra backslashes when generating a trait method #16655

@JustinHuPrime

Description

@JustinHuPrime

rust-analyzer version: 0.3.1850-standalone

rustc version: rustc 1.75.0 (82e1608df 2023-12-21)

relevant settings: default settings

This is a regression from 0.3.1850 and 0.3.1839

When in 0.3.1850 (newer), asking RA to implement the missing members for a trait generates extra backslashes:

struct SomeStruct {
    field: i32,
}
impl Display for SomeStruct {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result \{
        todo!()
    \}
}

When in 0.3.1839 (older), asking RA to implement the same missing member generates the expected code without the extra backslashes:

struct SomeStruct {
    field: i32,
}
impl Display for SomeStruct {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        todo!()
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions