diff options
author | Seivan Heidari <[email protected]> | 2019-11-07 17:44:59 +0000 |
---|---|---|
committer | Seivan Heidari <[email protected]> | 2019-11-07 17:44:59 +0000 |
commit | 915460544ae1d830e227f4c07e02d11d5e0f6a78 (patch) | |
tree | 6f6f709b0931ef0ff491c78c0b2b06c254c63ab0 /xtask/src | |
parent | cae45677fa9a32e4933c747bc3eb8b438f8f8a0a (diff) | |
parent | 2a8d48d8a9a83c46ca60bdf6e49a4690383b236a (diff) |
Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes
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> { |