Skip to content

Commit 6d82ee8

Browse files
committed
Remove GetDefId impl for FnRetTy
It was only used in one place, so it seems better to use ordinary functions.
1 parent 1da8659 commit 6d82ee8

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/librustdoc/clean/types.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,17 +1370,10 @@ crate enum FnRetTy {
13701370
DefaultReturn,
13711371
}
13721372

1373-
impl GetDefId for FnRetTy {
1374-
fn def_id(&self) -> Option<DefId> {
1375-
match *self {
1376-
Return(ref ty) => ty.def_id(),
1377-
DefaultReturn => None,
1378-
}
1379-
}
1380-
1381-
fn def_id_full(&self, cache: &Cache) -> Option<DefId> {
1382-
match *self {
1383-
Return(ref ty) => ty.def_id_full(cache),
1373+
impl FnRetTy {
1374+
crate fn as_return(&self) -> Option<&Type> {
1375+
match self {
1376+
Return(ret) => Some(ret),
13841377
DefaultReturn => None,
13851378
}
13861379
}

src/librustdoc/html/render/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ fn should_render_item(item: &clean::Item, deref_mut_: bool, tcx: TyCtxt<'_>) ->
12151215
fn notable_traits_decl(decl: &clean::FnDecl, cx: &Context<'_>) -> String {
12161216
let mut out = Buffer::html();
12171217

1218-
if let Some(did) = decl.output.def_id_full(cx.cache()) {
1218+
if let Some(did) = decl.output.as_return().and_then(|t| t.def_id_full(cx.cache())) {
12191219
if let Some(impls) = cx.cache().impls.get(&did) {
12201220
for i in impls {
12211221
let impl_ = i.inner_impl();

0 commit comments

Comments
 (0)