Skip to content

Commit

Permalink
[refactor,style]: cleanup more code + cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
null8626 committed Feb 2, 2024
1 parent 2b80302 commit bbdaaa9
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/app/from_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl App {

let version = self.select(
"Select a version",
&versions
versions
.iter()
.map(|v| {
SelectItem(
Expand Down Expand Up @@ -126,7 +126,7 @@ impl App {

let version = self.select(
"Select a version",
&versions
versions
.iter()
.map(|v| {
SelectItem(
Expand Down Expand Up @@ -165,7 +165,7 @@ impl App {

let version = self.select(
"Select a version",
&versions
versions
.iter()
.map(|v| {
SelectItem(
Expand Down
2 changes: 1 addition & 1 deletion src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ impl App {
worlds => WorldsAPI,
hooks => HooksAPI,
}

interop_methods_mut! {
packwiz => PackwizInterop,
mrpack => MRPackInterop,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/import/mrpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub async fn run(mut app: App, args: Args) -> Result<()> {
};

if !args.keep {
app.server.mods = vec![];
app.server.mods.clear();
app.info("cleared mods list");
}

Expand Down
5 changes: 4 additions & 1 deletion src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ impl<'a> BuildContext<'a> {

/// Save `new_lockfile`
pub fn write_lockfile(&mut self) -> Result<()> {
if std::env::var("MCMAN_DISABLE_LOCKFILE") == Ok("true".to_owned()) {
if std::env::var("MCMAN_DISABLE_LOCKFILE")
.map(|s| s.as_str() == "true")
.unwrap_or_default()
{
self.app.dbg("lockfile disabled");
} else {
self.new_lockfile.save()?;
Expand Down
20 changes: 10 additions & 10 deletions src/interop/packwiz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,16 @@ impl<'a> PackwizInterop<'a> {
_ => return Ok(None),
};

Ok(
self.0.modrinth()
.version_from_hash(&down.hash, fmt)
.await
.map(|ver| Downloadable::Modrinth {
id: ver.project_id.clone(),
version: ver.id.clone(),
})
.ok()
)
Ok(self
.0
.modrinth()
.version_from_hash(&down.hash, fmt)
.await
.map(|ver| Downloadable::Modrinth {
id: ver.project_id.clone(),
version: ver.id.clone(),
})
.ok())
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ enum Commands {

#[tokio::main]
async fn main() -> Result<()> {
if env::var("CI") == Ok("true".to_owned()) {
if env::var("CI")
.map(|s| s.as_str() == "true")
.unwrap_or_default()
{
println!("::endgroup::");
}

Expand Down
3 changes: 1 addition & 2 deletions src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ pub fn get_latest_semver(list: &[String]) -> Option<String> {

/// ci.luckto.me => ci-lucko-me
pub fn url_to_folder(url: &str) -> String {
url
.replace("https://", "")
url.replace("https://", "")
.replace("http://", "")
.replace('/', " ")
.trim()
Expand Down

0 comments on commit bbdaaa9

Please sign in to comment.