Skip to content

Commit daf916b

Browse files
committed
Fix bug in the syntax::config::StripUnconfigured folder
1 parent c2cab1f commit daf916b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/libsyntax/config.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,6 @@ impl<T: CfgFolder> fold::Folder for T {
166166
};
167167

168168
let item = match item {
169-
ast::ItemKind::Impl(u, o, a, b, c, items) => {
170-
let items = items.into_iter().filter_map(|item| self.configure(item)).collect();
171-
ast::ItemKind::Impl(u, o, a, b, c, items)
172-
}
173-
ast::ItemKind::Trait(u, a, b, items) => {
174-
let items = items.into_iter().filter_map(|item| self.configure(item)).collect();
175-
ast::ItemKind::Trait(u, a, b, items)
176-
}
177169
ast::ItemKind::Struct(def, generics) => {
178170
ast::ItemKind::Struct(fold_struct(self, def), generics)
179171
}
@@ -242,7 +234,17 @@ impl<T: CfgFolder> fold::Folder for T {
242234
}
243235

244236
fn fold_item(&mut self, item: P<ast::Item>) -> SmallVector<P<ast::Item>> {
245-
self.configure(item).map(|item| SmallVector::one(item.map(|i| self.fold_item_simple(i))))
237+
self.configure(item).map(|item| fold::noop_fold_item(item, self))
238+
.unwrap_or(SmallVector::zero())
239+
}
240+
241+
fn fold_impl_item(&mut self, item: ast::ImplItem) -> SmallVector<ast::ImplItem> {
242+
self.configure(item).map(|item| fold::noop_fold_impl_item(item, self))
243+
.unwrap_or(SmallVector::zero())
244+
}
245+
246+
fn fold_trait_item(&mut self, item: ast::TraitItem) -> SmallVector<ast::TraitItem> {
247+
self.configure(item).map(|item| fold::noop_fold_trait_item(item, self))
246248
.unwrap_or(SmallVector::zero())
247249
}
248250
}

0 commit comments

Comments
 (0)