We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b4c3f0f commit db41df1Copy full SHA for db41df1
clippy_utils/src/lib.rs
@@ -2153,8 +2153,8 @@ pub fn is_in_cfg_test(tcx: TyCtxt<'_>, id: hir::HirId) -> bool {
2153
fn is_cfg_test(attr: &Attribute) -> bool {
2154
if attr.has_name(sym::cfg)
2155
&& let Some(items) = attr.meta_item_list()
2156
- && items.len() == 1
2157
- && items[0].has_name(sym::test)
+ && let [item] = &*items
+ && item.has_name(sym::test)
2158
{
2159
true
2160
} else {
@@ -2163,7 +2163,8 @@ pub fn is_in_cfg_test(tcx: TyCtxt<'_>, id: hir::HirId) -> bool {
2163
}
2164
tcx.hir()
2165
.parent_iter(id)
2166
- .any(|(parent_id, _)| tcx.hir().attrs(parent_id).iter().any(is_cfg_test))
+ .flat_map(|(parent_id, _)| tcx.hir().attrs(parent_id))
2167
+ .any(is_cfg_test)
2168
2169
2170
/// Checks whether item either has `test` attribute applied, or
0 commit comments