Skip to content

Commit f533800

Browse files
committed
Merge from rustc
2 parents 5effe61 + f178139 commit f533800

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/items.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,13 +1804,15 @@ pub(crate) struct StaticParts<'a> {
18041804

18051805
impl<'a> StaticParts<'a> {
18061806
pub(crate) fn from_item(item: &'a ast::Item) -> Self {
1807-
let (defaultness, prefix, ty, mutability, expr) = match item.kind {
1808-
ast::ItemKind::Static(ref ty, mutability, ref expr) => {
1809-
(None, "static", ty, mutability, expr)
1810-
}
1811-
ast::ItemKind::Const(defaultness, ref ty, ref expr) => {
1812-
(Some(defaultness), "const", ty, ast::Mutability::Not, expr)
1813-
}
1807+
let (defaultness, prefix, ty, mutability, expr) = match &item.kind {
1808+
ast::ItemKind::Static(s) => (None, "static", &s.ty, s.mutability, &s.expr),
1809+
ast::ItemKind::Const(c) => (
1810+
Some(c.defaultness),
1811+
"const",
1812+
&c.ty,
1813+
ast::Mutability::Not,
1814+
&c.expr,
1815+
),
18141816
_ => unreachable!(),
18151817
};
18161818
StaticParts {
@@ -1826,10 +1828,8 @@ impl<'a> StaticParts<'a> {
18261828
}
18271829

18281830
pub(crate) fn from_trait_item(ti: &'a ast::AssocItem) -> Self {
1829-
let (defaultness, ty, expr_opt) = match ti.kind {
1830-
ast::AssocItemKind::Const(defaultness, ref ty, ref expr_opt) => {
1831-
(defaultness, ty, expr_opt)
1832-
}
1831+
let (defaultness, ty, expr_opt) = match &ti.kind {
1832+
ast::AssocItemKind::Const(c) => (c.defaultness, &c.ty, &c.expr),
18331833
_ => unreachable!(),
18341834
};
18351835
StaticParts {
@@ -1845,8 +1845,8 @@ impl<'a> StaticParts<'a> {
18451845
}
18461846

18471847
pub(crate) fn from_impl_item(ii: &'a ast::AssocItem) -> Self {
1848-
let (defaultness, ty, expr) = match ii.kind {
1849-
ast::AssocItemKind::Const(defaultness, ref ty, ref expr) => (defaultness, ty, expr),
1848+
let (defaultness, ty, expr) = match &ii.kind {
1849+
ast::AssocItemKind::Const(c) => (c.defaultness, &c.ty, &c.expr),
18501850
_ => unreachable!(),
18511851
};
18521852
StaticParts {

0 commit comments

Comments
 (0)