fix image_to_string

This commit is contained in:
Max Bradbury 2020-04-06 08:36:52 +01:00
parent 4bfb82dba0
commit 82779a3ed5
1 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,5 @@
use std::fmt;
use std::collections::HashMap; use std::collections::HashMap;
use std::fmt;
const IMAGE_DIMENSION_SD: usize = 8; const IMAGE_DIMENSION_SD: usize = 8;
const IMAGE_DIMENSION_HD: usize = 16; const IMAGE_DIMENSION_HD: usize = 16;
@ -190,7 +190,7 @@ fn test_image_from_string() {
} }
fn image_to_string(image: Image) -> String { fn image_to_string(image: Image) -> String {
image_to_string_opts(image, true) image_to_string_opts(image, false)
} }
fn image_to_string_opts(image: Image, hd: bool) -> String { fn image_to_string_opts(image: Image, hd: bool) -> String {
@ -199,7 +199,7 @@ fn image_to_string_opts(image: Image, hd: bool) -> String {
for line in image.pixels.chunks(chunk_size) { for line in image.pixels.chunks(chunk_size) {
for pixel in line { for pixel in line {
string.push(*pixel as char); string.push_str(&format!("{}", *pixel));
} }
string.push('\n'); string.push('\n');
} }