1
Fork 0

rust-analyzer guided tuple field to named field

This commit is contained in:
Oli Scherer 2023-03-29 08:50:04 +00:00
parent b08a557f80
commit e3828777a6
16 changed files with 33 additions and 24 deletions

View file

@ -228,7 +228,7 @@ impl<'a> Parser<'a> {
self.bump(); // `static`
let m = self.parse_mutability();
let (ident, ty, expr) = self.parse_item_global(Some(m))?;
(ident, ItemKind::Static(Static(ty, m, expr)))
(ident, ItemKind::Static(Static { ty, mutability: m, expr }))
} else if let Const::Yes(const_span) = self.parse_constness(Case::Sensitive) {
// CONST ITEM
if self.token.is_keyword(kw::Impl) {
@ -863,7 +863,7 @@ impl<'a> Parser<'a> {
let kind = match AssocItemKind::try_from(kind) {
Ok(kind) => kind,
Err(kind) => match kind {
ItemKind::Static(Static(a, _, b)) => {
ItemKind::Static(Static { ty: a, mutability: _, expr: b }) => {
self.sess.emit_err(errors::AssociatedStaticItemNotAllowed { span });
AssocItemKind::Const(Defaultness::Final, a, b)
}