clippy.ps1

 1$ErrorActionPreference = "Stop"
 2
 3$needAddWorkspace = $false
 4if ($args -notcontains "-p" -and $args -notcontains "--package") {
 5    $needAddWorkspace = $true
 6}
 7
 8# https://stackoverflow.com/questions/41324882/how-to-run-a-powershell-script-with-verbose-output/70020655#70020655
 9Set-PSDebug -Trace 2
10
11$Cargo = $env:CARGO
12if (-not $Cargo) {
13    $Cargo = "cargo"
14}
15
16if ($needAddWorkspace) {
17    & $Cargo clippy @args --workspace --release --all-targets --all-features -- --deny warnings
18}
19else {
20    & $Cargo clippy @args --release --all-targets --all-features -- --deny warnings
21}