-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce rust fmt #107
Enforce rust fmt #107
Conversation
I'm definitely in favor of using and enforcing rustfmt everywhere. Not sure whether this should be a single reformatting commit though. Is there any advantage in having multiple commits? |
IMO it is better to keep the history what was actually done. But I don't mind squashing it into single commit. |
I'm a big fan of keeping the history clean, but in "git log FILE" and "git blame FILE" both approaches will show up as a single commit 🙂 In contrast, I tend to find a single commit easier to "parse" in the commit history than 17. (The CI change makes sense as a separate commit though.) In any case, no strong opinons on that. I do think enforcing rustfmt is a good idea though, it completely eliminates the opinionated "could you please format this part of the code in a different way" from PR reviews. |
src/pwr.rs
Outdated
// Use MSI as clock source after wake-up | ||
w.stopwuck().clear_bit(), | ||
// Use MSI as clock source after wake-up | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one looks a bit weird... Since when does rustfmt put opening curly braces on its their own line? Might be a mess-up due to the comment...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably is. I will rearrange the comment so it does not look that bad. Good catch thanks
|
||
// Configure Stop mode | ||
self.pwr.0.cr.modify(|_, w| | ||
self.pwr.0.cr.modify(|_, w| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that I forgot to change this one. On it
Thank you, @almusil and @dbrgn! The formatting changes look good to me (well, as good as it gets with rustfmt'ed code, at least :-) ). I see two minor problems with the last commit:
I think it's fine to merge as-is though, and follow up with additional improvements later, as necessary. Especially point 2 is a bit of a can of worms of worms, due to the use of the build Matrix on CI (that other HAL I linked doesn't use the build Matrix for that reason). @arkorobotics What do you think? I'm inclined to merge this, to get the formatting discussion over with. |
@hannobraun Rebased, thanks |
Rust fmt might enforce different rules on nightly and also fmt is not always available there. So it makes sense to skip fmt on nightly.
This should not be that hard I will create a issue for that and assign myself. Once I have some more spare time I'll look into this.
|
Any update? |
There's a new conflict, maybe you can resolve that?
I think this is still missing as well, right? Or would that be part of #109? |
Done
It was meant to be part of #109 but I can probably do it in this patch. Only thing that might make it harder are the conflicts so if it's not vital I would rather do it in follow up. |
Nobody has complained, and this has been open long enough. I'm merging. Thank you, @almusil! |
@hannobraun Can you please take a look?