Created
April 18, 2019 10:32
-
-
Save Licenser/85ca9f78db51925ce6242980c3a0b0f1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# requires `remarshal` and `jq` to be installed | |
if [ -d "$1" ] | |
then | |
path="$1" | |
else | |
path="." | |
fi | |
for d in $(remarshal -i $path/Cargo.toml -of json | jq -r '.dependencies | keys []') | |
do | |
dep=$(echo $d | sed -e 's/-/_/g') | |
if ! rg "use $dep(::|;| )" $path -trust > /dev/null | |
then | |
if ! rg "extern crate $dep;" $path -trust > /dev/null | |
then | |
if ! rg "[^a-z]$dep::" $path -trust > /dev/null | |
then | |
echo "Not used: $d"; | |
fi | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
requires
remarshal
andjq
to be installed