1$ErrorActionPreference = "Stop"
 2
 3Write-Host "Your PATH entries:"
 4$env:Path -split ";" | ForEach-Object { Write-Host "  $_" }
 5
 6$needAddWorkspace = $false
 7if ($args -notcontains "-p" -and $args -notcontains "--package")
 8{
 9    $needAddWorkspace = $true
10}
11
12# https://stackoverflow.com/questions/41324882/how-to-run-a-powershell-script-with-verbose-output/70020655#70020655
13# Set-PSDebug -Trace 2
14
15if ($env:CARGO)
16{
17    $Cargo = $env:CARGO
18} elseif (Get-Command "cargo" -ErrorAction SilentlyContinue)
19{
20    $Cargo = "cargo"
21} else
22{
23    Write-Error "Could not find cargo in path." -ErrorAction Stop
24}
25
26if ($needAddWorkspace)
27{
28    & $Cargo clippy @args --workspace --release --all-targets --all-features -- --deny warnings
29} else
30{
31    & $Cargo clippy @args --release --all-targets --all-features -- --deny warnings
32}