by rootlocus · 3y ago · 0 comments
I don't impose fixed line counts for my methods. But when it makes sense, the readability improves a lot.
let foo = Foo::new()
.with_bar()
.with_baz(bak, bat)
.listen();
Or code like this: for f in in foo.iter() {
if f == 1 || f > 9 || f % 2 == 0 || is_edge_case(f) {
ret.push((f * 100).to_string());
}
}
Makes a big difference for readability. If you have a complicated conditional, go ahead and give it a name!