mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 19:06:35 +03:00
Fix some clippy warnings
This commit is contained in:
committed by
Floris Bruynooghe
parent
d7c42f3c98
commit
4732085421
11
src/blob.rs
11
src/blob.rs
@@ -140,9 +140,10 @@ impl<'a> BlobObject<'a> {
|
||||
context: &Context,
|
||||
src: impl AsRef<Path>,
|
||||
) -> std::result::Result<BlobObject, BlobError> {
|
||||
match src.as_ref().starts_with(context.get_blobdir()) {
|
||||
true => BlobObject::from_path(context, src),
|
||||
false => BlobObject::create_and_copy(context, src),
|
||||
if src.as_ref().starts_with(context.get_blobdir()) {
|
||||
BlobObject::from_path(context, src)
|
||||
} else {
|
||||
BlobObject::create_and_copy(context, src)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,13 +265,13 @@ impl<'a> BlobObject<'a> {
|
||||
fn sanitise_name(name: &str) -> (String, String) {
|
||||
let mut name = name.to_string();
|
||||
for part in name.rsplit('/') {
|
||||
if part.len() > 0 {
|
||||
if !part.is_empty() {
|
||||
name = part.to_string();
|
||||
break;
|
||||
}
|
||||
}
|
||||
for part in name.rsplit('\\') {
|
||||
if part.len() > 0 {
|
||||
if !part.is_empty() {
|
||||
name = part.to_string();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1207,9 +1207,8 @@ pub fn get_chat_media(
|
||||
|ids| {
|
||||
let mut ret = Vec::new();
|
||||
for id in ids {
|
||||
match id {
|
||||
Ok(msg_id) => ret.push(msg_id),
|
||||
Err(_) => (),
|
||||
if let Ok(msg_id) = id {
|
||||
ret.push(msg_id)
|
||||
}
|
||||
}
|
||||
Ok(ret)
|
||||
@@ -1530,7 +1529,7 @@ pub(crate) fn add_contact_to_chat_ex(
|
||||
msg.id = send_msg(context, chat_id, &mut msg)?;
|
||||
context.call_cb(Event::MsgsChanged {
|
||||
chat_id,
|
||||
msg_id: MsgId::from(msg.id),
|
||||
msg_id: msg.id,
|
||||
});
|
||||
}
|
||||
context.call_cb(Event::MsgsChanged {
|
||||
|
||||
@@ -92,7 +92,7 @@ pub fn dc_job_do_DC_JOB_CONFIGURE_IMAP(context: &Context) {
|
||||
const STEP_3_INDEX: u8 = 13;
|
||||
let mut step_counter: u8 = 0;
|
||||
while !context.shall_stop_ongoing() {
|
||||
step_counter = step_counter + 1;
|
||||
step_counter += 1;
|
||||
|
||||
let success = match step_counter {
|
||||
// Read login parameters from the database
|
||||
|
||||
@@ -38,7 +38,7 @@ pub fn dc_encode_header_words(input: impl AsRef<str>) -> String {
|
||||
fn must_encode(byte: u8) -> bool {
|
||||
static SPECIALS: &[u8] = b",:!\"#$@[\\]^`{|}~=?_";
|
||||
|
||||
SPECIALS.into_iter().any(|b| *b == byte)
|
||||
SPECIALS.iter().any(|b| *b == byte)
|
||||
}
|
||||
|
||||
fn quote_word(word: &[u8]) -> String {
|
||||
|
||||
@@ -522,7 +522,7 @@ pub fn perform_smtp_idle(context: &Context) {
|
||||
let res = cvar.wait_timeout(state, dur).unwrap();
|
||||
state = res.0;
|
||||
|
||||
if state.idle == true || res.1.timed_out() {
|
||||
if state.idle || res.1.timed_out() {
|
||||
// We received the notification and the value has been updated, we can leave.
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ impl Smtp {
|
||||
|
||||
/// SMTP-Send a prepared mail to recipients.
|
||||
/// on successful send out Ok() is returned.
|
||||
pub fn send<'a>(
|
||||
pub fn send(
|
||||
&mut self,
|
||||
context: &Context,
|
||||
recipients: Vec<EmailAddress>,
|
||||
|
||||
Reference in New Issue
Block a user