Skip to content

Commit e034941

Browse files
Make certain comparisons case-insensitive
1 parent 8230ed8 commit e034941

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ async fn actual_main(mut cli_app: Ferium) -> Result<()> {
307307
.await
308308
{
309309
return Err(
310-
if err.to_string() == ferinth::Error::InvalidIDorSlug.to_string() {
310+
if let Some(&ferinth::Error::InvalidIDorSlug) = err.downcast_ref() {
311311
anyhow!("Invalid identifier")
312312
} else {
313313
err

src/subcommands/modpack/delete.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn delete(
1818
config
1919
.modpacks
2020
.iter()
21-
.position(|modpack| modpack.name == modpack_name)
21+
.position(|modpack| modpack.name.eq_ignore_ascii_case(&modpack_name))
2222
.context("The modpack name provided does not exist")?
2323
} else {
2424
let modpack_names = config

src/subcommands/modpack/switch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn switch(config: &mut Config, modpack_name: Option<String>) -> Result<()> {
1414
match config
1515
.modpacks
1616
.iter()
17-
.position(|modpack| modpack.name == modpack_name)
17+
.position(|modpack| modpack.name.eq_ignore_ascii_case(&modpack_name))
1818
{
1919
Some(selection) => {
2020
config.active_modpack = selection;

src/subcommands/profile/switch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub fn switch(config: &mut Config, profile_name: Option<String>) -> Result<()> {
1313
match config
1414
.profiles
1515
.iter()
16-
.position(|profile| profile.name == profile_name)
16+
.position(|profile| profile.name.eq_ignore_ascii_case(&profile_name))
1717
{
1818
Some(selection) => {
1919
config.active_profile = selection;

src/subcommands/upgrade.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,11 @@ pub async fn upgrade(profile: &Profile) -> Result<()> {
115115
for file in read_dir(profile.output_dir.join("user"))? {
116116
let file = file?;
117117
let path = file.path();
118-
if path.is_file() && path.extension().is_some_and(|ext| ext == "jar") {
118+
if path.is_file()
119+
&& path
120+
.extension()
121+
.is_some_and(|ext| ext.eq_ignore_ascii_case("jar"))
122+
{
119123
to_install.push((file.file_name(), path));
120124
}
121125
}

0 commit comments

Comments
 (0)