Brendonovich / prisma-client-rust

Type-safe database access for Rust
https://prisma.brendonovich.dev
Apache License 2.0
1.75k stars 106 forks source link

Unused code warnings #315

Closed Massimiliano-solutiontech closed 1 year ago

Massimiliano-solutiontech commented 1 year ago

When I generate the code via cargo prisma generate the code that is created is plenty of is never used. Am I doing something wrong or is it a bug?

Piece of output `npm run tauri dev` warning: static `DATABASE_STR` is never used --> src/prisma.rs:4:8 | 4 | static DATABASE_STR: &'static str = "sqlite"; | ^^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default Building [=======================> ] 597/598: test-app(bin) warning: static `MIGRATIONS_DIR` is never used --> src/prisma.rs:6:12 | 6 | pub static MIGRATIONS_DIR : & :: prisma_client_rust :: migrations :: include_dir :: Dir = & :: prisma_client_rust :: migrations :: includ... | ^^^^^^^^^^^^^^ warning: function `new_client` is never used --> src/prisma.rs:7:14 | 7 | pub async fn new_client() -> Result { | ^^^^^^^^^^ ... warning: type alias `Count` is never used --> src/prisma.rs:777:14 | 777 | pub type Count<'a> = ::prisma_client_rust::Count<'a, Types>; | ^^^^^ Building [=======================> ] 597/598: test-app(bin) warning: type alias `Create` is never used --> src/prisma.rs:778:14 | 778 | pub type Create<'a> = ::prisma_client_rust::Create<'a, Types>; | ^^^^^^ Building [=======================> ] 597/598: test-app(bin) warning: type alias `CreateMany` is never used --> src/prisma.rs:779:14 | 779 | pub type CreateMany<'a> = ::prisma_client_rust::CreateMany<'a, Types>; | ^^^^^^^^^^ Building [=======================> ] 597/598: test-app(bin) warning: type alias `FindUnique` is never used --> src/prisma.rs:780:14 | 780 | pub type FindUnique<'a> = ::prisma_client_rust::FindUnique<'a, Types>; | ^^^^^^^^^^ warning: type alias `FindMany` is never used --> src/prisma.rs:781:14 | 781 | pub type FindMany<'a> = ::prisma_client_rust::FindMany<'a, Types>; | ^^^^^^^^ Building [=======================> ] 597/598: test-app(bin) warning: type alias `FindFirst` is never used --> src/prisma.rs:782:14 | 782 | pub type FindFirst<'a> = ::prisma_client_rust::FindFirst<'a, Types>; | ^^^^^^^^^ warning: type alias `Update` is never used --> src/prisma.rs:783:14 | 783 | pub type Update<'a> = ::prisma_client_rust::Update<'a, Types>; | ^^^^^^ Building [=======================> ] 597/598: test-app(bin) warning: type alias `UpdateMany` is never used --> src/prisma.rs:784:14 | 784 | pub type UpdateMany<'a> = ::prisma_client_rust::UpdateMany<'a, Types>; | ^^^^^^^^^^ warning: type alias `Delete` is never used --> src/prisma.rs:786:14 | 786 | pub type Delete<'a> = ::prisma_client_rust::Delete<'a, Types>; | ^^^^^^ Building [=======================> ] 597/598: test-app(bin) warning: type alias `DeleteMany` is never used --> src/prisma.rs:787:14 | 787 | pub type DeleteMany<'a> = ::prisma_client_rust::DeleteMany<'a, Types>; | ^^^^^^^^^^ Building [=======================> ] 597/598: test-app(bin) warning: method `to_selection` is never used --> src/prisma.rs:399:16 | 399 | pub fn to_selection(self) -> ::prisma_client_rust::Selection { | ^^^^^^^^^^^^
Brendonovich commented 1 year ago

Whoops, looks like I didn't update the docs about this. Add #[allow(warnings, unused)] to where you include the file as a module. It's documented here now.