diff options
Diffstat (limited to 'xtask/src')
-rw-r--r-- | xtask/src/codegen.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/xtask/src/codegen.rs b/xtask/src/codegen.rs index 4ec8ab75a..770b55a9a 100644 --- a/xtask/src/codegen.rs +++ b/xtask/src/codegen.rs | |||
@@ -46,7 +46,7 @@ pub enum Mode { | |||
46 | /// With verify = false, | 46 | /// With verify = false, |
47 | fn update(path: &Path, contents: &str, mode: Mode) -> Result<()> { | 47 | fn update(path: &Path, contents: &str, mode: Mode) -> Result<()> { |
48 | match fs::read_to_string(path) { | 48 | match fs::read_to_string(path) { |
49 | Ok(ref old_contents) if old_contents == contents => { | 49 | Ok(ref old_contents) if normalize(old_contents) == normalize(contents) => { |
50 | return Ok(()); | 50 | return Ok(()); |
51 | } | 51 | } |
52 | _ => (), | 52 | _ => (), |
@@ -56,7 +56,11 @@ fn update(path: &Path, contents: &str, mode: Mode) -> Result<()> { | |||
56 | } | 56 | } |
57 | eprintln!("updating {}", path.display()); | 57 | eprintln!("updating {}", path.display()); |
58 | fs::write(path, contents)?; | 58 | fs::write(path, contents)?; |
59 | Ok(()) | 59 | return Ok(()); |
60 | |||
61 | fn normalize(s: &str) -> String { | ||
62 | s.replace("\r\n", "\n") | ||
63 | } | ||
60 | } | 64 | } |
61 | 65 | ||
62 | fn reformat(text: impl std::fmt::Display) -> Result<String> { | 66 | fn reformat(text: impl std::fmt::Display) -> Result<String> { |