I am using some sqlx::query! and sqlx::query_as! and my project compiles fine. But when I run cargo sqlx prepare I get first and error:
$ cargo sqlx prepare
error: extra arguments to `rustc` can only be passed to one target, consider filtering
the package by passing, e.g., `--lib` or `--bin NAME` to specify a single target
error: `cargo check` failed with status: exit status: 101
Then when I run it with "-- --lib" I get:
$ cargo sqlx prepare -- --lib
Compiling crate v0.1.0 (/Users/ryan/Documents/crate)
Finished dev [unoptimized + debuginfo] target(s) in 5.78s
warning: no queries found; please ensure that the `offline` feature is enabled in sqlx
query data written to `sqlx-data.json` in the current directory; please check this into version control
I get similar output with --bin.
What am I doing wrong here?
Same case had before, but could find usefull information in their documentation. Rather than running only cargo sqlx prepare -- --lib
, first reinstall sqlx-cli, like below:
cargo install sqlx-cli && cargo sqlx prepare -- --lib
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With