Format Rust code using rustfmt
This commit is contained in:
committed by
GitHub
parent
9a5c4df2b1
commit
cba6c16414
20
src/image.rs
20
src/image.rs
@@ -10,9 +10,10 @@ impl From<String> for Image {
|
||||
let pixels: Vec<&str> = string.split("").collect();
|
||||
// the above seems to add an extra "" at the start and end of the vec, so strip them below
|
||||
let pixels = &pixels[1..(pixels.len() - 1)];
|
||||
let pixels: Vec<u32> = pixels.iter().map(|&pixel| {
|
||||
pixel.parse::<u32>().unwrap()
|
||||
}).collect();
|
||||
let pixels: Vec<u32> = pixels
|
||||
.iter()
|
||||
.map(|&pixel| pixel.parse::<u32>().unwrap())
|
||||
.collect();
|
||||
|
||||
Image { pixels }
|
||||
}
|
||||
@@ -43,15 +44,10 @@ fn test_image_from_string() {
|
||||
|
||||
let expected = Image {
|
||||
pixels: vec![
|
||||
1,1,1,1,1,1,1,1,
|
||||
1,1,0,0,1,1,1,1,
|
||||
1,0,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,
|
||||
]
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1,
|
||||
],
|
||||
};
|
||||
|
||||
assert_eq!(output, expected)
|
||||
|
||||
Reference in New Issue
Block a user