Skip to main content
Code Review

Timeline for Basic JSON Representation in Rust

Current License: CC BY-SA 3.0

6 events
when toggle format what by license comment
Feb 21, 2016 at 20:37 comment added Shepmaster strategy performs better — good to know! I stole the idea from somewhere that I can't remember at the moment. It's a bit longer, but there's less overall conditional branches. left the last call to fmt in each branch as an expression — yes, that's a good idea too. I often try to do something similar, but the for loops prevent it. in this case, you have the closing delimiter, so it works nicely!
Feb 21, 2016 at 20:28 comment added stefanobaghino I've come up with another solution for the duplicated Ok: I've removed it entirely and left the last call to fmt in each branch as an expression, what do you think?
Feb 21, 2016 at 19:29 comment added stefanobaghino I have used test::Bencher in the nightly channel and you're "peek-and-roll" strategy performs better. Added it as well. Now I'll think about the unescaped strings bug; regarding the Option, thanks for the tip, I'll keep it in mind as I play around. Thanks again for the tips!
Feb 21, 2016 at 17:46 vote accept stefanobaghino
Feb 21, 2016 at 17:43 comment added stefanobaghino Thank you so much for the detailed review and for the tips, @Shepmaster! I've addressed points 1 through 6 and will now explore the final 3. Regarding the tests, there was actually one but I didn't paste it, good to know it's a good practice to paste them along the code. Also, I didn't know about raw string literals, very handy!
Feb 21, 2016 at 16:33 history answered Shepmaster CC BY-SA 3.0

AltStyle によって変換されたページ (->オリジナル) /