remove unneccessary wrapping of return value of allow_unstable(), it would always return Some(thing)

This commit is contained in:
Matthias Krüger 2021-02-21 12:52:51 +01:00
parent ed58a2b03b
commit 4cb649bdb1
1 changed files with 5 additions and 5 deletions

View File

@ -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| {
@ -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(
@ -1073,5 +1073,5 @@ fn allow_unstable<'a>(
);
}
name
}))
})
}