tfa-next: add static and lint checks

    1. Copyright exists on new files (error) + are correctly dated
       (warn)
    2. Line endings are Unix style, not Windows
    3. Cargo fmt --check - returns error if format issues found
    4. Clippy - various lints, both error + warn

Checks 1+2 call the pre-existing scripts in the static-checks/ dir, 3+4
are newly implemented checks in the next-checks/ dir.

clippy is currently set to only fail on DENY level errors[1]. There are
many warnings currently in the prototype RF-A, however in future we
should look to enable the '-Dwarnings' flag to turn WARN into fail.

clippy is set to run twice for simplicity: once for fvp, once for qemu.
The '--all-features' flag to clippy exists and would allow a single run,
however rust/build.rs contains a check to ensure the Rust flag `--cfg
platform=${PLAT}` is set (where $PLAT is an env var passed to the make
command). This would mean some additional work is required to enable
'--all-features'. This work should be considered for future scaling to
additional platforms however is beyond the scope of this patch.

1: https://rust-lang.github.io/rust-clippy/master/index.html?levels=deny

Signed-off-by: Zachary Leaf <zachary.leaf@arm.com>
Change-Id: I31876f2d547d90c6d255ab1ebe8f8b205a6951fe
diff --git a/script/next-checks/next-checks-clippy.sh b/script/next-checks/next-checks-clippy.sh
new file mode 100755
index 0000000..b7a644a
--- /dev/null
+++ b/script/next-checks/next-checks-clippy.sh
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2024 Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+this_dir="$(readlink -f "$(dirname "$0")")"
+. $this_dir/../static-checks/common.sh
+
+TF_ROOT="$1"
+TEST_CASE="Rust clippy checks"
+LOG_FILE=`mktemp -t common.XXXX`
+EXIT_VALUE=0
+
+echo "# ${TEST_CASE}"
+echo >> "$LOG_TEST_FILENAME"
+echo "****** $TEST_CASE ******" >> "$LOG_TEST_FILENAME"
+echo >> "$LOG_TEST_FILENAME"
+echo "Platforms:" >> "$LOG_TEST_FILENAME"
+
+for plat in "fvp" "qemu"
+do
+    echo >> $LOG_FILE
+    echo "############### ${TEST_CASE} - platform: ${plat}" >> "$LOG_FILE"
+    echo >> $LOG_FILE
+    make -C ${TF_ROOT}/rust PLAT=${plat} clippy >> "$LOG_FILE" 2>&1
+
+    if [ "$?" -ne 0 ]; then
+        echo -e "  ${plat}\t: FAIL" >> "$LOG_TEST_FILENAME"
+        EXIT_VALUE=1
+    else
+        echo -e "  ${plat}\t: PASS" >> "$LOG_TEST_FILENAME"
+    fi
+done
+
+echo >> "$LOG_TEST_FILENAME"
+if [[ "$EXIT_VALUE" == 0 ]]; then
+  echo "Result : SUCCESS" >> "$LOG_TEST_FILENAME"
+else
+  echo "Result : FAILURE" >> "$LOG_TEST_FILENAME"
+fi
+echo >> "$LOG_TEST_FILENAME"
+cat "$LOG_FILE" >> "$LOG_TEST_FILENAME"
+
+rm "$LOG_FILE"
+
+exit "$EXIT_VALUE"