Skip to content

Commit

Permalink
resolve clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
mufeez-amjad committed Dec 28, 2022
1 parent 153a2ce commit c382327
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub async fn add_account(

let selected_platform = PLATFORMS[selection];

let accounts = db.execute(Box::new(|conn| AccountModel::get(conn)))??;
let accounts = db.execute(Box::new(AccountModel::get))??;
if accounts
.iter()
.any(|a| a.name == email && a.platform.unwrap() == selected_platform)
Expand Down Expand Up @@ -97,7 +97,7 @@ pub fn remove_account(db: Store, email: &str) -> anyhow::Result<()> {
}

pub fn list_accounts(db: Store) -> anyhow::Result<()> {
let accounts = db.execute(Box::new(|conn| AccountModel::get(conn)))??;
let accounts = db.execute(Box::new(AccountModel::get))??;

if accounts.is_empty() {
println!("Configured accounts: None");
Expand All @@ -116,7 +116,7 @@ pub fn list_accounts(db: Store) -> anyhow::Result<()> {
}

pub async fn refresh_calendars(db: Store, cfg: &AvailConfig) -> anyhow::Result<()> {
let accounts = db.execute(Box::new(|conn| AccountModel::get(conn)))??;
let accounts = db.execute(Box::new(AccountModel::get))??;

if accounts.is_empty() {
return Err(anyhow::anyhow!(format!(
Expand Down Expand Up @@ -194,7 +194,7 @@ pub async fn refresh_calendars(db: Store, cfg: &AvailConfig) -> anyhow::Result<(
}

let mut all_calendars: Vec<Calendar> = db
.execute(Box::new(move |conn| CalendarModel::get_all(conn)))??
.execute(Box::new(CalendarModel::get_all))??
.into_iter()
.map(|c| Calendar {
account_id: c.account_id.unwrap(),
Expand Down Expand Up @@ -253,7 +253,7 @@ pub(crate) async fn find_availability(
finder: AvailabilityFinder,
m: &ProgressIndicator,
) -> anyhow::Result<Vec<Availability<Local>>> {
let accounts = db.execute(Box::new(|conn| AccountModel::get(conn)))??;
let accounts = db.execute(Box::new(AccountModel::get))??;

if accounts.is_empty() {
return Err(anyhow::anyhow!(format!(
Expand Down Expand Up @@ -422,7 +422,7 @@ pub(crate) async fn create_hold_events(
merged: &[Availability<Local>],
m: &ProgressIndicator,
) -> anyhow::Result<()> {
let accounts = db.execute(Box::new(|conn| AccountModel::get(conn)))??;
let accounts = db.execute(Box::new(AccountModel::get))??;

let event_title: String = Input::with_theme(&ColorfulTheme::default())
.with_prompt("What's the name of your event?")
Expand Down
3 changes: 1 addition & 2 deletions src/datetime/finder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ impl AvailabilityFinder {
while curr.date() < self.end.date()
|| (curr.date() == self.end.date() && curr < self.end)
{
let is_weekend = is_weekend(curr.weekday());
if !is_weekend || (is_weekend && self.include_weekends) {
if !is_weekend(curr.weekday()) || self.include_weekends {
let start = curr.ceil();

// Whole day
Expand Down

0 comments on commit c382327

Please sign in to comment.