Skip to content

Commit b8959a2

Browse files
authored
Refactor: extract compile_objects_sequential (#1507)
* Refactor: extract compile_objects_sequential * Fix fmt in lib.rs
1 parent 3f62db1 commit b8959a2

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/lib.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,12 +1683,7 @@ impl Build {
16831683
check_disabled()?;
16841684

16851685
if objs.len() <= 1 {
1686-
for obj in objs {
1687-
let mut cmd = self.create_compile_object_cmd(obj)?;
1688-
run(&mut cmd, &self.cargo_output)?;
1689-
}
1690-
1691-
return Ok(());
1686+
return self.compile_objects_sequential(objs);
16921687
}
16931688

16941689
// Limit our parallelism globally with a jobserver.
@@ -1816,10 +1811,7 @@ impl Build {
18161811
}
18171812
}
18181813

1819-
#[cfg(not(feature = "parallel"))]
1820-
fn compile_objects(&self, objs: &[Object]) -> Result<(), Error> {
1821-
check_disabled()?;
1822-
1814+
fn compile_objects_sequential(&self, objs: &[Object]) -> Result<(), Error> {
18231815
for obj in objs {
18241816
let mut cmd = self.create_compile_object_cmd(obj)?;
18251817
run(&mut cmd, &self.cargo_output)?;
@@ -1828,6 +1820,13 @@ impl Build {
18281820
Ok(())
18291821
}
18301822

1823+
#[cfg(not(feature = "parallel"))]
1824+
fn compile_objects(&self, objs: &[Object]) -> Result<(), Error> {
1825+
check_disabled()?;
1826+
1827+
self.compile_objects_sequential(objs)
1828+
}
1829+
18311830
fn create_compile_object_cmd(&self, obj: &Object) -> Result<Command, Error> {
18321831
let asm_ext = AsmFileExt::from_path(&obj.src);
18331832
let is_asm = asm_ext.is_some();

0 commit comments

Comments
 (0)