diff --git a/.github/workflows/rust-compile.yml b/.github/workflows/rust-compile.yml index 341bb6b..d5729cb 100644 --- a/.github/workflows/rust-compile.yml +++ b/.github/workflows/rust-compile.yml @@ -25,29 +25,7 @@ jobs: - uses: actions-rust-lang/setup-rust-toolchain@v1 - shell: bash run: > - # Check intra-doc links, thanks to ChatGPT - cargo metadata --no-deps --format-version=1 \ - | jq -r '.packages[] | .name as $pname | .targets[] | [$pname, .kind[], .name] | @tsv' \ - | while IFS=$'\t' read -r package kind name; do - case "$kind" in - lib) - cargo rustdoc -p "$package" --lib --all-features -- -D warnings -W unreachable-pub - ;; - bin) - cargo rustdoc -p "$package" --bin "$name" --all-features -- -D warnings -W unreachable-pub - ;; - example) - cargo rustdoc -p "$package" --example "$name" --all-features -- -D warnings -W unreachable-pub - ;; - test) - cargo rustdoc -p "$package" --test "$name" --all-features -- -D warnings -W unreachable-pub - ;; - bench) - cargo rustdoc -p "$package" --bench "$name" --all-features -- -D warnings -W unreachable-pub - ;; - esac - done - + ./intra-doc-links.bash format_and_lint: name: Format and Lint runs-on: ubuntu-latest diff --git a/intra-doc-links.bash b/intra-doc-links.bash new file mode 100644 index 0000000..96d586f --- /dev/null +++ b/intra-doc-links.bash @@ -0,0 +1,21 @@ +cargo metadata --no-deps --format-version=1 \ +| jq -r '.packages[] | .name as $pname | .targets[] | [$pname, .kind[], .name] | @tsv' \ +| while IFS=$'\t' read -r package kind name; do + case "$kind" in + lib) + cargo rustdoc -p "$package" --lib --all-features -- -D warnings -W unreachable-pub + ;; + bin) + cargo rustdoc -p "$package" --bin "$name" --all-features -- -D warnings -W unreachable-pub + ;; + example) + cargo rustdoc -p "$package" --example "$name" --all-features -- -D warnings -W unreachable-pub + ;; + test) + cargo rustdoc -p "$package" --test "$name" --all-features -- -D warnings -W unreachable-pub + ;; + bench) + cargo rustdoc -p "$package" --bench "$name" --all-features -- -D warnings -W unreachable-pub + ;; + esac +done