/src/test/rustdoc/line-breaks.rs

https://gitlab.com/rust-lang/rust · Rust · 30 lines · 23 code · 4 blank · 3 comment · 0 complexity · 46200d64ded4e750bd296e90decb337a MD5 · raw file

  1. #![crate_name = "foo"]
  2. use std::ops::Add;
  3. use std::fmt::Display;
  4. //@count foo/fn.function_with_a_really_long_name.html //pre/br 2
  5. pub fn function_with_a_really_long_name(parameter_one: i32,
  6. parameter_two: i32)
  7. -> Option<i32> {
  8. Some(parameter_one + parameter_two)
  9. }
  10. //@count foo/fn.short_name.html //pre/br 0
  11. pub fn short_name(param: i32) -> i32 { param + 1 }
  12. //@count foo/fn.where_clause.html //pre/br 4
  13. pub fn where_clause<T, U>(param_one: T,
  14. param_two: U)
  15. where T: Add<U> + Display + Copy,
  16. U: Add<T> + Display + Copy,
  17. T::Output: Display + Add<U::Output> + Copy,
  18. <T::Output as Add<U::Output>>::Output: Display,
  19. U::Output: Display + Copy
  20. {
  21. let x = param_one + param_two;
  22. println!("{} + {} = {}", param_one, param_two, x);
  23. let y = param_two + param_one;
  24. println!("{} + {} = {}", param_two, param_one, y);
  25. println!("{} + {} = {}", x, y, x + y);
  26. }