Do not accidentally format files when only checking if they are formatted.
diff --git a/mesonbuild/scripts/clangformat.py b/mesonbuild/scripts/clangformat.py
index ceb36ac..9c09609 100644
--- a/mesonbuild/scripts/clangformat.py
+++ b/mesonbuild/scripts/clangformat.py
@@ -37,7 +37,10 @@
 
 def run_clang_format(exelist: T.List[str], fname: Path, check: bool) -> subprocess.CompletedProcess:
     before = fname.stat().st_mtime
-    ret = subprocess.run(exelist + ['-style=file', '-i', str(fname)])
+    args = ['-style=file', str(fname)]
+    if check:
+        args = ['-i'] + args
+    ret = subprocess.run(exelist + args)
     after = fname.stat().st_mtime
     if before != after:
         print('File reformatted: ', fname)