From 0e9ea62ecdc21587b2545ba6ad87c35c2dbe85e8 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 10 Aug 2022 20:58:38 +1000 Subject: [PATCH] XXX: various fixes for CI failures --- compiler/rustc_ast/src/ast.rs | 2 +- src/tools/rustfmt/src/items.rs | 54 +++++++++++++++++----------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 862ac541d5c3d..9c7ff078df129 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -12,7 +12,7 @@ //! - [`Stmt`] and [`StmtKind`]: An executable action that does not return a value. //! - [`FnDecl`], [`FnHeader`] and [`Param`]: Metadata associated with a function declaration. //! - [`Generics`], [`GenericParam`], [`WhereClause`]: Metadata associated with generic parameters. -//! - [`EnumDef`] and [`Variant`]: Enum declaration. +//! - [`Enum`] and [`Variant`]: Enum declaration. //! - [`Lit`] and [`LitKind`]: Literal expressions. //! - [`MacroDef`], [`MacStmtStyle`], [`MacCall`], [`MacDelimiter`]: Macro definition and invocation. //! - [`Attribute`]: Metadata associated with item. diff --git a/src/tools/rustfmt/src/items.rs b/src/tools/rustfmt/src/items.rs index c77065e855c3a..9624b0fbd7ed8 100644 --- a/src/tools/rustfmt/src/items.rs +++ b/src/tools/rustfmt/src/items.rs @@ -1803,9 +1803,13 @@ impl<'a> StaticParts<'a> { ast::ItemKind::Static(ref static_) => { (None, "static", &static_.ty, static_.mutbl, &static_.expr) } - ast::ItemKind::Const(ref const_) => { - (Some(const_.defaultness), "const", &const_.ty, ast::Mutability::Not, &const_.expr) - } + ast::ItemKind::Const(ref const_) => ( + Some(const_.defaultness), + "const", + &const_.ty, + ast::Mutability::Not, + &const_.expr, + ), _ => unreachable!(), }; StaticParts { @@ -1822,36 +1826,32 @@ impl<'a> StaticParts<'a> { pub(crate) fn from_trait_item(ti: &'a ast::AssocItem) -> Self { match &ti.kind { - ast::AssocItemKind::Const(const_) => { - StaticParts { - prefix: "const", - vis: &ti.vis, - ident: ti.ident, - ty: &const_.ty, - mutability: ast::Mutability::Not, - expr_opt: const_.expr.as_ref(), - defaultness: Some(const_.defaultness), - span: ti.span, - } - } + ast::AssocItemKind::Const(const_) => StaticParts { + prefix: "const", + vis: &ti.vis, + ident: ti.ident, + ty: &const_.ty, + mutability: ast::Mutability::Not, + expr_opt: const_.expr.as_ref(), + defaultness: Some(const_.defaultness), + span: ti.span, + }, _ => unreachable!(), } } pub(crate) fn from_impl_item(ii: &'a ast::AssocItem) -> Self { match &ii.kind { - ast::AssocItemKind::Const(const_) => { - StaticParts { - prefix: "const", - vis: &ii.vis, - ident: ii.ident, - ty: &const_.ty, - mutability: ast::Mutability::Not, - expr_opt: const_.expr.as_ref(), - defaultness: Some(const_.defaultness), - span: ii.span, - } - } + ast::AssocItemKind::Const(const_) => StaticParts { + prefix: "const", + vis: &ii.vis, + ident: ii.ident, + ty: &const_.ty, + mutability: ast::Mutability::Not, + expr_opt: const_.expr.as_ref(), + defaultness: Some(const_.defaultness), + span: ii.span, + }, _ => unreachable!(), } }