Use push instead of extend_from_slice on chars

This commit is contained in:
mo8it 2024-04-14 14:53:32 +02:00
parent 1c90575b9f
commit 3da860927d
3 changed files with 3 additions and 3 deletions

View file

@ -42,7 +42,7 @@ bin = [\n",
buf.extend_from_slice(b"\", path = \"../exercises/"); buf.extend_from_slice(b"\", path = \"../exercises/");
if let Some(dir) = &exercise_info.dir { if let Some(dir) = &exercise_info.dir {
buf.extend_from_slice(dir.as_bytes()); buf.extend_from_slice(dir.as_bytes());
buf.extend_from_slice(b"/"); buf.push(b'/');
} }
buf.extend_from_slice(exercise_info.name.as_bytes()); buf.extend_from_slice(exercise_info.name.as_bytes());
buf.extend_from_slice(b".rs\" },\n"); buf.extend_from_slice(b".rs\" },\n");

View file

@ -244,7 +244,7 @@ impl AppState {
for exercise in &self.exercises { for exercise in &self.exercises {
if exercise.done { if exercise.done {
self.file_buf.extend_from_slice(exercise.name.as_bytes()); self.file_buf.extend_from_slice(exercise.name.as_bytes());
self.file_buf.extend_from_slice(b"\n"); self.file_buf.push(b'\n');
} }
} }

View file

@ -17,7 +17,7 @@ fn create_cargo_toml(exercise_infos: &[ExerciseInfo]) -> io::Result<()> {
cargo_toml.extend_from_slice(b"\", path = \"exercises/"); cargo_toml.extend_from_slice(b"\", path = \"exercises/");
if let Some(dir) = &exercise_info.dir { if let Some(dir) = &exercise_info.dir {
cargo_toml.extend_from_slice(dir.as_bytes()); cargo_toml.extend_from_slice(dir.as_bytes());
cargo_toml.extend_from_slice(b"/"); cargo_toml.push(b'/');
} }
cargo_toml.extend_from_slice(exercise_info.name.as_bytes()); cargo_toml.extend_from_slice(exercise_info.name.as_bytes());
cargo_toml.extend_from_slice(b".rs\" },\n"); cargo_toml.extend_from_slice(b".rs\" },\n");