Simplify Model::from_path

This commit is contained in:
Hanno Braun 2022-03-16 14:20:01 +01:00
parent bf5c31f463
commit f094ce41d9
2 changed files with 6 additions and 8 deletions

View File

@ -53,10 +53,11 @@ fn main() -> anyhow::Result<()> {
let args = Args::parse();
let config = Config::load()?;
let model = Model::from_path(
config.default_path,
args.model.unwrap_or(config.default_model),
);
let mut path = config.default_path;
path.push(args.model.unwrap_or(config.default_model));
let model = Model::from_path(path);
let mut parameters = HashMap::new();
for parameter in args.parameters {

View File

@ -12,10 +12,7 @@ pub struct Model {
}
impl Model {
pub fn from_path(base_path: PathBuf, rel_path: PathBuf) -> Self {
let mut path = base_path;
path.push(rel_path);
pub fn from_path(path: PathBuf) -> Self {
Self { path }
}