We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7acb409 commit 32b3571Copy full SHA for 32b3571
Sources/swift-format/Frontend/FormatFrontend.swift
@@ -49,8 +49,10 @@ class FormatFrontend: Frontend {
49
to: &buffer,
50
parsingDiagnosticHandler: diagnosticsEngine.consumeParserDiagnostic)
51
52
- let bufferData = buffer.data(using: .utf8)! // Conversion to UTF-8 cannot fail
53
- try bufferData.write(to: url, options: .atomic)
+ if buffer != source {
+ let bufferData = buffer.data(using: .utf8)! // Conversion to UTF-8 cannot fail
54
+ try bufferData.write(to: url, options: .atomic)
55
+ }
56
} else {
57
try formatter.format(
58
source: source,
0 commit comments