rustdoc: Remove traces of old closures
This commit is contained in:
parent
8a69d35e1e
commit
072a89642b
@ -1055,27 +1055,6 @@ fn clean(&self, cx: &DocContext) -> Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)]
|
|
||||||
pub struct ClosureDecl {
|
|
||||||
pub lifetimes: Vec<Lifetime>,
|
|
||||||
pub decl: FnDecl,
|
|
||||||
pub onceness: ast::Onceness,
|
|
||||||
pub unsafety: ast::Unsafety,
|
|
||||||
pub bounds: Vec<TyParamBound>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Clean<ClosureDecl> for ast::ClosureTy {
|
|
||||||
fn clean(&self, cx: &DocContext) -> ClosureDecl {
|
|
||||||
ClosureDecl {
|
|
||||||
lifetimes: self.lifetimes.clean(cx),
|
|
||||||
decl: self.decl.clean(cx),
|
|
||||||
onceness: self.onceness,
|
|
||||||
unsafety: self.unsafety,
|
|
||||||
bounds: self.bounds.clean(cx)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||||
pub struct FnDecl {
|
pub struct FnDecl {
|
||||||
pub inputs: Arguments,
|
pub inputs: Arguments,
|
||||||
@ -1352,8 +1331,6 @@ pub enum Type {
|
|||||||
Generic(String),
|
Generic(String),
|
||||||
/// Primitives are just the fixed-size numeric types (plus int/uint/float), and char.
|
/// Primitives are just the fixed-size numeric types (plus int/uint/float), and char.
|
||||||
Primitive(PrimitiveType),
|
Primitive(PrimitiveType),
|
||||||
Closure(Box<ClosureDecl>),
|
|
||||||
Proc(Box<ClosureDecl>),
|
|
||||||
/// extern "ABI" fn
|
/// extern "ABI" fn
|
||||||
BareFunction(Box<BareFunctionDecl>),
|
BareFunction(Box<BareFunctionDecl>),
|
||||||
Tuple(Vec<Type>),
|
Tuple(Vec<Type>),
|
||||||
|
@ -465,61 +465,6 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|||||||
}
|
}
|
||||||
clean::Infer => write!(f, "_"),
|
clean::Infer => write!(f, "_"),
|
||||||
clean::Primitive(prim) => primitive_link(f, prim, prim.to_string()),
|
clean::Primitive(prim) => primitive_link(f, prim, prim.to_string()),
|
||||||
clean::Closure(ref decl) => {
|
|
||||||
write!(f, "{style}{lifetimes}|{args}|{bounds}{arrow}",
|
|
||||||
style = UnsafetySpace(decl.unsafety),
|
|
||||||
lifetimes = if decl.lifetimes.len() == 0 {
|
|
||||||
"".to_string()
|
|
||||||
} else {
|
|
||||||
format!("for <{}>",
|
|
||||||
CommaSep(decl.lifetimes.as_slice()))
|
|
||||||
},
|
|
||||||
args = decl.decl.inputs,
|
|
||||||
arrow = decl.decl.output,
|
|
||||||
bounds = {
|
|
||||||
let mut ret = String::new();
|
|
||||||
for bound in decl.bounds.iter() {
|
|
||||||
match *bound {
|
|
||||||
clean::RegionBound(..) => {}
|
|
||||||
clean::TraitBound(ref t, modifier) => {
|
|
||||||
if ret.len() == 0 {
|
|
||||||
ret.push_str(": ");
|
|
||||||
} else {
|
|
||||||
ret.push_str(" + ");
|
|
||||||
}
|
|
||||||
if modifier == ast::TraitBoundModifier::Maybe {
|
|
||||||
ret.push_str("?");
|
|
||||||
}
|
|
||||||
ret.push_str(format!("{}",
|
|
||||||
*t).as_slice());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ret
|
|
||||||
})
|
|
||||||
}
|
|
||||||
clean::Proc(ref decl) => {
|
|
||||||
write!(f, "{style}{lifetimes}proc({args}){bounds}{arrow}",
|
|
||||||
style = UnsafetySpace(decl.unsafety),
|
|
||||||
lifetimes = if decl.lifetimes.len() == 0 {
|
|
||||||
"".to_string()
|
|
||||||
} else {
|
|
||||||
format!("for <{}>",
|
|
||||||
CommaSep(decl.lifetimes.as_slice()))
|
|
||||||
},
|
|
||||||
args = decl.decl.inputs,
|
|
||||||
bounds = if decl.bounds.len() == 0 {
|
|
||||||
"".to_string()
|
|
||||||
} else {
|
|
||||||
let m = decl.bounds
|
|
||||||
.iter()
|
|
||||||
.map(|s| s.to_string());
|
|
||||||
format!(
|
|
||||||
": {}",
|
|
||||||
m.collect::<Vec<String>>().connect(" + "))
|
|
||||||
},
|
|
||||||
arrow = decl.decl.output)
|
|
||||||
}
|
|
||||||
clean::BareFunction(ref decl) => {
|
clean::BareFunction(ref decl) => {
|
||||||
write!(f, "{}{}fn{}{}",
|
write!(f, "{}{}fn{}{}",
|
||||||
UnsafetySpace(decl.unsafety),
|
UnsafetySpace(decl.unsafety),
|
||||||
|
Loading…
Reference in New Issue
Block a user