Use multi-span suggestions

This commit is contained in:
Lukas Wirth 2022-11-15 19:22:00 +01:00
parent ba951e3ca7
commit 23744cd4ba
5 changed files with 126 additions and 86 deletions

View file

@ -10,7 +10,7 @@
macro_rules! m {
(()) => {
()
();
};
(0) => {{
0
@ -58,7 +58,7 @@ fn main() {
unit_fn_block();
};
{ m!(()); }
{ m!(()) }
{ m!(()); }
{ m!(()); };
m!(0);

View file

@ -2,15 +2,26 @@ error: consider moving the `;` inside the block for consistent formatting
--> $DIR/semicolon_inside_block.rs:39:5
|
LL | { unit_fn_block() };
| ^^^^^^^^^^^^^^^^^^^^ help: put the `;` here: `{ unit_fn_block(); }`
| ^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::semicolon-inside-block` implied by `-D warnings`
help: put the `;` here
|
LL - { unit_fn_block() };
LL + { unit_fn_block(); }
|
error: consider moving the `;` inside the block for consistent formatting
--> $DIR/semicolon_inside_block.rs:40:5
|
LL | unsafe { unit_fn_block() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: put the `;` here: `unsafe { unit_fn_block(); }`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: put the `;` here
|
LL - unsafe { unit_fn_block() };
LL + unsafe { unit_fn_block(); }
|
error: consider moving the `;` inside the block for consistent formatting
--> $DIR/semicolon_inside_block.rs:48:5
@ -23,17 +34,24 @@ LL | | };
|
help: put the `;` here
|
LL ~ {
LL + unit_fn_block();
LL + unit_fn_block();
LL + }
LL ~ unit_fn_block();
LL ~ }
|
error: consider moving the `;` inside the block for consistent formatting
--> $DIR/semicolon_inside_block.rs:61:5
|
LL | { m!(()) };
| ^^^^^^^^^^^ help: put the `;` here: `{ m!(()); }`
| ^^^^^^^^^^^
|
help: put the `;` here
|
LL ~ ();
LL | };
...
LL |
LL ~ { m!(()) }
|
error: aborting due to 4 previous errors

View file

@ -21,6 +21,9 @@ macro_rules! m {
(2) => {{
2;
}};
(stmt) => {
stmt;
};
}
fn unit_fn_block() {
@ -39,8 +42,8 @@ fn main() {
{ unit_fn_block() };
unsafe { unit_fn_block() };
{ unit_fn_block() };
unsafe { unit_fn_block() };
{ unit_fn_block(); }
unsafe { unit_fn_block(); }
{ unit_fn_block(); };
unsafe { unit_fn_block(); };
@ -51,19 +54,20 @@ fn main() {
};
{
unit_fn_block();
unit_fn_block()
};
unit_fn_block();
}
{
unit_fn_block();
unit_fn_block();
};
{ m!(()) };
{ m!(()) };
{ m!(()); }
{ m!(()); };
m!(0);
m!(1);
m!(2);
{ m!(stmt) };
for _ in [()] {
unit_fn_block();

View file

@ -2,15 +2,26 @@ error: consider moving the `;` outside the block for consistent formatting
--> $DIR/semicolon_outside_block.rs:42:5
|
LL | { unit_fn_block(); }
| ^^^^^^^^^^^^^^^^^^^^ help: put the `;` outside the block: `{ unit_fn_block() };`
| ^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::semicolon-outside-block` implied by `-D warnings`
help: put the `;` here
|
LL - { unit_fn_block(); }
LL + { unit_fn_block() };
|
error: consider moving the `;` outside the block for consistent formatting
--> $DIR/semicolon_outside_block.rs:43:5
|
LL | unsafe { unit_fn_block(); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: put the `;` outside the block: `unsafe { unit_fn_block() };`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: put the `;` here
|
LL - unsafe { unit_fn_block(); }
LL + unsafe { unit_fn_block() };
|
error: consider moving the `;` outside the block for consistent formatting
--> $DIR/semicolon_outside_block.rs:52:5
@ -21,19 +32,23 @@ LL | | unit_fn_block();
LL | | }
| |_____^
|
help: put the `;` outside the block
help: put the `;` here
|
LL ~ {
LL + unit_fn_block();
LL + unit_fn_block()
LL + };
LL ~ unit_fn_block()
LL ~ };
|
error: consider moving the `;` outside the block for consistent formatting
--> $DIR/semicolon_outside_block.rs:62:5
|
LL | { m!(()); }
| ^^^^^^^^^^^ help: put the `;` outside the block: `{ m!(()) };`
| ^^^^^^^^^^^
|
help: put the `;` here
|
LL - ()
LL + (); };
|
error: aborting due to 4 previous errors