remove inlining

This commit is contained in:
Max Bradbury 2020-07-19 08:42:03 +01:00
parent 3de82cbacc
commit f08f0fdc16
16 changed files with 1 additions and 84 deletions

View File

@ -9,7 +9,6 @@ pub struct Colour {
pub struct InvalidRgb; pub struct InvalidRgb;
impl Colour { impl Colour {
#[inline]
pub(crate) fn from(string: &str) -> Result<Colour, InvalidRgb> { pub(crate) fn from(string: &str) -> Result<Colour, InvalidRgb> {
let values: Vec<&str> = string.trim_matches(',').split(',').collect(); let values: Vec<&str> = string.trim_matches(',').split(',').collect();
@ -26,7 +25,6 @@ impl Colour {
} }
impl ToString for Colour { impl ToString for Colour {
#[inline]
fn to_string(&self) -> String { fn to_string(&self) -> String {
format!("{},{},{}", self.red, self.green, self.blue) format!("{},{},{}", self.red, self.green, self.blue)
} }

View File

@ -26,7 +26,6 @@ impl From<String> for Dialogue {
} }
impl ToString for Dialogue { impl ToString for Dialogue {
#[inline]
fn to_string(&self) -> String { fn to_string(&self) -> String {
format!( format!(
"DLG {}\n{}{}", "DLG {}\n{}{}",

View File

@ -24,7 +24,6 @@ impl FromStr for Ending {
} }
impl fmt::Display for Ending { impl fmt::Display for Ending {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f,"END {}\n{}", self.id, self.dialogue) write!(f,"END {}\n{}", self.id, self.dialogue)
} }

View File

@ -17,7 +17,6 @@ pub enum Transition {
} }
impl From<&str> for Transition { impl From<&str> for Transition {
#[inline]
fn from(str: &str) -> Transition { fn from(str: &str) -> Transition {
match str { match str {
"fade_w" => Transition::FadeToWhite, "fade_w" => Transition::FadeToWhite,

View File

@ -35,7 +35,6 @@ impl RoomFormat {
pub enum RoomType {Room, Set} pub enum RoomType {Room, Set}
impl ToString for RoomType { impl ToString for RoomType {
#[inline]
fn to_string(&self) -> String { fn to_string(&self) -> String {
match &self { match &self {
RoomType::Set => "SET", RoomType::Set => "SET",
@ -54,7 +53,6 @@ pub struct Version {
pub struct InvalidVersion; pub struct InvalidVersion;
impl Version { impl Version {
#[inline]
fn from(str: &str) -> Result<Version, InvalidVersion> { fn from(str: &str) -> Result<Version, InvalidVersion> {
let parts: Vec<&str> = str.split(".").collect(); let parts: Vec<&str> = str.split(".").collect();
if parts.len() == 2 { if parts.len() == 2 {
@ -102,7 +100,6 @@ pub struct GameHasNoAvatar;
// todo no tiles? no rooms? no palettes? turn this into an enum? // todo no tiles? no rooms? no palettes? turn this into an enum?
impl Game { impl Game {
#[inline]
pub fn from(string: String) -> Result<Game, NotFound> { pub fn from(string: String) -> Result<Game, NotFound> {
let line_endings_crlf = string.contains("\r\n"); let line_endings_crlf = string.contains("\r\n");
let mut string = string; let mut string = string;
@ -243,7 +240,6 @@ impl Game {
} }
/// todo refactor this into "get T by ID", taking a Vec<T> and an ID name? /// todo refactor this into "get T by ID", taking a Vec<T> and an ID name?
#[inline]
pub fn get_sprite_by_id(&self, id: String) -> Result<&Sprite, NotFound> { pub fn get_sprite_by_id(&self, id: String) -> Result<&Sprite, NotFound> {
let index = self.sprites.iter().position( let index = self.sprites.iter().position(
|sprite| sprite.id == id |sprite| sprite.id == id
@ -525,7 +521,6 @@ impl Game {
} }
impl ToString for Game { impl ToString for Game {
#[inline]
fn to_string(&self) -> String { fn to_string(&self) -> String {
let mut segments: Vec<String> = Vec::new(); let mut segments: Vec<String> = Vec::new();
@ -585,43 +580,33 @@ impl ToString for Game {
impl Game { impl Game {
// todo dedupe // todo dedupe
#[inline]
pub fn palette_ids(&self) -> Vec<String> { pub fn palette_ids(&self) -> Vec<String> {
self.palettes.iter().map(|palette| palette.id.clone()).collect() self.palettes.iter().map(|palette| palette.id.clone()).collect()
} }
#[inline]
pub fn tile_ids(&self) -> Vec<String> { pub fn tile_ids(&self) -> Vec<String> {
self.tiles.iter().map(|tile| tile.id.clone()).collect() self.tiles.iter().map(|tile| tile.id.clone()).collect()
} }
#[inline]
pub fn sprite_ids(&self) -> Vec<String> { pub fn sprite_ids(&self) -> Vec<String> {
self.sprites.iter().map(|sprite| sprite.id.clone()).collect() self.sprites.iter().map(|sprite| sprite.id.clone()).collect()
} }
#[inline]
pub fn room_ids(&self) -> Vec<String> { pub fn room_ids(&self) -> Vec<String> {
self.rooms.iter().map(|room| room.id.clone()).collect() self.rooms.iter().map(|room| room.id.clone()).collect()
} }
#[inline]
pub fn item_ids(&self) -> Vec<String> { pub fn item_ids(&self) -> Vec<String> {
self.items.iter().map(|item| item.id.clone()).collect() self.items.iter().map(|item| item.id.clone()).collect()
} }
#[inline]
pub fn dialogue_ids(&self) -> Vec<String> { pub fn dialogue_ids(&self) -> Vec<String> {
self.dialogues.iter().map(|dialogue| dialogue.id.clone()).collect() self.dialogues.iter().map(|dialogue| dialogue.id.clone()).collect()
} }
#[inline]
pub fn ending_ids(&self) -> Vec<String> { pub fn ending_ids(&self) -> Vec<String> {
self.endings.iter().map(|ending| ending.id.clone()).collect() self.endings.iter().map(|ending| ending.id.clone()).collect()
} }
#[inline]
pub fn variable_ids(&self) -> Vec<String> { pub fn variable_ids(&self) -> Vec<String> {
self.variables.iter().map(|variable| variable.id.clone()).collect() self.variables.iter().map(|variable| variable.id.clone()).collect()
} }
@ -635,7 +620,6 @@ impl Game {
/// first available tile ID. /// first available tile ID.
/// e.g. if current tile IDs are [0, 2, 3] the result will be `1` /// e.g. if current tile IDs are [0, 2, 3] the result will be `1`
/// if current tile IDs are [0, 1, 2] the result will be `3` /// if current tile IDs are [0, 1, 2] the result will be `3`
#[inline]
pub fn new_tile_id(&self) -> String { pub fn new_tile_id(&self) -> String {
let mut ids = self.tile_ids(); let mut ids = self.tile_ids();
// don't allow 0 - this is a reserved ID for an implicit background tile // don't allow 0 - this is a reserved ID for an implicit background tile
@ -679,7 +663,6 @@ impl Game {
} }
/// adds a palette safely and returns the ID /// adds a palette safely and returns the ID
#[inline]
pub fn add_palette(&mut self, mut palette: Palette) -> String { pub fn add_palette(&mut self, mut palette: Palette) -> String {
let new_id = try_id(&self.palette_ids(), &palette.id); let new_id = try_id(&self.palette_ids(), &palette.id);
if new_id != palette.id { if new_id != palette.id {
@ -690,7 +673,6 @@ impl Game {
} }
/// adds a tile safely and returns the ID /// adds a tile safely and returns the ID
#[inline]
pub fn add_tile(&mut self, mut tile: Tile) -> String { pub fn add_tile(&mut self, mut tile: Tile) -> String {
if tile.id == "0".to_string() || self.tile_ids().contains(&tile.id) { if tile.id == "0".to_string() || self.tile_ids().contains(&tile.id) {
let new_id = self.new_tile_id(); let new_id = self.new_tile_id();
@ -704,7 +686,6 @@ impl Game {
} }
/// adds a sprite safely and returns the ID /// adds a sprite safely and returns the ID
#[inline]
pub fn add_sprite(&mut self, mut sprite: Sprite) -> String { pub fn add_sprite(&mut self, mut sprite: Sprite) -> String {
let new_id = try_id(&self.sprite_ids(), &sprite.id); let new_id = try_id(&self.sprite_ids(), &sprite.id);
if new_id != sprite.id { if new_id != sprite.id {
@ -715,7 +696,6 @@ impl Game {
} }
/// adds an item safely and returns the ID /// adds an item safely and returns the ID
#[inline]
pub fn add_item(&mut self, mut item: Item) -> String { pub fn add_item(&mut self, mut item: Item) -> String {
let new_id = try_id(&self.item_ids(), &item.id); let new_id = try_id(&self.item_ids(), &item.id);
if new_id != item.id { if new_id != item.id {
@ -726,7 +706,6 @@ impl Game {
} }
/// adds a dialogue safely and returns the ID /// adds a dialogue safely and returns the ID
#[inline]
pub fn add_dialogue(&mut self, mut dialogue: Dialogue) -> String { pub fn add_dialogue(&mut self, mut dialogue: Dialogue) -> String {
let new_id = try_id(&self.dialogue_ids(), &dialogue.id); let new_id = try_id(&self.dialogue_ids(), &dialogue.id);
if new_id != dialogue.id { if new_id != dialogue.id {
@ -798,7 +777,6 @@ impl Game {
self.tiles = unique_tiles; self.tiles = unique_tiles;
} }
#[inline]
fn version_line(&self) -> String { fn version_line(&self) -> String {
if self.version.is_some() { if self.version.is_some() {
format!( format!(
@ -810,7 +788,6 @@ impl Game {
} }
} }
#[inline]
fn room_format_line(&self) -> String { fn room_format_line(&self) -> String {
if self.room_format.is_some() { if self.room_format.is_some() {
format!("\n\n! ROOM_FORMAT {}", self.room_format.unwrap().to_string()) format!("\n\n! ROOM_FORMAT {}", self.room_format.unwrap().to_string())
@ -819,7 +796,6 @@ impl Game {
} }
} }
#[inline]
fn font_line(&self) -> String { fn font_line(&self) -> String {
if self.font == Font::AsciiSmall { if self.font == Font::AsciiSmall {
"".to_string() "".to_string()
@ -832,7 +808,6 @@ impl Game {
} }
} }
#[inline]
fn text_direction_line(&self) -> &str { fn text_direction_line(&self) -> &str {
if self.text_direction == TextDirection::RightToLeft { if self.text_direction == TextDirection::RightToLeft {
"\n\nTEXT_DIRECTION RTL" "\n\nTEXT_DIRECTION RTL"
@ -842,13 +817,11 @@ impl Game {
} }
/// older bitsy games do not specify a version, but we can infer 1.0 /// older bitsy games do not specify a version, but we can infer 1.0
#[inline]
pub fn version(&self) -> Version { pub fn version(&self) -> Version {
self.version.unwrap_or(Version { major: 1, minor: 0 }) self.version.unwrap_or(Version { major: 1, minor: 0 })
} }
/// older bitsy games do not specify a room format, but we can infer 0 /// older bitsy games do not specify a room format, but we can infer 0
#[inline]
pub fn room_format(&self) -> RoomFormat { pub fn room_format(&self) -> RoomFormat {
self.room_format.unwrap_or(RoomFormat::Contiguous) self.room_format.unwrap_or(RoomFormat::Contiguous)
} }

View File

@ -4,7 +4,6 @@ pub struct Image {
} }
impl From<String> for Image { impl From<String> for Image {
#[inline]
fn from(string: String) -> Image { fn from(string: String) -> Image {
let string = string.replace("NaN", "0"); let string = string.replace("NaN", "0");
let string = string.trim(); let string = string.trim();
@ -24,7 +23,6 @@ impl From<String> for Image {
} }
impl ToString for Image { impl ToString for Image {
#[inline]
fn to_string(&self) -> String { fn to_string(&self) -> String {
let mut string = String::new(); let mut string = String::new();
@ -42,7 +40,6 @@ impl ToString for Image {
} }
} }
#[inline]
pub(crate) fn animation_frames_from_string(string: String) -> Vec<Image> { pub(crate) fn animation_frames_from_string(string: String) -> Vec<Image> {
let frames: Vec<&str> = string.split(">").collect(); let frames: Vec<&str> = string.split(">").collect();

View File

@ -11,24 +11,20 @@ pub struct Item {
} }
impl Item { impl Item {
#[inline]
fn name_line(&self) -> String { fn name_line(&self) -> String {
optional_data_line("NAME", self.name.as_ref()) optional_data_line("NAME", self.name.as_ref())
} }
#[inline]
fn dialogue_line(&self) -> String { fn dialogue_line(&self) -> String {
optional_data_line("DLG", self.dialogue_id.as_ref()) optional_data_line("DLG", self.dialogue_id.as_ref())
} }
#[inline]
fn colour_line(&self) -> String { fn colour_line(&self) -> String {
optional_data_line("COL", self.colour_id.as_ref()) optional_data_line("COL", self.colour_id.as_ref())
} }
} }
impl From<String> for Item { impl From<String> for Item {
#[inline]
fn from(string: String) -> Item { fn from(string: String) -> Item {
let mut lines: Vec<&str> = string.lines().collect(); let mut lines: Vec<&str> = string.lines().collect();
@ -67,7 +63,6 @@ impl From<String> for Item {
} }
impl ToString for Item { impl ToString for Item {
#[inline]
fn to_string(&self) -> String { fn to_string(&self) -> String {
format!( format!(
"ITM {}\n{}{}{}{}", "ITM {}\n{}{}{}{}",

View File

@ -59,7 +59,6 @@ pub trait AnimationFrames {
} }
impl AnimationFrames for Vec<Image> { impl AnimationFrames for Vec<Image> {
#[inline]
fn to_string(&self) -> String { fn to_string(&self) -> String {
let mut string = String::new(); let mut string = String::new();
let last_frame = self.len() - 1; let last_frame = self.len() - 1;
@ -77,7 +76,6 @@ impl AnimationFrames for Vec<Image> {
} }
/// this doesn't work inside ToBase36 for some reason /// this doesn't work inside ToBase36 for some reason
#[inline]
fn to_base36(int: u64) -> String { fn to_base36(int: u64) -> String {
format!("{}", radix_36(int)) format!("{}", radix_36(int))
} }
@ -87,14 +85,12 @@ pub trait ToBase36 {
} }
impl ToBase36 for u64 { impl ToBase36 for u64 {
#[inline]
fn to_base36(&self) -> String { fn to_base36(&self) -> String {
to_base36(*self) to_base36(*self)
} }
} }
/// e.g. `\nNAME DLG_0` /// e.g. `\nNAME DLG_0`
#[inline]
fn optional_data_line<T: Display>(label: &str, item: Option<T>) -> String { fn optional_data_line<T: Display>(label: &str, item: Option<T>) -> String {
if item.is_some() { if item.is_some() {
format!("\n{} {}", label, item.unwrap()) format!("\n{} {}", label, item.unwrap())
@ -103,7 +99,6 @@ fn optional_data_line<T: Display>(label: &str, item: Option<T>) -> String {
} }
} }
#[inline]
fn transform_line_endings(input: String, mode: TransformMode) -> String { fn transform_line_endings(input: String, mode: TransformMode) -> String {
let mut input = Cursor::new(input); let mut input = Cursor::new(input);
let mut output = Cursor::new(Vec::new()); let mut output = Cursor::new(Vec::new());
@ -112,7 +107,6 @@ fn transform_line_endings(input: String, mode: TransformMode) -> String {
String::from_utf8(output.into_inner()).unwrap() String::from_utf8(output.into_inner()).unwrap()
} }
#[inline]
fn segments_from_string(string: String) -> Vec<String> { fn segments_from_string(string: String) -> Vec<String> {
// this is pretty weird but a dialogue can just have an empty line followed by a name // this is pretty weird but a dialogue can just have an empty line followed by a name
// however, on entering two empty lines, dialogue will be wrapped in triple quotation marks // however, on entering two empty lines, dialogue will be wrapped in triple quotation marks
@ -160,7 +154,6 @@ fn is_id_available(ids: &Vec<String>, id: &String) -> bool {
} }
/// e.g. pass all tile IDs into this to get a new non-conflicting tile ID /// e.g. pass all tile IDs into this to get a new non-conflicting tile ID
#[inline]
fn new_unique_id(ids: Vec<String>) -> String { fn new_unique_id(ids: Vec<String>) -> String {
let mut new_id: u64 = 0; let mut new_id: u64 = 0;
@ -176,7 +169,6 @@ pub trait Quote {
} }
impl Quote for String { impl Quote for String {
#[inline]
fn quote(&self) -> String { fn quote(&self) -> String {
format!("\"\"\"\n{}\n\"\"\"", self).to_string() format!("\"\"\"\n{}\n\"\"\"", self).to_string()
} }
@ -187,7 +179,6 @@ pub trait Unquote {
} }
impl Unquote for String { impl Unquote for String {
#[inline]
fn unquote(&self) -> String { fn unquote(&self) -> String {
self.trim_matches('\"').trim_matches('\n').to_string() self.trim_matches('\"').trim_matches('\n').to_string()
} }

View File

@ -4,7 +4,6 @@ use crate::game::{RoomType, RoomFormat};
pub mod image { pub mod image {
use crate::Image; use crate::Image;
#[inline]
pub fn chequers_1() -> Image { pub fn chequers_1() -> Image {
Image { Image {
pixels: vec![ pixels: vec![
@ -15,7 +14,6 @@ pub mod image {
} }
} }
#[inline]
pub fn chequers_2() -> Image { pub fn chequers_2() -> Image {
Image { Image {
pixels: vec![ pixels: vec![
@ -25,8 +23,7 @@ pub mod image {
], ],
} }
} }
#[inline]
pub fn animation_frames() -> Vec<Image> { pub fn animation_frames() -> Vec<Image> {
vec![ vec![
Image { Image {
@ -81,7 +78,6 @@ pub mod image {
} }
} }
#[inline]
pub fn avatar() -> Sprite { pub fn avatar() -> Sprite {
Sprite { Sprite {
id: "0".to_string(), id: "0".to_string(),
@ -110,7 +106,6 @@ pub fn avatar() -> Sprite {
} }
} }
#[inline]
pub fn tile_default() -> Tile { pub fn tile_default() -> Tile {
Tile { Tile {
id: "a".to_string(), id: "a".to_string(),
@ -127,7 +122,6 @@ pub fn tile_default() -> Tile {
} }
} }
#[inline]
pub fn tile_background() -> Tile { pub fn tile_background() -> Tile {
Tile { Tile {
id: "0".to_string(), id: "0".to_string(),
@ -138,7 +132,6 @@ pub fn tile_background() -> Tile {
} }
} }
#[inline]
pub fn sprite() -> Sprite { pub fn sprite() -> Sprite {
Sprite { Sprite {
id: "a".to_string(), id: "a".to_string(),
@ -210,7 +203,6 @@ pub fn item() -> Item {
} }
} }
#[inline]
pub fn room() -> Room { pub fn room() -> Room {
Room { Room {
id: "a".to_string(), id: "a".to_string(),
@ -514,7 +506,6 @@ pub fn room() -> Room {
} }
} }
#[inline]
pub fn game_default() -> Game { pub fn game_default() -> Game {
Game { Game {
name: "Write your game's title here".to_string(), name: "Write your game's title here".to_string(),

View File

@ -8,7 +8,6 @@ pub struct Palette {
} }
impl From<String> for Palette { impl From<String> for Palette {
#[inline]
fn from(string: String) -> Palette { fn from(string: String) -> Palette {
let lines: Vec<&str> = string.lines().collect(); let lines: Vec<&str> = string.lines().collect();
@ -31,7 +30,6 @@ impl From<String> for Palette {
} }
impl ToString for Palette { impl ToString for Palette {
#[inline]
fn to_string(&self) -> String { fn to_string(&self) -> String {
let name = if self.name.as_ref().is_some() { let name = if self.name.as_ref().is_some() {
format!("NAME {}\n", self.name.as_ref().unwrap()) format!("NAME {}\n", self.name.as_ref().unwrap())

View File

@ -31,7 +31,6 @@ impl FromStr for Position {
} }
impl fmt::Display for Position { impl fmt::Display for Position {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{},{}", self.x, self.y) write!(f, "{},{}", self.x, self.y)
} }

View File

@ -20,12 +20,10 @@ pub struct Room {
} }
impl Room { impl Room {
#[inline]
fn name_line(&self) -> String { fn name_line(&self) -> String {
optional_data_line("NAME", self.name.as_ref()) optional_data_line("NAME", self.name.as_ref())
} }
#[inline]
fn wall_line(&self) -> String { fn wall_line(&self) -> String {
if self.walls.len() > 0 { if self.walls.len() > 0 {
optional_data_line("WAL", Some(self.walls.join(","))) optional_data_line("WAL", Some(self.walls.join(",")))
@ -34,7 +32,6 @@ impl Room {
} }
} }
#[inline]
fn palette_line(&self) -> String { fn palette_line(&self) -> String {
if self.palette_id.is_some() { if self.palette_id.is_some() {
optional_data_line("PAL", Some(self.palette_id.as_ref().unwrap())) optional_data_line("PAL", Some(self.palette_id.as_ref().unwrap()))
@ -45,7 +42,6 @@ impl Room {
} }
impl From<String> for Room { impl From<String> for Room {
#[inline]
fn from(string: String) -> Room { fn from(string: String) -> Room {
let string = string.replace("ROOM ", ""); let string = string.replace("ROOM ", "");
let string = string.replace("SET ", ""); let string = string.replace("SET ", "");
@ -159,7 +155,6 @@ impl From<String> for Room {
} }
impl Room { impl Room {
#[inline]
pub fn to_string(&self, room_format: RoomFormat, room_type: RoomType) -> String { pub fn to_string(&self, room_format: RoomFormat, room_type: RoomType) -> String {
let mut tiles = String::new(); let mut tiles = String::new();
let mut items = String::new(); let mut items = String::new();
@ -226,7 +221,6 @@ impl Room {
} }
/// "changes" is a hash of old -> new tile IDs /// "changes" is a hash of old -> new tile IDs
#[inline]
pub fn change_tile_ids(&mut self, changes: &HashMap<String, String>) { pub fn change_tile_ids(&mut self, changes: &HashMap<String, String>) {
self.tiles = self.tiles.iter().map(|tile_id| self.tiles = self.tiles.iter().map(|tile_id|
changes.get(tile_id).unwrap_or(tile_id).clone() changes.get(tile_id).unwrap_or(tile_id).clone()

View File

@ -15,17 +15,14 @@ pub struct Sprite {
} }
impl Sprite { impl Sprite {
#[inline]
fn name_line(&self) -> String { fn name_line(&self) -> String {
optional_data_line("NAME", self.name.as_ref()) optional_data_line("NAME", self.name.as_ref())
} }
#[inline]
fn dialogue_line(&self) -> String { fn dialogue_line(&self) -> String {
optional_data_line("DLG", self.dialogue_id.as_ref()) optional_data_line("DLG", self.dialogue_id.as_ref())
} }
#[inline]
fn room_position_line(&self) -> String { fn room_position_line(&self) -> String {
if self.room_id.is_some() && self.position.is_some() { if self.room_id.is_some() && self.position.is_some() {
format!( format!(
@ -38,12 +35,10 @@ impl Sprite {
} }
} }
#[inline]
fn colour_line(&self) -> String { fn colour_line(&self) -> String {
optional_data_line("COL", self.colour_id.as_ref()) optional_data_line("COL", self.colour_id.as_ref())
} }
#[inline]
fn item_lines(&self) -> String { fn item_lines(&self) -> String {
if self.items.len() == 0 { if self.items.len() == 0 {
"".to_string() "".to_string()
@ -59,7 +54,6 @@ pub struct SpriteMissingRoomPosition;
// todo "malformed sprite ID" or something // todo "malformed sprite ID" or something
impl Sprite { impl Sprite {
#[inline]
pub(crate) fn from(string: String) -> Result<Sprite, SpriteMissingRoomPosition> { pub(crate) fn from(string: String) -> Result<Sprite, SpriteMissingRoomPosition> {
let mut lines: Vec<&str> = string.lines().collect(); let mut lines: Vec<&str> = string.lines().collect();
@ -118,7 +112,6 @@ impl Sprite {
} }
impl ToString for Sprite { impl ToString for Sprite {
#[inline]
fn to_string(&self) -> String { fn to_string(&self) -> String {
format!( format!(
"SPR {}\n{}{}{}{}{}{}", "SPR {}\n{}{}{}{}{}{}",

View File

@ -9,7 +9,6 @@ pub enum Font {
} }
impl Font { impl Font {
#[inline]
pub(crate) fn from(str: &str) -> Font { pub(crate) fn from(str: &str) -> Font {
match str { match str {
"unicode_european_small" => Font::UnicodeEuropeanSmall, "unicode_european_small" => Font::UnicodeEuropeanSmall,
@ -20,7 +19,6 @@ impl Font {
} }
} }
#[inline]
pub(crate) fn to_string(&self) -> Result<String, &'static str> { pub(crate) fn to_string(&self) -> Result<String, &'static str> {
match &self { match &self {
Font::UnicodeEuropeanSmall => Ok("unicode_european_small".to_string()), Font::UnicodeEuropeanSmall => Ok("unicode_european_small".to_string()),

View File

@ -23,12 +23,10 @@ impl PartialEq for Tile {
} }
impl Tile { impl Tile {
#[inline]
fn name_line(&self) -> String { fn name_line(&self) -> String {
optional_data_line("NAME", self.name.as_ref()) optional_data_line("NAME", self.name.as_ref())
} }
#[inline]
fn wall_line(&self) -> String { fn wall_line(&self) -> String {
if self.wall.is_some() { if self.wall.is_some() {
format!("\nWAL {}", self.wall.unwrap()) format!("\nWAL {}", self.wall.unwrap())
@ -37,7 +35,6 @@ impl Tile {
} }
} }
#[inline]
fn colour_line(&self) -> String { fn colour_line(&self) -> String {
if self.colour_id.is_some() { if self.colour_id.is_some() {
format!("\nCOL {}", self.colour_id.unwrap()) format!("\nCOL {}", self.colour_id.unwrap())
@ -48,7 +45,6 @@ impl Tile {
} }
impl From<String> for Tile { impl From<String> for Tile {
#[inline]
fn from(string: String) -> Tile { fn from(string: String) -> Tile {
let mut lines: Vec<&str> = string.lines().collect(); let mut lines: Vec<&str> = string.lines().collect();
@ -88,7 +84,6 @@ impl From<String> for Tile {
} }
impl ToString for Tile { impl ToString for Tile {
#[inline]
fn to_string(&self) -> String { fn to_string(&self) -> String {
format!( format!(
"TIL {}\n{}{}{}{}", "TIL {}\n{}{}{}{}",

View File

@ -5,7 +5,6 @@ pub struct Variable {
} }
impl From<String> for Variable { impl From<String> for Variable {
#[inline]
fn from(string: String) -> Variable { fn from(string: String) -> Variable {
let id_value: Vec<&str> = string.lines().collect(); let id_value: Vec<&str> = string.lines().collect();
let id = id_value[0].replace("VAR ", "").to_string(); let id = id_value[0].replace("VAR ", "").to_string();
@ -21,7 +20,6 @@ impl From<String> for Variable {
} }
impl ToString for Variable { impl ToString for Variable {
#[inline]
fn to_string(&self) -> String { fn to_string(&self) -> String {
format!("VAR {}\n{}", self.id, self.initial_value) format!("VAR {}\n{}", self.id, self.initial_value)
} }