Skip to content

Commit

Permalink
Add lifetime's bounds in doc generation
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed May 15, 2016
1 parent 1a26d23 commit 391ae7f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,17 @@ impl Clean<Lifetime> for hir::Lifetime {

impl Clean<Lifetime> for hir::LifetimeDef {
fn clean(&self, _: &DocContext) -> Lifetime {
Lifetime(self.lifetime.name.to_string())
if self.bounds.len() > 0 {
let mut s = format!("{}: {}",
self.lifetime.name.to_string(),
self.bounds[0].name.to_string());
for bound in self.bounds.iter().skip(1) {
s.push_str(&format!(" + {}", bound.name.to_string()));
}
Lifetime(s)
} else {
Lifetime(self.lifetime.name.to_string())
}
}
}

Expand Down

0 comments on commit 391ae7f

Please sign in to comment.