Skip to content

Commit

Permalink
collapse nested if detected by clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Amr Hesham authored and ytmimi committed Jun 4, 2024
1 parent 76ef162 commit c97996f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,10 +682,12 @@ impl Rewrite for ast::Ty {
};
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}"))
}
Expand Down

0 comments on commit c97996f

Please sign in to comment.