Skip to content

Commit db41df1

Browse files
committed
fix
1 parent b4c3f0f commit db41df1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clippy_utils/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,8 +2153,8 @@ pub fn is_in_cfg_test(tcx: TyCtxt<'_>, id: hir::HirId) -> bool {
21532153
fn is_cfg_test(attr: &Attribute) -> bool {
21542154
if attr.has_name(sym::cfg)
21552155
&& let Some(items) = attr.meta_item_list()
2156-
&& items.len() == 1
2157-
&& items[0].has_name(sym::test)
2156+
&& let [item] = &*items
2157+
&& item.has_name(sym::test)
21582158
{
21592159
true
21602160
} else {
@@ -2163,7 +2163,8 @@ pub fn is_in_cfg_test(tcx: TyCtxt<'_>, id: hir::HirId) -> bool {
21632163
}
21642164
tcx.hir()
21652165
.parent_iter(id)
2166-
.any(|(parent_id, _)| tcx.hir().attrs(parent_id).iter().any(is_cfg_test))
2166+
.flat_map(|(parent_id, _)| tcx.hir().attrs(parent_id))
2167+
.any(is_cfg_test)
21672168
}
21682169

21692170
/// Checks whether item either has `test` attribute applied, or

0 commit comments

Comments
 (0)