-
Notifications
You must be signed in to change notification settings - Fork 250
Open
Labels
Description
Previous ID | SR-15167 |
Radar | None |
Original Reporter | @karwa |
Type | Bug |
Environment
swift-format 0.50300.0
Additional Detail from JIRA
Votes | 0 |
Component/s | swift-format |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: 2f04a8858227c6ebd6c94f80e9e6a07e
Issue Description:
Given this input:
func test() {
let result = newValue.withContiguousStorageIfAvailable {
setNewValue($0)
} ?? setNewValue(newValue)
}
For some reason, swift-format decides it would be better with a newline and if everything was indented:
func test() {
let result =
newValue.withContiguousStorageIfAvailable {
setNewValue($0)
} ?? setNewValue(newValue)
}
But I think this looks quite a lot worse. The actual body, involving wCSIA and the optional chaining, seems to be kept intact... it's just a bit lower and to the side. I'm not sure how that helps anything.
I'm not sure which rule is causing this or how to disable it, but I'd really like if swift-format could stop doing it. It's not a line-length issue: my max length is set at 120 and the original doesn't get anywhere near that.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
typesanitizer commentedon Sep 7, 2021
cc @allevato
ahoppen commentedon Apr 23, 2024
Tracked in Apple’s issue tracker as rdar://126948211