Skip to content

Commit a8fc697

Browse files
committed
dist: inline short single-use function
1 parent ac8ad88 commit a8fc697

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

src/dist/component/package.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ pub struct DirectoryPackage {
3636

3737
impl DirectoryPackage {
3838
pub fn new(path: PathBuf, copy: bool) -> Result<Self> {
39-
validate_installer_version(&path)?;
39+
let file = utils::read_file("installer version", &path.join(VERSION_FILE))?;
40+
let v = file.trim();
41+
if v != INSTALLER_VERSION {
42+
return Err(anyhow!(format!("unsupported installer version: {v}")));
43+
}
4044

4145
let content = utils::read_file("package components", &path.join("components"))?;
4246
let components = content.lines().map(ToOwned::to_owned).collect();
@@ -46,19 +50,7 @@ impl DirectoryPackage {
4650
copy,
4751
})
4852
}
49-
}
50-
51-
fn validate_installer_version(path: &Path) -> Result<()> {
52-
let file = utils::read_file("installer version", &path.join(VERSION_FILE))?;
53-
let v = file.trim();
54-
if v == INSTALLER_VERSION {
55-
Ok(())
56-
} else {
57-
Err(anyhow!(format!("unsupported installer version: {v}")))
58-
}
59-
}
6053

61-
impl DirectoryPackage {
6254
pub fn contains(&self, component: &str, short_name: Option<&str>) -> bool {
6355
self.components.contains(component)
6456
|| if let Some(n) = short_name {

0 commit comments

Comments
 (0)