Skip to content

Commit 524f469

Browse files
committed
auto merge of #15331 : Derecho/rust/master, r=alexcrichton
One of the examples in the docs on adding documentation to rust code has an error that will cause the function to run endlessly rather than return the desired result, should someone actually implement this for some reason. While the error does not hinder the explanation of documenting code, it does look better if it is corrected.
2 parents 550cc04 + c85d42a commit 524f469

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/doc/rustdoc.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Calculates the factorial of a number.
5151
5252
Given the input integer `n`, this function will calculate `n!` and return it.
5353
"]
54-
pub fn factorial(n: int) -> int { if n < 2 {1} else {n * factorial(n)} }
54+
pub fn factorial(n: int) -> int { if n < 2 {1} else {n * factorial(n - 1)} }
5555
# fn main() {}
5656
~~~
5757

0 commit comments

Comments
 (0)