Skip to content

Commit

Permalink
Add clippy::pedantic for star import
Browse files Browse the repository at this point in the history
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 :)
  • Loading branch information
DannyGoldberg committed Oct 5, 2023
1 parent 0377c25 commit fbe644a
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions diesel_cli/src/print_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ impl<'a> Display for TableDefinition<'a> {
{
if already_imported_custom_types.insert(&ct.rust_name) {
if !has_written_import {
writeln!(out, "#[allow(clippy::pedantic)]")?;
writeln!(out, "use diesel::sql_types::*;")?;
}
writeln!(out, "use super::sql_types::{};", ct.rust_name)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub mod sql_types {
}

diesel::table! {
#[allow(clippy::pedantic)]
use diesel::sql_types::*;
use super::sql_types::MyType;
use super::sql_types::MyType2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub mod sql_types {
}

diesel::table! {
#[allow(clippy::pedantic)]
use diesel::sql_types::*;
use super::sql_types::MyType;
use super::sql_types::MyType2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub mod sql_types {
}

diesel::table! {
#[allow(clippy::pedantic)]
use diesel::sql_types::*;
use super::sql_types::MyType;
use super::sql_types::MyType2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub mod sql_types {
}

diesel::table! {
#[allow(clippy::pedantic)]
use diesel::sql_types::*;
use super::sql_types::MyType;
use super::sql_types::MyType2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub mod sql_types {
}

diesel::table! {
#[allow(clippy::pedantic)]
use diesel::sql_types::*;
use super::sql_types::MyType;
use super::sql_types::MyType2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub mod custom_schema {
}

diesel::table! {
#[allow(clippy::pedantic)]
use diesel::sql_types::*;
use super::sql_types::MyEnum;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub mod sql_types {
}

diesel::table! {
#[allow(clippy::pedantic)]
use diesel::sql_types::*;
use super::sql_types::UserJob;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub mod sql_types {
}

diesel::table! {
#[allow(clippy::pedantic)]
use diesel::sql_types::*;
use super::sql_types::Users1UserStateEnum;
use super::sql_types::Users1EnabledFeaturesSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub mod sql_types {
}

diesel::table! {
#[allow(clippy::pedantic)]
use diesel::sql_types::*;
use super::sql_types::SomeEnum;
use super::sql_types::SomeEnum2;
Expand Down
1 change: 1 addition & 0 deletions examples/postgres/custom_types/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub mod sql_types {
}

diesel::table! {
#[allow(clippy::pedantic)]
use diesel::sql_types::*;
use super::sql_types::Language;

Expand Down

0 comments on commit fbe644a

Please sign in to comment.