# Sourced by the Rust scripts (never executed): puts the user-level rustup toolchain on # PATH when the calling shell did not. Non-interactive shells skip ~/.bashrc, so editor # tasks, git hooks and agent shells start without ~/.cargo/bin. rustup then selects the # channel pinned by rust-toolchain.toml. Nothing here installs anything. The directory is # appended, never prepended (the guard only fires when no cargo is on PATH, and the system # tools used by the scripts must keep resolving first), and only when it is absolute. cargo_bin="${CARGO_HOME:-$HOME/.cargo}/bin" case "$cargo_bin" in /*) ;; *) cargo_bin="" ;; esac if ! command -v cargo >/dev/null 2>&1 && [ -n "$cargo_bin" ] && [ -x "$cargo_bin/cargo" ]; then PATH="$PATH:$cargo_bin" export PATH fi unset cargo_bin