Fix Clippy lints (#3494)

* chore: fix some Clippy lints

* chore(labrinth): more Clippy fixes
This commit is contained in:
Alejandro González
2025-04-12 15:45:17 +02:00
committed by GitHub
parent 365367dd16
commit e008b657a5
6 changed files with 10 additions and 13 deletions

View File

@@ -598,7 +598,7 @@ async fn fetch(
))
})?;
let file_name = value.split('/').last()
let file_name = value.split('/').next_back()
.ok_or_else(|| {
crate::ErrorKind::InvalidInput(format!(
"Unable reading filename for data key {key} at path {value}",

View File

@@ -189,8 +189,8 @@ impl ChargeType {
pub fn as_str(&self) -> &'static str {
match self {
ChargeType::OneTime => "one-time",
ChargeType::Subscription { .. } => "subscription",
ChargeType::Proration { .. } => "proration",
ChargeType::Subscription => "subscription",
ChargeType::Proration => "proration",
ChargeType::Refund => "refund",
}
}

View File

@@ -188,7 +188,7 @@ pub async fn version_create(
// Handle project type via file extension prediction
let mut project_type = None;
for file_part in &legacy_create.file_parts {
if let Some(ext) = file_part.split('.').last() {
if let Some(ext) = file_part.split('.').next_back() {
match ext {
"mrpack" | "mrpack-primary" => {
project_type = Some("modpack");

View File

@@ -155,7 +155,7 @@ pub async fn get_update_from_hash(
database::models::Project::get_id(file.project_id, &**pool, &redis)
.await?
{
let versions = database::models::Version::get_many(
let mut versions = database::models::Version::get_many(
&project.versions,
&**pool,
&redis,
@@ -191,7 +191,7 @@ pub async fn get_update_from_hash(
})
.sorted();
if let Some(first) = versions.last() {
if let Some(first) = versions.next_back() {
if !is_visible_version(
&first.inner,
&user_option,
@@ -523,7 +523,7 @@ pub async fn update_individual_files(
bool
})
.sorted()
.last();
.next_back();
if let Some(version) = version {
if is_visible_version(