about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src/expr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-12-01 07:13:45 +0000
committerbors <bors@rust-lang.org>2022-12-01 07:13:45 +0000
commitd6c4de0fb22fe8f3cc5a27e94b6b6d88fb504a91 (patch)
treedaeb506f5cabec0a0b7f16f5a4a5e65fd723b7f4 /compiler/rustc_ast_lowering/src/expr.rs
parent744a97b98c3f2722e1a43486c05203b04e499e21 (diff)
parentba1751a201190930a16ef20e6f7021c785d3891d (diff)
downloadrust-d6c4de0fb22fe8f3cc5a27e94b6b6d88fb504a91.tar.gz
rust-d6c4de0fb22fe8f3cc5a27e94b6b6d88fb504a91.zip
Auto merge of #104861 - nnethercote:attr-cleanups, r=petrochenkov
Attribute cleanups

Best reviewed one commit at a time.

r? `@petrochenkov`
Diffstat (limited to 'compiler/rustc_ast_lowering/src/expr.rs')
-rw-r--r--compiler/rustc_ast_lowering/src/expr.rs17
1 files changed, 7 insertions, 10 deletions
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs
index c14c591d387..82912a733d5 100644
--- a/compiler/rustc_ast_lowering/src/expr.rs
+++ b/compiler/rustc_ast_lowering/src/expr.rs
@@ -1606,16 +1606,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
         };
 
         // `#[allow(unreachable_code)]`
-        let attr = {
-            // `allow(unreachable_code)`
-            let allow = {
-                let allow_ident = Ident::new(sym::allow, self.lower_span(span));
-                let uc_ident = Ident::new(sym::unreachable_code, self.lower_span(span));
-                let uc_nested = attr::mk_nested_word_item(uc_ident);
-                attr::mk_list_item(allow_ident, vec![uc_nested])
-            };
-            attr::mk_attr_outer(&self.tcx.sess.parse_sess.attr_id_generator, allow)
-        };
+        let attr = attr::mk_attr_nested_word(
+            &self.tcx.sess.parse_sess.attr_id_generator,
+            AttrStyle::Outer,
+            sym::allow,
+            sym::unreachable_code,
+            self.lower_span(span),
+        );
         let attrs: AttrVec = thin_vec![attr];
 
         // `ControlFlow::Continue(val) => #[allow(unreachable_code)] val,`