mirror of
https://github.com/house-of-vanity/desubot.git
synced 2025-08-21 15:27:14 +00:00
Clippy lint
This commit is contained in:
@@ -13,7 +13,7 @@ use mystem::Tense::{Inpresent, Past};
|
|||||||
use rand::seq::SliceRandom;
|
use rand::seq::SliceRandom;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use silicon;
|
|
||||||
use sqlparser::ast::Statement;
|
use sqlparser::ast::Statement;
|
||||||
use sqlparser::dialect::GenericDialect;
|
use sqlparser::dialect::GenericDialect;
|
||||||
use sqlparser::parser::Parser;
|
use sqlparser::parser::Parser;
|
||||||
@@ -475,7 +475,7 @@ impl Execute for Omedeto {
|
|||||||
.filter(|m| re.is_match(m))
|
.filter(|m| re.is_match(m))
|
||||||
.map(|m| m.split(' ').map(|s| s.to_string()).collect::<Vec<String>>()[1].clone())
|
.map(|m| m.split(' ').map(|s| s.to_string()).collect::<Vec<String>>()[1].clone())
|
||||||
.map(|m| {
|
.map(|m| {
|
||||||
let stem = mystem.stemming(m.clone()).unwrap_or_default();
|
let stem = mystem.stemming(m).unwrap_or_default();
|
||||||
if stem.is_empty() {
|
if stem.is_empty() {
|
||||||
|
|
||||||
} else if stem[0].lex.is_empty() {
|
} else if stem[0].lex.is_empty() {
|
||||||
@@ -494,9 +494,9 @@ impl Execute for Omedeto {
|
|||||||
.facts
|
.facts
|
||||||
.contains(&mystem::Fact::Gender(Feminine))
|
.contains(&mystem::Fact::Gender(Feminine))
|
||||||
{
|
{
|
||||||
fm = fm + 1;
|
fm += 1;
|
||||||
} else {
|
} else {
|
||||||
mu = mu + 1;
|
mu += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
false => (),
|
false => (),
|
||||||
@@ -508,11 +508,7 @@ impl Execute for Omedeto {
|
|||||||
})
|
})
|
||||||
.for_each(drop);
|
.for_each(drop);
|
||||||
//debug!("fm - {}, mu - {}", fm, mu);
|
//debug!("fm - {}, mu - {}", fm, mu);
|
||||||
if fm >= mu {
|
fm >= mu
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
//debug!("Is Feminine - {}", fem);
|
//debug!("Is Feminine - {}", fem);
|
||||||
let result = format!(
|
let result = format!(
|
||||||
|
@@ -54,7 +54,7 @@ pub(crate) fn get_user(id: telegram_bot::UserId) -> Result<telegram_bot::User, e
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if users.len() == 0 {
|
if users.is_empty() {
|
||||||
Err(errors::Error::UserNotFound)
|
Err(errors::Error::UserNotFound)
|
||||||
} else {
|
} else {
|
||||||
Ok(users[0].clone())
|
Ok(users[0].clone())
|
||||||
@@ -74,7 +74,7 @@ pub(crate) fn get_conf(id: telegram_bot::ChatId) -> Result<Conf, errors::Error>
|
|||||||
date: row.get(2)?,
|
date: row.get(2)?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if confs.len() == 0 {
|
if confs.is_empty() {
|
||||||
Err(errors::Error::ConfNotFound)
|
Err(errors::Error::ConfNotFound)
|
||||||
} else {
|
} else {
|
||||||
Ok(confs[0].clone())
|
Ok(confs[0].clone())
|
||||||
|
@@ -57,18 +57,18 @@ impl From<io_error> for Error {
|
|||||||
|
|
||||||
impl From<serde_error> for Error {
|
impl From<serde_error> for Error {
|
||||||
fn from(e: serde_error) -> Error {
|
fn from(e: serde_error) -> Error {
|
||||||
return Error::JsonParseError(e);
|
Error::JsonParseError(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<popen_error> for Error {
|
impl From<popen_error> for Error {
|
||||||
fn from(e: popen_error) -> Error {
|
fn from(e: popen_error) -> Error {
|
||||||
return Error::PopenError(e);
|
Error::PopenError(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<mystem_error> for Error {
|
impl From<mystem_error> for Error {
|
||||||
fn from(e: mystem_error) -> Error {
|
fn from(e: mystem_error) -> Error {
|
||||||
return Error::MystemError(e);
|
Error::MystemError(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,12 +13,12 @@ pub(crate) fn get_title(message: &Message) -> String {
|
|||||||
match &message.chat {
|
match &message.chat {
|
||||||
MessageChat::Supergroup(chat) => chat.title.clone(),
|
MessageChat::Supergroup(chat) => chat.title.clone(),
|
||||||
MessageChat::Group(chat) => chat.title.clone(),
|
MessageChat::Group(chat) => chat.title.clone(),
|
||||||
MessageChat::Private(_) => format!("PRIVATE"),
|
MessageChat::Private(_) => "PRIVATE".to_string(),
|
||||||
_ => "PRIVATE".to_string(),
|
_ => "PRIVATE".to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn create_dir(dir: &String) -> () {
|
pub(crate) async fn create_dir(dir: &String) {
|
||||||
match fs_create_dir(dir) {
|
match fs_create_dir(dir) {
|
||||||
Ok(_) => info!("Dir {} created.", dir),
|
Ok(_) => info!("Dir {} created.", dir),
|
||||||
Err(_) => (),
|
Err(_) => (),
|
||||||
|
Reference in New Issue
Block a user