mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 04:55:22 +03:00
collapse nested if detected by clippy
This commit is contained in:
+6
-4
@@ -682,10 +682,12 @@ fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String>
|
||||
};
|
||||
let mut res = bounds.rewrite(context, shape)?;
|
||||
// We may have falsely removed a trailing `+` inside macro call.
|
||||
if context.inside_macro() && bounds.len() == 1 {
|
||||
if context.snippet(self.span).ends_with('+') && !res.ends_with('+') {
|
||||
res.push('+');
|
||||
}
|
||||
if context.inside_macro()
|
||||
&& bounds.len() == 1
|
||||
&& context.snippet(self.span).ends_with('+')
|
||||
&& !res.ends_with('+')
|
||||
{
|
||||
res.push('+');
|
||||
}
|
||||
Some(format!("{prefix}{res}"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user