Format Rust code using rustfmt

This commit is contained in:
github-actions[bot]
2020-04-18 15:58:30 +00:00
committed by GitHub
parent 9a5c4df2b1
commit cba6c16414
18 changed files with 956 additions and 394 deletions

View File

@@ -1,4 +1,4 @@
use crate::{AnimationFrames, Image, from_base36, ToBase36, optional_data_line};
use crate::{from_base36, optional_data_line, AnimationFrames, Image, ToBase36};
#[derive(Debug, Eq, PartialEq)]
pub struct Tile {
@@ -59,11 +59,18 @@ impl From<String> for Tile {
let animation_frames = lines[1..].join("");
let animation_frames: Vec<&str> = animation_frames.split(">").collect();
let animation_frames: Vec<Image> = animation_frames.iter().map(|&frame| {
Image::from(frame.to_string())
}).collect();
let animation_frames: Vec<Image> = animation_frames
.iter()
.map(|&frame| Image::from(frame.to_string()))
.collect();
Tile { id, name, wall, animation_frames, colour_id }
Tile {
id,
name,
wall,
animation_frames,
colour_id,
}
}
}
@@ -89,12 +96,10 @@ fn test_tile_from_string() {
id: 35,
name: Some("concrete 1".to_string()),
wall: Some(true),
animation_frames: vec![
Image {
pixels: vec![1; 64]
}
],
colour_id: None
animation_frames: vec![Image {
pixels: vec![1; 64],
}],
colour_id: None,
};
assert_eq!(output, expected);
@@ -110,8 +115,9 @@ fn test_tile_to_string() {
crate::mock::image::chequers_1(),
crate::mock::image::chequers_2(),
],
colour_id: None
}.to_string();
colour_id: None,
}
.to_string();
let expected = include_str!("test-resources/tile-chequers").to_string();