diff options
author | Tyler Murphy <tylerm@tylerm.dev> | 2023-06-08 00:58:29 -0400 |
---|---|---|
committer | Tyler Murphy <tylerm@tylerm.dev> | 2023-06-08 00:58:29 -0400 |
commit | 665e500fe706c190a9393171fd15eeadfe24c0ed (patch) | |
tree | 02e44b2c17e0271e932cef2ad17b908d689419c9 /src/lib.rs | |
parent | initial (diff) | |
download | leak_memory-665e500fe706c190a9393171fd15eeadfe24c0ed.tar.gz leak_memory-665e500fe706c190a9393171fd15eeadfe24c0ed.tar.bz2 leak_memory-665e500fe706c190a9393171fd15eeadfe24c0ed.zip |
clippy my beloved
Diffstat (limited to '')
-rw-r--r-- | src/lib.rs | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -1,9 +1,26 @@ use std::cell::RefCell; use libc::malloc; +use std::fmt::{Result, Display, Formatter}; -pub mod error; pub mod parse; +#[derive(Clone, Debug)] +pub enum PissError { + InvalidSuffix(String), + InvalidNumber(String), + NumberNotPositive +} + +impl Display for PissError { + fn fmt(&self, f: &mut Formatter<'_>) -> Result { + match self { + Self::InvalidSuffix(s) => write!(f, "I cannot piss the suffix {s:?}"), + Self::InvalidNumber(s) => write!(f, "I cannot piss the invalid number {s:?}"), + Self::NumberNotPositive => write!(f, "I cannot piss nonexistent memory") + } + } +} + #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] pub struct PissAmount { to_piss: u128 |