Remove superfluous return

Making it arguably more idiomatic and being consistent.

See also: https://doc.rust-lang.org/book/functions.html#early-returns
This commit is contained in:
Georg Sauthoff 2017-05-09 22:19:58 +02:00
parent 0b72a2a4f5
commit e9c617bda5
1 changed files with 1 additions and 1 deletions

View File

@ -83,7 +83,7 @@ A more concrete example:
fn main() {
// Don't worry if you don't understand how `fold` works, the point here is that an immutable reference is borrowed.
fn sum_vec(v: &Vec<i32>) -> i32 {
return v.iter().fold(0, |a, &b| a + b);
v.iter().fold(0, |a, &b| a + b)
}
// Borrow two vectors and sum them.
// This kind of borrowing does not allow mutation through the borrowed reference.