Skip to content

Commit 1f64d63

Browse files
ZuseZ4oli-obk
andauthored
Apply suggestions from code review
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
1 parent 091b300 commit 1f64d63

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

compiler/rustc_builtin_macros/src/autodiff.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ mod llvm_enzyme {
4545
}
4646
}
4747
fn first_ident(x: &MetaItemInner) -> rustc_span::Ident {
48-
if x.lit().is_some() {
49-
let l = x.lit().unwrap();
48+
if let Some(l) = x.lit() {
5049
match l.kind {
5150
ast::LitKind::Int(val, _) => {
5251
// get an Ident from a lit
@@ -89,8 +88,8 @@ mod llvm_enzyme {
8988
// If he doesn't specify an integer (=width), we default to scalar mode, thus width=1.
9089
let mut first_activity = 2;
9190

92-
let width = if meta_item.len() >= 3
93-
&& let Some(x) = width(&meta_item[2])
91+
let width = if let [_, _, x, ..] = &meta_item[..]
92+
&& let Some(x) = width(x)
9493
{
9594
first_activity = 3;
9695
match x.try_into() {

0 commit comments

Comments
 (0)