chore: enable Clippy pedantic lints
Some checks failed
actionlint check / actionlint check (pull_request) Successful in 6s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 7s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 6s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 10s
GitLeaks check / GitLeaks check (pull_request) Successful in 14s
hadolint check / hadolint check (pull_request) Successful in 14s
Prettier check / Prettier check (pull_request) Successful in 40s
markdownlint check / markdownlint check (pull_request) Successful in 43s
htmlhint check / htmlhint check (pull_request) Successful in 51s
checkov check / checkov check (pull_request) Successful in 1m35s
Stylelint check / Stylelint check (pull_request) Successful in 29s
ShellCheck check / ShellCheck check (pull_request) Successful in 31s
yamllint check / yamllint check (pull_request) Successful in 35s
Rust check / Rust check (pull_request) Failing after 2m1s

This commit is contained in:
2026-02-09 18:29:01 +01:00
parent d208a81442
commit 8181cc823e
13 changed files with 36 additions and 26 deletions

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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);
}
}

View File

@@ -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);

View File

@@ -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()),
}
}
}

View File

@@ -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));
}
}

View File

@@ -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

View File

@@ -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(

View File

@@ -28,7 +28,7 @@ impl From<LocaleFromLanguageIdentifier<'_>> for Locale {
fn from(language_identifier: LocaleFromLanguageIdentifier) -> Self {
language_identifier
.to_string()
.replace("-", "_")
.replace('-', "_")
.parse()
.unwrap()
}

View File

@@ -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;

View File

@@ -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 {

View File

@@ -1,3 +1,6 @@
// For Diesel DSL.
#![allow(clippy::wildcard_imports)]
#[cfg(feature = "server")]
pub(crate) mod database_connection;
pub(crate) mod projects;

View File

@@ -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(
@@ -153,12 +153,12 @@ pub(crate) async fn complete_task(task_id: i32) -> Result<Task> {
date.year(),
date.month(),
reoccurrence.start_date.day().min(
Month::try_from(date.month() as u8)
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?;