chore: enable Clippy pedantic lints (#136)
This commit was merged in pull request #136.
This commit is contained in:
@@ -12,7 +12,7 @@ pub(crate) fn ButtonPrimary(
|
|||||||
button {
|
button {
|
||||||
class: format!(
|
class: format!(
|
||||||
"cursor-pointer pb-[6px] hover:pb-[7px] active:pb-[2px] mt-[1px] hover:mt-0 active:mt-[5px] hover:*:drop-shadow-[0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted)] active:*:drop-shadow-[0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted)] transition-all duration-150 {}",
|
"cursor-pointer pb-[6px] hover:pb-[7px] active:pb-[2px] mt-[1px] hover:mt-0 active:mt-[5px] hover:*:drop-shadow-[0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted)] active:*:drop-shadow-[0_1px_0_var(--color-amber-700-muted),0_1px_0_var(--color-amber-700-muted)] transition-all duration-150 {}",
|
||||||
class.unwrap_or("".to_owned())
|
class.unwrap_or(String::new())
|
||||||
),
|
),
|
||||||
onclick: move |event| {
|
onclick: move |event| {
|
||||||
if let Some(onclick) = onclick {
|
if let Some(onclick) = onclick {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ pub(crate) fn ButtonSecondary(
|
|||||||
button {
|
button {
|
||||||
class: format!(
|
class: format!(
|
||||||
"cursor-pointer pb-[6px] hover:pb-[7px] active:pb-[2px] mt-[1px] hover:mt-0 active:mt-[5px] hover:*:drop-shadow-[0_7px_0_var(--color-gray-800)] active:*:drop-shadow-[0_2px_0_var(--color-gray-800)] transition-all duration-150 {}",
|
"cursor-pointer pb-[6px] hover:pb-[7px] active:pb-[2px] mt-[1px] hover:mt-0 active:mt-[5px] hover:*:drop-shadow-[0_7px_0_var(--color-gray-800)] active:*:drop-shadow-[0_2px_0_var(--color-gray-800)] transition-all duration-150 {}",
|
||||||
class.unwrap_or("".to_owned())
|
class.unwrap_or(String::new())
|
||||||
),
|
),
|
||||||
onclick: move |event| {
|
onclick: move |event| {
|
||||||
if let Some(onclick) = onclick {
|
if let Some(onclick) = onclick {
|
||||||
|
|||||||
@@ -19,35 +19,35 @@ pub(crate) fn CategoryInput(
|
|||||||
SelectButton {
|
SelectButton {
|
||||||
icon: FaLightbulb,
|
icon: FaLightbulb,
|
||||||
is_selected: matches!(selected_category(), Category::SomedayMaybe),
|
is_selected: matches!(selected_category(), Category::SomedayMaybe),
|
||||||
on_select: move |_| {
|
on_select: move |()| {
|
||||||
selected_category.set(Category::SomedayMaybe);
|
selected_category.set(Category::SomedayMaybe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SelectButton {
|
SelectButton {
|
||||||
icon: FaWater,
|
icon: FaWater,
|
||||||
is_selected: matches!(selected_category(), Category::LongTerm),
|
is_selected: matches!(selected_category(), Category::LongTerm),
|
||||||
on_select: move |_| {
|
on_select: move |()| {
|
||||||
selected_category.set(Category::LongTerm);
|
selected_category.set(Category::LongTerm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SelectButton {
|
SelectButton {
|
||||||
icon: FaHourglassHalf,
|
icon: FaHourglassHalf,
|
||||||
is_selected: matches!(selected_category(), Category::WaitingFor(_)),
|
is_selected: matches!(selected_category(), Category::WaitingFor(_)),
|
||||||
on_select: move |_| {
|
on_select: move |()| {
|
||||||
selected_category.set(Category::WaitingFor(String::new()));
|
selected_category.set(Category::WaitingFor(String::new()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SelectButton {
|
SelectButton {
|
||||||
icon: FaSignsPost,
|
icon: FaSignsPost,
|
||||||
is_selected: matches!(selected_category(), Category::NextSteps),
|
is_selected: matches!(selected_category(), Category::NextSteps),
|
||||||
on_select: move |_| {
|
on_select: move |()| {
|
||||||
selected_category.set(Category::NextSteps);
|
selected_category.set(Category::NextSteps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SelectButton {
|
SelectButton {
|
||||||
icon: FaCalendarDays,
|
icon: FaCalendarDays,
|
||||||
is_selected: matches!(selected_category(), Category::Calendar { .. }),
|
is_selected: matches!(selected_category(), Category::Calendar { .. }),
|
||||||
on_select: move |_| {
|
on_select: move |()| {
|
||||||
selected_category.set(Category::Calendar {
|
selected_category.set(Category::Calendar {
|
||||||
date: chrono::Local::now().date_naive(),
|
date: chrono::Local::now().date_naive(),
|
||||||
reoccurrence: None,
|
reoccurrence: None,
|
||||||
@@ -58,7 +58,7 @@ pub(crate) fn CategoryInput(
|
|||||||
SelectButton {
|
SelectButton {
|
||||||
icon: FaInbox,
|
icon: FaInbox,
|
||||||
is_selected: matches!(selected_category(), Category::Inbox),
|
is_selected: matches!(selected_category(), Category::Inbox),
|
||||||
on_select: move |_| {
|
on_select: move |()| {
|
||||||
selected_category.set(Category::Inbox);
|
selected_category.set(Category::Inbox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ pub(crate) fn Input(
|
|||||||
"text" | "number" => "",
|
"text" | "number" => "",
|
||||||
_ => "enabled:cursor-pointer"
|
_ => "enabled:cursor-pointer"
|
||||||
},
|
},
|
||||||
class.unwrap_or("".to_owned())
|
class.unwrap_or(String::new())
|
||||||
),
|
),
|
||||||
name: name.clone(),
|
name: name.clone(),
|
||||||
r#type,
|
r#type,
|
||||||
id: id.unwrap_or(format!("input_{}", name)),
|
id: id.unwrap_or(format!("input_{name}")),
|
||||||
oninput: move |event| {
|
oninput: move |event| {
|
||||||
if let Some(oninput) = oninput {
|
if let Some(oninput) = oninput {
|
||||||
oninput.call(event);
|
oninput.call(event);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ pub(crate) fn ProjectForm() -> Element {
|
|||||||
name: "title",
|
name: "title",
|
||||||
required: true,
|
required: true,
|
||||||
r#type: "text",
|
r#type: "text",
|
||||||
initial_value: project.as_ref().map(|project| project.title.to_owned()),
|
initial_value: project.as_ref().map(|project| project.title.clone()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,28 +14,28 @@ pub(crate) fn ReoccurrenceIntervalInput(
|
|||||||
SelectButton {
|
SelectButton {
|
||||||
icon: FaBan,
|
icon: FaBan,
|
||||||
is_selected: reoccurrence_interval().is_none(),
|
is_selected: reoccurrence_interval().is_none(),
|
||||||
on_select: move |_| {
|
on_select: move |()| {
|
||||||
reoccurrence_interval.set(None);
|
reoccurrence_interval.set(None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SelectButton {
|
SelectButton {
|
||||||
icon: FaSun,
|
icon: FaSun,
|
||||||
is_selected: matches!(reoccurrence_interval(), Some(ReoccurrenceInterval::Day)),
|
is_selected: matches!(reoccurrence_interval(), Some(ReoccurrenceInterval::Day)),
|
||||||
on_select: move |_| {
|
on_select: move |()| {
|
||||||
reoccurrence_interval.set(Some(ReoccurrenceInterval::Day))
|
reoccurrence_interval.set(Some(ReoccurrenceInterval::Day));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SelectButton {
|
SelectButton {
|
||||||
icon: FaMoon,
|
icon: FaMoon,
|
||||||
is_selected: matches!(reoccurrence_interval(), Some(ReoccurrenceInterval::Month)),
|
is_selected: matches!(reoccurrence_interval(), Some(ReoccurrenceInterval::Month)),
|
||||||
on_select: move |_| {
|
on_select: move |()| {
|
||||||
reoccurrence_interval.set(Some(ReoccurrenceInterval::Month));
|
reoccurrence_interval.set(Some(ReoccurrenceInterval::Month));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SelectButton {
|
SelectButton {
|
||||||
icon: FaEarthEurope,
|
icon: FaEarthEurope,
|
||||||
is_selected: matches!(reoccurrence_interval(), Some(ReoccurrenceInterval::Year)),
|
is_selected: matches!(reoccurrence_interval(), Some(ReoccurrenceInterval::Year)),
|
||||||
on_select: move |_| {
|
on_select: move |()| {
|
||||||
reoccurrence_interval.set(Some(ReoccurrenceInterval::Year));
|
reoccurrence_interval.set(Some(ReoccurrenceInterval::Year));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ pub(crate) fn TaskForm() -> Element {
|
|||||||
name: "category_calendar_reminder_offset_index",
|
name: "category_calendar_reminder_offset_index",
|
||||||
r#type: "range",
|
r#type: "range",
|
||||||
min: 0,
|
min: 0,
|
||||||
max: REMINDER_OFFSETS.len() as i64 - 1,
|
max: REMINDER_OFFSETS.len() as i128 - 1,
|
||||||
initial_value: category_calendar_reminder_offset_index()
|
initial_value: category_calendar_reminder_offset_index()
|
||||||
.to_string(),
|
.to_string(),
|
||||||
oninput: move |event| {
|
oninput: move |event| {
|
||||||
@@ -319,13 +319,14 @@ pub(crate) fn TaskForm() -> Element {
|
|||||||
class: "pr-3 min-w-16 text-right",
|
class: "pr-3 min-w-16 text-right",
|
||||||
r#for: "category_calendar_reminder_offset_index",
|
r#for: "category_calendar_reminder_offset_index",
|
||||||
{REMINDER_OFFSETS[category_calendar_reminder_offset_index()]
|
{REMINDER_OFFSETS[category_calendar_reminder_offset_index()]
|
||||||
.map(
|
.map_or(
|
||||||
|
t!("none"),
|
||||||
|offset| if offset.num_hours() < 1 {
|
|offset| if offset.num_hours() < 1 {
|
||||||
format!("{} min", offset.num_minutes())
|
format!("{} min", offset.num_minutes())
|
||||||
} else {
|
} else {
|
||||||
format!("{} h", offset.num_hours())
|
format!("{} h", offset.num_hours())
|
||||||
}
|
}
|
||||||
).unwrap_or_else(|| t!("none"))}
|
)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -359,7 +360,7 @@ pub(crate) fn TaskForm() -> Element {
|
|||||||
delete_task(task.id).await
|
delete_task(task.id).await
|
||||||
} else {
|
} else {
|
||||||
let new_task = NewTask {
|
let new_task = NewTask {
|
||||||
title: task.title.to_owned(),
|
title: task.title.clone(),
|
||||||
deadline: task.deadline,
|
deadline: task.deadline,
|
||||||
category: Category::Trash,
|
category: Category::Trash,
|
||||||
project_id: task.project_id
|
project_id: task.project_id
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
fn use_on_document_become_visible(mut callback: impl FnMut() + 'static) {
|
fn use_on_document_become_visible(mut callback: impl FnMut() + 'static) {
|
||||||
let callback = use_callback(move |_| callback());
|
let callback = use_callback(move |()| callback());
|
||||||
use_effect(move || {
|
use_effect(move || {
|
||||||
spawn(async move {
|
spawn(async move {
|
||||||
let mut eval = document::eval(
|
let mut eval = document::eval(
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ impl From<LocaleFromLanguageIdentifier<'_>> for Locale {
|
|||||||
fn from(language_identifier: LocaleFromLanguageIdentifier) -> Self {
|
fn from(language_identifier: LocaleFromLanguageIdentifier) -> Self {
|
||||||
language_identifier
|
language_identifier
|
||||||
.to_string()
|
.to_string()
|
||||||
.replace("-", "_")
|
.replace('-', "_")
|
||||||
.parse()
|
.parse()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
#![warn(clippy::pedantic)]
|
||||||
|
#![allow(clippy::unused_async)]
|
||||||
|
// TODO: Enable once false positives are fixed.
|
||||||
|
#![allow(clippy::assigning_clones)]
|
||||||
|
|
||||||
mod components;
|
mod components;
|
||||||
mod dotenv;
|
mod dotenv;
|
||||||
mod hooks;
|
mod hooks;
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ pub enum Category {
|
|||||||
#[cfg(feature = "server")]
|
#[cfg(feature = "server")]
|
||||||
impl Category {
|
impl Category {
|
||||||
pub fn eq_sql_predicate(&self) -> Box<dyn BoxableExpression<tasks::table, Pg, SqlType = Bool>> {
|
pub fn eq_sql_predicate(&self) -> Box<dyn BoxableExpression<tasks::table, Pg, SqlType = Bool>> {
|
||||||
|
#![allow(clippy::wildcard_imports)]
|
||||||
use crate::schema::tasks::dsl::*;
|
use crate::schema::tasks::dsl::*;
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// For Diesel DSL.
|
||||||
|
#![allow(clippy::wildcard_imports)]
|
||||||
|
|
||||||
#[cfg(feature = "server")]
|
#[cfg(feature = "server")]
|
||||||
pub(crate) mod database_connection;
|
pub(crate) mod database_connection;
|
||||||
pub(crate) mod projects;
|
pub(crate) mod projects;
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ pub(crate) async fn complete_task(task_id: i32) -> Result<Task> {
|
|||||||
} = &mut new_task.category
|
} = &mut new_task.category
|
||||||
{
|
{
|
||||||
match reoccurrence.interval {
|
match reoccurrence.interval {
|
||||||
ReoccurrenceInterval::Day => *date = *date + Days::new(reoccurrence.length as u64),
|
ReoccurrenceInterval::Day => *date = *date + Days::new(u64::from(reoccurrence.length)),
|
||||||
ReoccurrenceInterval::Month | ReoccurrenceInterval::Year => {
|
ReoccurrenceInterval::Month | ReoccurrenceInterval::Year => {
|
||||||
*date = *date
|
*date = *date
|
||||||
+ Months::new(
|
+ Months::new(
|
||||||
@@ -152,13 +152,13 @@ pub(crate) async fn complete_task(task_id: i32) -> Result<Task> {
|
|||||||
*date = NaiveDate::from_ymd_opt(
|
*date = NaiveDate::from_ymd_opt(
|
||||||
date.year(),
|
date.year(),
|
||||||
date.month(),
|
date.month(),
|
||||||
reoccurrence.start_date.day().min(
|
reoccurrence.start_date.day().min(u32::from(
|
||||||
Month::try_from(date.month() as u8)
|
Month::try_from(u8::try_from(date.month()).unwrap())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.length(date.year()) as u32,
|
.length(date.year()),
|
||||||
),
|
)),
|
||||||
)
|
)
|
||||||
.unwrap()
|
.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
restore_subtasks_of_task(task_id).await?;
|
restore_subtasks_of_task(task_id).await?;
|
||||||
|
|||||||
Reference in New Issue
Block a user