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

Fix warnings about non_local_definitions #31

Merged
merged 2 commits into from Apr 19, 2024
Merged

Conversation

damszew
Copy link
Contributor

@damszew damszew commented Apr 12, 2024

This PR changes named constant block to anon-const so rustc doesn't warn about non_local_definitions (and makes minor fixes suggested by clippy)

Details:
Recent nightly versions implement rust-lang/rust#120393 which causes compilation warnings like

warning: non-local `impl` definition, they should be avoided as they go against expectation
 --> src/containers/password.rs:8:38
  |
8 | #[cfg_attr(feature = "pgsql", derive(diesel_derive_newtype::DieselNewType))]
  |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: move this `impl` block outside the of the current constant `_IMPL_DIESEL_NEW_TYPE_FOR_PASSWORD`
  = note: an `impl` definition is non-local if it is nested inside an item and may impact type checking outside of that item. This can be the case if neither the trait or the self type are at the same nesting level as the `impl`
  = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
  = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
  = note: the derive macro `diesel_derive_newtype::DieselNewType` may come from an old version of the `diesel_derive_newtype` crate, try updating your dependency with `cargo update -p diesel_derive_newtype`
  = note: `#[warn(non_local_definitions)]` on by default
  = note: this warning originates in the derive macro `diesel_derive_newtype::DieselNewType` (in Nightly builds, run with -Z macro-backtrace for more info)

As warning states, this lint might become deny-by-default in the future.
Only exception to this rule are anon-const which are used also by serde to be compatible with different rust editions more info here.

@sfisol
Copy link

sfisol commented Apr 19, 2024

Hi @quodlibetor, any chance this could be merged any soon?

@quodlibetor
Copy link
Owner

ah thanks for the ping! And for the fix! yeah I'll get this out.

@quodlibetor quodlibetor merged commit 66767cb into quodlibetor:main Apr 19, 2024
3 checks passed
@quodlibetor
Copy link
Owner

this is released.

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

Successfully merging this pull request may close these issues.

None yet

3 participants