Skip to content

Commit

Permalink
AutoSplitterSettings: Default
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKnauth committed May 9, 2024
1 parent 83620b6 commit f3196d3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
10 changes: 1 addition & 9 deletions src/run/auto_splitter_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,14 @@ use crate::run::parser::livesplit::Version;
use core::fmt::Debug;
use livesplit_auto_splitting::settings;

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Default, Clone, PartialEq)]
pub struct AutoSplitterSettings {
pub version: Version,
pub script_path: String,
pub custom_settings: settings::Map,
}

impl AutoSplitterSettings {
pub fn new() -> Self {
Self {
version: Version::default(),
script_path: String::default(),
custom_settings: settings::Map::default(),
}
}

pub fn set_version(&mut self, version: Version) {
self.version = version;
}
Expand Down
2 changes: 1 addition & 1 deletion src/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ impl Run {
let p = self.parsed_auto_splitter_settings_mut();
match p {
None => {
let mut a = AutoSplitterSettings::new();
let mut a = AutoSplitterSettings::default();
a.set_custom_settings(settings_map);
*p = Some(a);
}
Expand Down
2 changes: 1 addition & 1 deletion src/run/parser/livesplit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ fn parse_auto_splitter_settings(
#[cfg(feature = "auto-splitting")]
let mut any_parsed = false;
#[cfg(feature = "auto-splitting")]
let mut settings = AutoSplitterSettings::new();
let mut settings = AutoSplitterSettings::default();

#[cfg(feature = "auto-splitting")]
// The compiler seems to throw a warning that 'attributes' isn't used by default, it actually is though
Expand Down

0 comments on commit f3196d3

Please sign in to comment.