Skip to content

Commit e44cb24

Browse files
committed
FMT: Remove spaces around inclusive ranges
Remove spaces around '...' for inclusive ranges and range patterns. This makes our formatting of inclusive ranges consistent with rustfmt and the formatting of exclusive ranges.
1 parent b243f0c commit e44cb24

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/main/kotlin/org/rust/ide/formatter/impl/utils.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import com.intellij.psi.tree.TokenSet.create as ts
2323

2424
val SPECIAL_MACRO_ARGS = ts(FORMAT_MACRO_ARGUMENT, LOG_MACRO_ARGUMENT, TRY_MACRO_ARGUMENT, VEC_MACRO_ARGUMENT, ASSERT_MACRO_ARGUMENT)
2525

26-
val NO_SPACE_AROUND_OPS = ts(COLONCOLON, DOT, DOTDOT)
26+
val NO_SPACE_AROUND_OPS = ts(COLONCOLON, DOT, DOTDOT, DOTDOTDOT)
2727
val SPACE_AROUND_OPS = TokenSet.andNot(RS_OPERATORS, NO_SPACE_AROUND_OPS)
2828
val UNARY_OPS = ts(MINUS, MUL, EXCL, AND, ANDAND)
2929

src/test/kotlin/org/rust/ide/formatter/RsFormatterTest.kt

+6-2
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,13 @@ class RsFormatterTest : RsFormatterTestBase() {
306306
""")
307307

308308
fun `test unary minus in range patterns`() = doTextTest("""
309-
fn main() { if let - 10 ... - 1 = - 8 {} }
309+
fn main() {
310+
if let - 10 ... - 1 = - 8 {}
311+
}
310312
""", """
311-
fn main() { if let -10 ... -1 = -8 {} }
313+
fn main() {
314+
if let -10...-1 = -8 {}
315+
}
312316
""")
313317

314318
fun `test preserve punctuation settings`() {

0 commit comments

Comments
 (0)