streambed / streambed-rs

Event driven services toolkit
Apache License 2.0
31 stars 5 forks source link

chore: improve code-style #15

Closed hseeberger closed 1 year ago

hseeberger commented 1 year ago

Get rid of unnecessary type annotations. Replace other occurrences with turbo-fish. Use json! instead of #r to avoid JSON parsing errors.

huntc commented 1 year ago

Thanks!

huntc commented 1 year ago

I would say it’s a preference, but I’ve probably been doing both! Heiko may have more to say.

huntc commented 1 year ago

Some commentary: https://users.rust-lang.org/t/type-annotation-vs-turbofish/32690

stevewillcock commented 1 year ago

Some commentary: https://users.rust-lang.org/t/type-annotation-vs-turbofish/32690

Interesting - there's another slightly longer discussion here - no real conclusion either way though. I don't have a strong preference around this. Sometimes the turbofish approach will be less verbose while at other times a type annotation may add value by making the intent / type clear. Perhaps it's something that needs to be addressed on a case by case basis where it comes up depending on the context.

huntc commented 1 year ago

Some commentary: https://users.rust-lang.org/t/type-annotation-vs-turbofish/32690

Interesting - there's another slightly longer discussion here - no real conclusion either way though. I don't have a strong preference around this. Sometimes the turbofish approach will be less verbose while at other times a type annotation may add value by making the intent / type clear. Perhaps it's something that needs to be addressed on a case by case basis where it comes up depending on the context.

I'd agree on that.

hseeberger commented 1 year ago

It‘s clearly a preference, no semantic difference. As Chris knows I just have to stick to conventions 100%, so I don‘t like case by case compromises. I guess you can figure out my clear favorite here. Having said that, it‘s of course just my preference. Well, Daniel Spiewak would probably agree from what I know. Anyway, the main gist of this PR was removing the unnecessary annotations.