simplify
This commit is contained in:
@@ -14,10 +14,9 @@ impl Image {
|
||||
let name = path.file_stem().unwrap().to_str().unwrap().into();
|
||||
let mut pixels: Vec<u8> = Vec::new();
|
||||
|
||||
for line in read_to_string(&path).unwrap().lines() {
|
||||
for char in line.chars() {
|
||||
pixels.push(char.to_string().parse().unwrap());
|
||||
}
|
||||
// todo .matches [0..3] instead of replacing whitespace?
|
||||
for char in read_to_string(&path).unwrap().replace('\n', "").chars() {
|
||||
pixels.push(char.to_string().parse().unwrap());
|
||||
}
|
||||
|
||||
Self { name, pixels }
|
||||
|
||||
Reference in New Issue
Block a user