branch: elpa/swift-mode
commit c882c70a70122b262553d6010c6e2820a1d02b6d
Author: Chris Barrett <[email protected]>
Commit: Chris Barrett <[email protected]>
Replace `if` exprs with `when` exprs
Fix degenerate `if` expressions with no else clause. Use with `when`
expressions instead.
---
swift-mode.el | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/swift-mode.el b/swift-mode.el
index a538b7c..c879eb7 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -72,11 +72,12 @@
"Move backward past spaces and comments."
(let ((starting (point)))
(skip-chars-backward "[:space:]\n")
- (if (looking-back "\\*/") (backward-char))
- (if (swift-indent--in-str-or-cmnt)
- (swift-indent--rewind-past-str-cmnt))
- (if (/= starting (point))
- (swift-indent--rewind-irrelevant))))
+ (when (looking-back "\\*/")
+ (backward-char))
+ (when (swift-indent--in-str-or-cmnt)
+ (swift-indent--rewind-past-str-cmnt))
+ (when (/= starting (point))
+ (swift-indent--rewind-irrelevant))))
(defun swift-indent--align-to-expr-after-brace ()
"Return the column to use for aligning an expression after a brace."