You've already forked AstralRinth
forked from didirus/AstralRinth
Fix Clippy lints (#3494)
* chore: fix some Clippy lints * chore(labrinth): more Clippy fixes
This commit is contained in:
committed by
GitHub
parent
365367dd16
commit
e008b657a5
@@ -598,7 +598,7 @@ async fn fetch(
|
|||||||
))
|
))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let file_name = value.split('/').last()
|
let file_name = value.split('/').next_back()
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
crate::ErrorKind::InvalidInput(format!(
|
crate::ErrorKind::InvalidInput(format!(
|
||||||
"Unable reading filename for data key {key} at path {value}",
|
"Unable reading filename for data key {key} at path {value}",
|
||||||
|
|||||||
@@ -189,8 +189,8 @@ impl ChargeType {
|
|||||||
pub fn as_str(&self) -> &'static str {
|
pub fn as_str(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
ChargeType::OneTime => "one-time",
|
ChargeType::OneTime => "one-time",
|
||||||
ChargeType::Subscription { .. } => "subscription",
|
ChargeType::Subscription => "subscription",
|
||||||
ChargeType::Proration { .. } => "proration",
|
ChargeType::Proration => "proration",
|
||||||
ChargeType::Refund => "refund",
|
ChargeType::Refund => "refund",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ pub async fn version_create(
|
|||||||
// Handle project type via file extension prediction
|
// Handle project type via file extension prediction
|
||||||
let mut project_type = None;
|
let mut project_type = None;
|
||||||
for file_part in &legacy_create.file_parts {
|
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 {
|
match ext {
|
||||||
"mrpack" | "mrpack-primary" => {
|
"mrpack" | "mrpack-primary" => {
|
||||||
project_type = Some("modpack");
|
project_type = Some("modpack");
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ pub async fn get_update_from_hash(
|
|||||||
database::models::Project::get_id(file.project_id, &**pool, &redis)
|
database::models::Project::get_id(file.project_id, &**pool, &redis)
|
||||||
.await?
|
.await?
|
||||||
{
|
{
|
||||||
let versions = database::models::Version::get_many(
|
let mut versions = database::models::Version::get_many(
|
||||||
&project.versions,
|
&project.versions,
|
||||||
&**pool,
|
&**pool,
|
||||||
&redis,
|
&redis,
|
||||||
@@ -191,7 +191,7 @@ pub async fn get_update_from_hash(
|
|||||||
})
|
})
|
||||||
.sorted();
|
.sorted();
|
||||||
|
|
||||||
if let Some(first) = versions.last() {
|
if let Some(first) = versions.next_back() {
|
||||||
if !is_visible_version(
|
if !is_visible_version(
|
||||||
&first.inner,
|
&first.inner,
|
||||||
&user_option,
|
&user_option,
|
||||||
@@ -523,7 +523,7 @@ pub async fn update_individual_files(
|
|||||||
bool
|
bool
|
||||||
})
|
})
|
||||||
.sorted()
|
.sorted()
|
||||||
.last();
|
.next_back();
|
||||||
|
|
||||||
if let Some(version) = version {
|
if let Some(version) = version {
|
||||||
if is_visible_version(
|
if is_visible_version(
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ pub async fn import_curseforge(
|
|||||||
let icon_bytes =
|
let icon_bytes =
|
||||||
fetch(&thumbnail_url, None, &state.fetch_semaphore, &state.pool)
|
fetch(&thumbnail_url, None, &state.fetch_semaphore, &state.pool)
|
||||||
.await?;
|
.await?;
|
||||||
let filename = thumbnail_url.rsplit('/').last();
|
let filename = thumbnail_url.rsplit('/').next_back();
|
||||||
if let Some(filename) = filename {
|
if let Some(filename) = filename {
|
||||||
icon = Some(
|
icon = Some(
|
||||||
write_cached_icon(
|
write_cached_icon(
|
||||||
|
|||||||
@@ -139,9 +139,7 @@ pub async fn write(
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.map_err(|_| {
|
.map_err(|_| std::io::Error::other("background task failed"))??;
|
||||||
std::io::Error::new(std::io::ErrorKind::Other, "background task failed")
|
|
||||||
})??;
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -152,8 +150,7 @@ fn sync_write(
|
|||||||
) -> Result<(), std::io::Error> {
|
) -> Result<(), std::io::Error> {
|
||||||
let mut tempfile =
|
let mut tempfile =
|
||||||
NamedTempFile::new_in(path.as_ref().parent().ok_or_else(|| {
|
NamedTempFile::new_in(path.as_ref().parent().ok_or_else(|| {
|
||||||
std::io::Error::new(
|
std::io::Error::other(
|
||||||
std::io::ErrorKind::Other,
|
|
||||||
"could not get parent directory for temporary file",
|
"could not get parent directory for temporary file",
|
||||||
)
|
)
|
||||||
})?)?;
|
})?)?;
|
||||||
|
|||||||
Reference in New Issue
Block a user