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 args = Args::parse();
let config = Config::load()?; let config = Config::load()?;
let model = Model::from_path(
config.default_path, let mut path = config.default_path;
args.model.unwrap_or(config.default_model), path.push(args.model.unwrap_or(config.default_model));
);
let model = Model::from_path(path);
let mut parameters = HashMap::new(); let mut parameters = HashMap::new();
for parameter in args.parameters { for parameter in args.parameters {

View File

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