style: apply rustfmt
This commit is contained in:
1 parent
7723716e18
commit
a58e6fb76d
20 files changed
+114
-83
No files matched your search
@@ -6,11 +6,11 @@ pub mod resource_packs;
|
||||
pub mod shaders;
|
||||
pub mod worlds;
|
||||
|
||||
pub use mods::{ContentEntry, scan_mods, toggle_entry};
|
||||
pub use mods::scan_one_mod;
|
||||
pub use resource_packs::{scan_resource_packs, scan_one_resource_pack};
|
||||
pub use shaders::{scan_shaders, scan_one_shader};
|
||||
pub use worlds::{scan_worlds, scan_one_world};
|
||||
pub use mods::{ContentEntry, scan_mods, toggle_entry};
|
||||
pub use resource_packs::{scan_one_resource_pack, scan_resource_packs};
|
||||
pub use shaders::{scan_one_shader, scan_shaders};
|
||||
pub use worlds::{scan_one_world, scan_worlds};
|
||||
|
||||
use std::io::Read;
|
||||
|
||||
|
||||
@@ -742,7 +742,8 @@ description = "A neoforge mod"
|
||||
fn scan_mods_prefers_neoforge_toml_over_forge_toml() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let dir = setup_mods_dir(tmp.path(), "inst");
|
||||
let neoforge = "[[mods]]\ndisplayName = \"NeoForge Name\"\ndescription = \"neoforge desc\"\n";
|
||||
let neoforge =
|
||||
"[[mods]]\ndisplayName = \"NeoForge Name\"\ndescription = \"neoforge desc\"\n";
|
||||
let forge = "[[mods]]\ndisplayName = \"Forge Name\"\ndescription = \"forge desc\"\n";
|
||||
make_jar(
|
||||
&dir,
|
||||
|
||||
@@ -89,4 +89,3 @@ fn read_shader_metadata_from_dir(dir: &Path) -> (String, Option<Vec<u8>>) {
|
||||
|
||||
(description, icon_bytes)
|
||||
}
|
||||
|
||||
@@ -134,4 +134,3 @@ fn format_size(bytes: u64) -> String {
|
||||
format!("{:.2} GB", bytes as f64 / (1024.0 * 1024.0 * 1024.0))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,11 +154,7 @@ mod tests {
|
||||
#[test]
|
||||
fn detect_format_recognises_mrpack() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let path = make_pack_zip(
|
||||
tmp.path(),
|
||||
"pack.mrpack",
|
||||
&[("modrinth.index.json", b"{}")],
|
||||
);
|
||||
let path = make_pack_zip(tmp.path(), "pack.mrpack", &[("modrinth.index.json", b"{}")]);
|
||||
assert_eq!(detect_format(&path), Ok(PackFormat::Mrpack));
|
||||
}
|
||||
|
||||
@@ -176,11 +172,7 @@ mod tests {
|
||||
// mmc-pack.json one directory deep - the more common layout where
|
||||
// the archive wraps everything in a named directory.
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let path = make_pack_zip(
|
||||
tmp.path(),
|
||||
"pack.zip",
|
||||
&[("MyPack/mmc-pack.json", b"{}")],
|
||||
);
|
||||
let path = make_pack_zip(tmp.path(), "pack.zip", &[("MyPack/mmc-pack.json", b"{}")]);
|
||||
assert_eq!(detect_format(&path), Ok(PackFormat::Mmc));
|
||||
}
|
||||
|
||||
@@ -192,10 +184,7 @@ mod tests {
|
||||
let path = make_pack_zip(
|
||||
tmp.path(),
|
||||
"weird.zip",
|
||||
&[
|
||||
("modrinth.index.json", b"{}"),
|
||||
("mmc-pack.json", b"{}"),
|
||||
],
|
||||
&[("modrinth.index.json", b"{}"), ("mmc-pack.json", b"{}")],
|
||||
);
|
||||
assert_eq!(detect_format(&path), Ok(PackFormat::Mrpack));
|
||||
}
|
||||
|
||||
@@ -383,8 +383,13 @@ mod tests {
|
||||
#[test]
|
||||
fn parse_add_opens_extracts_module_args() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let manifest = b"Manifest-Version: 1.0\nAdd-Opens: java.base/java.lang java.base/java.util\n";
|
||||
let zip_path = make_zip(tmp.path(), "patches.zip", &[("META-INF/MANIFEST.MF", manifest)]);
|
||||
let manifest =
|
||||
b"Manifest-Version: 1.0\nAdd-Opens: java.base/java.lang java.base/java.util\n";
|
||||
let zip_path = make_zip(
|
||||
tmp.path(),
|
||||
"patches.zip",
|
||||
&[("META-INF/MANIFEST.MF", manifest)],
|
||||
);
|
||||
let args = parse_add_opens(&zip_path).expect("parsed");
|
||||
assert_eq!(
|
||||
args,
|
||||
|
||||
@@ -468,7 +468,9 @@ mod tests {
|
||||
|
||||
manager.touch_last_played("ticker").expect("touch");
|
||||
let reloaded = manager.load_one("ticker").unwrap();
|
||||
let stamp = reloaded.last_played.expect("last_played should be Some now");
|
||||
let stamp = reloaded
|
||||
.last_played
|
||||
.expect("last_played should be Some now");
|
||||
let age = chrono::Utc::now() - stamp;
|
||||
assert!(
|
||||
age.num_seconds().abs() < 5,
|
||||
|
||||
+2
-5
@@ -11,11 +11,8 @@ pub mod models;
|
||||
pub mod screenshots;
|
||||
|
||||
pub use content::{
|
||||
ContentEntry, toggle_entry,
|
||||
scan_mods, scan_one_mod,
|
||||
scan_resource_packs, scan_one_resource_pack,
|
||||
scan_shaders, scan_one_shader,
|
||||
scan_worlds, scan_one_world,
|
||||
ContentEntry, scan_mods, scan_one_mod, scan_one_resource_pack, scan_one_shader, scan_one_world,
|
||||
scan_resource_packs, scan_shaders, scan_worlds, toggle_entry,
|
||||
};
|
||||
pub use launch::LaunchError;
|
||||
pub use loader::{GameVersion, ModLoaderInstaller, VanillaInstaller, get_installer};
|
||||
|
||||
@@ -45,4 +45,3 @@ pub fn scan_screenshots(instances_dir: &Path, instance_name: &str) -> Vec<Screen
|
||||
entries.sort_by(|a, b| b.name.cmp(&a.name));
|
||||
entries
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user