chore: upgrade Rust toolchain to 1.89 and modernize code with let-chains

This commit is contained in:
Kumpelinus
2025-09-13 20:20:02 +02:00
committed by nitnelave
parent 3d5542996f
commit 176c49c78d
27 changed files with 62 additions and 33 deletions
+1
View File
@@ -8,6 +8,7 @@ authors.workspace = true
homepage.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
[dependencies]
anyhow = "1"
+12 -14
View File
@@ -147,20 +147,18 @@ impl Component for JpegFileInput {
true
}
Msg::FileLoaded(file_name, data) => {
if let Some(avatar) = &mut self.avatar {
if let Some(file) = &avatar.file {
if file.name() == file_name {
if let Result::Ok(data) = data {
if !is_valid_jpeg(data.as_slice()) {
// Clear the selection.
self.avatar = Some(JsFile::default());
// TODO: bail!("Chosen image is not a valid JPEG");
} else {
avatar.contents = Some(data);
return true;
}
}
}
if let Some(avatar) = &mut self.avatar
&& let Some(file) = &avatar.file
&& file.name() == file_name
&& let Result::Ok(data) = data
{
if !is_valid_jpeg(data.as_slice()) {
// Clear the selection.
self.avatar = Some(JsFile::default());
// TODO: bail!("Chosen image is not a valid JPEG");
} else {
avatar.contents = Some(data);
return true;
}
}
self.reader = None;
+4 -4
View File
@@ -8,7 +8,7 @@ pub mod group {
use super::AttributeDescription;
pub fn resolve_group_attribute_description(name: &str) -> Option<AttributeDescription> {
pub fn resolve_group_attribute_description(name: &str) -> Option<AttributeDescription<'_>> {
match name {
"creation_date" => Some(AttributeDescription {
attribute_identifier: name,
@@ -39,7 +39,7 @@ pub mod group {
}
}
pub fn resolve_group_attribute_description_or_default(name: &str) -> AttributeDescription {
pub fn resolve_group_attribute_description_or_default(name: &str) -> AttributeDescription<'_> {
match resolve_group_attribute_description(name) {
Some(d) => d,
None => AttributeDescription {
@@ -55,7 +55,7 @@ pub mod user {
use super::AttributeDescription;
pub fn resolve_user_attribute_description(name: &str) -> Option<AttributeDescription> {
pub fn resolve_user_attribute_description(name: &str) -> Option<AttributeDescription<'_>> {
match name {
"avatar" => Some(AttributeDescription {
attribute_identifier: name,
@@ -111,7 +111,7 @@ pub mod user {
}
}
pub fn resolve_user_attribute_description_or_default(name: &str) -> AttributeDescription {
pub fn resolve_user_attribute_description_or_default(name: &str) -> AttributeDescription<'_> {
match resolve_user_attribute_description(name) {
Some(d) => d,
None => AttributeDescription {
+1
View File
@@ -2,6 +2,7 @@
#![forbid(non_ascii_idents)]
#![allow(clippy::uninlined_format_args)]
#![allow(clippy::let_unit_value)]
#![allow(clippy::unnecessary_operation)] // Doesn't work well with the html macro.
pub mod components;
pub mod infra;