From 33ffb1355546d09e2c1cef38c8ccf109aa464ce8 Mon Sep 17 00:00:00 2001 From: Filipe Rodrigues Date: Sat, 11 Jul 2020 22:03:35 +0100 Subject: [PATCH] Fixed formatting errors from `thiserror` migration. --- src/game/card/property/effect.rs | 2 +- src/game/card/table.rs | 20 ++++++++++---------- src/game/deck/table.rs | 8 ++++---- src/game/util.rs | 8 ++++---- src/io/address.rs | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/game/card/property/effect.rs b/src/game/card/property/effect.rs index 0b06215..ea4bb08 100644 --- a/src/game/card/property/effect.rs +++ b/src/game/card/property/effect.rs @@ -155,7 +155,7 @@ pub enum FromBytesError { UseAttackAttackType(#[source] property::attack_type::FromBytesError), /// Unknown effect type - #[error("Unknown byte for an effect type: {}", "byte")] + #[error("Unknown byte for an effect type: {}", byte)] EffectType { byte: u8 }, } diff --git a/src/game/card/table.rs b/src/game/card/table.rs index 5626d6b..5184813 100644 --- a/src/game/card/table.rs +++ b/src/game/card/table.rs @@ -73,12 +73,12 @@ pub enum DeserializeError { /// There were too many cards #[error( "Too many cards in table ({} digimon, {} item, {} digivolve, {} / {} bytes max)", - "digimon_cards", - "item_cards", - "digivolve_cards", - " digimon_cards * (0x3 + CardType::Digimon .byte_size() + 0x1) + + digimon_cards, + item_cards, + digivolve_cards, + digimon_cards * (0x3 + CardType::Digimon .byte_size() + 0x1) + item_cards * (0x3 + CardType::Item .byte_size() + 0x1) + - digivolve_cards * (0x3 + CardType::Digivolve.byte_size() + 0x1)", + digivolve_cards * (0x3 + CardType::Digivolve.byte_size() + 0x1), Table::MAX_BYTE_SIZE )] TooManyCards { @@ -160,12 +160,12 @@ pub enum SerializeError { /// There were too many cards #[error( "Too many cards in table ({} digimon, {} item, {} digivolve, {} / {} bytes max)", - "digimon_cards", - "item_cards", - "digivolve_cards", - " digimon_cards * (0x3 + CardType::Digimon .byte_size() + 0x1) + + digimon_cards, + item_cards, + digivolve_cards, + digimon_cards * (0x3 + CardType::Digimon .byte_size() + 0x1) + item_cards * (0x3 + CardType::Item .byte_size() + 0x1) + - digivolve_cards * (0x3 + CardType::Digivolve.byte_size() + 0x1)", + digivolve_cards * (0x3 + CardType::Digivolve.byte_size() + 0x1), Table::MAX_BYTE_SIZE )] TooManyCards { diff --git a/src/game/deck/table.rs b/src/game/deck/table.rs index 21c9632..2371117 100644 --- a/src/game/deck/table.rs +++ b/src/game/deck/table.rs @@ -39,7 +39,7 @@ pub enum DeserializeError { ReadHeader(#[source] std::io::Error), /// Could not read a deck entry - #[error("Unable to read deck entry with id {}", "id")] + #[error("Unable to read deck entry with id {}", id)] ReadDeck { id: usize, #[source] @@ -47,7 +47,7 @@ pub enum DeserializeError { }, /// Could not deserialize a deck entry - #[error("Unable to serialize deck entry with id {}", "id")] + #[error("Unable to serialize deck entry with id {}", id)] DeserializeDeck { id: usize, #[source] @@ -67,7 +67,7 @@ pub enum SerializeError { WriteHeader(#[source] std::io::Error), /// Could not deserialize a deck entry - #[error("Unable to deserialize deck entry with id {}", "id")] + #[error("Unable to deserialize deck entry with id {}", id)] SerializeDeck { id: usize, #[source] @@ -75,7 +75,7 @@ pub enum SerializeError { }, /// Could not write a deck entry - #[error("Unable to read deck entry with id {}", "id")] + #[error("Unable to read deck entry with id {}", id)] WriteDeck { id: usize, #[source] diff --git a/src/game/util.rs b/src/game/util.rs index 506901c..053edab 100644 --- a/src/game/util.rs +++ b/src/game/util.rs @@ -29,7 +29,7 @@ pub macro array_split { $name: $( &'a [T; $arr_size], )? - $( &'a T, #[cfg(os = "Os that does not exist")] __field: [u8; $val_size], )? + $( &'a T, #[cfg(invalid)] __field: [u8; $val_size], )? )* } @@ -80,7 +80,7 @@ pub macro array_split_mut { $name: $( &'a mut [T; $arr_size], )? - $( &'a mut T, #[cfg(os = "Os that does not exist")] __field: [u8; $val_size], )? + $( &'a mut T, #[cfg(invalid)] __field: [u8; $val_size], )? )* } @@ -158,7 +158,7 @@ pub fn read_maybe_null_ascii_string(buf: &impl AsRef<[u8]>) -> Result<&ascii::As #[derive(PartialEq, Eq, Clone, Copy, Debug, thiserror::Error)] pub enum WriteNullAsciiStringError { /// The input string was too large - #[error("Input string was too large for buffer. ({}+1 / {})", "input_len", "buffer_len")] + #[error("Input string was too large for buffer. ({}+1 / {})", input_len, buffer_len)] TooLarge { input_len: usize, buffer_len: usize }, } @@ -185,7 +185,7 @@ pub fn write_null_ascii_string<'a>(input: &ascii::AsciiStr, buf: &'a mut [u8]) - #[derive(PartialEq, Eq, Clone, Copy, Debug, thiserror::Error)] pub enum WriteMaybeNullAsciiStringError { /// The input string was too large - #[error("Input string was too large for buffer. ({} / {})", "input_len", "buffer_len")] + #[error("Input string was too large for buffer. ({} / {})", input_len, buffer_len)] TooLarge { input_len: usize, buffer_len: usize }, } diff --git a/src/io/address.rs b/src/io/address.rs index 0e84ca6..6062f87 100644 --- a/src/io/address.rs +++ b/src/io/address.rs @@ -17,7 +17,7 @@ pub use real::Real; #[derive(PartialEq, Eq, Clone, Copy, Debug, thiserror::Error)] pub enum RealToDataError { /// Occurs when the Real is outside of the data section of the sector - #[error("The real address {} could not be converted to a data address as it is not in the data section", _0)] + #[error("The real address {} could not be converted to a data address as it is not in the data section", .0)] OutsideDataSection(Real), }