Remove a Clean impl for a tuple (9)
This was the last one!
This commit is contained in:
parent
de5ea80437
commit
e36561dbdd
1 changed files with 48 additions and 43 deletions
|
@ -52,7 +52,11 @@ crate trait Clean<T> {
|
||||||
impl Clean<Item> for DocModule<'_> {
|
impl Clean<Item> for DocModule<'_> {
|
||||||
fn clean(&self, cx: &mut DocContext<'_>) -> Item {
|
fn clean(&self, cx: &mut DocContext<'_>) -> Item {
|
||||||
let mut items: Vec<Item> = vec![];
|
let mut items: Vec<Item> = vec![];
|
||||||
items.extend(self.foreigns.iter().map(|x| x.clean(cx)));
|
items.extend(
|
||||||
|
self.foreigns
|
||||||
|
.iter()
|
||||||
|
.map(|(item, renamed)| clean_maybe_renamed_foreign_item(cx, item, *renamed)),
|
||||||
|
);
|
||||||
items.extend(self.mods.iter().map(|x| x.clean(cx)));
|
items.extend(self.mods.iter().map(|x| x.clean(cx)));
|
||||||
items.extend(
|
items.extend(
|
||||||
self.items
|
self.items
|
||||||
|
@ -2030,50 +2034,51 @@ fn clean_use_statement(
|
||||||
vec![Item::from_def_id_and_parts(import.def_id.to_def_id(), None, ImportItem(inner), cx)]
|
vec![Item::from_def_id_and_parts(import.def_id.to_def_id(), None, ImportItem(inner), cx)]
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Clean<Item> for (&hir::ForeignItem<'_>, Option<Symbol>) {
|
fn clean_maybe_renamed_foreign_item(
|
||||||
fn clean(&self, cx: &mut DocContext<'_>) -> Item {
|
cx: &mut DocContext<'_>,
|
||||||
let (item, renamed) = self;
|
item: &hir::ForeignItem<'_>,
|
||||||
let def_id = item.def_id.to_def_id();
|
renamed: Option<Symbol>,
|
||||||
cx.with_param_env(def_id, |cx| {
|
) -> Item {
|
||||||
let kind = match item.kind {
|
let def_id = item.def_id.to_def_id();
|
||||||
hir::ForeignItemKind::Fn(decl, names, ref generics) => {
|
cx.with_param_env(def_id, |cx| {
|
||||||
let abi = cx.tcx.hir().get_foreign_abi(item.hir_id());
|
let kind = match item.kind {
|
||||||
let (generics, decl) = enter_impl_trait(cx, |cx| {
|
hir::ForeignItemKind::Fn(decl, names, ref generics) => {
|
||||||
// NOTE: generics must be cleaned before args
|
let abi = cx.tcx.hir().get_foreign_abi(item.hir_id());
|
||||||
let generics = generics.clean(cx);
|
let (generics, decl) = enter_impl_trait(cx, |cx| {
|
||||||
let args = clean_args_from_types_and_names(cx, decl.inputs, names);
|
// NOTE: generics must be cleaned before args
|
||||||
let decl = clean_fn_decl_with_args(cx, decl, args);
|
let generics = generics.clean(cx);
|
||||||
(generics, decl)
|
let args = clean_args_from_types_and_names(cx, decl.inputs, names);
|
||||||
});
|
let decl = clean_fn_decl_with_args(cx, decl, args);
|
||||||
ForeignFunctionItem(Function {
|
(generics, decl)
|
||||||
decl,
|
});
|
||||||
generics,
|
ForeignFunctionItem(Function {
|
||||||
header: hir::FnHeader {
|
decl,
|
||||||
unsafety: if abi == Abi::RustIntrinsic {
|
generics,
|
||||||
intrinsic_operation_unsafety(item.ident.name)
|
header: hir::FnHeader {
|
||||||
} else {
|
unsafety: if abi == Abi::RustIntrinsic {
|
||||||
hir::Unsafety::Unsafe
|
intrinsic_operation_unsafety(item.ident.name)
|
||||||
},
|
} else {
|
||||||
abi,
|
hir::Unsafety::Unsafe
|
||||||
constness: hir::Constness::NotConst,
|
|
||||||
asyncness: hir::IsAsync::NotAsync,
|
|
||||||
},
|
},
|
||||||
})
|
abi,
|
||||||
}
|
constness: hir::Constness::NotConst,
|
||||||
hir::ForeignItemKind::Static(ref ty, mutability) => {
|
asyncness: hir::IsAsync::NotAsync,
|
||||||
ForeignStaticItem(Static { type_: ty.clean(cx), mutability, expr: None })
|
},
|
||||||
}
|
})
|
||||||
hir::ForeignItemKind::Type => ForeignTypeItem,
|
}
|
||||||
};
|
hir::ForeignItemKind::Static(ref ty, mutability) => {
|
||||||
|
ForeignStaticItem(Static { type_: ty.clean(cx), mutability, expr: None })
|
||||||
|
}
|
||||||
|
hir::ForeignItemKind::Type => ForeignTypeItem,
|
||||||
|
};
|
||||||
|
|
||||||
Item::from_hir_id_and_parts(
|
Item::from_hir_id_and_parts(
|
||||||
item.hir_id(),
|
item.hir_id(),
|
||||||
Some(renamed.unwrap_or(item.ident.name)),
|
Some(renamed.unwrap_or(item.ident.name)),
|
||||||
kind,
|
kind,
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Clean<TypeBinding> for hir::TypeBinding<'_> {
|
impl Clean<TypeBinding> for hir::TypeBinding<'_> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue