projects
/
rust-101.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e6c369c
)
part01.rs lines shortened
author
Nicola 'tekNico' Larosa
<nico@teknico.net>
Sun, 21 Jan 2018 18:22:12 +0000
(19:22 +0100)
committer
Nicola 'tekNico' Larosa
<nico@teknico.net>
Sun, 21 Jan 2018 18:26:32 +0000
(19:26 +0100)
src/part01.rs
patch
|
blob
|
history
diff --git
a/src/part01.rs
b/src/part01.rs
index 95e45937e977073ae391ba626727186fa22abfb8..a4537acbc18f05e621fc0b5d05cbbffd3bb7bfcd 100644
(file)
--- a/
src/part01.rs
+++ b/
src/part01.rs
@@
-43,9
+43,10
@@
fn compute_stuff(x: i32) -> i32 {
// Let us now refactor `vec_min`.
fn vec_min(v: Vec<i32>) -> NumberOrNothing {
// Let us now refactor `vec_min`.
fn vec_min(v: Vec<i32>) -> NumberOrNothing {
- //@ Remember that helper function `min_i32`? Rust allows us to define such helper functions *inside* other
- //@ functions. This is just a matter of namespacing, the inner function has no access to the data of the outer
- //@ one. Still, being able to nicely group functions can significantly increase readability.
+ //@ Remember that helper function `min_i32`? Rust allows us to define such helper functions
+ //@ *inside* other functions. This is just a matter of namespacing, the inner function has no
+ //@ access to the data of the outer one. Still, being able to nicely group functions can
+ //@ significantly increase readability.
fn min_i32(a: i32, b: i32) -> i32 {
if a < b { a } else { b } /*@*/
}
fn min_i32(a: i32, b: i32) -> i32 {
if a < b { a } else { b } /*@*/
}
@@
-106,4
+107,5
@@
pub fn main() {
// **Exercise 01.2**: Write a function `vec_print` that takes a vector and prints all its elements.
// **Exercise 01.2**: Write a function `vec_print` that takes a vector and prints all its elements.
-//@ [index](main.html) | [previous](part00.html) | [raw source](workspace/src/part01.rs) | [next](part02.html)
+//@ [index](main.html) | [previous](part00.html) | [raw source](workspace/src/part01.rs) |
+//@ [next](part02.html)