1

fix: Only move comments when extracting a struct from an enum variant by DropDem...

 2 years ago
source link: https://github.com/rust-lang/rust-analyzer/pull/13051
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Contributor

@DropDemBits DropDemBits commented 21 days ago

edited

Motivating example:

#[derive(Debug, thiserror::Error)]
enum Error {
    /// Some explanation for this error
    #[error("message")]
    $0Woops {
        code: u32
    }
}

now becomes

/// Some explanation for this error
#[derive(Debug, thiserror::Error)]
struct Woops{
    code: u32
}

#[derive(Debug, thiserror::Error)]
enum Error {
    #[error("message")]
    Woops(Woops)
}

(the thiserror::Error derive being copied and the struct formatting aren't ideal, though those are issues for another day)

All reactions

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK