1
fix: Only move comments when extracting a struct from an enum variant by DropDem...
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.
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
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK