<commit_before>use crate::schema::{email, mailbox};
use crate::utils::{ConnectionPool, LoggedResult};
use anyhow::{format_err, Error};
use diesel::prelude::*;
use log::{debug, error};
use native_tls::{Identity, TlsAcceptor, TlsStream};
use std::io::{BufRead, BufReader, Write};
use std::iter::once;
use std::net::TcpStream;
use std::ops::Deref;
use std::time::SystemTime;

use crate::utils::StartsWithIgnoreCase;

const _MAX_LINE_LENGTH: usize = 1024;

#[derive(Debug)]
enum SMTPVerb<'a> {
    Helo,
    Ehlo,
    MailFrom(&'a str),
    RcptTo(&'a str),
    StartTLS,
    Data,
    Quit,
}

impl<'a> SMTPVerb<'a> {
    fn is_handshake(&self) -> bool {
        match self {
            Ehlo | Helo => true,
            _ => false,
        }
    }
}

use self::SMTPVerb::*;

pub struct SMTPSession {
    data: Option<String>,
    handshake_done: bool,
    recipients: Vec<String>,
    sender: Option<String>,
    plain_stream: BufReader<TcpStream>,
    tls_stream: Option<BufReader<TlsStream<TcpStream>>>,
}<commit_msg>Clippy warnings<commit_after>use crate::schema::{email, mailbox};
use crate::utils::{ConnectionPool, LoggedResult};
use anyhow::{format_err, Error};
use diesel::prelude::*;
use log::{debug, error};
use native_tls::{Identity, TlsAcceptor, TlsStream};
use std::io::{BufRead, BufReader, Write};
use std::iter::once;
use std::net::TcpStream;
use std::ops::Deref;
use std::time::SystemTime;

use crate::utils::StartsWithIgnoreCase;

const _MAX_LINE_LENGTH: usize = 1024;

#[derive(Debug)]
enum SMTPVerb<'a> {
    Helo,
    Ehlo,
    MailFrom(&'a str),
    RcptTo(&'a str),
    StartTLS,
    Data,
    Quit,
}

impl<'a> SMTPVerb<'a> {
    fn is_handshake(&self) -> bool {
        matches!(self, Ehlo | Helo)
    }
}

use self::SMTPVerb::*;

pub struct SMTPSession {
    data: Option<String>,
    handshake_done: bool,
    recipients: Vec<String>,
    sender: Option<String>,
    plain_stream: BufReader<TcpStream>,
    tls_stream: Option<BufReader<TlsStream<TcpStream>>>,
}
{'fraction_non_alphanumeric': 0.16330645161290322, 'fraction_numerical': 0.004032258064516129, 'mean_word_length': 4.544692737430168, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4755283', 'n_tokens_mistral': 731, 'n_tokens_neox': 741, 'n_words': 150}