Add pre-commit

This commit is contained in:
2023-09-24 22:37:40 +02:00
parent 0afe3acfcd
commit 452040e83a
51 changed files with 771 additions and 596 deletions

View File

@@ -1,6 +1,5 @@
use std::fmt;
#[derive(Debug)]
pub struct CallbackQueryParseError;
@@ -12,7 +11,6 @@ impl fmt::Display for CallbackQueryParseError {
impl std::error::Error for CallbackQueryParseError {}
#[derive(Debug)]
pub struct CommandParseError;

View File

@@ -2,12 +2,10 @@ use teloxide::{dptree, prelude::*, types::*};
use super::errors::CommandParseError;
pub trait CommandParse<T> {
fn parse(s: &str, bot_name: &str) -> Result<T, CommandParseError>;
}
pub fn filter_command<Output>() -> crate::bots::BotHandler
where
Output: CommandParse<Output> + Send + Sync + 'static,

View File

@@ -1,4 +1,4 @@
pub mod errors;
pub mod filter_command;
pub mod pagination;
pub mod split_text;
pub mod filter_command;
pub mod errors;

View File

@@ -1,6 +1,5 @@
use teloxide::types::{InlineKeyboardButton, InlineKeyboardMarkup};
pub enum PaginationDelta {
OneMinus,
OnePlus,
@@ -12,7 +11,6 @@ pub trait GetPaginationCallbackData {
fn get_pagination_callback_data(&self, target_page: u32) -> String;
}
pub fn generic_get_pagination_button<T>(
target_page: u32,
delta: PaginationDelta,
@@ -36,7 +34,6 @@ where
}
}
pub fn generic_get_pagination_keyboard<T>(
page: u32,
total_pages: u32,

View File

@@ -26,7 +26,6 @@ pub fn split_text_to_chunks(text: &str, width: usize) -> Vec<String> {
result
}
#[cfg(test)]
mod tests {
use crate::bots::approved_bot::modules::utils::split_text::split_text_to_chunks;