Skip to content

Commit

Permalink
remove unneccessary wrapping of return value of allow_unstable(), it …
Browse files Browse the repository at this point in the history
…would always return Some(thing)
  • Loading branch information
matthiaskrgr committed Feb 21, 2021
1 parent ed58a2b commit 4cb649b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions compiler/rustc_attr/src/builtin.rs
Expand Up @@ -1036,21 +1036,21 @@ pub fn allow_internal_unstable<'a>(
sess: &'a Session,
attrs: &'a [Attribute],
) -> Option<impl Iterator<Item = Symbol> + 'a> {
allow_unstable(sess, attrs, sym::allow_internal_unstable)
Some(allow_unstable(sess, attrs, sym::allow_internal_unstable))
}

pub fn rustc_allow_const_fn_unstable<'a>(
sess: &'a Session,
attrs: &'a [Attribute],
) -> Option<impl Iterator<Item = Symbol> + 'a> {
allow_unstable(sess, attrs, sym::rustc_allow_const_fn_unstable)
Some(allow_unstable(sess, attrs, sym::rustc_allow_const_fn_unstable))
}

fn allow_unstable<'a>(
sess: &'a Session,
attrs: &'a [Attribute],
symbol: Symbol,
) -> Option<impl Iterator<Item = Symbol> + 'a> {
) -> impl Iterator<Item = Symbol> + 'a {
let attrs = sess.filter_by_name(attrs, symbol);
let list = attrs
.filter_map(move |attr| {
Expand All @@ -1064,7 +1064,7 @@ fn allow_unstable<'a>(
})
.flatten();

Some(list.into_iter().filter_map(move |it| {
list.into_iter().filter_map(move |it| {
let name = it.ident().map(|ident| ident.name);
if name.is_none() {
sess.diagnostic().span_err(
Expand All @@ -1073,5 +1073,5 @@ fn allow_unstable<'a>(
);
}
name
}))
})
}

0 comments on commit 4cb649b

Please sign in to comment.