rollup merge of #18630 : nikomatsakis/purge-the-bars

This commit is contained in:
Alex Crichton 2014-11-06 13:31:18 -08:00
commit 76d2abe0e7
45 changed files with 954 additions and 630 deletions

View file

@ -323,7 +323,6 @@ fn build_impl(cx: &DocContext, tcx: &ty::ctxt,
trait_: associated_trait.clean(cx).map(|bound| {
match bound {
clean::TraitBound(ty) => ty,
clean::UnboxedFnBound(..) |
clean::RegionBound(..) => unreachable!(),
}
}),

View file

@ -476,7 +476,6 @@ impl Clean<TyParam> for ty::TypeParameterDef {
#[deriving(Clone, Encodable, Decodable, PartialEq)]
pub enum TyParamBound {
RegionBound(Lifetime),
UnboxedFnBound(UnboxedFnType),
TraitBound(Type)
}
@ -484,7 +483,6 @@ impl Clean<TyParamBound> for ast::TyParamBound {
fn clean(&self, cx: &DocContext) -> TyParamBound {
match *self {
ast::RegionTyParamBound(lt) => RegionBound(lt.clean(cx)),
ast::UnboxedFnTyParamBound(ref ty) => { UnboxedFnBound(ty.clean(cx)) },
ast::TraitTyParamBound(ref t) => TraitBound(t.clean(cx)),
}
}
@ -599,21 +597,6 @@ impl Clean<Option<Vec<TyParamBound>>> for subst::Substs {
}
}
#[deriving(Clone, Encodable, Decodable, PartialEq)]
pub struct UnboxedFnType {
pub path: Path,
pub decl: FnDecl
}
impl Clean<UnboxedFnType> for ast::UnboxedFnBound {
fn clean(&self, cx: &DocContext) -> UnboxedFnType {
UnboxedFnType {
path: self.path.clean(cx),
decl: self.decl.clean(cx)
}
}
}
#[deriving(Clone, Encodable, Decodable, PartialEq)]
pub struct Lifetime(String);
@ -1641,10 +1624,23 @@ pub struct PathSegment {
impl Clean<PathSegment> for ast::PathSegment {
fn clean(&self, cx: &DocContext) -> PathSegment {
let (lifetimes, types) = match self.parameters {
ast::AngleBracketedParameters(ref data) => {
(data.lifetimes.clean(cx), data.types.clean(cx))
}
ast::ParenthesizedParameters(ref data) => {
// FIXME -- rustdoc should be taught about Foo() notation
let inputs = Tuple(data.inputs.clean(cx));
let output = data.output.as_ref().map(|t| t.clean(cx)).unwrap_or(Tuple(Vec::new()));
(Vec::new(), vec![inputs, output])
}
};
PathSegment {
name: self.identifier.clean(cx),
lifetimes: self.lifetimes.clean(cx),
types: self.types.clean(cx),
lifetimes: lifetimes,
types: types,
}
}
}

View file

@ -143,9 +143,6 @@ impl fmt::Show for clean::TyParamBound {
clean::RegionBound(ref lt) => {
write!(f, "{}", *lt)
}
clean::UnboxedFnBound(ref ty) => {
write!(f, "{}{}", ty.path, ty.decl)
}
clean::TraitBound(ref ty) => {
write!(f, "{}", *ty)
}
@ -404,8 +401,7 @@ impl fmt::Show for clean::Type {
let mut ret = String::new();
for bound in decl.bounds.iter() {
match *bound {
clean::RegionBound(..) |
clean::UnboxedFnBound(..) => {}
clean::RegionBound(..) => {}
clean::TraitBound(ref t) => {
if ret.len() == 0 {
ret.push_str(": ");