You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the same as both semicolon-inside-block and semicolon-outside-block, but decides which one to use based on whether the block is singleline or multiline.
Lint Name
semicolon-inside-block-if-multiline or semicolon-outside-block-if-singleline (I prefer this one)
Category
restriction
Advantage
rustfmt will make an unsafe block containing only one expression multiline if the semicolon is inside the block, but won't if it's on the outside. Adding this lint will allow swapping the location to allow rustfmt to make it a singleline, while also encouraging some consistency.
Some may find outside cleaner only in the case that it's singleline.
Drawbacks
The descriptions of both semicolon-inside-block and semicolon-outside-block suggest consistency, so this may contradict that.
If rustfmt is invoked, what was previously fine could become a warning (or an error if a library author is a bit zealous about warnings). This may be unexpected.
Example
unsafe{WriteProcessMemory(self.inner,
base as_,
bytes.as_ptr()as_,
bytes.len(),None,)};unsafe{ExitProcess(0i32);}
Could be written as:
unsafe{WriteProcessMemory(self.inner,
base as_,
bytes.as_ptr()as_,
bytes.len(),None,);}unsafe{ExitProcess(0i32)};
The text was updated successfully, but these errors were encountered:
Add configuration for `semicolon_block` lints
Does exactly what it says on the tin, suggests moving a block's final semicolon inside if it's multiline and outside if it's singleline.
I don't really like how this is implemented so I'm not too sure if this is ready yet. Alas, it might be ok.
---
fixes#10654
changelog: Enhancement: [`semicolon_inside_block`]: Added `semicolon-inside-block-ignore-singleline` as a new config value.
[#10656](#10656)
changelog: Enhancement: [`semicolon_outside_block`]: Added `semicolon-outside-block-ignore-multiline` as a new config value.
[#10656](#10656)
<!-- changelog_checked -->
What it does
This is the same as both semicolon-inside-block and semicolon-outside-block, but decides which one to use based on whether the block is singleline or multiline.
Lint Name
semicolon-inside-block-if-multiline or semicolon-outside-block-if-singleline (I prefer this one)
Category
restriction
Advantage
Drawbacks
Example
Could be written as:
The text was updated successfully, but these errors were encountered: