about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Beránek <jakub.beranek@vsb.cz>2024-07-07 13:28:14 +0200
committerJakub Beránek <berykubik@gmail.com>2024-07-12 20:15:19 +0200
commit8ee18d600f962df67e831da4d07cc556cff39526 (patch)
treeca3ad882d01ea45cc5eccde1ca67d9d20ec8b320
parent9634633889a48d1d565ce22cc0b577addd2ab32c (diff)
downloadrust-8ee18d600f962df67e831da4d07cc556cff39526.tar.gz
rust-8ee18d600f962df67e831da4d07cc556cff39526.zip
Fix a case where a RustBook command is potentially not executed
We can move the command creation to a block where it is clear that the command will be executed.
-rw-r--r--src/bootstrap/src/core/build_steps/doc.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs
index 4b35d6c5d4c..d1080775efe 100644
--- a/src/bootstrap/src/core/build_steps/doc.rs
+++ b/src/bootstrap/src/core/build_steps/doc.rs
@@ -146,7 +146,6 @@ impl<P: Step> Step for RustbookSrc<P> {
         let out = out.join(&name);
         let index = out.join("index.html");
         let rustbook = builder.tool_exe(Tool::Rustbook);
-        let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook);
 
         if !builder.config.dry_run()
             && (!up_to_date(&src, &index) || !up_to_date(&rustbook, &index))
@@ -154,7 +153,13 @@ impl<P: Step> Step for RustbookSrc<P> {
             builder.info(&format!("Rustbook ({target}) - {name}"));
             let _ = fs::remove_dir_all(&out);
 
-            rustbook_cmd.arg("build").arg(&src).arg("-d").arg(&out).run(builder);
+            builder
+                .tool_cmd(Tool::Rustbook)
+                .arg("build")
+                .arg(&src)
+                .arg("-d")
+                .arg(&out)
+                .run(builder);
 
             for lang in &self.languages {
                 let out = out.join(lang);