]> git.lizzy.rs Git - rust.git/blob - src/tools/tidy/src/primitive_docs.rs
Merge commit 'a98e7ab8b94485be6bd03e0c6b8682ecab5b52e6' into clippyup
[rust.git] / src / tools / tidy / src / primitive_docs.rs
1 //! Tidy check to make sure `library/{std,core}/src/primitive_docs.rs` are the same file.  These are
2 //! different files so that relative links work properly without having to have `CARGO_PKG_NAME`
3 //! set, but conceptually they should always be the same.
4
5 use std::path::Path;
6
7 pub fn check(library_path: &Path, bad: &mut bool) {
8     let std_name = "std/src/primitive_docs.rs";
9     let core_name = "core/src/primitive_docs.rs";
10     let std_contents = std::fs::read_to_string(library_path.join(std_name))
11         .unwrap_or_else(|e| panic!("failed to read library/{}: {}", std_name, e));
12     let core_contents = std::fs::read_to_string(library_path.join(core_name))
13         .unwrap_or_else(|e| panic!("failed to read library/{}: {}", core_name, e));
14     if std_contents != core_contents {
15         tidy_error!(bad, "library/{} and library/{} have different contents", core_name, std_name);
16     }
17 }