Misc changes (#14702)

This mainly fixes `with_leading_whitespace` not always adding the
whitespace it can.

changelog: None
This commit is contained in:
Timo 2025-05-17 10:40:21 +00:00 committed by GitHub
commit daeb6a1d18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 90 additions and 55 deletions

View file

@ -13,7 +13,7 @@ fn main() {
//~^^^^^^ collapsible_if
// The following tests check for the fix of https://github.com/rust-lang/rust-clippy/issues/798
if x == "hello" // Inner comment
if x == "hello" // Inner comment
&& y == "world" {
println!("Hello world!");
}
@ -26,7 +26,7 @@ fn main() {
}
//~^^^^^^ collapsible_if
if x == "hello" /* Inner comment */
if x == "hello" /* Inner comment */
&& y == "world" {
println!("Hello world!");
}

View file

@ -32,7 +32,7 @@ LL | | }
|
help: collapse nested if block
|
LL ~ if x == "hello" // Inner comment
LL ~ if x == "hello" // Inner comment
LL ~ && y == "world" {
LL | println!("Hello world!");
LL ~ }
@ -70,7 +70,7 @@ LL | | }
|
help: collapse nested if block
|
LL ~ if x == "hello" /* Inner comment */
LL ~ if x == "hello" /* Inner comment */
LL ~ && y == "world" {
LL | println!("Hello world!");
LL ~ }

View file

@ -107,7 +107,7 @@ fn main() {
let _ = || {
let _x = x;
};
return ;
return;
}
println!("test");
});

View file

@ -98,7 +98,7 @@ LL | if x.is_empty() {
LL | let _ = || {
LL ~ let _x = x;
LL | };
LL ~ return ;
LL ~ return;
LL | }
LL ~ println!("test");
|