Skip to content

Commit 1c72e54

Browse files
authored
Merge pull request #19315 from snprajwal/ci-xtask
fix(codegen): do not generate docs with `--check`
2 parents 64d39c1 + 1f366e7 commit 1c72e54

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

xtask/src/codegen/assists_doc_tests.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ r#####"
5353
);
5454
}
5555

56+
// Do not generate assists manual when run with `--check`
57+
if check {
58+
return;
59+
}
60+
5661
{
5762
// Generate assists manual. Note that we do _not_ commit manual to the
5863
// git repo. Instead, `cargo xtask release` runs this test before making

xtask/src/codegen/diagnostics_docs.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ use crate::{
1010

1111
pub(crate) fn generate(check: bool) {
1212
let diagnostics = Diagnostic::collect().unwrap();
13-
if !check {
14-
let contents =
15-
diagnostics.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");
16-
let contents = add_preamble(crate::flags::CodegenType::DiagnosticsDocs, contents);
17-
let dst = project_root().join("docs/book/src/diagnostics_generated.md");
18-
fs::write(dst, contents).unwrap();
13+
// Do not generate docs when run with `--check`
14+
if check {
15+
return;
1916
}
17+
let contents =
18+
diagnostics.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");
19+
let contents = add_preamble(crate::flags::CodegenType::DiagnosticsDocs, contents);
20+
let dst = project_root().join("docs/book/src/diagnostics_generated.md");
21+
fs::write(dst, contents).unwrap();
2022
}
2123

2224
#[derive(Debug)]

xtask/src/codegen/feature_docs.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ use crate::{
88
util::list_rust_files,
99
};
1010

11-
pub(crate) fn generate(_check: bool) {
11+
pub(crate) fn generate(check: bool) {
1212
let features = Feature::collect().unwrap();
13+
// Do not generate docs when run with `--check`
14+
if check {
15+
return;
16+
}
1317
let contents = features.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");
1418
let contents = add_preamble(crate::flags::CodegenType::FeatureDocs, contents);
1519
let dst = project_root().join("docs/book/src/features_generated.md");

0 commit comments

Comments
 (0)