From 849e84233610656d85605cd1c25fcb92a8979e00 Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Sun, 27 Oct 2024 18:56:29 +0100 Subject: [PATCH] dont write to the file if the contents did not differ from formatted --- lang/src/fs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/src/fs.rs b/lang/src/fs.rs index 83300030..6a628f74 100644 --- a/lang/src/fs.rs +++ b/lang/src/fs.rs @@ -74,7 +74,7 @@ pub fn run_compiler(root_file: &str, options: Options, out: &mut Vec) -> std fn format_ast(ast: parser::Ast) -> std::io::Result<()> { let mut output = String::new(); write!(output, "{ast}").unwrap(); - if ast.file.deref() != output.as_str() { + if ast.file.deref().trim() != output.as_str().trim() { std::fs::write(&*ast.path, output)?; } Ok(())