commit 61d6a4d7be9b67bacc0f4964a921e03ec3aabde3
parent 5eca6b026c1f8ab14f824d763df4874912febc78
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Thu, 30 Mar 2023 13:08:52 -0700
simplify code
Diffstat:
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/src/lechatphp/mod.rs b/src/lechatphp/mod.rs
@@ -1,6 +1,6 @@
use std::collections::{HashMap, HashSet};
use std::fmt::{Display, Formatter};
-use std::hash::{Hash, Hasher};
+use std::hash::Hash;
use base64::{engine::general_purpose, Engine as _};
use image::{ColorType, DynamicImage, GenericImageView, Rgba};
use lazy_static::lazy_static;
@@ -152,20 +152,12 @@ fn solve_difficulty2(img: &DynamicImage) -> Option<String> {
Some(answer)
}
-#[derive(Clone, Debug, PartialEq, Eq)]
+#[derive(Clone, Debug, PartialEq, Eq, Hash)]
struct Letter {
offset: Point,
character: char,
}
-impl Hash for Letter {
- fn hash<H: Hasher>(&self, state: &mut H) {
- self.character.hash(state);
- self.offset.x.hash(state);
- self.offset.y.hash(state);
- }
-}
-
impl Letter {
fn new(offset: Point, character: char) -> Self {
Self { offset, character }
@@ -382,7 +374,7 @@ impl Rect {
}
}
-#[derive(Debug, Clone, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
struct Point {
x: u32,
y: u32,