Skip to content

Commit

Permalink
XXX: various fixes for CI failures
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Aug 10, 2022
1 parent c0a3752 commit 0e9ea62
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
54 changes: 27 additions & 27 deletions src/tools/rustfmt/src/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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!(),
}
}
Expand Down

0 comments on commit 0e9ea62

Please sign in to comment.