cargo-count
cargo-count copied to clipboard
cargo-count doesn't find any code
I cannot get cargo-count to find any code. I have tried it in both Rust and C++ repositories, and it always outputs "No source files were found matching the specified criteria". Example:
bram@falafel% mkdir testrepo
bram@falafel% cd testrepo
bram@falafel% cargo init --bin
Created binary (application) project
bram@falafel% cat src/main.rs
fn main() {
println!("Hello, world!");
}
bram@falafel% cargo count
Gathering information...
No source files were found matching the specified criteria
Edit: additional info:
bram@falafel% cargo count -v
Gathering information...
Excluding: ["/home/bram/tmp/testrepo/.git"]
Displaying the results:
No source files were found matching the specified criteria
bram@falafel% cargo count -V
cargo-count v0.2.2
I installed cargo-count from crates.io.
This is fixed for me by #37, which I find a bit strange, since I have no idea why the version mismatch between Cargo.toml and Cargo.lock would result in this behavior.
This is my first ever PR so I hope I did it right! (Even though this is pretty much the smallest PR possible...)
I have the same issue - but I can workaround it, because if I run cargo count -a --exclude=$(cat .gitignore)
everything works as expected. Which suggests it's the gitignore handling that's broken...?
Same problem here, on both Mac and Windows with my repo. cargo count -a --exclude=$(cat .gitignore)
worked around it
Until the author makes a new version on crates.io, you can fix this by cloning the repo and building and installing it yourself.
Here is a quick script to do that: git clone https://github.com/kbknapp/cargo-count && cd cargo-count && cargo install --path . --force
Can confirm that installing the latest git version solved the issue I was running into
Installing the latest git version with @Aeledfyr 's suggested command did install the new version but did not fix the issue for me in the root of my project workspace. However, it does now work for each individual crate, which it did not before.