From 80602a0ac976e418b7b1900971473e644c4782b3 Mon Sep 17 00:00:00 2001 From: realaravinth Date: Mon, 8 Mar 2021 19:58:47 +0530 Subject: [PATCH] removing dead code and problematic Default impls --- src/defense.rs | 18 ------------------ src/mcaptcha.rs | 17 ----------------- 2 files changed, 35 deletions(-) diff --git a/src/defense.rs b/src/defense.rs index 92d6f5c..ae79b22 100644 --- a/src/defense.rs +++ b/src/defense.rs @@ -51,15 +51,6 @@ pub struct Level { difficulty_factor: u32, } -impl Default for Level { - fn default() -> Self { - Level { - visitor_threshold: 0, - difficulty_factor: 0, - } - } -} - /// Bulder struct for [Level] to describe threshold-difficulty factor mapping #[derive(Debug, Copy, Clone, PartialEq)] pub struct LevelBuilder { @@ -176,15 +167,6 @@ impl DefenseBuilder { } } -impl Default for Defense { - fn default() -> Self { - Defense { - levels: vec![Level::default()], - current_visitor_threshold: 0, - } - } -} - impl Defense { ///! Difficulty is calculated as: ///! ```rust diff --git a/src/mcaptcha.rs b/src/mcaptcha.rs index e66d5c4..7b41788 100644 --- a/src/mcaptcha.rs +++ b/src/mcaptcha.rs @@ -76,8 +76,6 @@ use std::time::Duration; use actix::dev::*; use derive_builder::Builder; -use pow_sha256::PoW as ShaPoW; -use serde::Deserialize; use crate::defense::Defense; @@ -156,21 +154,6 @@ impl Handler for MCaptcha { } } -/// Message to decrement the visitor count -#[derive(Message, Deserialize)] -#[rtype(result = "()")] -pub struct VerifyPoW { - pow: ShaPoW>, - id: String, -} - -impl Handler for MCaptcha { - type Result = (); - fn handle(&mut self, _: VerifyPoW, _ctx: &mut Self::Context) -> Self::Result { - self.decrement_visiotr(); - } -} - #[cfg(test)] pub mod tests { use super::*;