Fix new clippy lints.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>pull/311/head
parent
e95c275d68
commit
f702dc220c
|
@ -347,6 +347,7 @@ impl EmbedGrid {
|
|||
};
|
||||
}
|
||||
|
||||
#[allow(clippy::redundant_locals)]
|
||||
let mut state = state;
|
||||
match (byte, &mut state) {
|
||||
(b'\x1b', State::Normal) => {
|
||||
|
|
|
@ -142,7 +142,6 @@ impl<const N: usize> Default for DataColumns<N> {
|
|||
elem.write(cl());
|
||||
}
|
||||
let ptr = &data as *const [MaybeUninit<T>; N];
|
||||
std::mem::forget(data);
|
||||
unsafe { (ptr as *const [T; N]).read() }
|
||||
}
|
||||
Self {
|
||||
|
|
|
@ -180,8 +180,13 @@ impl ImapStream {
|
|||
let mut socket = AsyncWrapper::new({
|
||||
let conn = Connection::new_tcp(tcp_stream_connect(addr, server_conf.timeout)?);
|
||||
#[cfg(feature = "imap-trace")]
|
||||
let conn = conn.trace(true).with_id("imap");
|
||||
conn
|
||||
{
|
||||
conn.trace(true).with_id("imap")
|
||||
}
|
||||
#[cfg(not(feature = "imap-trace"))]
|
||||
{
|
||||
conn
|
||||
}
|
||||
})?;
|
||||
if server_conf.use_starttls {
|
||||
let err_fn = || {
|
||||
|
@ -278,8 +283,13 @@ impl ImapStream {
|
|||
AsyncWrapper::new({
|
||||
let conn = Connection::new_tcp(tcp_stream_connect(addr, server_conf.timeout)?);
|
||||
#[cfg(feature = "imap-trace")]
|
||||
let conn = conn.trace(true).with_id("imap");
|
||||
conn
|
||||
{
|
||||
conn.trace(true).with_id("imap")
|
||||
}
|
||||
#[cfg(not(feature = "imap-trace"))]
|
||||
{
|
||||
conn
|
||||
}
|
||||
})?
|
||||
};
|
||||
if let Err(err) = stream
|
||||
|
@ -442,17 +452,16 @@ impl ImapStream {
|
|||
}
|
||||
}
|
||||
|
||||
if capabilities.is_none() {
|
||||
if let Some(capabilities) = capabilities {
|
||||
Ok((capabilities, ret))
|
||||
} else {
|
||||
/* sending CAPABILITY after LOGIN automatically is an RFC recommendation, so
|
||||
* check for lazy servers */
|
||||
ret.send_command(CommandBody::Capability).await?;
|
||||
ret.read_response(&mut res).await.unwrap();
|
||||
ret.read_response(&mut res).await?;
|
||||
let capabilities = protocol_parser::capabilities(&res)?.1;
|
||||
let capabilities = HashSet::from_iter(capabilities.into_iter().map(|s| s.to_vec()));
|
||||
Ok((capabilities, ret))
|
||||
} else {
|
||||
let capabilities = capabilities.unwrap();
|
||||
Ok((capabilities, ret))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -124,9 +124,9 @@ impl<F: FilterTrait<OBJ>, OBJ: Object> Not for Filter<F, OBJ> {
|
|||
fn not(self) -> Self {
|
||||
match self {
|
||||
Self::Operator {
|
||||
operator,
|
||||
operator: FilterOperator::Not,
|
||||
conditions,
|
||||
} if operator == FilterOperator::Not => Self::Operator {
|
||||
} => Self::Operator {
|
||||
operator: FilterOperator::Or,
|
||||
conditions,
|
||||
},
|
||||
|
|
|
@ -185,6 +185,7 @@ pub extern crate nom;
|
|||
#[macro_use]
|
||||
extern crate bitflags;
|
||||
pub extern crate futures;
|
||||
#[allow(unused_imports)]
|
||||
#[macro_use]
|
||||
pub extern crate indexmap;
|
||||
pub extern crate smallvec;
|
||||
|
|
|
@ -83,8 +83,13 @@ impl NntpStream {
|
|||
Some(std::time::Duration::new(16, 0)),
|
||||
)?);
|
||||
#[cfg(feature = "nntp-trace")]
|
||||
let conn = conn.trace(true).with_id("nntp");
|
||||
conn
|
||||
{
|
||||
conn.trace(true).with_id("nntp")
|
||||
}
|
||||
#[cfg(not(feature = "nntp-trace"))]
|
||||
{
|
||||
conn
|
||||
}
|
||||
})?
|
||||
};
|
||||
let mut res = String::with_capacity(8 * 1024);
|
||||
|
@ -176,8 +181,13 @@ impl NntpStream {
|
|||
ret.stream = AsyncWrapper::new({
|
||||
let conn = Connection::new_tls(conn_result?);
|
||||
#[cfg(feature = "nntp-trace")]
|
||||
let conn = conn.trace(true).with_id("nntp");
|
||||
conn
|
||||
{
|
||||
conn.trace(true).with_id("nntp")
|
||||
}
|
||||
#[cfg(not(feature = "nntp-trace"))]
|
||||
{
|
||||
conn
|
||||
}
|
||||
})
|
||||
.chain_err_summary(|| format!("Could not initiate TLS negotiation to {}.", path))?;
|
||||
}
|
||||
|
|
|
@ -357,8 +357,13 @@ impl SmtpConnection {
|
|||
AsyncWrapper::new({
|
||||
let conn = Connection::new_tls(conn);
|
||||
#[cfg(feature = "smtp-trace")]
|
||||
let conn = conn.trace(true).with_id("smtp");
|
||||
conn
|
||||
{
|
||||
conn.trace(true).with_id("smtp")
|
||||
}
|
||||
#[cfg(not(feature = "smtp-trace"))]
|
||||
{
|
||||
conn
|
||||
}
|
||||
})?
|
||||
};
|
||||
if matches!(server_conf.security, SmtpSecurity::Tls { .. }) {
|
||||
|
@ -382,8 +387,13 @@ impl SmtpConnection {
|
|||
Some(std::time::Duration::new(4, 0)),
|
||||
)?);
|
||||
#[cfg(feature = "smtp-trace")]
|
||||
let conn = conn.trace(true).with_id("smtp");
|
||||
conn
|
||||
{
|
||||
conn.trace(true).with_id("smtp")
|
||||
}
|
||||
#[cfg(not(feature = "smtp-trace"))]
|
||||
{
|
||||
conn
|
||||
}
|
||||
})?;
|
||||
res.clear();
|
||||
let reply = read_lines(
|
||||
|
|
|
@ -839,7 +839,8 @@ fn search_table(c: u32, t: &'static [(u32, u32, LineBreakClass)]) -> LineBreakCl
|
|||
}
|
||||
|
||||
mod alg {
|
||||
use super::super::{grapheme_clusters::TextProcessing, *};
|
||||
use crate::text_processing::{grapheme_clusters::TextProcessing, *};
|
||||
|
||||
fn cost(i: usize, j: usize, width: usize, minima: &[usize], offsets: &[usize]) -> usize {
|
||||
let w = offsets[j] + j - offsets[i] - i - 1;
|
||||
if w > width {
|
||||
|
@ -849,7 +850,7 @@ mod alg {
|
|||
}
|
||||
|
||||
fn smawk(
|
||||
rows: &mut Vec<usize>,
|
||||
rows: &Vec<usize>,
|
||||
columns: &mut Vec<usize>,
|
||||
minima: &mut Vec<usize>,
|
||||
breaks: &mut Vec<usize>,
|
||||
|
@ -876,7 +877,7 @@ mod alg {
|
|||
i += 1;
|
||||
}
|
||||
}
|
||||
let rows = &mut stack;
|
||||
let rows = &stack;
|
||||
if columns.len() > 1 {
|
||||
let mut odd_columns = columns.iter().skip(1).step_by(2).cloned().collect();
|
||||
smawk(rows, &mut odd_columns, minima, breaks, width, offsets);
|
||||
|
@ -949,7 +950,7 @@ mod alg {
|
|||
let r = std::cmp::min(n, 2 * i);
|
||||
let edge = i + offset;
|
||||
smawk(
|
||||
&mut (offset..edge).collect(),
|
||||
&(offset..edge).collect(),
|
||||
&mut (edge..(r + offset)).collect(),
|
||||
&mut minima,
|
||||
&mut breaks,
|
||||
|
|
Loading…
Reference in New Issue