Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow clippy::pedantic for star import #3816

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DannyGoldberg
Copy link
Contributor

@DannyGoldberg DannyGoldberg commented Oct 5, 2023

To fix:

warning: usage of wildcard import
   --> src/models/schema_gen.rs:174:9
    |
174 |     use diesel::sql_types::*;
    |         ^^^^^^^^^^^^^^^^^^^^ help: try: `diesel::sql_types::{Nullable, Text, Timestamptz, Uuid, Varchar}`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports

For now, I added a patch_file to my diesel.toml configuration, but I figured it'd be nicer for all if it's added automatically.

Or perhaps there's a better way that a reviewer will recommend :)

EDIT: I was able to find a fix without a patch file:

-#[allow(clippy::all)]
+#[allow(clippy::all, clippy::pedantic)]
 pub mod schema_gen;

So a patch_file is no longer necessary for my needs, although leaving this up in case it's useful for others

To fix:

```
warning: usage of wildcard import
   --> src/models/schema_gen.rs:174:9
    |
174 |     use diesel::sql_types::*;
    |         ^^^^^^^^^^^^^^^^^^^^ help: try: `diesel::sql_types::{Nullable, Text, Timestamptz, Uuid, Varchar}`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports
```

For now, I added a `patch_file` to my `diesel.toml` configuration, but I figured it'd be nicer for all if it's added automatically.

Or perhaps there's a better way that a reviewer will recommend :)
@weiznich weiznich requested a review from a team October 5, 2023 18:00
@DannyGoldberg
Copy link
Contributor Author

DannyGoldberg commented Oct 5, 2023

it seems like there's an unrelated clippy failure in diesel_derives/src/sql_function.rs:224:22: https://github.com/diesel-rs/diesel/actions/runs/6422538158/job/17439224135?pr=3816#step:8:78

@DannyGoldberg DannyGoldberg changed the title Add clippy::pedantic for star import Allow clippy::pedantic for star import Oct 5, 2023
@weiznich
Copy link
Member

weiznich commented Oct 6, 2023

Thanks for opening this PR.

Rather than adding this #[allow()] to each generated instance of the table! macro, I would go and allow it here:

#[allow(unused_imports, dead_code, unreachable_pub)]
instead (so in the macro itself)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants