mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
*actually* fix codegen
This commit is contained in:
parent
0dd44fe739
commit
a9a2610a03
1 changed files with 2 additions and 12 deletions
|
@ -15,7 +15,6 @@ pub(crate) mod schema;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
fs,
|
fs,
|
||||||
io::{Read, Write},
|
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -79,16 +78,7 @@ pub fn ensure_files_contents<'a>(
|
||||||
let mut err_count = 0;
|
let mut err_count = 0;
|
||||||
|
|
||||||
for (path, contents) in files_and_contents {
|
for (path, contents) in files_and_contents {
|
||||||
let mut file = fs::File::options()
|
let old_contents = fs::read_to_string(path).unwrap();
|
||||||
.read(true)
|
|
||||||
.write(true)
|
|
||||||
.create(true)
|
|
||||||
.truncate(true)
|
|
||||||
.append(false)
|
|
||||||
.open(path)
|
|
||||||
.unwrap();
|
|
||||||
let mut old_contents = String::with_capacity(contents.len());
|
|
||||||
file.read_to_string(&mut old_contents).unwrap();
|
|
||||||
|
|
||||||
if normalize_newlines(&old_contents) == normalize_newlines(contents) {
|
if normalize_newlines(&old_contents) == normalize_newlines(contents) {
|
||||||
// File is already up to date.
|
// File is already up to date.
|
||||||
|
@ -105,7 +95,7 @@ pub fn ensure_files_contents<'a>(
|
||||||
if let Some(parent) = path.parent() {
|
if let Some(parent) = path.parent() {
|
||||||
let _ = fs::create_dir_all(parent);
|
let _ = fs::create_dir_all(parent);
|
||||||
}
|
}
|
||||||
file.write_all(contents.as_bytes()).unwrap();
|
fs::write(path, contents.as_bytes()).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
let (s, were) = match err_count {
|
let (s, were) = match err_count {
|
||||||
|
|
Loading…
Reference in a new issue