chore: enable Clippy pedantic lints
All checks were successful
actionlint check / actionlint check (pull_request) Successful in 7s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 3m44s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 3m46s
GitLeaks check / GitLeaks check (pull_request) Successful in 1m45s
Prettier check / Prettier check (pull_request) Successful in 2m1s
markdownlint check / markdownlint check (pull_request) Successful in 2m4s
htmlhint check / htmlhint check (pull_request) Successful in 2m6s
ShellCheck check / ShellCheck check (pull_request) Successful in 1m15s
yamllint check / yamllint check (pull_request) Successful in 1m11s
Stylelint check / Stylelint check (pull_request) Successful in 1m13s
Rust check / Rust check (pull_request) Successful in 22m46s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 19s
hadolint check / hadolint check (pull_request) Successful in 25s
checkov check / checkov check (pull_request) Successful in 56s
All checks were successful
actionlint check / actionlint check (pull_request) Successful in 7s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 3m44s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 3m46s
GitLeaks check / GitLeaks check (pull_request) Successful in 1m45s
Prettier check / Prettier check (pull_request) Successful in 2m1s
markdownlint check / markdownlint check (pull_request) Successful in 2m4s
htmlhint check / htmlhint check (pull_request) Successful in 2m6s
ShellCheck check / ShellCheck check (pull_request) Successful in 1m15s
yamllint check / yamllint check (pull_request) Successful in 1m11s
Stylelint check / Stylelint check (pull_request) Successful in 1m13s
Rust check / Rust check (pull_request) Successful in 22m46s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 19s
hadolint check / hadolint check (pull_request) Successful in 25s
checkov check / checkov check (pull_request) Successful in 56s
This commit is contained in:
@@ -12,7 +12,7 @@ pub(crate) fn ButtonPrimary(
|
||||
button {
|
||||
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 {}",
|
||||
class.unwrap_or("".to_owned())
|
||||
class.unwrap_or(String::new())
|
||||
),
|
||||
onclick: move |event| {
|
||||
if let Some(onclick) = onclick {
|
||||
|
||||
@@ -12,7 +12,7 @@ pub(crate) fn ButtonSecondary(
|
||||
button {
|
||||
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 {}",
|
||||
class.unwrap_or("".to_owned())
|
||||
class.unwrap_or(String::new())
|
||||
),
|
||||
onclick: move |event| {
|
||||
if let Some(onclick) = onclick {
|
||||
|
||||
@@ -19,35 +19,35 @@ pub(crate) fn CategoryInput(
|
||||
SelectButton {
|
||||
icon: FaLightbulb,
|
||||
is_selected: matches!(selected_category(), Category::SomedayMaybe),
|
||||
on_select: move |_| {
|
||||
on_select: move |()| {
|
||||
selected_category.set(Category::SomedayMaybe);
|
||||
}
|
||||
}
|
||||
SelectButton {
|
||||
icon: FaWater,
|
||||
is_selected: matches!(selected_category(), Category::LongTerm),
|
||||
on_select: move |_| {
|
||||
on_select: move |()| {
|
||||
selected_category.set(Category::LongTerm);
|
||||
}
|
||||
}
|
||||
SelectButton {
|
||||
icon: FaHourglassHalf,
|
||||
is_selected: matches!(selected_category(), Category::WaitingFor(_)),
|
||||
on_select: move |_| {
|
||||
on_select: move |()| {
|
||||
selected_category.set(Category::WaitingFor(String::new()));
|
||||
}
|
||||
}
|
||||
SelectButton {
|
||||
icon: FaSignsPost,
|
||||
is_selected: matches!(selected_category(), Category::NextSteps),
|
||||
on_select: move |_| {
|
||||
on_select: move |()| {
|
||||
selected_category.set(Category::NextSteps);
|
||||
}
|
||||
}
|
||||
SelectButton {
|
||||
icon: FaCalendarDays,
|
||||
is_selected: matches!(selected_category(), Category::Calendar { .. }),
|
||||
on_select: move |_| {
|
||||
on_select: move |()| {
|
||||
selected_category.set(Category::Calendar {
|
||||
date: chrono::Local::now().date_naive(),
|
||||
reoccurrence: None,
|
||||
@@ -58,7 +58,7 @@ pub(crate) fn CategoryInput(
|
||||
SelectButton {
|
||||
icon: FaInbox,
|
||||
is_selected: matches!(selected_category(), Category::Inbox),
|
||||
on_select: move |_| {
|
||||
on_select: move |()| {
|
||||
selected_category.set(Category::Inbox);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@ pub(crate) fn Input(
|
||||
"text" | "number" => "",
|
||||
_ => "enabled:cursor-pointer"
|
||||
},
|
||||
class.unwrap_or("".to_owned())
|
||||
class.unwrap_or(String::new())
|
||||
),
|
||||
name: name.clone(),
|
||||
r#type,
|
||||
id: id.unwrap_or(format!("input_{}", name)),
|
||||
id: id.unwrap_or(format!("input_{name}")),
|
||||
oninput: move |event| {
|
||||
if let Some(oninput) = oninput {
|
||||
oninput.call(event);
|
||||
|
||||
@@ -47,7 +47,7 @@ pub(crate) fn ProjectForm() -> Element {
|
||||
name: "title",
|
||||
required: true,
|
||||
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 {
|
||||
icon: FaBan,
|
||||
is_selected: reoccurrence_interval().is_none(),
|
||||
on_select: move |_| {
|
||||
on_select: move |()| {
|
||||
reoccurrence_interval.set(None);
|
||||
}
|
||||
}
|
||||
SelectButton {
|
||||
icon: FaSun,
|
||||
is_selected: matches!(reoccurrence_interval(), Some(ReoccurrenceInterval::Day)),
|
||||
on_select: move |_| {
|
||||
reoccurrence_interval.set(Some(ReoccurrenceInterval::Day))
|
||||
on_select: move |()| {
|
||||
reoccurrence_interval.set(Some(ReoccurrenceInterval::Day));
|
||||
}
|
||||
}
|
||||
SelectButton {
|
||||
icon: FaMoon,
|
||||
is_selected: matches!(reoccurrence_interval(), Some(ReoccurrenceInterval::Month)),
|
||||
on_select: move |_| {
|
||||
on_select: move |()| {
|
||||
reoccurrence_interval.set(Some(ReoccurrenceInterval::Month));
|
||||
}
|
||||
}
|
||||
SelectButton {
|
||||
icon: FaEarthEurope,
|
||||
is_selected: matches!(reoccurrence_interval(), Some(ReoccurrenceInterval::Year)),
|
||||
on_select: move |_| {
|
||||
on_select: move |()| {
|
||||
reoccurrence_interval.set(Some(ReoccurrenceInterval::Year));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ pub(crate) fn TaskForm() -> Element {
|
||||
name: "category_calendar_reminder_offset_index",
|
||||
r#type: "range",
|
||||
min: 0,
|
||||
max: REMINDER_OFFSETS.len() as i64 - 1,
|
||||
max: REMINDER_OFFSETS.len() as i128 - 1,
|
||||
initial_value: category_calendar_reminder_offset_index()
|
||||
.to_string(),
|
||||
oninput: move |event| {
|
||||
@@ -319,13 +319,14 @@ pub(crate) fn TaskForm() -> Element {
|
||||
class: "pr-3 min-w-16 text-right",
|
||||
r#for: "category_calendar_reminder_offset_index",
|
||||
{REMINDER_OFFSETS[category_calendar_reminder_offset_index()]
|
||||
.map(
|
||||
.map_or(
|
||||
t!("none"),
|
||||
|offset| if offset.num_hours() < 1 {
|
||||
format!("{} min", offset.num_minutes())
|
||||
} else {
|
||||
format!("{} h", offset.num_hours())
|
||||
}
|
||||
).unwrap_or_else(|| t!("none"))}
|
||||
)}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -359,7 +360,7 @@ pub(crate) fn TaskForm() -> Element {
|
||||
delete_task(task.id).await
|
||||
} else {
|
||||
let new_task = NewTask {
|
||||
title: task.title.to_owned(),
|
||||
title: task.title.clone(),
|
||||
deadline: task.deadline,
|
||||
category: Category::Trash,
|
||||
project_id: task.project_id
|
||||
|
||||
@@ -14,7 +14,7 @@ use crate::{
|
||||
};
|
||||
|
||||
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 || {
|
||||
spawn(async move {
|
||||
let mut eval = document::eval(
|
||||
|
||||
@@ -28,7 +28,7 @@ impl From<LocaleFromLanguageIdentifier<'_>> for Locale {
|
||||
fn from(language_identifier: LocaleFromLanguageIdentifier) -> Self {
|
||||
language_identifier
|
||||
.to_string()
|
||||
.replace("-", "_")
|
||||
.replace('-', "_")
|
||||
.parse()
|
||||
.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 dotenv;
|
||||
mod hooks;
|
||||
|
||||
@@ -41,6 +41,7 @@ pub enum Category {
|
||||
#[cfg(feature = "server")]
|
||||
impl Category {
|
||||
pub fn eq_sql_predicate(&self) -> Box<dyn BoxableExpression<tasks::table, Pg, SqlType = Bool>> {
|
||||
#![allow(clippy::wildcard_imports)]
|
||||
use crate::schema::tasks::dsl::*;
|
||||
|
||||
match self {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// For Diesel DSL.
|
||||
#![allow(clippy::wildcard_imports)]
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub(crate) mod database_connection;
|
||||
pub(crate) mod projects;
|
||||
|
||||
@@ -138,7 +138,7 @@ pub(crate) async fn complete_task(task_id: i32) -> Result<Task> {
|
||||
} = &mut new_task.category
|
||||
{
|
||||
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 => {
|
||||
*date = *date
|
||||
+ Months::new(
|
||||
@@ -152,13 +152,13 @@ pub(crate) async fn complete_task(task_id: i32) -> Result<Task> {
|
||||
*date = NaiveDate::from_ymd_opt(
|
||||
date.year(),
|
||||
date.month(),
|
||||
reoccurrence.start_date.day().min(
|
||||
Month::try_from(date.month() as u8)
|
||||
reoccurrence.start_date.day().min(u32::from(
|
||||
Month::try_from(u8::try_from(date.month()).unwrap())
|
||||
.unwrap()
|
||||
.length(date.year()) as u32,
|
||||
),
|
||||
.length(date.year()),
|
||||
)),
|
||||
)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
restore_subtasks_of_task(task_id).await?;
|
||||
|
||||
Reference in New Issue
Block a user