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.
2 parents 7acb409 + 32b3571 commit f30e81eCopy full SHA for f30e81e
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