summaryrefslogtreecommitdiffstats
path: root/src/launcher/runner.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/launcher/runner.rs')
-rw-r--r--src/launcher/runner.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/launcher/runner.rs b/src/launcher/runner.rs
index f7fd025..afdfc7f 100644
--- a/src/launcher/runner.rs
+++ b/src/launcher/runner.rs
@@ -21,7 +21,7 @@ const PATH_SEP: &str = ";";
#[cfg(not(windows))]
const PATH_SEP: &str = ":";
-impl<'rep, 'l, F: FeatureMatcher> SubFunc<'rep> for LaunchArgSub<'rep, 'l, F> {
+impl<'rep, F: FeatureMatcher> SubFunc<'rep> for LaunchArgSub<'rep, '_, F> {
fn substitute(&self, key: &str) -> Option<Cow<'rep, str>> {
match key {
"assets_index_name" => self.0.asset_index_name.as_ref().map(|s| Cow::Borrowed(s.as_str())),
@@ -51,12 +51,11 @@ impl<'rep, 'l, F: FeatureMatcher> SubFunc<'rep> for LaunchArgSub<'rep, 'l, F> {
"user_properties" => Some(Cow::Borrowed("{}")), // TODO
"user_property_map" => Some(Cow::Borrowed("[]")), // TODO
"user_type" => Some(Cow::Borrowed("legacy")), // TODO
- "version_name" => Some(Cow::Borrowed(&self.0.version_id.as_ref())),
+ "version_name" => Some(Cow::Borrowed(self.0.version_id.as_ref())),
"version_type" => self.0.version_type.as_ref().map(|s| Cow::Borrowed(s.to_str())),
_ => {
if let Some(asset_key) = key.strip_prefix("asset=") {
- return self.0.asset_index.as_ref()
- .map_or(None, |idx| idx.objects.get(asset_key))
+ return self.0.asset_index.as_ref().and_then(|idx| idx.objects.get(asset_key))
.map(|obj| Cow::Owned(self.0.launcher.assets.get_object_path(obj).as_java_path().to_string_lossy().into_owned()))
}
@@ -68,16 +67,16 @@ impl<'rep, 'l, F: FeatureMatcher> SubFunc<'rep> for LaunchArgSub<'rep, 'l, F> {
#[derive(Clone, Copy)]
pub enum ArgumentType {
- JVM,
+ Jvm,
Game
}
-pub fn build_arguments<'l, F: FeatureMatcher>(launch: &LaunchInfo<'l, F>, version: &CompleteVersion, arg_type: ArgumentType) -> Vec<OsString> {
+pub fn build_arguments<F: FeatureMatcher>(launch: &LaunchInfo<'_, F>, version: &CompleteVersion, arg_type: ArgumentType) -> Vec<OsString> {
let sub = LaunchArgSub(launch);
let system_info = &launch.launcher.system_info;
- if let Some(arguments) = version.arguments.as_ref().map_or(None, |args| match arg_type {
- ArgumentType::JVM => args.jvm.as_ref(),
+ if let Some(arguments) = version.arguments.as_ref().and_then(|args| match arg_type {
+ ArgumentType::Jvm => args.jvm.as_ref(),
ArgumentType::Game => args.game.as_ref()
}) {
arguments.iter()
@@ -86,7 +85,7 @@ pub fn build_arguments<'l, F: FeatureMatcher>(launch: &LaunchInfo<'l, F>, versio
.map(|s| OsString::from(strsub::replace_string(s, &sub).into_owned())).collect()
} else if let Some(arguments) = version.minecraft_arguments.as_ref() {
match arg_type {
- ArgumentType::JVM => {
+ ArgumentType::Jvm => {
[
"-Djava.library.path=${natives_directory}",
"-Dminecraft.launcher.brand=${launcher_name}",