Skip to content

Commit 597ec11

Browse files
committed
fix: use PathBuf in ProductVersionContext
1 parent bdc6dfd commit 597ec11

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

rust/patchable/src/main.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ mod repo;
55
mod utils;
66

77
use core::str;
8-
use std::{
9-
fs::File,
10-
io::Write,
11-
path::{Path, PathBuf},
12-
};
8+
use std::{fs::File, io::Write, path::PathBuf};
139

1410
use git2::{Oid, Repository};
1511
use serde::{Deserialize, Serialize};
@@ -35,12 +31,12 @@ struct ProductVersionConfig {
3531
base: Oid,
3632
}
3733

38-
struct ProductVersionContext<'a> {
34+
struct ProductVersionContext {
3935
pv: ProductVersion,
40-
images_repo_root: &'a Path,
36+
images_repo_root: PathBuf,
4137
}
4238

43-
impl ProductVersionContext<'_> {
39+
impl ProductVersionContext {
4440
fn load_config(&self) -> Result<ProductVersionConfig> {
4541
let path = &self.config_path();
4642
tracing::info!(
@@ -271,10 +267,12 @@ fn main() -> Result<()> {
271267
Some(path) => path,
272268
None => {
273269
let images_repo = repo::discover_images_repo(".").context(FindImagesRepoSnafu)?;
274-
images_repo.workdir().context(NoImagesRepoWorkdirSnafu)?.to_owned()
270+
images_repo
271+
.workdir()
272+
.context(NoImagesRepoWorkdirSnafu)?
273+
.to_owned()
275274
}
276275
};
277-
let images_repo_root = images_repo_root.as_path();
278276
match opts.cmd {
279277
Cmd::Checkout { pv, base_only } => {
280278
let ctx = ProductVersionContext {

0 commit comments

Comments
 (0)