mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 23:36:30 +03:00
example: happy clippy
This commit is contained in:
@@ -212,7 +212,7 @@ async fn log_msg(context: &Context, prefix: impl AsRef<str>, msg: &Message) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn log_msglist(context: &Context, msglist: &Vec<MsgId>) -> Result<(), Error> {
|
async fn log_msglist(context: &Context, msglist: &[MsgId]) -> Result<(), Error> {
|
||||||
let mut lines_out = 0;
|
let mut lines_out = 0;
|
||||||
for &msg_id in msglist {
|
for &msg_id in msglist {
|
||||||
if msg_id.is_daymarker() {
|
if msg_id.is_daymarker() {
|
||||||
@@ -240,8 +240,8 @@ async fn log_msglist(context: &Context, msglist: &Vec<MsgId>) -> Result<(), Erro
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn log_contactlist(context: &Context, contacts: &Vec<u32>) {
|
async fn log_contactlist(context: &Context, contacts: &[u32]) {
|
||||||
let mut contacts = contacts.clone();
|
let mut contacts = contacts.to_vec();
|
||||||
if !contacts.contains(&1) {
|
if !contacts.contains(&1) {
|
||||||
contacts.push(1);
|
contacts.push(1);
|
||||||
}
|
}
|
||||||
@@ -862,7 +862,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
|
|||||||
print!(", {}", data);
|
print!(", {}", data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print!("\n");
|
println!();
|
||||||
}
|
}
|
||||||
"archive" | "unarchive" | "pin" | "unpin" => {
|
"archive" | "unarchive" | "pin" | "unpin" => {
|
||||||
ensure!(!arg1.is_empty(), "Argument <chat-id> missing.");
|
ensure!(!arg1.is_empty(), "Argument <chat-id> missing.");
|
||||||
@@ -1049,8 +1049,8 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
|
|||||||
"estimatedeletion" => {
|
"estimatedeletion" => {
|
||||||
ensure!(!arg1.is_empty(), "Argument <seconds> missing");
|
ensure!(!arg1.is_empty(), "Argument <seconds> missing");
|
||||||
let seconds = arg1.parse()?;
|
let seconds = arg1.parse()?;
|
||||||
let device_cnt = message::estimate_deletion_cnt(context, false, seconds)?;
|
let device_cnt = message::estimate_deletion_cnt(&context, false, seconds).await?;
|
||||||
let server_cnt = message::estimate_deletion_cnt(context, true, seconds)?;
|
let server_cnt = message::estimate_deletion_cnt(&context, true, seconds).await?;
|
||||||
println!(
|
println!(
|
||||||
"estimated count of messages older than {} seconds:\non device: {}\non server: {}",
|
"estimated count of messages older than {} seconds:\non device: {}\non server: {}",
|
||||||
seconds, device_cnt, server_cnt
|
seconds, device_cnt, server_cnt
|
||||||
|
|||||||
@@ -6,10 +6,6 @@
|
|||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate deltachat;
|
extern crate deltachat;
|
||||||
#[macro_use]
|
|
||||||
extern crate lazy_static;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate rusqlite;
|
|
||||||
|
|
||||||
use std::borrow::Cow::{self, Borrowed, Owned};
|
use std::borrow::Cow::{self, Borrowed, Owned};
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
@@ -282,12 +278,8 @@ async fn start(args: Vec<String>) -> Result<(), Error> {
|
|||||||
let ctx = context.clone();
|
let ctx = context.clone();
|
||||||
async_std::task::spawn(async move {
|
async_std::task::spawn(async move {
|
||||||
loop {
|
loop {
|
||||||
if ctx.has_next_event() {
|
if let Ok(event) = ctx.get_next_event() {
|
||||||
if let Ok(event) = ctx.get_next_event() {
|
receive_event(event);
|
||||||
receive_event(event);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
async_std::task::sleep(std::time::Duration::from_millis(50)).await;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user