Skip to content

serial refactoring #400

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

Merged
merged 1 commit into from
Feb 14, 2022
Merged

Conversation

AndreySmirnov81
Copy link
Contributor

src/serial.rs Outdated
Comment on lines 328 to 335
self.usart.cr1.modify(|_r, w| { w
.m().bit(match config.wordlength {
WordLength::DataBits8 => false,
WordLength::DataBits9 => true,
})
.ps().bit(parity_is_odd)
.pce().bit(parity_is_used)
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to write it in 1 line you can use this way

Suggested change
self.usart.cr1.modify(|_r, w| { w
.m().bit(match config.wordlength {
WordLength::DataBits8 => false,
WordLength::DataBits9 => true,
})
.ps().bit(parity_is_odd)
.pce().bit(parity_is_used)
});
self.usart.cr1.modify(|_r, w| {
w.m().bit(match config.wordlength {
WordLength::DataBits8 => false,
WordLength::DataBits9 => true,
});
w.ps().bit(parity_is_odd);
w.pce().bit(parity_is_used)
});

or rustfmt

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the hint

@burrbull
Copy link
Member

LGTM. Please squash commits

@burrbull
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Feb 14, 2022

@bors bors bot merged commit ab33c09 into stm32-rs:master Feb 14, 2022
@AndreySmirnov81 AndreySmirnov81 deleted the serial_refactoring branch February 14, 2022 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants