about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAmr Hesham <amr.gaber@vodafone.com>2024-05-21 21:19:25 +0200
committerYacin Tmimi <yacintmimi@gmail.com>2024-06-03 21:08:58 -0600
commitc97996fab61fc09432abcf64dbe3ce2d84f4d679 (patch)
treec384fe2f5b56b2711b3c7bb6fcb6f886643e3fad
parent76ef162af7392bc373bcfa20fb21190c7a48f9a2 (diff)
downloadrust-c97996fab61fc09432abcf64dbe3ce2d84f4d679.tar.gz
rust-c97996fab61fc09432abcf64dbe3ce2d84f4d679.zip
collapse nested if detected by clippy
-rw-r--r--src/types.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/types.rs b/src/types.rs
index 9d6e43c0ba4..1544d2df335 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -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}"))
             }