|
|
|
|
|
by sinhpham
3087 days ago
|
|
I find myself increasingly doing this in Rust: let lines = {
let ret = vec![];
// Open file
// Read into ret
ret
};
let processed_data = {
// Open another file
// Use lines
// Construct ret
ret
};
....
You get the best of both worlds this way: scoped, meaningful names like with sub-functions and the continuity of a long one.Everything is an expression is an underrated feature of Rust. |
|