mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +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,
|
context: &Context,
|
||||||
src: impl AsRef<Path>,
|
src: impl AsRef<Path>,
|
||||||
) -> std::result::Result<BlobObject, BlobError> {
|
) -> std::result::Result<BlobObject, BlobError> {
|
||||||
match src.as_ref().starts_with(context.get_blobdir()) {
|
if src.as_ref().starts_with(context.get_blobdir()) {
|
||||||
true => BlobObject::from_path(context, src),
|
BlobObject::from_path(context, src)
|
||||||
false => BlobObject::create_and_copy(context, src),
|
} else {
|
||||||
|
BlobObject::create_and_copy(context, src)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,13 +265,13 @@ impl<'a> BlobObject<'a> {
|
|||||||
fn sanitise_name(name: &str) -> (String, String) {
|
fn sanitise_name(name: &str) -> (String, String) {
|
||||||
let mut name = name.to_string();
|
let mut name = name.to_string();
|
||||||
for part in name.rsplit('/') {
|
for part in name.rsplit('/') {
|
||||||
if part.len() > 0 {
|
if !part.is_empty() {
|
||||||
name = part.to_string();
|
name = part.to_string();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for part in name.rsplit('\\') {
|
for part in name.rsplit('\\') {
|
||||||
if part.len() > 0 {
|
if !part.is_empty() {
|
||||||
name = part.to_string();
|
name = part.to_string();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1207,9 +1207,8 @@ pub fn get_chat_media(
|
|||||||
|ids| {
|
|ids| {
|
||||||
let mut ret = Vec::new();
|
let mut ret = Vec::new();
|
||||||
for id in ids {
|
for id in ids {
|
||||||
match id {
|
if let Ok(msg_id) = id {
|
||||||
Ok(msg_id) => ret.push(msg_id),
|
ret.push(msg_id)
|
||||||
Err(_) => (),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(ret)
|
Ok(ret)
|
||||||
@@ -1530,7 +1529,7 @@ pub(crate) fn add_contact_to_chat_ex(
|
|||||||
msg.id = send_msg(context, chat_id, &mut msg)?;
|
msg.id = send_msg(context, chat_id, &mut msg)?;
|
||||||
context.call_cb(Event::MsgsChanged {
|
context.call_cb(Event::MsgsChanged {
|
||||||
chat_id,
|
chat_id,
|
||||||
msg_id: MsgId::from(msg.id),
|
msg_id: msg.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
context.call_cb(Event::MsgsChanged {
|
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;
|
const STEP_3_INDEX: u8 = 13;
|
||||||
let mut step_counter: u8 = 0;
|
let mut step_counter: u8 = 0;
|
||||||
while !context.shall_stop_ongoing() {
|
while !context.shall_stop_ongoing() {
|
||||||
step_counter = step_counter + 1;
|
step_counter += 1;
|
||||||
|
|
||||||
let success = match step_counter {
|
let success = match step_counter {
|
||||||
// Read login parameters from the database
|
// 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 {
|
fn must_encode(byte: u8) -> bool {
|
||||||
static SPECIALS: &[u8] = b",:!\"#$@[\\]^`{|}~=?_";
|
static SPECIALS: &[u8] = b",:!\"#$@[\\]^`{|}~=?_";
|
||||||
|
|
||||||
SPECIALS.into_iter().any(|b| *b == byte)
|
SPECIALS.iter().any(|b| *b == byte)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn quote_word(word: &[u8]) -> String {
|
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();
|
let res = cvar.wait_timeout(state, dur).unwrap();
|
||||||
state = res.0;
|
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.
|
// We received the notification and the value has been updated, we can leave.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ impl Smtp {
|
|||||||
|
|
||||||
/// SMTP-Send a prepared mail to recipients.
|
/// SMTP-Send a prepared mail to recipients.
|
||||||
/// on successful send out Ok() is returned.
|
/// on successful send out Ok() is returned.
|
||||||
pub fn send<'a>(
|
pub fn send(
|
||||||
&mut self,
|
&mut self,
|
||||||
context: &Context,
|
context: &Context,
|
||||||
recipients: Vec<EmailAddress>,
|
recipients: Vec<EmailAddress>,
|
||||||
|
|||||||
Reference in New Issue
Block a user