Skip to content

Commit

Permalink
/tmp/tools
Browse files Browse the repository at this point in the history
  • Loading branch information
Bromeon committed Jun 23, 2024
1 parent 29cdf3f commit a1252ed
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/other/apply-doc-cfg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ if [[ "$installSd" == "true" ]]; then
# Install sd (modern sed). No point in waiting for eternal `cargo install` if we can fetch a prebuilt binary in 1s.
echo "$PRE install sd (modern sed)..."
curl -L https://github.com/chmln/sd/releases/download/v${SD_VERSION}/sd-v${SD_VERSION}-x86_64-unknown-linux-musl.tar.gz -o archive.tar.gz
mkdir -p tools
tar -zxvf archive.tar.gz -C tools --strip-components=1
alias sd=./tools/sd
mkdir -p /tmp/tools
tar -zxvf archive.tar.gz -C /tmp/tools --strip-components=1
sd=/tmp/tools/sd
else
sd=sd
fi

echo "$PRE preprocess docs..."
Expand All @@ -59,7 +61,7 @@ find . -type f -name '*.rs' \
| while read -r file; do
# Replace #[cfg(...)] with #[doc(cfg(...))]. Do not insert a newline, in case the #[cfg] is commented-out.
# shellcheck disable=SC2016
sd '(\#\[(cfg\(.+?\))\])\s*([A-Za-z]|#\[)' '$1 #[doc($2)]\n$3' "$file"
$sd '(\#\[(cfg\(.+?\))\])\s*([A-Za-z]|#\[)' '$1 #[doc($2)]\n$3' "$file"
# ^^^^^^^^^^^^^^^^^ require that #[cfg] is followed by an identifier or a #[ attribute start.
# This avoids some usages of function-local #[cfg]s, although by far not all. Others generate warnings, which is fine.
done
Expand Down

0 comments on commit a1252ed

Please sign in to comment.