rust-analyzer guided enum variant structification
This commit is contained in:
@@ -2890,6 +2890,9 @@ pub struct Fn {
|
||||
pub body: Option<P<Block>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Encodable, Decodable, Debug)]
|
||||
pub struct Static(pub P<Ty>, pub Mutability, pub Option<P<Expr>>);
|
||||
|
||||
#[derive(Clone, Encodable, Decodable, Debug)]
|
||||
pub enum ItemKind {
|
||||
/// An `extern crate` item, with the optional *original* crate name if the crate was renamed.
|
||||
@@ -2903,7 +2906,7 @@ pub enum ItemKind {
|
||||
/// A static item (`static`).
|
||||
///
|
||||
/// E.g., `static FOO: i32 = 42;` or `static FOO: &'static str = "bar";`.
|
||||
Static(P<Ty>, Mutability, Option<P<Expr>>),
|
||||
Static(Static),
|
||||
/// A constant item (`const`).
|
||||
///
|
||||
/// E.g., `const FOO: i32 = 42;`.
|
||||
@@ -2975,7 +2978,7 @@ impl ItemKind {
|
||||
match self {
|
||||
ItemKind::ExternCrate(..) => "extern crate",
|
||||
ItemKind::Use(..) => "`use` import",
|
||||
ItemKind::Static(..) => "static item",
|
||||
ItemKind::Static(Static(..)) => "static item",
|
||||
ItemKind::Const(..) => "constant item",
|
||||
ItemKind::Fn(..) => "function",
|
||||
ItemKind::Mod(..) => "module",
|
||||
@@ -3084,7 +3087,7 @@ pub enum ForeignItemKind {
|
||||
impl From<ForeignItemKind> for ItemKind {
|
||||
fn from(foreign_item_kind: ForeignItemKind) -> ItemKind {
|
||||
match foreign_item_kind {
|
||||
ForeignItemKind::Static(a, b, c) => ItemKind::Static(a, b, c),
|
||||
ForeignItemKind::Static(a, b, c) => ItemKind::Static(Static(a, b, c)),
|
||||
ForeignItemKind::Fn(fn_kind) => ItemKind::Fn(fn_kind),
|
||||
ForeignItemKind::TyAlias(ty_alias_kind) => ItemKind::TyAlias(ty_alias_kind),
|
||||
ForeignItemKind::MacCall(a) => ItemKind::MacCall(a),
|
||||
@@ -3097,7 +3100,7 @@ impl TryFrom<ItemKind> for ForeignItemKind {
|
||||
|
||||
fn try_from(item_kind: ItemKind) -> Result<ForeignItemKind, ItemKind> {
|
||||
Ok(match item_kind {
|
||||
ItemKind::Static(a, b, c) => ForeignItemKind::Static(a, b, c),
|
||||
ItemKind::Static(Static(a, b, c)) => ForeignItemKind::Static(a, b, c),
|
||||
ItemKind::Fn(fn_kind) => ForeignItemKind::Fn(fn_kind),
|
||||
ItemKind::TyAlias(ty_alias_kind) => ForeignItemKind::TyAlias(ty_alias_kind),
|
||||
ItemKind::MacCall(a) => ForeignItemKind::MacCall(a),
|
||||
|
||||
Reference in New Issue
Block a user