Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'xtask/src/codegen/diagnostics_docs.rs')
-rw-r--r--xtask/src/codegen/diagnostics_docs.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/xtask/src/codegen/diagnostics_docs.rs b/xtask/src/codegen/diagnostics_docs.rs
index cf8f97be00..4a47a5f6aa 100644
--- a/xtask/src/codegen/diagnostics_docs.rs
+++ b/xtask/src/codegen/diagnostics_docs.rs
@@ -3,20 +3,22 @@
use std::{fmt, fs, io, path::PathBuf};
use crate::{
- codegen::{add_preamble, CommentBlock, Location},
+ codegen::{CommentBlock, Location, add_preamble},
project_root,
util::list_rust_files,
};
pub(crate) fn generate(check: bool) {
let diagnostics = Diagnostic::collect().unwrap();
- if !check {
- let contents =
- diagnostics.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");
- let contents = add_preamble(crate::flags::CodegenType::DiagnosticsDocs, contents);
- let dst = project_root().join("docs/book/src/diagnostics_generated.md");
- fs::write(dst, contents).unwrap();
+ // Do not generate docs when run with `--check`
+ if check {
+ return;
}
+ let contents =
+ diagnostics.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");
+ let contents = add_preamble(crate::flags::CodegenType::DiagnosticsDocs, contents);
+ let dst = project_root().join("docs/book/src/diagnostics_generated.md");
+ fs::write(dst, contents).unwrap();
}
#[derive(Debug)]