Skip to content

Commit 3b71d3a

Browse files
committed
Pass result vec into build_impls
1 parent b56c383 commit 3b71d3a

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/librustdoc/clean/inline.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ crate fn try_inline(
5656
let kind = match res {
5757
Res::Def(DefKind::Trait, did) => {
5858
record_extern_fqn(cx, did, clean::TypeKind::Trait);
59-
ret.extend(build_impls(cx, Some(parent_module), did, attrs));
59+
build_impls(cx, Some(parent_module), did, attrs, &mut ret);
6060
clean::TraitItem(build_external_trait(cx, did))
6161
}
6262
Res::Def(DefKind::Fn, did) => {
@@ -65,27 +65,27 @@ crate fn try_inline(
6565
}
6666
Res::Def(DefKind::Struct, did) => {
6767
record_extern_fqn(cx, did, clean::TypeKind::Struct);
68-
ret.extend(build_impls(cx, Some(parent_module), did, attrs));
68+
build_impls(cx, Some(parent_module), did, attrs, &mut ret);
6969
clean::StructItem(build_struct(cx, did))
7070
}
7171
Res::Def(DefKind::Union, did) => {
7272
record_extern_fqn(cx, did, clean::TypeKind::Union);
73-
ret.extend(build_impls(cx, Some(parent_module), did, attrs));
73+
build_impls(cx, Some(parent_module), did, attrs, &mut ret);
7474
clean::UnionItem(build_union(cx, did))
7575
}
7676
Res::Def(DefKind::TyAlias, did) => {
7777
record_extern_fqn(cx, did, clean::TypeKind::Typedef);
78-
ret.extend(build_impls(cx, Some(parent_module), did, attrs));
78+
build_impls(cx, Some(parent_module), did, attrs, &mut ret);
7979
clean::TypedefItem(build_type_alias(cx, did), false)
8080
}
8181
Res::Def(DefKind::Enum, did) => {
8282
record_extern_fqn(cx, did, clean::TypeKind::Enum);
83-
ret.extend(build_impls(cx, Some(parent_module), did, attrs));
83+
build_impls(cx, Some(parent_module), did, attrs, &mut ret);
8484
clean::EnumItem(build_enum(cx, did))
8585
}
8686
Res::Def(DefKind::ForeignTy, did) => {
8787
record_extern_fqn(cx, did, clean::TypeKind::Foreign);
88-
ret.extend(build_impls(cx, Some(parent_module), did, attrs));
88+
build_impls(cx, Some(parent_module), did, attrs, &mut ret);
8989
clean::ForeignTypeItem
9090
}
9191
// Never inline enum variants but leave them shown as re-exports.
@@ -277,16 +277,14 @@ crate fn build_impls(
277277
parent_module: Option<DefId>,
278278
did: DefId,
279279
attrs: Option<Attrs<'_>>,
280-
) -> Vec<clean::Item> {
280+
ret: &mut Vec<clean::Item>,
281+
) {
281282
let tcx = cx.tcx;
282-
let mut impls = Vec::new();
283283

284284
// for each implementation of an item represented by `did`, build the clean::Item for that impl
285285
for &did in tcx.inherent_impls(did).iter() {
286-
build_impl(cx, parent_module, did, attrs, &mut impls);
286+
build_impl(cx, parent_module, did, attrs, ret);
287287
}
288-
289-
impls
290288
}
291289

292290
/// `parent_module` refers to the parent of the re-export, not the original item

src/librustdoc/clean/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ crate fn build_deref_target_impls(cx: &DocContext<'_>, items: &[Item], ret: &mut
329329
}
330330
} else if let ResolvedPath { did, .. } = *target {
331331
if !did.is_local() {
332-
ret.extend(inline::build_impls(cx, None, did, None));
332+
inline::build_impls(cx, None, did, None, ret);
333333
}
334334
}
335335
}

0 commit comments

Comments
 (0)