mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 22:12:15 +00:00
remove Clean trait implementation for hir::GenericArgs
This commit is contained in:
parent
a4f52a5622
commit
0cd06fb481
@ -123,7 +123,7 @@ fn clean_generic_bound<'tcx>(
|
||||
|
||||
let trait_ref = ty::TraitRef::identity(cx.tcx, def_id).skip_binder();
|
||||
|
||||
let generic_args = generic_args.clean(cx);
|
||||
let generic_args = clean_generic_args(generic_args, cx);
|
||||
let GenericArgs::AngleBracketed { bindings, .. } = generic_args
|
||||
else {
|
||||
bug!("clean: parenthesized `GenericBound::LangItemTrait`");
|
||||
@ -1826,16 +1826,18 @@ fn clean_path<'tcx>(path: &hir::Path<'tcx>, cx: &mut DocContext<'tcx>) -> Path {
|
||||
Path { res: path.res, segments: path.segments.iter().map(|x| x.clean(cx)).collect() }
|
||||
}
|
||||
|
||||
impl<'tcx> Clean<'tcx, GenericArgs> for hir::GenericArgs<'tcx> {
|
||||
fn clean(&self, cx: &mut DocContext<'tcx>) -> GenericArgs {
|
||||
if self.parenthesized {
|
||||
let output = clean_ty(self.bindings[0].ty(), cx);
|
||||
let output =
|
||||
if output != Type::Tuple(Vec::new()) { Some(Box::new(output)) } else { None };
|
||||
let inputs = self.inputs().iter().map(|x| clean_ty(x, cx)).collect::<Vec<_>>().into();
|
||||
fn clean_generic_args<'tcx>(
|
||||
generic_args: &hir::GenericArgs<'tcx>,
|
||||
cx: &mut DocContext<'tcx>,
|
||||
) -> GenericArgs {
|
||||
if generic_args.parenthesized {
|
||||
let output = clean_ty(generic_args.bindings[0].ty(), cx);
|
||||
let output = if output != Type::Tuple(Vec::new()) { Some(Box::new(output)) } else { None };
|
||||
let inputs =
|
||||
generic_args.inputs().iter().map(|x| clean_ty(x, cx)).collect::<Vec<_>>().into();
|
||||
GenericArgs::Parenthesized { inputs, output }
|
||||
} else {
|
||||
let args = self
|
||||
let args = generic_args
|
||||
.args
|
||||
.iter()
|
||||
.map(|arg| match arg {
|
||||
@ -1849,16 +1851,19 @@ impl<'tcx> Clean<'tcx, GenericArgs> for hir::GenericArgs<'tcx> {
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.into();
|
||||
let bindings =
|
||||
self.bindings.iter().map(|x| clean_type_binding(x, cx)).collect::<Vec<_>>().into();
|
||||
let bindings = generic_args
|
||||
.bindings
|
||||
.iter()
|
||||
.map(|x| clean_type_binding(x, cx))
|
||||
.collect::<Vec<_>>()
|
||||
.into();
|
||||
GenericArgs::AngleBracketed { args, bindings }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Clean<'tcx, PathSegment> for hir::PathSegment<'tcx> {
|
||||
fn clean(&self, cx: &mut DocContext<'tcx>) -> PathSegment {
|
||||
PathSegment { name: self.ident.name, args: self.args().clean(cx) }
|
||||
PathSegment { name: self.ident.name, args: clean_generic_args(self.args(), cx) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -2228,7 +2233,10 @@ fn clean_type_binding<'tcx>(
|
||||
cx: &mut DocContext<'tcx>,
|
||||
) -> TypeBinding {
|
||||
TypeBinding {
|
||||
assoc: PathSegment { name: type_binding.ident.name, args: type_binding.gen_args.clean(cx) },
|
||||
assoc: PathSegment {
|
||||
name: type_binding.ident.name,
|
||||
args: clean_generic_args(type_binding.gen_args, cx),
|
||||
},
|
||||
kind: match type_binding.kind {
|
||||
hir::TypeBindingKind::Equality { ref term } => {
|
||||
TypeBindingKind::Equality { term: clean_hir_term(term, cx) }
|
||||
|
Loading…
Reference in New Issue
Block a user