Skip to content

Commit 632f2cb

Browse files
Remove one loop in extract_cfg_from_attrs
1 parent 8d72d3e commit 632f2cb

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/librustdoc/clean/types.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute>
10851085
let mut changed_auto_active_status = None;
10861086

10871087
// First we get all `doc(auto_cfg)` attributes.
1088-
for attr in attrs.clone() {
1088+
for attr in attrs {
10891089
if let Some(ident) = attr.ident()
10901090
&& ident.name == sym::doc
10911091
&& let Some(attrs) = attr.meta_item_list()
@@ -1146,13 +1146,9 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute>
11461146
}
11471147
}
11481148
}
1149-
}
1150-
}
1151-
1152-
// If there is no `doc(cfg())`, then we retrieve the `cfg()` attributes (because
1153-
// `doc(cfg())` overrides `cfg()`).
1154-
for attr in attrs {
1155-
if let hir::Attribute::Parsed(AttributeKind::TargetFeature { features, .. }) = attr {
1149+
// If there is no `doc(cfg())`, then we retrieve the `cfg()` attributes (because
1150+
// `doc(cfg())` overrides `cfg()`).
1151+
} else if let hir::Attribute::Parsed(AttributeKind::TargetFeature { features, .. }) = attr {
11561152
// treat #[target_feature(enable = "feat")] attributes as if they were
11571153
// #[doc(cfg(target_feature = "feat"))] attributes as well
11581154
for (feature, _) in features {

0 commit comments

Comments
 (0)