ndd 0.2.12

Non De-Duplicated cell. For statics guaranteed not to share memory with any other static/const.
Documentation
#!/bin/sh
# Validate "version" field in Cargo.toml, so that it confirms to stable vs. nightly versioning as
# described in README.md.
#
# The "version" field also gets validated by cargo and crates.io:
# - it must have three numeric parts
# - it must not start with leading zero(s).
#
# That simplifies the following regexes.

grep -qE '^ *version *= *"[1-9][0-9]*.[^"]*"' Cargo.toml
if [ $? -eq 0 ]; then
    echo Prevent non-zero leftmost version part. All versions have to be below 1.0.
    exit 1
fi

grep -qE '^ *version *= *"0\.[0-9]*[02468]\.[0-9]*-.*"' Cargo.toml
if [ $? -eq 0 ]; then
    echo "Prevent even-numbered major (stable) versions to have a pre-release postfix like `-nightly`."
    exit 1
fi

grep -qE '^ *version *= *"0\.[0-9]*[13579]\.[0-9]+"' Cargo.toml
if [ $? -eq 0 ]; then
    echo "Require odd-numbered major (nightly) versions to have a pre-release postfix like `-nightly`."
    exit 1
fi