Improve overall performance (#6699)

* Improve overall performance

* Clean up code

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Remove needless ::

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Remove needless ::

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
pscott
2020-07-21 14:46:49 +02:00
committed by GitHub
parent ab82eb1c98
commit 046fda914a
73 changed files with 141 additions and 144 deletions
+2 -2
View File
@@ -189,7 +189,7 @@ fn check_skip_build() -> bool {
/// Write to the given `file` if the `content` is different.
fn write_file_if_changed(file: PathBuf, content: String) {
if fs::read_to_string(&file).ok().as_ref() != Some(&content) {
fs::write(&file, content).expect(&format!("Writing `{}` can not fail!", file.display()));
fs::write(&file, content).unwrap_or_else(|_| panic!("Writing `{}` can not fail!", file.display()));
}
}
@@ -200,7 +200,7 @@ fn copy_file_if_changed(src: PathBuf, dst: PathBuf) {
if src_file != dst_file {
fs::copy(&src, &dst)
.expect(&format!("Copying `{}` to `{}` can not fail; qed", src.display(), dst.display()));
.unwrap_or_else(|_| panic!("Copying `{}` to `{}` can not fail; qed", src.display(), dst.display()));
}
}