Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
ddboline committed Nov 24, 2023
1 parent 54788e5 commit 35ed291
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion diary_app_api/src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use anyhow::Error as AnyhowError;
use handlebars::RenderError;
use rweb::http::StatusCode;
use log::error;
use postgres_query::Error as PqError;
use rweb::{
http::StatusCode,
openapi::{
ComponentDescriptor, ComponentOrInlineSchema, Entity, Response, ResponseEntity, Responses,
},
Expand Down
1 change: 1 addition & 0 deletions diary_app_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#![allow(clippy::used_underscore_binding)]
#![allow(clippy::unused_async)]
#![allow(clippy::implicit_hasher)]
#![allow(clippy::ignored_unit_patterns)]

pub mod app;
pub mod elements;
Expand Down
2 changes: 1 addition & 1 deletion diary_app_bot/src/telegram_bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ async fn telegram_worker(dapp: DiaryAppInterface) -> Result<(), Error> {
let d = dapp.clone();

match timeout(Duration::from_secs(3600), bot_handler(d)).await {
Err(_) | Ok(Ok(_)) => FAILURE_COUNT.reset()?,
Err(_) | Ok(Ok(())) => FAILURE_COUNT.reset()?,
Ok(Err(_)) => FAILURE_COUNT.increment()?,
}
}
Expand Down
13 changes: 8 additions & 5 deletions diary_app_lib/src/diary_app_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,14 @@ impl DiaryAppInterface {
let local = DateTimeWrapper::local_tz();
let date_entry_map = DiaryCache::get_cache_entries(&self.pool)
.await?
.try_fold(HashMap::new(), |mut acc, entry| async move {
let entry_date = entry.diary_datetime.to_timezone(local).date();
acc.entry(entry_date).or_insert_with(Vec::new).push(entry);
Ok(acc)
})
.try_fold(
HashMap::new(),
|mut acc: HashMap<Date, Vec<DiaryCache>>, entry| async move {
let entry_date = entry.diary_datetime.to_timezone(local).date();
acc.entry(entry_date).or_default().push(entry);
Ok(acc)
},
)
.await?;

let futures: FuturesUnordered<_> = date_entry_map
Expand Down
2 changes: 1 addition & 1 deletion diary_app_lib/src/local_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl LocalInterface {
let year_map: BTreeMap<i32, Vec<_>> =
date_list.into_iter().fold(BTreeMap::new(), |mut acc, d| {
let year = d.year();
acc.entry(year).or_insert_with(Vec::new).push(d);
acc.entry(year).or_default().push(d);
acc
});

Expand Down
2 changes: 1 addition & 1 deletion src/diary_app_rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ async fn main() {
env_logger::init();

match DiaryAppOpts::process_args().await {
Ok(_) => {}
Ok(()) => {}
Err(e) => {
assert!(e.to_string().contains("Broken pipe"), "{}", e);
}
Expand Down

0 comments on commit 35ed291

Please sign in to comment.