1#!/bin/bash -eu 2 3# Get the directory of the script 4REPO=$(dirname "$0")/../../.. 5 6# The possible values are "linux" and "darwin". 7OS=$(uname | tr '[:upper:]' '[:lower:]') 8 9OUT_PATH="$1" 10RUST_VERSION="$2" 11CLIPPY_FLAGS="$3" 12 13source $REPO/tools/netsim/scripts/cargo_env.sh $OUT_PATH 14 15pushd $REPO/tools/netsim/rust 16# Run the cargo command 17# TODO(360874898): prebuilt rust toolchain for darwin-aarch64 is supported from 1.77.1 18if [[ "$OS" == "darwin" && $(uname -m) == "arm64" ]]; then 19 cargo clippy -- $CLIPPY_FLAGS 20else 21 $REPO/prebuilts/rust/$OS-x86/$RUST_VERSION/bin/cargo clippy -- $CLIPPY_FLAGS 22fi 23popd 24